Skip to contents
devtools::load_all(".")
library(dplyr)

First, create an OmicSignatureCollection object.
This is the same code in “Create OmicSignatureCollection” section.
The following signatures are pseudo results for illustration purpose.

OmS1 <- readJson(file.path(system.file("extdata", package = "OmicSignature"), "OmS_example_1.json"))
#>   [Success] OmicSignature object Experiment in liver created.
OmS2 <- readJson(file.path(system.file("extdata", package = "OmicSignature"), "OmS_example_2.json"))
#>   [Success] OmicSignature object Experiment in brain created.
OmS3 <- readJson(file.path(system.file("extdata", package = "OmicSignature"), "OmS_example_3.json"))
#>   [Success] OmicSignature object Experiment in heart created.
ColMeta <- list(
  "collection_name" = "OmS_example_Collection",
  "description" = "An example of signature collection",
  "organism" = "Mus Musculus",
  "author" = "me"
)
OmSC <- OmicSignatureCollection$new(
  OmicSigList = list(OmS1, OmS2, OmS3),
  metadata = ColMeta,
  print_message = FALSE
)
#>   [Success] OmicSignature Collection OmS_example_Collection created.

$metadataSummary() will print out the metadata fields in all OmicSignature objects stored in the OmicSignatureCollection.
When parameter “only_shared” is set to be TRUE, only shared metadata fields among all OmicSignature objects will be included. Otherwise, all metadata fields will be included.

OmSC$metadataSummary(only_shared = TRUE)
#>                Experiment in liver        Experiment in brain       
#> assay_type     "transcriptomics"          "transcriptomics"         
#> covariates     "none"                     "none"                    
#> direction_type "bi-directional"           "bi-directional"          
#> organism       "Mus musculus"             "Mus musculus"            
#> p_cutoff       0.05                       0.05                      
#> phenotype      "new_experiment"           "new_experiment"          
#> platform       "transcriptomics by array" "transcriptomics by array"
#> sample_type    "liver"                    "brain"                   
#> score_cutoff   3                          3                         
#> signature_name "Experiment in liver"      "Experiment in brain"     
#>                Experiment in heart       
#> assay_type     "transcriptomics"         
#> covariates     "none"                    
#> direction_type "bi-directional"          
#> organism       "Mus musculus"            
#> p_cutoff       0.05                      
#> phenotype      "new_experiment"          
#> platform       "transcriptomics by array"
#> sample_type    "heart"                   
#> score_cutoff   3                         
#> signature_name "Experiment in heart"

Extract new signatures from the OmicSignatureCollection object

For example, extract all features with a absolute score > 4.5 and p < 0.01 from all the OmicSignature object stored in this Collection. The features are ranked by absolute score, if applicable.

OmSC$extractSignature("abs(score) > 4.5 & p_value < 0.01")
#>               sig_name probe_id feature_name score direction
#> 1  Experiment in brain       14       gene14 -4.99         -
#> 2  Experiment in heart       28       gene28  4.99         +
#> 3  Experiment in heart       32       gene32 -4.90         -
#> 4  Experiment in brain        9        gene9 -4.86         -
#> 5  Experiment in brain       15       gene15 -4.77         -
#> 6  Experiment in liver       46       gene46 -4.71         -
#> 7  Experiment in heart       25       gene25  4.71         +
#> 8  Experiment in heart       49       gene49 -4.70         -
#> 9  Experiment in liver       13       gene13  4.68         +
#> 10 Experiment in liver       48       gene48 -4.67         -
#> 11 Experiment in brain       25       gene25 -4.62         -
#> 12 Experiment in brain       16       gene16 -4.59         -
#> 13 Experiment in heart        6        gene6 -4.54         -

If bind is set to be FALSE, the output of each OmicSignature objects are provided as a list.

OmSC$extractSignature("abs(score) > 4.5 & p_value < 0.01", bind = FALSE)
#> $`Experiment in liver`
#>   probe_id feature_name score direction
#> 1       46       gene46 -4.71         -
#> 2       13       gene13  4.68         +
#> 3       48       gene48 -4.67         -
#> 
#> $`Experiment in brain`
#>   probe_id feature_name score direction
#> 1       14       gene14 -4.99         -
#> 2        9        gene9 -4.86         -
#> 3       15       gene15 -4.77         -
#> 4       25       gene25 -4.62         -
#> 5       16       gene16 -4.59         -
#> 
#> $`Experiment in heart`
#>   probe_id feature_name score direction
#> 1       28       gene28  4.99         +
#> 2       32       gene32 -4.90         -
#> 3       25       gene25  4.71         +
#> 4       49       gene49 -4.70         -
#> 5        6        gene6 -4.54         -