match, concatenate based on filename
Matt
macmanes at gmail.com
Thu Nov 3 22:55:29 EDT 2011
Hi All,
I am trying to concatenate several hundred files based on their filename.. Filenames are like this:
Q1.HOMOblast.fasta
Q1.mus.blast.fasta
Q1.query.fasta
Q2.HOMOblast.fasta
Q2.mus.blast.fasta
Q2.query.fasta
...
Q1223.HOMOblast.fasta
Q1223.mus.blast.fasta
Q1223.query.fasta
All the Q1's should be concatenated together in a single file = Q1.concat.fasta.. Q2's go together, Q3's and so on...
I envision something like
for file in os.listdir("/home/matthew/Desktop/pero.ngs/fasta/final/"):
if file.startswith("Q%i"):
concatenate...
But I can't figure out how to iterate this process over Q-numbers 1-1223
Any help appreciate.
More information about the Python-list
mailing list