def compile_transcription_factors(base_dir, version): # use transcription_factor.xml as it is more complete and only missing from 6.0 if version == (6, 0): LOGGER.error("no transcription_factor.xml file for this version") return LOGGER.info("Compiling transcription factors...") t_factors = regdb.read_transcription_factors( os.path.join(base_dir, "transcription_factor.xml"), VERSION) norm = len(t_factors) LOGGER.info("Found {0:d}".format(norm)) if norm == 0: LOGGER.error("Failed to compile transcription factors.") return t_factors regdb.update_synonyms(os.path.join(base_dir, "object_synonym.xml"), pyreg.TranscriptionFactor, VERSION) regdb.update_external(os.path.join(base_dir, "object_external_db_link.xml"), pyreg.TranscriptionFactor, VERSION) norm = float(norm) num = sum(1 for tf in t_factors if tf.name) LOGGER.info("Found {0:d} transcription factors with a name ({1:.2%})".format(num, num / norm)) num = sum(1 for tf in t_factors if tf.synonyms) LOGGER.info("Found {0:d} transcription factors with synonyms ({1:.2%})".format(num, num / norm)) regdb.update_product_transcription_factor_link(os.path.join(base_dir, "product_tf_link.xml"), VERSION) return t_factors
def compile_products(base_dir): LOGGER.info("Compiling products...") products = regdb.read_products(os.path.join(base_dir, "product.xml"), VERSION) norm = len(products) LOGGER.info("Found {0:d}".format(norm)) if norm == 0: LOGGER.error("Failed to compile products.") return products LOGGER.info("Compiling additional information...") regdb.update_synonyms(os.path.join(base_dir, "object_synonym.xml"), pyreg.Product, VERSION) regdb.update_external(os.path.join(base_dir, "object_external_db_link.xml"), pyreg.Product, VERSION) norm = float(norm) num = sum(1 for prod in products if prod.name) LOGGER.info("Found {0:d} products with names ({1:.2%})".format(num, num / norm)) num = sum(1 for prod in products if prod.synonyms) LOGGER.info("Found {0:d} products with synonyms ({1:.2%})".format(num, num / norm)) num = sum(1 for prod in products if prod.go) LOGGER.info("Found {0:d} products with GO ID ({1:.2%})".format(num, num / norm)) return products