View source: R/subInterestResult.R
subInterestResult | R Documentation |
Build a new object using subset of data in an SummarizedExperiment
object.
subInterestResult(x, selectRow, selectCol,
sampleAnnoCol, sampleAnnotation=c())
x |
Object of type |
selectRow |
Numeric or TRUE/FALSE Vector indicating what rows to extract. |
selectCol |
A vector with Numeric values, character strings (sample names) or TRUE/FALSE Vector indicating what columns to extract. |
sampleAnnoCol |
Which colummn of |
sampleAnnotation |
Vector including the annotations to consider for subset data extraction. They
should be present in the |
An object of calss SummarizedExperiment
.
Ali Oghabian
interest
,
InterestResult
.
geneId<- paste("gene", c(rep(1,7), rep(2,7), rep(3,7), rep(4,7)),
sep="_")
readCnt1<- sample(1:100, 28)
readCnt2<- sample(1:100, 28)
readCnt3<- sample(1:100, 28)
readCnt4<- sample(1:100, 28)
fpkm1<- readCnt1/(tapply(readCnt1, geneId, sum))[geneId]
fpkm2<- readCnt2/(tapply(readCnt2, geneId, sum))[geneId]
fpkm3<- readCnt3/(tapply(readCnt3, geneId, sum))[geneId]
fpkm4<- readCnt4/(tapply(readCnt4, geneId, sum))[geneId]
# Creating object using test data
interestDat<-data.frame(
int_ex=rep(c(rep(c("exon","intron"),3),"exon"),4),
int_ex_num= rep(c(1,1,2,2,3,3,4),4),
int_type=rep(c(NA,"U2",NA,"U12",NA,"U2",NA),4),
strand=rep("*",28),
gene_id= geneId,
sam1_readCnt=readCnt1,
sam2_readCnt=readCnt2,
sam3_readCnt=readCnt3,
sam4_readCnt=readCnt4,
sam1_fpkm=fpkm1,
sam2_fpkm=fpkm2,
sam3_fpkm=fpkm3,
sam4_fpkm=fpkm4
)
readFreqColIndex<- grep("_readCnt$",colnames(interestDat))
scaledRetentionColIndex<- grep("_fpkm$",colnames(interestDat))
samNames<-paste("sam", 1:4, sep="")
frqTmp<-as.matrix(interestDat[, readFreqColIndex])
sclTmp<-as.matrix(interestDat[, scaledRetentionColIndex])
colnames(frqTmp)<- samNames
colnames(sclTmp)<- samNames
interestResObj<- InterestResult(
resultFiles=paste("file",1:4, sep="_"),
rowData= interestDat[, -c(readFreqColIndex,
scaledRetentionColIndex)],
counts= frqTmp,
scaledRetention= sclTmp ,
scaleLength=TRUE,
scaleFragment=FALSE,
sampleAnnotation=data.frame(
sampleName=paste("sam",1:4, sep=""),
gender=c("M","M","F","F"),
health=c("healthy","unhealthy","healthy","unhealthy"),
row.names=samNames
)
)
#Build new object
newObj<- subInterestResult(interestResObj, selectRow=1:20)
#View newObj
print(newObj)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.