Having issues with having extra information on my Fasta file.
from Bio import Entrez
from Bio import SeqIO
Entrez.email = "trejomarco@test.edu"
file = open("humanSeq.txt")
sequences = open("humanSeq.fasta", "w")
l=[]
for line in file:
fields=line.split()
l.append(fields[0])
try:
handle = Entrez.efetch(db="nucleotide", id=l, rettype="fasta", retmode="text")
fasta_str = handle.read()
handle.close()
sequences.write(fasta_str)
except:
continue
sequences.close()
file.close()
So in my fasta file I get the id for example: AY195771.1 Homo sapiens haplotype As2A mitochondrion, complete genome but I want to only have AY195771.1 and not the rest. Can anyone tell me to remove the extra information?
• 816 views
•
link
0 answers
No answers yet.
Log in to answer this question.
This issue has been addressed multiple times on the forum. Please search the forum for "fasta header" and you'll get a bunch of leads.