view 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
line wrap: on
line source

import sys, os

input = sys.argv[1]

print(input)

import re, os

def fix_seq_ids(filename):
	'''
	make sequence ids the same for paired reads.
	'''
	file = list(open(filename, 'r'))
	new_file = open(filename, 'w')
	for line in file:
		if re.search('^@', line) or re.search('^\+', line) and re.search(' ', line):
			linel = re.split(' ', line)
			linel[0] = re.sub('.\d$', '', linel[0])
			line = ' '.join(linel)
		new_file.write(line)
# fastq-dump --log-level fatal --split-3 --accession accession_number --ncbi_error_report never

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')

os.system('ls -lh | grep ' + input)

#os.system('/nfs/sw/apps/sratoolkit/sratoolkit.2.8.0-centos_linux64/bin/fastq-dump -I --split-files ' + input)
#mv_cmd = 'mv -v ' + input + '_1.fastq R1.fastq'
#print(mv_cmd)

#fix_seq_ids(input + '_1.fastq')
#fix_seq_ids(input + '_2.fastq')

os.system('mv -v ' + input + '_1.fastq R1.fastq')
os.system('mv -v ' + input + '_2.fastq R2.fastq')