def __init__(self, db_name: str): """ Downloader init. :param db_name: Name of the public database to download. WARNING: must be the same spelling as in your config ! :type db_name: str """ # Get logging module from main script self.logger = logging.getLogger(__name__) # Set project config self.config = utilities.extract_config() # Which DB to download self.db_name = db_name # Download path and URL self.dir_name = self.config[self.db_name]["SAVE FILE TO"] self.urls = [ self.config[self.db_name][url] for url in self.config[self.db_name] if "url" in url ] self.filenames = [ os.path.join(self.dir_name, url.split("/")[-1]) for url in self.urls ]
def __init__(self, db_name: str): """ Updater init. :param db_name: Name of the public database to update. WARNING: must be the same spelling as in your config ! :type db_name: str """ # Get logging module from main script self.logger = logging.getLogger(__name__) # Set project config self.config = utilities.extract_config() # Which DB to update self.db_name = db_name self.species = "hsa" self.mirna_dico = utilities.get_mirna_conversion_info(self.config) self.gene_dico = utilities.get_gene_conversion_info(self.config) self.unknown_mirs = [] self.unknown_genes = [] self.validated_interactions = utilities.get_validated_interactions(self.config) # Module to convert ensemble ID necessary for RNA22 if "Rna22" in self.db_name: self.gene_ensemble_list = [] # File paths if "Svmicro" in self.db_name or "Mbstar" in self.db_name: self.dir_name = self.config[self.db_name.upper()]["SAVE FILE TO"] self.filenames = [] with open(self.config[self.db_name.upper()]["URL_0"], "r") as my_txt: for line in my_txt: self.filenames.append(os.path.join(self.dir_name, line).strip()) elif "Mirabel" in self.db_name: self.dir_name = "" self.urls = [] self.filenames = [] else: self.dir_name = self.config[self.db_name.upper()]["SAVE FILE TO"] self.urls = [self.config[self.db_name.upper()][url] for url in self.config[self.db_name.upper()] if "url" in url] self.filenames = [os.path.join(self.dir_name, url.split("/")[-1]) for url in self.urls]
def __init__(self, db_list: list): """ Aggregator init. :param db_list: list of databases from which to aggregate predictions """ # Get logging module from main script self.logger = logging.getLogger(__name__) # Set project config self.config = utilities.extract_config() # Variables self.ascendant = [ "Targetscan", "Miranda", "Pita", "Mirmap", "Mirabel", "Rna22" ] self.db_list = db_list self.validated_interactions = utilities.get_validated_interactions( self.config)
def __init__(self, db_main: str, db_compare: list): """ Aggregator init. :param db_list: list of databases from which to aggregate predictions :param db_compare: list of databases with which you wish to compare aggregated data """ # Get logging module from main script self.logger = logging.getLogger(__name__) # Set project config self.config = utilities.extract_config() # Variables self.ascendant = [ "Targetscan", "Miranda", "Pita", "Mirmap", "Mirabel", "Rna22" ] self.db_main = db_main self.db_comp = db_compare self.all_db = [db_main] self.all_db.extend(self.db_comp) self.ascendant.append(self.db_main)
from scripts import utilities from scripts.downloader import Downloader from scripts.updater import Updater from scripts.aggregater import Aggregator from scripts.rocker import Rocker if __name__ == '__main__': # Start execution timing startTime = datetime.now() # Set logging module logging.basicConfig(level="INFO", format="%(asctime)s - %(levelname)s - %(message)s") # Set project config config = utilities.extract_config() # Set variables parser = argparse.ArgumentParser() parser.add_argument('-d', action="store_true", help="If -d present: download all files, else don't.") parser.add_argument('-u', action="store_true", help="If -u present: update all files, else don't.") parser.add_argument( '-l', '--list', nargs='*', help= 'Pass the list of databases you wish to aggregate. Default is empty list (but all DB later).',