View Single Post
Old 07-04-2013, 07:00 AM   #5
wieni
Junior Member
 
Location: Germany

Join Date: Jun 2012
Posts: 6
Default

Here a quick and dirty solution in python - was still missing :-)


#!/usr/bin/env python

import re
import string
import sys


infile = open(sys.argv[1])
data = infile.readlines()
infile.close()

outfile = open(sys.argv[2], "w")
c = 1
l = 1
for i in data:
i = re.sub("\n|\r", "", i)
if c%2 != 0:
outfile.write(i+"_" +str(l) +"\n")
l+=1
else:
outfile.write(i +"\n")
c += 1
outfile.close()


save the upper code in a file called for example "numberFasta.py"
on a terminal call the program with: python numberFasta.py <yourInfile> <outfilename>
wieni is offline   Reply With Quote