Package: sgd-rest
sgd-restSaccharomyces Genome Database (SGD) REST API wrapper. Refer to theSGD RESTpage for information about API usage and terms of service.Installationpipinstallsgd-restQuick startGet GO (gene ontology) information for gene ARO1.importsgdaro1=sgd.gene("ARO1")aro1.go_details.json()BackgroundNavigate the SGD REST API with Python.ClassesClassDescriptionExamplelocusQuery SGD REST using locus ID.locus("S000002534")geneQuery SGD REST using gene name.gene("ARO1")phenotypeQuery SGD REST using phenotype name.phenotype("increased_chemical_compound_accumulation")goQuery SGD REST using GO ID.go("GO:0000001")First, instantiate an SGD class prior to working with subclasses:importsgdaro1=sgd.gene("ARO1")SubclassesUse theendpointsattribute to search a class's subclasses:importsgdprint(sgd.gene.endpoints)ClassSubclassDescriptionlocus&genedetailsGets basic information about a locus.locus&genego_detailsGets GO (gene ontology) annotations and the references used to make them.locus&geneinteraction_detailsGets interaction annotations and the references used to make them.locus&geneliterature_detailsGets references which refer to a gene, organized by subject of relevance.locus&geneneighbor_sequence_detailsGets get sequences for neighboring loci in the strains for which they are available.locus&genephenotype_detailsGets phenotype annotations and the references used to make them.locus&geneposttranslational_detailsGets posttranslational protein data.locus&geneprotein_domain_detailsGets protein domains, their sources, and their positions relative to protein sequence.locus&geneprotein_experiment_detailsGets metadata and data values for protein experiments.locus&generegulation_detailsGets regulation annotations and the references used to make them.locus&genesequence_detailsGets sequence for genomic, coding, protein, and +/- 1KB sequence.phenotypedetailsGets basic information about a phenotype.phenotypelocus_detailsGets a list of genes annotated to a phenotype with some information about the experiment and strain background.godetailsGets basic information about a GO term.golocus_detailsGets a list of genes annotated to a GO term.Use a subclass to retrieve the endpoint's response. This library utilizes therequestslibrary, returning arequests.models.Responseinstance. Use this instance to define the desired processing of the REST API content.For example, for the gene ARO1, get GO details as JSON and literature details as text:importsgdaro1=sgd.gene("ARO1")aro1.go_details.json()aro1.literature_details.textAdvancedJust like a subclass returns arequests.models.Responseinstance, the user can pass keyword arguments directly to therequests.getmethod during class instantiation. For example, you can add a header to prevent server-side caching and parse the locus details response as text:importsgdgo_0000001=sgd.go("GO:0000001",headers={"Cache-Control":"no-cache","Pragma":"no-cache"})go_0000001.locus_details.textAdditional attributesurl: Gets the endpoint's URL. Available for all classes.locus_id: Gets the endpoint's locus ID. Avaialble forlocusandgeneclasses.importsgdtor2=sgd.gene("TOR2")# 1print(tor2.url)# >>> 'https://www.yeastgenome.org/backend/locus/S000001686'# 2print(tor2.locus_id)# >>> 'S000001686'ExceptionsInvalidGene: An invalid gene was queried.importsgdfromsgd.exceptionsimportInvalidGenetry:bad_gene=sgd.gene("BadGene")exceptInvalidGene:print("Whoops, an invalid gene was queried.")ContributeIssues TrackerSource CodeSupportIf you are having issues or would like to propose a new feature, please use theissues tracker.LicenseThis project is licensed under the MIT license.