Example #1
0
def getWtssDBConnection(db=''):
    """Get access to the database specified in the config file."""
    wtss_param = utils_param.get_wtss_parameter()
    mysql_dbh = getDbConnection(db, wtss_param.get_mysql_user(),
                                wtss_param.get_mysql_password(),
                                wtss_param.get_mysql_host())
    return mysql_dbh
Example #2
0
def getWtssDBConnection(db=''):
    """Get access to the database specified in the config file."""
    wtss_param=utils_param.get_wtss_parameter()
    mysql_dbh=getDbConnection(db, wtss_param.get_mysql_user(),
                              wtss_param.get_mysql_password(),
                              wtss_param.get_mysql_host())
    return mysql_dbh
Example #3
0
def get_list_contig_file(sp_code,wtss_param=None):
    if not wtss_param:
        wtss_param=utils_param.get_wtss_parameter()
    list_contig_file=wtss_param.get_list_contig_file(sp_code)
    if not list_contig_file:
        samtools_bin=os.path.join(wtss_param.get_samtools_dir(),'samtools')
        genome_fasta=wtss_param.get_genome_fasta(sp_code)
        list_contig_file=generate_fai_from_genome(genome_fasta=genome_fasta, samtools_bin=samtools_bin)
        if not list_contig_file:
            logging.error("Can't create the .fai file from the genome fasta using %s on %s"%(samtools_bin,genome_fasta))
    return list_contig_file
Example #4
0
def get_list_contig_file(sp_code, wtss_param=None):
    if not wtss_param:
        wtss_param = utils_param.get_wtss_parameter()
    list_contig_file = wtss_param.get_list_contig_file(sp_code)
    if not list_contig_file:
        samtools_bin = os.path.join(wtss_param.get_samtools_dir(), 'samtools')
        genome_fasta = wtss_param.get_genome_fasta(sp_code)
        list_contig_file = generate_fai_from_genome(genome_fasta=genome_fasta,
                                                    samtools_bin=samtools_bin)
        if not list_contig_file:
            logging.error(
                "Can't create the .fai file from the genome fasta using %s on %s"
                % (samtools_bin, genome_fasta))
    return list_contig_file
Example #5
0
def get_sp_code(specie, available_species=None):
    if specie:
        sp_lo=specie.lower()
        if not available_species:
            wtss_param=utils_param.get_wtss_parameter()
            available_species=wtss_param.get_available_species()
            if not available_species:
                #keep for backward compatibility
                available_species={'hs':['human','homo_sapiens','hs', '9606'],
                       'mm':['mouse', 'mus_musculus', 'mm', '10090'],
                       'pt':['poplar', 'populus_trichocarpa', 'pt', '3694'],
                       'ce':['worm', 'c_elegans', 'ce', '6239']}
        for sp in available_species.keys():
            if sp_lo in available_species.get(sp) or specie in available_species.get(sp):
                return sp
    return None
Example #6
0
def get_sp_code(specie, available_species=None):
    if specie:
        sp_lo = specie.lower()
        if not available_species:
            wtss_param = utils_param.get_wtss_parameter()
            available_species = wtss_param.get_available_species()
            if not available_species:
                #keep for backward compatibility
                available_species = {
                    'hs': ['human', 'homo_sapiens', 'hs', '9606'],
                    'mm': ['mouse', 'mus_musculus', 'mm', '10090'],
                    'pt': ['poplar', 'populus_trichocarpa', 'pt', '3694'],
                    'ce': ['worm', 'c_elegans', 'ce', '6239']
                }
        for sp in available_species.keys():
            if sp_lo in available_species.get(
                    sp) or specie in available_species.get(sp):
                return sp
    return None