def populate_SW_exon_alignments(protein_list): logger = Logger.Instance() alignment_logger = logger.get_logger('alignment') for protein_id in protein_list: try: if FileUtilities.read_status_file(protein_id)['ENSEMBL_EXON_RETRIEVAL'] == 'FAILED' or FileUtilities.read_status_file(protein_id)['REF_SP_DB_FORMATTING'] == 'FAILED': print "ABORTING {0} SW_EXON: some resources have FAILED stats!".format(protein_id) FileUtilities.update_entry_in_status_file(protein_id, 'SW_EXON_ALIGNMENT', 'FAILED') continue except KeyError: FileUtilities.update_entry_in_status_file(protein_id, 'SW_EXON_ALIGNMENT', 'FAILED') alignment_logger.error ("{0},Keys missing in the .status file (ENSEMBL_EXON_RETRIEVAL / REF_SP_DB_FORMATTING)".format(protein_id)) try: if FileUtilities.read_status_file(protein_id)['SW_EXON_ALIGNMENT'] == 'OK': print "SKIPPING {0} SW_EXONs: .status file -> OK!".format(protein_id) continue except KeyError: pass print "ALIGNING SW_EXON: {0}".format(protein_id) if Alignments.generate_SW_exon_alignments2(protein_id): FileUtilities.update_entry_in_status_file(protein_id, 'SW_EXON_ALIGNMENT', 'OK') else: FileUtilities.update_entry_in_status_file(protein_id, 'SW_EXON_ALIGNMENT', 'PARTIAL')
def populate_SW_gene_alignments(protein_list): for protein_id in protein_list: if FileUtilities.read_status_file(protein_id)['EXP_GENE_RETRIEVAL'] == 'FAILED' or FileUtilities.read_status_file(protein_id)['REF_SP_DB_FORMATTING'] == 'FAILED': print "ABORTING {0} SW_GENE: some resources have FAILED stats!".format(protein_id) FileUtilities.update_entry_in_status_file(protein_id, 'SW_GENE_ALIGNMENT', 'FAILED') continue try: if FileUtilities.read_status_file(protein_id)['SW_GENE_ALIGNMENT'] == 'OK': print "SKIPPING {0} SW_GENE: .status file -> OK!".format(protein_id) continue except KeyError: pass print "ALIGNING SW_GENE: {0}".format(protein_id) if Alignments.generate_SW_gene_alignments(protein_id): FileUtilities.update_entry_in_status_file(protein_id, 'SW_GENE_ALIGNMENT', 'OK') else: FileUtilities.update_entry_in_status_file(protein_id, 'SW_GENE_ALIGNMENT', 'PARTIAL')
def populate_referenced_species_databases(protein_list, referenced_species): for protein_id in protein_list: if not check_status_file_no_alignment(protein_id): #if FileUtilities.read_status_file(protein_id)['ENSEMBL_EXON_RETRIEVAL'] == 'FAILED': print "ABORTING {0} DATABASE FORMATTING: ENSEMBL_EXON_RETRIEVAL has a FAILED status!".format(protein_id) FileUtilities.update_entry_in_status_file(protein_id, 'REF_SP_DB_FORMATTING', 'FAILED') continue try: if FileUtilities.read_status_file(protein_id)['REF_SP_DB_FORMATTING'] == 'OK': print "SKIPPING {0} DATABASE FORMATTING: .status file -> OK!".format(protein_id) continue except KeyError: pass print "DATABASE FORMATTING: {0} for reference species {1}".format(protein_id, referenced_species) if Alignments.generate_referenced_species_database(protein_id, referenced_species): FileUtilities.update_entry_in_status_file(protein_id, 'REF_SP_DB_FORMATTING', 'OK') else: FileUtilities.update_entry_in_status_file(protein_id, 'REF_SP_DB_FORMATTING', 'FAILED')