def get(self, object_category, taxon): """ Bulk download of gene associations. NOTE: this route has a limiter on it, you may be restricted in the number of downloads per hour. Use carefully. """ assocs = bulk_fetch(subject_category='gene', object_category=object_category, taxon=taxon) return assocs
def main(): """ Wrapper for OGR """ parser = argparse.ArgumentParser( description='Command line interface to python-ontobio.golr library' """ Provides command line interface onto the ontobio.golr python library, a high level abstraction layer over Monarch and GO solr indices. """, formatter_class=argparse.RawTextHelpFormatter) parser.add_argument('-o', '--outfile', type=str, required=False, help='Path to output file') parser.add_argument('-C', '--category', nargs=2, type=str, required=True, help='Category pair. E.g. disease gene') parser.add_argument('-s', '--species', type=str, required=True, help='NCBITaxon ID') parser.add_argument('-S', '--slim', nargs='*', type=str, required=False, help='Slim IDs') parser.add_argument('-L', '--limit', type=int, default=100000, required=False, help='Limit on number of rows') parser.add_argument('-u', '--url', type=str, required=False, help='Solr URL. E.g. http://localhost:8983/solr/golr') parser.add_argument('-v', '--verbosity', default=0, action='count', help='Increase output verbosity') parser.add_argument('ids',nargs='*') args = parser.parse_args() if args.verbosity >= 2: logging.basicConfig(level=logging.DEBUG) elif args.verbosity == 1: logging.basicConfig(level=logging.INFO) else: logging.basicConfig(level=logging.WARNING) logging.info("Welcome!") [subject_category, object_category] = args.category assocs = bulk_fetch(subject_category, object_category, args.species, rows=args.limit, slim=args.slim, url=args.url) for a in assocs: print("{}\t{}\t{}".format(a['subject'], a['relation'], ";".join(a['objects'])))
def get(self, taxon1, taxon2): """ Bulk download of orthologs """ assocs = bulk_fetch(subject_category='gene', object_category='gene', relation=ortholog_rel, taxon=taxon1, object_taxon=taxon2, user_agent=USER_AGENT) return assocs
def get(self, object_category, taxon): """ Bulk download of disease associations. NOTE: this route has a limiter on it, you may be restricted in the number of downloads per hour. Use carefully. """ # TODO temporary workaround if taxon == "NCBITaxon:9606": taxon = None assocs = bulk_fetch(subject_category='disease', object_category=object_category, taxon=taxon) return assocs
def get(self, object_category, taxon): """ Bulk download of disease associations. NOTE: this route has a limiter on it, you may be restricted in the number of downloads per hour. Use carefully. """ # TODO temporary workaround for # https://github.com/monarch-initiative/monarch-app/issues/1448 if taxon == "NCBITaxon:9606": taxon = None assocs = bulk_fetch(subject_category='disease', object_category=object_category, taxon=taxon, user_agent=USER_AGENT) return assocs
def bulk_fetch_cached(**args): logging.info("Fetching assocs from store (will be cached)") return bulk_fetch(**args)