[BioPython] Parsing BLAST

Pavel SRB srbanator at heckler-koch.cz
Wed Aug 27 21:47:52 UTC 2008


hi alex, when i am accessing data like

handle = Entrez.esearch(db="nucleotide", rettype="fasta", retmax=100, 
email=my_email)

i get 100 results, but without i get only 20. When looking into 
/usr/share/python-support/python-biopython/Bio/EUtils/ThinClient.py
there is defaul value for retmax set to 20.

hope it helps

pavel srb

Alex Garbino wrote:
> Thanks for the help; that was a lot of time wasted for something simple....
>
> I do have an additional request: once I parse these out, I only get 50
> entries. however, if I do the same search online, I get 138... what
> accounts for the difference?
>
> This is my code:
>
> from Bio import SeqIO
> from Bio.Blast import NCBIWWW
> from Bio.Blast import NCBIXML
>
> record = SeqIO.read(open("protein_fasta.txt"), format="fasta")
> result_handle = NCBIWWW.qblast("blastp", "nr", record.seq.tostring())
>
> blast_records = NCBIXML.parse(result_handle)
> blast_record = blast_records.next()
>
> for x in blast_record.alignments:
>     print x.title, x.accession, x.length
>
> acc_list = []
> for x in blast_record.alignments:
>     acc_list.append(x.accession)
>
> len(acc_list) tells me 50...
>
> Is there a default limit somewhere?
>
> Thanks!
> Alex
>
> On Wed, Aug 27, 2008 at 12:27 PM, C. G. <cg5x6 at yahoo.com> wrote:
>   
>>
>> --- On Wed, 8/27/08, Alex Garbino <agarbino at gmail.com> wrote:
>>
>>     
>>> From: Alex Garbino <agarbino at gmail.com>
>>> Subject: [BioPython] Parsing BLAST
>>> To: biopython at lists.open-bio.org
>>> Date: Wednesday, August 27, 2008, 11:12 AM
>>> Hello,
>>>
>>> I'm following the tutorials to do BLAST queries,
>>> however, I can't get
>>> the Blast object to work.
>>>
>>> I've downloaded the blast search, saved it in XML, etc,
>>> as the
>>> tutorial does. However, when I get to the step where
>>> I'm trying to get
>>> actual data out, it fails (the for loops part).
>>> Here is a simplified version that illustrates the problem:
>>>
>>> for x in blast_record.alignments:
>>>     print alignment.title
>>>
>>> Traceback (most recent call last):
>>>   File "<input>", line 2, in <module>
>>> NameError: name 'alignment' is not defined
>>>
>>> -----------------------
>>>       
>> It's a Python coding error. Try:
>>
>>     print x.title
>>
>> Or change the name of your variable in the "for" loop to "alignment".
>>
>>
>>
>>
>> _______________________________________________
>> BioPython mailing list  -  BioPython at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/biopython
>>
>>     
> _______________________________________________
> BioPython mailing list  -  BioPython at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/biopython
>   




More information about the Biopython mailing list