This function facilitates ontology-based queries for experimental factors and body sites.
subsetByOntology(df, column = c("Body site", "Condition"), term, ontology)data.frame storing BugSigDB data. Typically obtained via
importBugSigDB.
character. Column of df on which subsetting should be
performed. Should be either "Body site" (default) or "Condition".
character. A valid term of ontology. Subsetting by this term
then involves subsetting column to this term and all descendants of that
term in the the chosen ontology and that are present in the chosen
column of df.
an object of class ontology_index as defined in the
ontologyIndex package. Typically obtained via getOntology.
a data.frame with the chosen column restricted to descendants
of the chosen term in the chosen ontology.
importBugSigDB, getOntology
# (1) Obtain BugSigDB data
df <- importBugSigDB()
#> Using cached version from 2025-10-30 18:34:16
# (2) Obtain ontology of interest as an R object
uberon <- getOntology("uberon")
#> Using cached version from 2025-10-30 18:34:58
# (3) High-level query on body site
sdf <- subsetByOntology(df,
column = "Body site",
term = "digestive system element",
ontology = uberon)
table(sdf[,"Body site"])
#>
#> Caecum
#> 41
#> Cardia of stomach
#> 2
#> Cecum mucosa
#> 31
#> Cecum mucosa,Colonic mucosa,Mucosa of rectum,Ileal mucosa
#> 5
#> Colon
#> 70
#> Colon,Blood serum
#> 1
#> Colon,Feces
#> 2
#> Colonic mucosa
#> 8
#> Colorectal mucosa
#> 18
#> Colorectal mucosa,Feces
#> 2
#> Colorectum
#> 3
#> Duodenal mucosa
#> 6
#> Duodenum
#> 18
#> Duodenum,Bile duct
#> 1
#> Esophagus
#> 40
#> Feces,Colon
#> 4
#> Feces,Colonic mucosa
#> 1
#> Feces,Colorectal mucosa
#> 2
#> Feces,Duodenum
#> 6
#> Feces,Mucosa of descending colon
#> 5
#> Feces,Mucosa of small intestine
#> 4
#> Feces,Stomach,Caecum,Small intestine,Colon
#> 2
#> Gastric pit
#> 4
#> Ileum
#> 23
#> Ileum,Colon
#> 2
#> Ileum,Feces
#> 2
#> Ileum,Feces,Rectum
#> 2
#> Ileum,Jejunum
#> 2
#> Ileum,Rectum
#> 2
#> Jejunum
#> 29
#> Lumen of duodenum
#> 2
#> Midgut,Saliva-secreting gland
#> 2
#> Midgut,Saliva-secreting gland,Ovary
#> 6
#> Mucosa of ascending colon
#> 2
#> Mucosa of body of stomach
#> 1
#> Mucosa of rectum
#> 5
#> Mucosa of sigmoid colon
#> 3
#> Mucosa of small intestine
#> 2
#> Mucosa of stomach
#> 3
#> Nasopharyngeal gland
#> 2
#> Nasopharyngeal gland,Saliva
#> 6
#> Oral cavity,Esophagus
#> 2
#> Oropharyngeal gland,Saliva
#> 6
#> Proventriculus,Cloaca
#> 9
#> Rectal lumen
#> 2
#> Rectum
#> 31
#> Rumen
#> 13
#> Saliva,Esophagus,Gastric juice,Stomach,Feces
#> 3
#> Saliva,Esophagus,Stomach,Gastric juice,Feces
#> 3
#> Saliva-secreting gland,Ovary
#> 2
#> Sigmoid colon
#> 2
#> Small intestine
#> 19
#> Spleen
#> 2
#> Stomach
#> 48
#> Superior surface of tongue
#> 2
#> Surface of tongue
#> 16
#> Tongue
#> 33
#> Wall of small intestine
#> 2