On Mar 30, 2009, at 5:54 PM, Brent Pedersen wrote:
> all goes well until the 2nd to last line. where i get an error: > KeyError: "no key 'b11' in database <SequenceFileDB > '/home/bpederse/work/learn_pygr/data/b.fasta'>" > > where 'b11' is the name of the fake gene in the variable b_gene. but > apparently, it's looking for the keys in b.fasta which > has the chromsomal fasta headers of 'chr1' ... 'chr3' Hi Brent, I looked at your load_simple_msa.py, and I think I see the problem: you are specifying seqDict=a_seq when you construct the NLMSA, but that's not right. Remember, the NLMSA seqDict needs to contain *all* the objects that are being mapped from / to. In this case that is not only the sequences in a_seq, but also the annotations in a_anno (this is why seqDict is almost invariably a union like PrefixUnionDict, unless all the source and destination sequences being aligned are from a single "sequence database"). The easiest solution is just not give any seqDict argument, which will make the NLMSA construct a seqDict for you automatically (based on the object pairs you tell it to align). So just build your NLMSA like this: a_gene_msa = cnestedlist.NLMSA('/tmp/agenes', mode='w', pairwiseMode=True, bidirectional=False) bidirectional=False is recommended because you will never need the reverse mapping (from annotation --> sequence), since the annotation object automatically provides that via its own "sequence" attribute). bidirectional=False will prevent NLMSA from wasting space storing the reverse mapping. Here's an example of how we usually build such a sequence --> annotation mapping: http://www.doe-mbi.ucla.edu/~leec/newpygrdocs/tutorials/annotation.html#constructing-an-annotation-database It seems we need to add an error message that will catch this problem and give you a clear explanation of what to do. And of course we need to update all the docs to reflect the new 0.8 features and tutorials. By the way, importing AnnotationDB from seqdb is deprecated in 0.8; annotation functionality has been moved to a separate module called (unsurprisingly) pygr.annotation. -- Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pygr-dev" group. To post to this group, send email to pygr-dev@googlegroups.com To unsubscribe from this group, send email to pygr-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pygr-dev?hl=en -~----------~----~----~----~------~----~------~--~---