Function Repository Resource:

EnsemblPhenotype

Source Notebook

Retrieve phenotype information associated with genomic variants

Contributed by: Keiko Hirayama

ResourceFunction["EnsemblPhenotype"][phenotype, "GenomicFeatures"]

gives genomic features associated with a given phenotype description.

ResourceFunction["EnsemblPhenotype"][gene, "Phenotypes"]

gives phenotype annotations associated with a given gene.

ResourceFunction["EnsemblPhenotype"][{chromosome,{start,end}},"PhenotypeAnnotations"]]

gives genomics features and associated phenotypes found for a given chromosome region specified by start and end positions.

Details and Options

EnsemblPhenotype is based on Ensembl, which provides genomics information including phenotype annotations. Phenotypes are traits that are associated with the genomic variants.
Selected phenotype descriptions, such as the names of common genetic diseases or traits, or phenotype ontology accessions, as defined by the Human Phenotype Ontology, Experimental Factor Ontology, Orphanet, or Mammalian Phenotype Ontology can be used for the input phenotype to retrieve "GenomicFeatures".
To retrieve "PhenotypeAnnotations", specify the chromosome argument by a chromosome name such as "chromosome 1" or simply just "1" and the start and end positions of the genome sequence by the integers.
The following option can be given:
"Species""human"species for which to query; should be one of selected TaxonomicSpecies entities or names of species
Supported species include: human (Homo sapiens), cat (Felis catus), chicken (Gallus gallus), cow (Bos taurus), dog (Canis lupus_familiaris), goat (Capra hircus), horse (Equus caballus), mouse (Mus musculus), pig (Sus scrofa), rat (Rattus norvegicus), sheep (Ovis aries) and zebrafish (Danio rerio).
ResourceFunction["EnsemblPhenotype"][phenotype] is equivalent to ResourceFunction["EnsemblPhenotype"][phenotype,"GenomicFeatures"].

Examples

Basic Examples (3) 

Find genomic features associated with hypercholesterolemia:

In[1]:=
ResourceFunction[
 "EnsemblPhenotype", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["hypercholesterolemia", "GenomicFeatures"]
Out[1]=

Find phenotype annotations associated with the homeostatic iron (Fe) regulator (HFE) gene:

In[2]:=
ResourceFunction[
 "EnsemblPhenotype", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["HFE", "Phenotypes"]
Out[2]=

Find genomic features and phenotypes associated with the specified region of the human chromosome 19:

In[3]:=
ResourceFunction[
 "EnsemblPhenotype", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"][{"19", {44900000, 44910000}}, "PhenotypeAnnotations"]
Out[3]=

Scope (8) 

Find single-nucleotide polymorphisms (SNPs) associated with coffee consumption:

In[4]:=
snps = ResourceFunction[
  "EnsemblPhenotype", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["coffee consumption", "GenomicFeatures"]
Out[4]=

Analyze SNPs affecting the coffee consumption rate:

In[5]:=
coffeConsumptionRateAffectingSNP = snps[Select[! MissingQ[#BetaCoefficient] && ! StringFreeQ[#BetaCoefficient, "unit" | "cups"] &]][
    All, {#ID[
       "ExternalID"], (StringTrim[
         StringSplit[#BetaCoefficient, i : "increase" | "decrease" :> i], " unit" | " NR" | " cups" ~~ __] /. {{d_, "increase"} :> ToExpression@d, {d_, "decrease"} :> -ToExpression@d})} &][
   GroupBy[First -> Last], MeanAround][
  ReverseSortBy[# /. a_Around :> a[[1]] &]]
Out[5]=

Plot SNPs associated with the change in coffee consumption rate:

In[6]:=
ListPlot[coffeConsumptionRateAffectingSNP, PlotRange -> Full, Ticks -> {None, Automatic}, PlotLabel -> "change in coffee consumption rate (cups per day)"]
Out[6]=

Find population frequency information for one of the notable SNPs:

In[7]:=
ResourceFunction[
ResourceObject[<|"Name" -> "NCBIGenomicSNPData", "ShortName" -> "NCBIGenomicSNPData", "UUID" -> "6f2d5756-cc3b-42f3-932f-bc6d163c3291", "ResourceType" -> "Function", "Version" -> "1.1.0", "Description" -> "Retrieve information on reference SNPs from the NCBI database", "RepositoryLocation" -> URL[
     "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$e00201f1a4fc41339cdf633e9bc60ebe`NCBIGenomicSNPData", "FunctionLocation" -> CloudObject[
     "https://www.wolframcloud.com/obj/e9678ccc-563b-485b-aa0d-3c4f4cd9de18"]|>, ResourceSystemBase -> Automatic]][
 Keys[coffeConsumptionRateSNP][1], "FrequencyData"]
Out[7]=

Find genes associated with the coffee consumption rate:

In[8]:=
coffeConsumptionRateAffectingGene = Dataset[GroupBy[
   Flatten@Normal@
     snps[Select[! MissingQ[#AssociatedGene] && ! MissingQ[#BetaCoefficient] && ! StringFreeQ[#BetaCoefficient, "unit" | "cups"] &]][All, Thread[(StringTrim[
             StringSplit[#BetaCoefficient, i : "increase" | "decrease" :> i], " unit" | " NR" | " cups" ~~ __] /. {{d_, "increase"} :> ToExpression@d, {d_, "decrease"} :> -ToExpression@d}) -> #AssociatedGene] &][
      ReverseSortBy[Mean[#] &]], Last -> First, MeanAround]]
Out[8]=

Plot genes associated with the change in coffee consumption rate:

In[9]:=
ListPlot[coffeConsumptionRateAffectingGene, PlotRange -> Full, Ticks -> {None, Automatic}, PlotLabel -> "change in coffee consumption rate (cups per day)"]
Out[9]=

Find the pathways associated with caffeine metabolism:

In[10]:=
caffinePathways = ResourceFunction[
ResourceObject[<|"Name" -> "WikiPathways", "ShortName" -> "WikiPathways", "UUID" -> "ab81ab85-9317-4fea-bb15-b96c7609c487", "ResourceType" -> "Function", "Version" -> "1.2.0", "Description" -> "Get pathways and additional information from the WikiPathways database", "RepositoryLocation" -> URL[
      "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$ee47149bfa5547ac9c3e8a4e782aaf9b`WikiPathways", "FunctionLocation" -> CloudObject[
      "https://www.wolframcloud.com/obj/f13d5633-a6a7-4b04-a013-dffe85f4f453"]|>, ResourceSystemBase -> Automatic]]["caffeine", "SearchPaths"]
Out[10]=

Draw a pathway associated with the caffeine and theobromine metabolism:

In[11]:=
ResourceFunction[
ResourceObject[<|"Name" -> "WikiPathways", "ShortName" -> "WikiPathways", "UUID" -> "ab81ab85-9317-4fea-bb15-b96c7609c487", "ResourceType" -> "Function", "Version" -> "1.2.0", "Description" -> "Get pathways and additional information from the WikiPathways database", "RepositoryLocation" -> URL[
     "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"], "SymbolName" -> "FunctionRepository`$ee47149bfa5547ac9c3e8a4e782aaf9b`WikiPathways", "FunctionLocation" -> CloudObject[
     "https://www.wolframcloud.com/obj/f13d5633-a6a7-4b04-a013-dffe85f4f453"]|>, ResourceSystemBase -> Automatic]][
 caffinePathways[1, "Pathcode"], "Graphics", ImageSize -> 800]
Out[11]=

Options (1) 

Find genomic features associated with hyperactivity in mice:

In[12]:=
ResourceFunction[
 "EnsemblPhenotype", ResourceSystemBase -> "https://www.wolframcloud.com/obj/resourcesystem/api/1.0"]["hyperactivity", "GenomicFeatures", "Species" -> Entity["TaxonomicSpecies", "MusMusculus::y84t7"]]
Out[12]=

Requirements

Wolfram Language 13.0 (December 2021) or above

Version History

  • 1.0.2 – 21 April 2025
  • 1.0.1 – 12 March 2025
  • 1.0.0 – 19 February 2025

Source Metadata

Related Resources

License Information