Having issues with having extra information on my Fasta file.
0
0
Entering edit mode
4.5 years ago
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?

sequence • 695 views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY

Login before adding your answer.

Traffic: 3524 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6