This function facilitates ontology-based queries for experimental factors and body sites.

subsetByOntology(df, column = c("Body site", "Condition"), term, ontology)

Arguments

df

data.frame storing BugSigDB data. Typically obtained via importBugSigDB.

column

character. Column of df on which subsetting should be performed. Should be either "Body site" (default) or "Condition".

term

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.

ontology

an object of class ontology_index as defined in the ontologyIndex package. Typically obtained via getOntology.

Value

a data.frame with the chosen column restricted to descendants of the chosen term in the chosen ontology.

See also

importBugSigDB, getOntology

Examples


 # (1) Obtain BugSigDB data
 df <- importBugSigDB()
#> Using cached version from 2024-10-30 16:00:33

 # (2) Obtain ontology of interest as an R object
 uberon <- getOntology("uberon")
#> Using cached version from 2024-10-30 16:01:10

 # (3) High-level query on body site
 sdf <- subsetByOntology(df, 
                         column = "Body site",
                         term = "digestive system element",
                         ontology = uberon)
 table(sdf[,"Body site"])
#> 
#>                                           Body of stomach 
#>                                                         5 
#>                                                    Caecum 
#>                                                        24 
#>                                         Cardia of stomach 
#>                                                         7 
#>                                              Cecum mucosa 
#>                                                        12 
#> Cecum mucosa,Colonic mucosa,Mucosa of rectum,Ileal mucosa 
#>                                                         5 
#>                                                     Colon 
#>                                                        53 
#>                                               Colon,Feces 
#>                                                         2 
#>                                            Colonic mucosa 
#>                                                         8 
#>                                         Colorectal mucosa 
#>                                                        18 
#>                                   Colorectal mucosa,Feces 
#>                                                         2 
#>                                                Colorectum 
#>                                                         3 
#>                                           Duodenal mucosa 
#>                                                         6 
#>                                                  Duodenum 
#>                                                        16 
#>                                        Duodenum,Bile duct 
#>                                                         1 
#>                                                 Esophagus 
#>                                                        53 
#>                                               Feces,Colon 
#>                                                         4 
#>                                      Feces,Colonic mucosa 
#>                                                         1 
#>                                   Feces,Colorectal mucosa 
#>                                                         2 
#>                                     Feces,Large intestine 
#>                                                         4 
#>                          Feces,Mucosa of descending colon 
#>                                                         5 
#>                           Feces,Mucosa of small intestine 
#>                                                         4 
#>                                              Feces,Spleen 
#>                                                         2 
#>                Feces,Stomach,Caecum,Small intestine,Colon 
#>                                                         2 
#>                                               Gastric pit 
#>                                                         4 
#>                                                     Ileum 
#>                                                        21 
#>                                               Ileum,Colon 
#>                                                         2 
#>                                               Ileum,Feces 
#>                                                         2 
#>                                             Ileum,Jejunum 
#>                                                         2 
#>                                              Ileum,Rectum 
#>                                                         2 
#>                                        Ileum,Rectum,Feces 
#>                                                         2 
#>                                                   Jejunum 
#>                                                        25 
#>                                         Lumen of duodenum 
#>                                                         2 
#>                                 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 
#>                                              Rectal lumen 
#>                                                         2 
#>                                                    Rectum 
#>                                                        23 
#>                                                     Rumen 
#>                                                         7 
#>                                           Small intestine 
#>                                                        14 
#>                                                   Stomach 
#>                                                        44 
#>                                Superior surface of tongue 
#>                                                         2 
#>                                         Surface of tongue 
#>                                                        10 
#>                                                    Tongue 
#>                                                        29 
#>                                   Wall of small intestine 
#>                                                         2