[DIYbio] modifying the FASTQ>FASTA script

Hi all,
Once again, thanks for helping me with my python issue. Let me just
point out that my programming skills are very low (script kiddie at
best) and I don't have much time nowadays to sit down and really learn
python. I know the basics.

Anyway, my boss wanted to convert FASTQ to FASTA. The only way is thru
a script and I settled with python. I found the script online that
works:
================================================
#!/usr/bin/env python

#Takes a single FASTQ file and splits to .fasta + .qual files
import sys
from Bio import SeqIO

if len(sys.argv) == 1:
print "Please specify a single .fastq file to convert."
sys.exit()

filetoload = sys.argv[1]
basename = filetoload

#Chop the extension to get names for output files
if basename.find(".") != -1:
basename = '.'.join(basename.split(".")[:-1])

SeqIO.convert(filetoload, "fastq", basename + ".fasta", "fasta")
SeqIO.convert(filetoload, "fastq", basename + ".qual", "qual")
================================================

I'm thinking about adding 2 features to it for the convenience for my
colleagues. I know you all don't like leading people step by step, so
I'm fine if you all can point me in the right direction (simplest and
fastest solutions).

[1] I would like to add something that shows progress {bar, text,
etc.} of the conversion so that people on the computer know it's
working and not frozen. Maybe read the size of the output file every
30 seconds (first the FASTA file, then a QUAL file)?

[2] I am not sure if the script can process more than one file
(sequentially) in the argument. I just ran "fastq_to_fasta.py
file1.fastq". I am wondering if I can do: "fastq_to_fasta.py
file1.fastq file2.fastq"? Basically, I am not sure if python can do
that?

BTW, I got the script from:
http://nebc.nerc.ac.uk/nebc_website_frozen/nebc.nerc.ac.uk//tools/code-corner/scripts/sequence-formatting-and-other-text-manipulation

Thanks

--
In necessariis unitas, in dubiis libertas, in omnibus caritas.
-Marco Antonio Dominis

--
-- You received this message because you are subscribed to the Google Groups DIYbio group. To post to this group, send email to diybio@googlegroups.com. To unsubscribe from this group, send email to diybio+unsubscribe@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/diybio?hl=en
Learn more at www.diybio.org
---
You received this message because you are subscribed to the Google Groups "DIYbio" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diybio+unsubscribe@googlegroups.com.
To post to this group, send email to diybio@googlegroups.com.
Visit this group at http://groups.google.com/group/diybio.
To view this discussion on the web visit https://groups.google.com/d/msgid/diybio/CAAhF0RKiRhWGYQ%2B%2Bu06xZ3mqTf9eF4UD0Oh2w2aOd0cOXQAWDw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comments:

Post a Comment