concatenate fasta file

Roy Smith roy at
Fri Feb 12 17:23:54 CET 2010

In article 
<62a50def-e391-4585-9a23-fb91f2e2edc8 at>,
 PeroMHC <macmanes at> wrote:

> Hi All, I have  a simple problem that I hope somebody can help with. I
> have an input file (a fasta file) that I need to edit..
> Input file format
> >name 1
> tactcatacatac
> >name 2
> acggtggcat
> >name 3
> gggtaccacgtt
> I need to concatenate the sequences.. make them look like
> >concatenated
> tactcatacatacacggtggcatgggtaccacgtt
> thanks. Matt

Some quick ideas.  First, try something along the lines of (not tested):

for line in sys.stdin:
   if line.startswith('>'):
print ''.join(data)

Second, check out  I'm sure somebody 
has solved this problem before.

More information about the Python-list mailing list