Пример #1
0
def generate_annotated_hpo_network(obo_file,
                                   disease_to_phenotype_file,
                                   annotations_file=None,
                                   ages_distribution_file=None):
    hpo_network = load_network(obo_file)

    alt2prim = generate_alternate_ids(hpo_network)

    # load phenotypes to diseases associations
    (
        disease_records,
        phenotype_to_diseases,
    ) = load_d2p(disease_to_phenotype_file, hpo_network, alt2prim)

    # load hpo network
    hpo_network = annotate(
        hpo_network,
        phenotype_to_diseases,
        len(disease_records),
        alt2prim,
        annotations_file=annotations_file,
        ages_distribution_file=ages_distribution_file,
    )

    return hpo_network, alt2prim, disease_records
Пример #2
0
    def test_annotate_network(self):
        hpo_network = load_network(self.obo_file)
        alt2prim = generate_alternate_ids(hpo_network)

        # load phenotypes to diseases associations
        disease_to_phenotype_file = os.path.join(self.parent_dir,
                                                 'data/phenotype.hpoa')
        disease_records, phenotype_to_diseases = load_d2p(
            disease_to_phenotype_file, hpo_network, alt2prim)

        num_diseases_annotated = len(disease_records)
        hpo_network = annotate(hpo_network, phenotype_to_diseases,
                               num_diseases_annotated, alt2prim)

        self.assertAlmostEqual(hpo_network.nodes['HP:0010863']['ic'], 5.69, 2)
Пример #3
0
    def setUpClass(cls):
        # parent dir
        cls.parent_dir = os.path.dirname(os.path.realpath(__file__))

        # load and process the network
        cls.obo_file = os.path.join(cls.parent_dir, 'data/hp.obo')
        cls.hpo_network = load_network(cls.obo_file)
        cls.alt2prim = generate_alternate_ids(cls.hpo_network)

        # load phenotypes to genes associations
        cls.disease_to_phenotype_file = os.path.join(cls.parent_dir, 'data/phenotype.hpoa')
        cls.disease_records, cls.phenotype_to_diseases = load_d2p(cls.disease_to_phenotype_file, cls.hpo_network, cls.alt2prim)

        cls.num_diseases_annotated = len(cls.disease_records)
        cls.hpo_network = annotate(cls.hpo_network, cls.phenotype_to_diseases, cls.num_diseases_annotated, cls.alt2prim)

        cls.hpo_id = 'HP:0010863'
        cls.disease_to_phenotype_output_file = os.path.join(cls.parent_dir, 'data/phenotype.noparents.hpoa')
Пример #4
0
    def setUp(cls):
        # parent dir
        cls.parent_dir = os.path.dirname(os.path.realpath(__file__))

        # load and process the network
        cls.obo_file = os.path.join(cls.parent_dir, 'data/hp.obo')
        cls.hpo_network = load_network(cls.obo_file)
        cls.alt2prim = generate_alternate_ids(cls.hpo_network)
        cls.ages_distribution_file = os.path.join(cls.parent_dir,
                                                  'data/phenotype_age.tsv')

        # load phenotypes to genes associations
        cls.disease_to_phenotype_file = os.path.join(cls.parent_dir,
                                                     'data/phenotype.hpoa')
        cls.disease_records, cls.phenotype_to_diseases = load_d2p(
            cls.disease_to_phenotype_file, cls.hpo_network, cls.alt2prim)

        cls.num_diseases_annotated = len(cls.disease_records)
        cls.hpo_network = annotate(cls.hpo_network, cls.phenotype_to_diseases,
                                   cls.num_diseases_annotated, cls.alt2prim)

        # create instance the scorer class
        cls.scorer = Scorer(cls.hpo_network, min_score_mask=None)