Learn R Programming

pbcmc (version 1.0.0)

as: PAM50 high level coerce functions

Description

These functions (setAs and as.PAM50) are intended to be used with limma MAList-class in order to coerce its structure into a compatible PAM50 class.

Usage

as(object,Class,strict=TRUE,ext=possibleExtends(thisClass,Class))
as.PAM50(object)
"as.PAM50"(object)

Arguments

object
MAList object with at least M and genes items, optionally targets.
Class
character with the name of class "PAM50" to be coerced.
strict, ext
see as function.

Value

a PAM50 object with the respective copied data.

Details

Basically the $M and $genes items are copied into a MolecularPermutationClassifier's exprs and annotation slots respectively. In addition, if present, $targets content is also copied to the same named slot.

See Also

PAM50 for a complete example.

Other PAM50: classify,PAM50-method, filtrate,PAM50-method, pam50centroids, permutate,PAM50-method, subjectReport,PAM50-method, subtypes,PAM50-method

Examples

Run this code
##Example 1: Create a PAM50 object -----------------------------------------  
##1) Just an empty object
object<-PAM50()
object

##2) Using Breast Cancer NKI database, if available. 
if(requireNamespace("breastCancerNKI")){
    object<-loadBCDataset(Class=PAM50, libname="nki", verbose=TRUE)  
    object    
    ##Now we can inspect the object   
    head(exprs(object))      ##The gene expression    
    head(annotation(object)) ##The available annotation 
    head(targets(object))    ##The clinical data present in the package  
}

##Example 2: Build a PAM50 object with user data --------------------------   
##Option 1: using PAM50 constructor. The user will only need:   
##a) The M gene expression object, i. e., gene in rows and sample in columns  
##b) The annotation data.frame which must include the compulsory fields   
## "probe", "NCBI.gene.symbol" and "EntrezGene.ID"
M<-pam50$centroids
genes<-pam50$centroids.map
names(genes)<-c("probe", "NCBI.gene.symbol", "EntrezGene.ID")  
object<-PAM50(exprs=M, annotation=genes)   
object

##Option 2: Two ways to build it from a MAList (as or as.PAM50)-------------
##Let's use PAM50 classifier's centroids toy example, i. e., the five subject 
##subtypes, which must correctly classify all the subject. 
M<-pam50$centroids
genes<-pam50$centroids.map
names(genes)<-c("probe", "NCBI.gene.symbol", "EntrezGene.ID")  
maux<-new("MAList", list(M=M, genes=genes))  
##calling as function  
object<-as(maux, "PAM50")   
object
##same result with as.PAM50 function
object<-as.PAM50(maux)
object

Run the code above in your browser using DataLab