I'm working with Jake on this code (or something similar that should
effectively work the same). First, thanks for the clarifications on
data types, Chris. I can successfully make all the AnnotationDBs and
NLMSA objects for the different datasets. In this case, I have two
AnnotationDB (and NLMSAs) - one of a set of genes, the other of a set
of repeat regions. I want to build a mapping schema to get the list of
repeats nearby a gene, just like one would use for getting the exons
that are in a gene.

I are not successful at getting the schema to work correctly - namely,
binding a "ltrs" attribute (the repeat regions) to the gene object.
Our mapping and schema are saved (and loadable) in pygr. Querying the
Mapping directly works correctly - given a gene id, the ltr(s)
associated with it are returned. However, they are not accessible from
the "ltrs" attribute on a gene. I'm running this line that should give
me this:

schema = metabase.OneToManyRelation(annotdb1, annotdb2, bindAttrs=
('ltrs', 'genes'))

Where annotdb1 are the genes, and annotdb2 are the repeats.

Any suggestions on how to troubleshoot this problem? An full example
is available at http://kmdaily.pastebin.com/m5f21ff52. Thanks!

Kenny

On Jun 4, 4:35 pm, Christopher Lee <l...@chem.ucla.edu> wrote:
> On Jun 1, 2009, at 5:06 PM, jbiesinger wrote:
>
> > There is other code that creates the OneToMany Mapping of gene->exons,
> > which is also suffering, but I thought I'd start out here.  When I try
> > to load the resulting resource, I'm getting
> > <type 'exceptions.AttributeError'>: FakeModule object has no attribute
> > 'Exon'
>
> This sounds like a pickling problem due to not being able to find  
> (import) the module containing your Exon class.  Do you have any idea  
> where this "FakeModule" is coming from?  Pygr doesn't contain any such  
> string.  My guess is that your Exon class couldn't be unpickled  
> because Python couldn't find the module that contained it.  Pickling  
> saves a class by simply recording its module name and class name.  
> Unpickling tries to import the module by name, and looks for the class  
> name in that module.  So the module containing Exon must be importable  
> (using its name) at the time of unpickling.  For example, if the Exon  
> class was defined in an interactive interpreter session (instead of a  
> module file), it will not be unpickle-able in a subsequent interpreter  
> session.
>
>
>
> > The Exon class is defined above this, and the ExonCollection uses
> > Collection(itemClass=Exon).
>
> I suggest you start by creating an AnnotationDB and making sure that  
> it works correctly, before adding the extra complications of pickling  
> and unpickling it.  I suggest you look at simple examples of creating  
> an AnnotationDB in pygr/tests/annotation_test.py, in the setUp()  
> methods for our various tests.  The key ingredients are:
>
> - The first argument to AnnotationDB should be a "slice database"  
> which gives information about the annotation coordinates.  This "slice  
> info" can be a tuple (for an example, see the test_translation_db()  
> method in our annotation_test.py) or an object (for an example, see  
> AnnotationSeq_Test.setUp()).  By default AnnotationDB looks for  
> attributes "id", "start", "stop" and (optional) "orientation" on each  
> slice info object.  Your Exon class looks fine, although you might  
> want to call it ExonInfo to emphasize that it's the slice info, not  
> the actual exon annotation object.  Note also that the sliceAttrDict  
> argument can be used to remap these default attribute names to a  
> different attribute name (string) or tuple index value (int).
>
> - you save new annotations to the AnnotationDB using its  
> new_annotation() method.  This has one advantage over just saving the  
> slice info directly to your slicedb; new_annotation() will first check  
> that it can successfully construct an annotation from the slice info,  
> before saving it to the slicedb.  This way, any error will be exposed  
> immediately.  For that reason, I suggest you save annotations this way  
> rather than saving them directly to your slicedb as you are doing.
>
> Test this out using a regular Python dict as your sliceDB, and if that  
> works try a Pygr Collection as your sliceDB.  Note: for Collection,  
> don't bother with the itemClass parameter, which isn't useful in this  
> context.  Think of a Collection as being just like a dict, except that  
> a) it can be stored on disk a la Shelve; b) it can be pickled (unlike  
> Shelve).
>
> Make sure you're able to retrieve annotations from your AnnotationDB,  
> get subslices of them, get their string sequence value, etc.
>
> If all that works, then try saving your AnnotationDB to worldbase  
> (Pygr 0.8; called pygr.Data in 0.7 and before), and retrieving it in a  
> new Python session.  Once your AnnotationDB is working correctly,  
> saving it in worldbase should be easy.
>
> -- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to