def get(self): """ Summary statistics for objects associated """ args = parser.parse_args() M = GolrFields() ont = None ocat = args.get('object_category') ontid = args.get('ontology') if ontid is None: if ocat == 'function': ontid = 'go' if ocat == 'phenotype': # TODO: other phenotype ontologies ontid = 'hp' print("Loading: {}".format(ontid)) ont = get_ontology(ontid) taxid = args.get('taxon') max_p_value = float(args.max_p_value) subjects = args.get('subject') background = args.get('background') afactory = AssociationSetFactory() aset = afactory.create(ontology=ont, subject_category='gene', object_category=ocat, taxon=taxid) enr = aset.enrichment_test(subjects=subjects, threshold=max_p_value, labels=True) return {'results': enr}
def get(self): """ Returns compact associations for a given input set """ args = parser.parse_args() M = GolrFields() results = search_associations( subjects=args.get('subject'), select_fields=[M.SUBJECT, M.RELATION, M.OBJECT], use_compact_associations=True, rows=MAX_ROWS, facet_fields=[], user_agent=USER_AGENT, **args) return results
def get(self): """ Returns homology associations for a given input set of genes """ args = parser.parse_args() M = GolrFields() rel = 'RO:0002434' # TODO; allow other types results = search_associations( subjects=args.get('subject'), select_fields=[M.SUBJECT, M.RELATION, M.OBJECT], use_compact_associations=True, relation=rel, rows=MAX_ROWS, facet_fields=[], **args) return results
def get(self): """ Summary statistics for objects associated """ args = parser.parse_args() M = GolrFields() results = search_associations( subjects=args.get('subject'), rows=0, facet_fields=[M.OBJECT_CLOSURE, M.IS_DEFINED_BY], facet_limit=-1, **args) print("RESULTS=" + str(results)) obj_count_dict = results['facet_counts'][M.OBJECT_CLOSURE] del results['facet_counts'][M.OBJECT_CLOSURE] return {'results': obj_count_dict, 'facets': results['facet_counts']}
def get(self): """ Returns compact associations for a given input set """ args = parser.parse_args() M = GolrFields() #results = search_associations(subjects=args.get('subject'), # rows=0, # pivot_subject_object=True, # facet_fields=[], # facet_limit=-1, # **args) results = search_associations( subjects=args.get('subject'), select_fields=[M.SUBJECT, M.RELATION, M.OBJECT], use_compact_associations=True, rows=MAX_ROWS, facet_fields=[], **args) return results
import logging from flask import request from flask_restplus import Resource from biolink.datamodel.serializers import association, association_results from biolink.api.restplus import api from ontobio.golr.golr_associations import get_association, search_associations, GolrFields from biolink import USER_AGENT log = logging.getLogger(__name__) M = GolrFields() parser = api.parser() parser.add_argument( 'subject_taxon', help='SUBJECT TAXON id, e.g. NCBITaxon:9606. Includes inferred by default') parser.add_argument( 'evidence', help="""Object id, e.g. ECO:0000501 (for IEA; Includes inferred by default) or a specific publication or other supporting ibject, e.g. ZFIN:ZDB-PUB-060503-2. """) class RelationUsageResource(Resource): @api.expect(parser) @api.marshal_list_with(association_results) def get(self): """ All relations used plus count of associations """