PeroMHC 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 formatname 1tactcatacatacname 2acggtggcatname 3gggtaccacgtt I need to concatenate the sequences.. make them look likeconcatenatedtactcatacatacacggtggcatgggtaccacgtt thanks. Matt
A solution using regexp:
found = []
for line in open('seqfile.txt'):
found += re.findall('^[acgtACGT]+$', line)
print found
> ['tactcatacatac', 'acggtggcat', 'gggtaccacgtt']
print ''.join(found)
> 'tactcatacatacacggtggcatgggtaccacgtt'
JM
--
http://mail.python.org/mailman/listinfo/python-list
