I tried to add some kind of indicator but, they always make my the
conversion script 10x slow. So I just put simple print warnings, cause
that's the best I could do. One thing I have been told is to use
os.path because it is an acutal basename function. Also added a prompt
for user to check there is enough room on HDD, cause it seems they
don't delete or move files to archive. I compared the outputs of the
original with my modified script and I didn't find any differences.
Can someone check my modified script to make sure I didn't miss
something? Anything I can do better? This is the best I can do with my
abilities. Its for use with python 2.7 (thru Anaconda on windows).
Right now, I tested it on my linux machine; hopefully it works on
windows when I get back to work next week.
=======================CODE============================
#!/usr/bin/env python
#Takes a single FASTQ file and splits to .fasta + .qual files
import sys
import os.path
from Bio import SeqIO
#Disk space Checking
print "Warning! Please check that there is at least 50GB of Free Disk
Space per file conversion."
DiskCheck = raw_input('Is there enough space? (yes or no) ')
if DiskCheck == 'yes':
if len(sys.argv) == 1:
print "Please specify a single .fastq file to convert."
sys.exit()
filetoload = sys.argv[1]
basename = filetoload
#BETTER WAY: Chop the extension to get names for output files
basename, extension = os.path.splitext(os.path.basename(filetoload))
print "\nWorking on", basename
print "Don't close this window."
SeqIO.convert(filetoload, "fastq", basename + ".fasta", "fasta")
#QUAL file creation disabled
#SeqIO.convert(filetoload, "fastq", basename + ".qual", "qual")
print "\nDone converting", basename, "to FASTA format."
elif DiskCheck == 'no':
print "\nMake room on disk, then run script again"
sys.exit()
=======================CODE============================
> To view this discussion on the web visit
https://groups.google.com/d/msgid/diybio/CA%2BcsFZiNfGqANizvXbzBcAbjx13H8FoM01KP1uQVV0WLO%2Bp9sA%40mail.gmail.com.