comparison runfastq_dump.py @ 0:500ceb70e4bd draft

planemo upload commit d4d558b27a09f684be8311f3cfb659b16545e167-dirty
author charles_s_test
date Sun, 12 Nov 2017 09:12:36 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:500ceb70e4bd
1 import sys, os
2
3 input = sys.argv[1]
4
5 print(input)
6
7 import re, os
8
9 def fix_seq_ids(filename):
10 '''
11 make sequence ids the same for paired reads.
12 '''
13 file = list(open(filename, 'r'))
14 new_file = open(filename, 'w')
15 for line in file:
16 if re.search('^@', line) or re.search('^\+', line) and re.search(' ', line):
17 linel = re.split(' ', line)
18 linel[0] = re.sub('.\d$', '', linel[0])
19 line = ' '.join(linel)
20 new_file.write(line)
21 # fastq-dump --log-level fatal --split-3 --accession accession_number --ncbi_error_report never
22
23 os.system('/nfs/sw/apps/sratoolkit/sratoolkit.2.8.0-centos_linux64/bin/fastq-dump --log-level fatal --split-3 --accession ' + input + ' --ncbi_error_report never')
24
25 os.system('ls -lh | grep ' + input)
26
27 #os.system('/nfs/sw/apps/sratoolkit/sratoolkit.2.8.0-centos_linux64/bin/fastq-dump -I --split-files ' + input)
28 #mv_cmd = 'mv -v ' + input + '_1.fastq R1.fastq'
29 #print(mv_cmd)
30
31 #fix_seq_ids(input + '_1.fastq')
32 #fix_seq_ids(input + '_2.fastq')
33
34 os.system('mv -v ' + input + '_1.fastq R1.fastq')
35 os.system('mv -v ' + input + '_2.fastq R2.fastq')
36
37
38