my fasta file has multiple sequences like the following
>header1 MPANFTE GSFDSSG >header2 MDNASFS EPWPANA
so I am writing a code to remove the headers and the output looks like this in a temporary file:
MPANFTEGSFDSSG
MDNASFSEPWPANA
So far, I have come up with this code: but it is not giving me the exact output.
import sys,subprocess
# open the file
my_file = open("gpcr.fasta")
# read the contents
my_gpcr = my_file.readlines()
for line in my_gpcr:
if '>' == line[0]:
header = line
else:
tempf = open('temp.fasta', 'w')
tempf.write(header)
tempf.write(line)
tempf.close()
print line