Esempio n. 1
0
        """
        sim1 = 0
        for goterm in gene1:
            sim1 = sim1 + self.__get_go_score(goterm, gene2)
        sim2 = 0
        for goterm in gene2:
            sim2 = sim2 + self.__get_go_score(goterm, gene1)
        score = (sim1 + sim2) / (len(gene1) + len(gene2))
        return score


if __name__ == '__main__':
    from oboio import OboIO
    from src import download_go_graph

    OBIO = OboIO()
    ONTO = download_go_graph()
    TERMS = OBIO.get_graph(ONTO)

    # G-Sesame GO example
    GSGO = GsesameGO(TERMS)
    print 'GO:0043229 semantic value:', GSGO.semantic_value('GO:0043229')
    print 'GO:0043231 semantic value:', GSGO.semantic_value('GO:0043231')
    print 'Score for: GO:0043229 - GO:0043231:', \
        GSGO.scores('GO:0043229', 'GO:0043231')

    # G-Sesame Gene example
    GSGENE = GsesameGene(TERMS)
    GENE1 = [
        'GO:0004022', 'GO:0004024', 'GO:0004174', 'GO:0046872', 'GO:0008270',
        'GO:0004023'