コード例 #1
0
ファイル: graph_test.py プロジェクト: mamanambiya/pygr
 def setUp(self):
     self.nodeDB = {}
     tmp = testutil.TempDir('graphshelve-test')
     filename = tmp.subfile() # needs a random name each time
     self.datagraph = mapping.Graph(sourceDB=self.nodeDB,
                                    targetDB=self.nodeDB,
                                    filename=filename, intKeys=True)
コード例 #2
0
ファイル: worldbase_test.py プロジェクト: mamanambiya/pygr
 def setUp(self, worldbasePath=None, **kwargs):
     # overwrite the WORLDBASEPATH environment variable
     self.tempdir = testutil.TempDir('pygrdata')
     if worldbasePath is None:
         worldbasePath = self.tempdir.path
     worldbase.update(worldbasePath, **kwargs)
     # handy shortcuts
     self.EQ = self.assertEqual
コード例 #3
0
ファイル: pygrdata_test.py プロジェクト: mamanambiya/pygr
 def setUp(self, pygrDataPath=None, **kwargs):
     # overwrite the WORLDBASEPATH environment variable
     self.tempdir = testutil.TempDir('pygrdata')
     if pygrDataPath is None:
         pygrDataPath = self.tempdir.path
     pygr.Data.clear_cache() # make sure no old data loaded
     pygr.Data.update(pygrDataPath, **kwargs) # use this path
     # handy shortcuts
     self.EQ = self.assertEqual
コード例 #4
0
 def setUp(self, worldbasePath=None, **kwargs):
     # overwrite the WORLDBASEPATH environment variable
     self.tempdir = testutil.TempDir('pygrdata')
     if worldbasePath is None:
         worldbasePath = self.tempdir.path
     self.metabase = metabase.MetabaseList(worldbasePath, **kwargs)
     self.pygrData = self.metabase.Data
     self.schema = self.metabase.Schema
     # handy shortcuts
     self.EQ = self.assertEqual
コード例 #5
0
ファイル: worldbase_test.py プロジェクト: mamanambiya/pygr
def populate_swissprot():
    "Populate the current worldbase with swissprot data"
    # build BlastDB out of the sequences
    sp_hbb1 = testutil.datafile('sp_hbb1')
    sp = seqdb.BlastDB(sp_hbb1)
    sp.__doc__ = 'little swissprot'
    worldbase.Bio.Seq.Swissprot.sp42 = sp

    # also store a fragment
    hbb = sp['HBB1_TORMA']
    ival = hbb[10:35]
    ival.__doc__ = 'fragment'
    worldbase.Bio.Seq.frag = ival

    # build a mapping to itself
    m = mapping.Mapping(sourceDB=sp, targetDB=sp)
    trypsin = sp['PRCA_ANAVA']
    m[hbb] = trypsin
    m.__doc__ = 'map sp to itself'
    worldbase.Bio.Seq.spmap = m

    # create an annotation database and bind as exons attribute
    worldbase.schema.Bio.Seq.spmap = metabase.OneToManyRelation(
        sp, sp, bindAttrs=('buddy', ))
    annoDB = seqdb.AnnotationDB({1: ('HBB1_TORMA', 10, 50)},
                                sp,
                                sliceAttrDict=dict(id=0, start=1, stop=2))
    exon = annoDB[1]

    # generate the names where these will be stored
    tempdir = testutil.TempDir('exonAnnot')
    filename = tempdir.subfile('cnested')
    nlmsa = cnestedlist.NLMSA(filename,
                              'w',
                              pairwiseMode=True,
                              bidirectional=False)
    nlmsa.addAnnotation(exon)
    nlmsa.build()
    annoDB.__doc__ = 'a little annotation db'
    nlmsa.__doc__ = 'a little map'
    worldbase.Bio.Annotation.annoDB = annoDB
    worldbase.Bio.Annotation.map = nlmsa
    worldbase.schema.Bio.Annotation.map = \
         metabase.ManyToManyRelation(sp, annoDB, bindAttrs=('exons', ))
コード例 #6
0
ファイル: graph_test.py プロジェクト: mamanambiya/pygr
    def setUp(self):

        tmp = testutil.TempDir('graphshelve-test')
        filename = tmp.subfile() # needs a random name each time
        self.datagraph = mapping.Graph(filename=filename, intKeys=True)