コード例 #1
0
ファイル: test_host.py プロジェクト: adamrp/pycogent
 def test_get_ensembl_account(self):
     """return an HostAccount with correct port"""
     for release in [48, '48', None]:
         act_new = get_ensembl_account(release=release)
         self.assertEqual(act_new.port, 5306)
     
     for release in [45, '45']:
         act_old = get_ensembl_account(release=45)
         self.assertEqual(act_old.port, 3306)
コード例 #2
0
ファイル: test_host.py プロジェクト: mikerobeson/pycogent
    def test_get_ensembl_account(self):
        """return an HostAccount with correct port"""
        for release in [48, '48', None]:
            act_new = get_ensembl_account(release=release)
            self.assertEqual(act_new.port, 5306)

        for release in [45, '45']:
            act_old = get_ensembl_account(release=45)
            self.assertEqual(act_old.port, 3306)
コード例 #3
0
    def __init__(self, Species, Release, account=None, pool_recycle=None):
        super(Genome, self).__init__()

        assert Release, 'invalid release specified'
        if account is None:
            account = get_ensembl_account(release=Release)

        self._account = account
        self._pool_recycle = pool_recycle

        # TODO: check Release may not be necessary because: assert Release above
        if Release is None:
            Release = get_latest_release(account=account)

        self._gen_release = None

        # TODO make name and release immutable properties
        self.Species = _Species.getSpeciesName(Species)
        self.Release = str(Release)

        # the db connections
        self._core_db = None
        self._var_db = None
        self._other_db = None
        self._feature_type_ids = FeatureTypeCache(self)
        self._feature_coord_levels = FeatureCoordLevels(self.Species)
コード例 #4
0
ファイル: genome.py プロジェクト: miklou/pycogent
 def __init__(self, Species, Release, account=None, pool_recycle=None):
     super(Genome, self).__init__()
     
     assert Release, 'invalid release specified'
     if account is None:
         account = get_ensembl_account(release=Release)
     
     self._account = account
     self._pool_recycle = pool_recycle
     
     # TODO: check Release may not be necessary because: assert Release above
     if Release is None:
         Release = get_latest_release(account=account)
     
     self._gen_release = None
     
     # TODO make name and release immutable properties
     self.Species = _Species.getSpeciesName(Species)
     self.Release = str(Release)
     
     # the db connections
     self._core_db = None
     self._var_db = None
     self._other_db = None
     self._feature_type_ids = FeatureTypeCache(self)
     self._feature_coord_levels = FeatureCoordLevels(self.Species)
コード例 #5
0
ファイル: test_host.py プロジェクト: adamrp/pycogent
 def test_active_connections(self):
     """connecting to a database on a specified server should be done once
     only, but same database on a different server should be done"""
     ensembl_acct = get_ensembl_account(release='46')
     engine1 = DbConnection(account=ensembl_acct,
                 db_name="homo_sapiens_core_46_36h")
     engine2 = DbConnection(account=ensembl_acct,
                 db_name="homo_sapiens_core_46_36h")
     self.assertEqual(engine1, engine2)
コード例 #6
0
ファイル: test_host.py プロジェクト: mikerobeson/pycogent
 def test_active_connections(self):
     """connecting to a database on a specified server should be done once
     only, but same database on a different server should be done"""
     ensembl_acct = get_ensembl_account(release='46')
     engine1 = DbConnection(account=ensembl_acct,
                            db_name="homo_sapiens_core_46_36h")
     engine2 = DbConnection(account=ensembl_acct,
                            db_name="homo_sapiens_core_46_36h")
     self.assertEqual(engine1, engine2)
コード例 #7
0
ファイル: test_database.py プロジェクト: Honglongwu/pycogent
 def test_table_has_column(self):
     """return correct values for whether a Table has a column"""
     account = get_ensembl_account(release=Release)
     var61 = Database(account=account, release=61, species='human',
         db_type='variation')
     
     var62 = Database(account=account, release=62, species='human',
         db_type='variation')
     
     self.assertTrue(var61.tableHasColumn('transcript_variation',
         'peptide_allele_string'))
     self.assertFalse(var61.tableHasColumn('transcript_variation',
         'pep_allele_string'))
     
     self.assertTrue(var62.tableHasColumn('transcript_variation',
         'pep_allele_string'))
     self.assertFalse(var62.tableHasColumn('transcript_variation',
         'peptide_allele_string'))
コード例 #8
0
ファイル: compara.py プロジェクト: pycogent/pycogent
    def __init__(self, species, Release, account=None, pool_recycle=None, division=None):
        assert Release, "invalid release specified"
        self.Release = str(Release)
        if account is None:
            account = get_ensembl_account(release=Release)
        self._account = account
        self._pool_recycle = pool_recycle
        self._compara_db = None
        sp = sorted([_Species.getSpeciesName(sp) for sp in set(species)])
        self.Species = tuple(sp)
        self._genomes = {}
        self._attach_genomes()

        self._species_id_map = None
        self._species_db_map = None
        self._species_set = None
        self._method_species_link = None
        self.division = division
コード例 #9
0
ファイル: compara.py プロジェクト: josenavas/pycogent
    def __init__(self,
                 species,
                 Release,
                 account=None,
                 pool_recycle=None,
                 division=None):
        assert Release, 'invalid release specified'
        self.Release = str(Release)
        if account is None:
            account = get_ensembl_account(release=Release)
        self._account = account
        self._pool_recycle = pool_recycle
        self._compara_db = None
        sp = sorted([_Species.getSpeciesName(sp) for sp in set(species)])
        self.Species = tuple(sp)
        self._genomes = {}
        self._attach_genomes()

        self._species_id_map = None
        self._species_db_map = None
        self._species_set = None
        self._method_species_link = None
        self.division = division
コード例 #10
0
ファイル: test_database.py プロジェクト: josenavas/pycogent
    def test_table_has_column(self):
        """return correct values for whether a Table has a column"""
        account = get_ensembl_account(release=Release)
        var61 = Database(account=account,
                         release=61,
                         species='human',
                         db_type='variation')

        var62 = Database(account=account,
                         release=62,
                         species='human',
                         db_type='variation')

        self.assertTrue(
            var61.tableHasColumn('transcript_variation',
                                 'peptide_allele_string'))
        self.assertFalse(
            var61.tableHasColumn('transcript_variation', 'pep_allele_string'))

        self.assertTrue(
            var62.tableHasColumn('transcript_variation', 'pep_allele_string'))
        self.assertFalse(
            var62.tableHasColumn('transcript_variation',
                                 'peptide_allele_string'))
コード例 #11
0
ファイル: test_host.py プロジェクト: adamrp/pycogent
 def test_pool_recycle_option(self):
     """excercising ability to specify a pool recycle option"""
     ensembl_acct = get_ensembl_account(release='56')
     engine1 = DbConnection(account=ensembl_acct,
                 db_name="homo_sapiens_core_46_36h", pool_recycle=1000)
コード例 #12
0
ファイル: test_host.py プロジェクト: adamrp/pycogent
__version__ = "1.5.3-dev"
__maintainer__ = "Gavin Huttley"
__email__ = "*****@*****.**"
__status__ = "alpha"

Release = 68

if 'ENSEMBL_ACCOUNT' in os.environ:
    args = os.environ['ENSEMBL_ACCOUNT'].split()
    host, username, password = args[0:3]
    kwargs = {}
    if len(args) > 3:
        kwargs['port'] = int(args[3])
    account = HostAccount(host, username, password, **kwargs)
else:
    account = get_ensembl_account(release=Release)

class TestEnsemblDbName(TestCase):
    def test_cmp_name(self):
        """should validly compare names by attributes"""
        n1 = EnsemblDbName('homo_sapiens_core_46_36h')
        n2 = EnsemblDbName('homo_sapiens_core_46_36h')
        self.assertEqual(n1, n2)
    
    def test_name_without_build(self):
        """should correctly handle a db name without a build"""
        n = EnsemblDbName("pongo_pygmaeus_core_49_1")
        self.assertEqual(n.Prefix, "pongo_pygmaeus")
        self.assertEqual(n.Type, "core")
        self.assertEqual(n.Build, '1')
    
コード例 #13
0
ファイル: test_host.py プロジェクト: mikerobeson/pycogent
 def test_pool_recycle_option(self):
     """excercising ability to specify a pool recycle option"""
     ensembl_acct = get_ensembl_account(release='56')
     engine1 = DbConnection(account=ensembl_acct,
                            db_name="homo_sapiens_core_46_36h",
                            pool_recycle=1000)
コード例 #14
0
ファイル: test_host.py プロジェクト: mikerobeson/pycogent
__version__ = "1.5.3-dev"
__maintainer__ = "Gavin Huttley"
__email__ = "*****@*****.**"
__status__ = "alpha"

Release = 76

if 'ENSEMBL_ACCOUNT' in os.environ:
    args = os.environ['ENSEMBL_ACCOUNT'].split()
    host, username, password = args[0:3]
    kwargs = {}
    if len(args) > 3:
        kwargs['port'] = int(args[3])
    account = HostAccount(host, username, password, **kwargs)
else:
    account = get_ensembl_account(release=Release)


class TestEnsemblDbName(TestCase):
    def test_cmp_name(self):
        """should validly compare names by attributes"""
        n1 = EnsemblDbName('homo_sapiens_core_46_36h')
        n2 = EnsemblDbName('homo_sapiens_core_46_36h')
        self.assertEqual(n1, n2)

    def test_name_without_build(self):
        """should correctly handle a db name without a build"""
        n = EnsemblDbName("pongo_pygmaeus_core_49_1")
        self.assertEqual(n.Prefix, "pongo_pygmaeus")
        self.assertEqual(n.Type, "core")
        self.assertEqual(n.Build, '1')