[Biopython-dev] 8/21 biopython Questions - BioStar

Feed My Inbox updates at feedmyinbox.com
Sun Aug 21 07:48:37 UTC 2011


// Error using Entrez.esummary from biopython
// August 16, 2011 at 8:47 AM

http://biostar.stackexchange.com/questions/11232/error-using-entrez-esummary-from-biopython
Can someone please explain this error?

I hava a smal script that tries to fetch information from the a NCBI BioAssay using the Entrez module form Bipython. I get an error I do not understand. I try to run:

from Bio import Entrez
Entrez.email="yourname at mail.se"

handle_esummary=Entrez.esummary(db='pcassay',id='1337')
record_esummary=Entrez.read(handle_esummary)


I get the error:

File "smaltest.py", line 5, in <module>
    record_esummary=Entrez.read(handle_esummary)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/__init__.py", line 297, in read
    record = handler.run(handle)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 90, in run
    self.parser.ParseFile(handle)
  File "/usr/common/schrodinger/mmshare-v20109/lib/Linux-x86_64/lib/python2.7/site-packages/Bio/Entrez/Parser.py", line 105, in startElement
    itemtype = str(attrs["Type"]) # convert from Unicode
KeyError: 'Type'


// Import fasta sequences to a motif
// August 15, 2011 at 11:54 AM

http://biostar.stackexchange.com/questions/11204/import-fasta-sequences-to-a-motif
I need to construct a PWM from every sequence in a fasta file, using biopython.  The way I'm trying to do this is to import each line of sequence into a motif, then run a PWM on each instance of the motif.  Currently, I'm trying it this way, but different variations of it have generated their fair share of errors, mostly "Wrong Alphabet" and "NoneType object is not iterable":

alphabet = IUPAC.unambiguous_dna
m = Motif.Motif(alphabet)

for seq_record in SeqIO.parse("10fasta.fasta", "fasta"):
    m.add_instance(seq_record.seq)
    print m1.pwm()


Does anyone see what's wrong with the way I'm adding instances to the motif?  Of course, if there's a better way to do this that I'm completely missing, feel free to comment on that too.


// A PWM with gapped alignments in Biopython
// August 9, 2011 at 1:47 PM

http://biostar.stackexchange.com/questions/11070/a-pwm-with-gapped-alignments-in-biopython
I'm trying to generate a Position-Weighted Matrix (PWM) in Biopython from Clustalw multiple sequence alignments. I get a "Wrong Alphabet" error every time I do it with gapped alignments. From reading the documentation, I think I need to utilize the Gapped Alphabet to deal with the '-' character in gapped alignments. But when I do this, it still doesn't resolve the error. Does anyone see the problem with this code, or have a better way to generate a PWM from gapped Clustal alignments?

from Bio.Alphabet import Gapped
alignment = AlignIO.read("filename.clustalw", "clustal", alphabet=Gapped)
m = Motif.Motif()
for a in alignment:
    m.add_instance(a.seq)
m.pwm()


--
Website: http://biostar.stackexchange.com/questions/tagged/biopython

Account Login: 
https://www.feedmyinbox.com/members/login/?utm_source=fmi&utm_medium=email&utm_campaign=feed-email

Unsubscribe here: 
http://www.feedmyinbox.com/feeds/unsubscribe/837946/d83641150d25e0f52255e3fcfa9e7ccb2b83405f/?utm_source=fmi&utm_medium=email&utm_campaign=feed-email

--
This email was carefully delivered by FeedMyInbox.com. 
PO Box 682532 Franklin, TN 37068




More information about the Biopython-dev mailing list