示例#1
0
 def connect_rethink(self, **kwargs):
     if self.database not in ['tdb', 'test_tdb', 'test']:
         raise Exception("Cant download to this database: " + self.database)
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
     self.rethink_io.connect_rethink(self.database, self.rethink_host, self.auth_key)
     self.rethink_io.check_table_exists(self.database, self.virus)
示例#2
0
    def connect_rethink(self, **kwargs):

        if self.database not in ['tdb', 'test_tdb']:
            raise Exception("Cant download to this database: " + self.database)
        self.rethink_io = rethink_io()
        self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
        self.rethink_io.connect_rethink(self.database, self.rethink_host, self.auth_key)
        self.rethink_io.check_table_exists(self.database, self.virus)
示例#3
0
 def connect(self, **kwargs):
     if self.database not in self.uploadable_databases:
         raise Exception("Cant upload to this database: " + self.database, "add to list of databases allowed", self.uploadable_databases)
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
     self.rethink_io.connect_rethink(self.database, self.rethink_host, self.auth_key)
     self.rethink_io.check_table_exists(self.database, self.viruses_table)
     self.rethink_io.check_table_exists(self.database, self.sequences_table)
示例#4
0
 def connect_rethink(self, **kwargs):
     if self.database not in ["vdb", "test_vdb", "test"]:
         raise Exception("Can't download from this database: " + self.database)
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
     self.rethink_io.connect_rethink(self.database, self.rethink_host, self.auth_key)
     self.rethink_io.check_table_exists(self.database, self.viruses_table)
     self.rethink_io.check_table_exists(self.database, self.sequences_table)
示例#5
0
    def __init__(self, database, **kwargs):
        self.upload_hour = 3
        self.database = database.lower()
        if 'database' in kwargs:
            kwargs['database'] = self.database

        self.rethink_io = rethink_io()
        self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
        self.rethink_io.connect_rethink(self.database, self.rethink_host, self.auth_key)
        self.rethink_interact = rethink_interact()
示例#6
0
 def connect(self, **kwargs):
     if self.database not in self.uploadable_databases:
         raise Exception("Can't upload to this database: " + self.database,
                         "add to list of databases allowed",
                         self.uploadable_databases)
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(
         **kwargs)
     self.rethink_io.connect_rethink(self.database, self.rethink_host,
                                     self.auth_key)
     self.rethink_io.check_table_exists(self.database, self.viruses_table)
     self.rethink_io.check_table_exists(self.database, self.sequences_table)
示例#7
0
文件: append.py 项目: tmehoke/fauna
 def __init__(self, **kwargs):
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(
         **kwargs)
     self.rethink_interact = rethink_interact()
示例#8
0
 def __init__(self, **kwargs):
     self.rethink_io = rethink_io()
     self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(**kwargs)
     self.rethink_interact = rethink_interact()
示例#9
0
    def __init__(self, database, virus, subtype, **kwargs):
        parse.__init__(self, **kwargs)
        flu_upload.__init__(self, database=database, virus=virus)
        self.virus = virus.lower()
        self.table = self.virus
        if subtype is not None:
            self.subtype = subtype.lower()
        self.database = database.lower()
        self.uploadable_databases = [
            'tdb', 'test_tdb', 'test_tdb_2', 'cdc_tdb', 'test_cdc',
            'vidrl_tdb', 'test_vidrl', 'crick_tdb', 'test_crick', 'niid_tdb',
            'test_niid'
        ]
        if self.database not in self.uploadable_databases:
            raise Exception("Can't upload to this database: " + self.database,
                            "add to list of databases allowed",
                            self.uploadable_databases)
        self.flu_upload = flu_upload(database=self.database, virus=self.virus)
        self.rethink_io = rethink_io()
        self.rethink_host, self.auth_key = self.rethink_io.assign_rethink(
            **kwargs)
        self.rethink_io.connect_rethink(self.database, self.rethink_host,
                                        self.auth_key)
        self.rethink_io.check_table_exists(self.database, self.virus)
        self.strain_fix_fname = "source-data/flu_strain_name_fix.tsv"
        self.HI_ref_name_abbrev_fname = "source-data/HI_ref_name_abbreviations.tsv"

        # fields that are needed to upload
        self.upload_fields = [
            'virus_strain', 'serum_strain', 'serum_id', 'assay_type',
            'assay_date', 'titer', 'timestamp'
        ]
        self.optional_fields = [
            'date', 'ref', 'virus_cdc_id', 'virus_passage',
            'virus_passage_category', 'subtype', 'serum_host', 'serum_passage',
            'serum_passage_category'
        ]
        self.overwritable_fields = ['titer', 'date', 'ref']
        self.index_fields = [
            'virus_strain', 'serum_strain', 'serum_id', 'source',
            'virus_passage_category', 'serum_passage_category', 'assay_type',
            'assay_date'
        ]
        self.ref_virus_strains = set()
        self.ref_serum_strains = set()
        self.test_virus_strains = set()
        self.indexes = set()
        self.virus_passage = set()
        self.serum_passage = set()
        self.strain_names = set()
        self.assay_type = set()
        self.different_date_format = [
            'NIMR-REPORT-FEB2010_03.CSV', 'NIMR-REPORT-FEB2010_06.CSV',
            'NIMR-REPORT-FEB2010_05.CSV', 'NIMR_Feb2010_15.csv',
            'NIMR-REPORT-SEP2009_03.CSV', 'NIMR-REPORT-FEB2010_04.CSV',
            'NIMR_FEB2010_15.CSV', 'NIMR_FEB2010_16.CSV',
            'NIMR_Feb2010_16.csv', 'NIMR-report-Feb2010_03.csv',
            'NIMR-report-Feb2010_06.csv', 'NIMR-report-Feb2010_05.csv',
            'NIMR-report-Sep2009_03.csv', 'NIMR-report-Feb2010_04.csv'
        ]
        self.new_different_date_format = set()
        self.fix = set()
示例#10
0
 def __init__(self, **kwargs):
     self.rethink_io = rethink_io()
示例#11
0
 def __init__(self, **kwargs):
     self.rethink_io = rethink_io()