Closed Jwenyi closed 2 years ago
@Jwenyi Thank you for using DeMixT in our study. Can I suggest you to use raw read counts instead of TPM/FPKM as the input for DeMixT? You can obtain the it by query <- GDCquery(project = i, data.category = "Transcriptome Profiling", data.type = "Gene Expression Quantification", workflow.type = "HTSeq - Counts", legacy = F)
and feed the counts directly to DeMixT. Please run DeMixT again and let me know if you have the error again. Thanks.
Thanks @jiyunmaths
I fed DeMixT with raw read counts data, but there's another ERROR raised.
Error in inputdata[id1, ] : (subscript) logical subscript too long
I checked original code of DeMixT_GS and found that this error might be ascribed to a code in Line 433 and 291 inputdatamat1 <- inputdata[id1, ]
I thinks this code is to extract a subset of inputdata
, in which genes expressions are less thanfilter.sd
. So I guess that maybe the inputdata contains too many rows (over 52k), thus[]
is unable to process subset operation. This is a very common case, because I also get an error when I use "[ ]" to take a subset of the very large dataframe.
So I use inputdatamat1 <- subset(inputdata,row.names(inputdata) %in% names(id1)[id1]==TRUE)
to replace inputdatamat1 <- inputdata[id1, ]
, and found that DemixT works well.
However, I still wonder if whether my code changed the workflow of DemixT, if so, could you pls send me some advice? I will be very grateful of it.
And I also got two questions as below:
1) I found that the raw read counts of some genes are 0, could you kindly pls give me some suggestion about how should I to process it? Cuz I found that the original code of DemixT_GS
need to log2-convert inputdata, which will report NA
when raw read counts is 0.
2) I found that the shape of deconvoluted tumor expression is different from original tumor expression. The inputdata has 56602 rows(genes), but the output data only has 27531 rows. Did I do something wrong? If not, what the reason that lead to genes reduction and is this reduction affects the downstream statistical analysis?
> View(res.S2)
> dim(res.S2[["decovExprT"]])
[1] 27531 36
> dim(tumor_exprs)
[1] 56602 36
Look forward to your kindly suggestion.
Wenyi Jin
Sorry for boring you @jiyunmaths but DeMixT report the same error again (pls see the ERROR REPORT below) when I used modified DeMixT to process other read counts data (PRAD from TCGA)
Error in if (sum(obj == 0) > 1) { : missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In theta.valid + sqrt(abs(qchisq(0.95, 1) * C)) :
longer object length is not a multiple of shorter object length
2: In theta.valid - sqrt(abs(qchisq(0.95, 1) * C)) :
I attached my code and inputdata, could you pls give me some advice for fixing it?
MY CODE
i = "TCGA-PRAD_RNASeq_Counts.RData"
load(i)
# extract normal and cancer samples' exprs matrix
barcode <- colnames(expDataCounts)
if(grepl("TARGET",i)){
if(grepl("TARGET-ALL-P3FPKM",i)){
tumor_sample_ids <- which(substr(barcode,25,26) %in% c('01',"02","03","04","05","06","07","08","09"))
tumor_exprs <- expDataCounts[,tumor_sample_ids]
normal_exprs <- expDataCounts[,-tumor_sample_ids]
}else{
tumor_sample_ids <- which(substr(barcode,18,19) %in% c('01',"02","03","04","05","06","07","08","09"))
tumor_exprs <- expDataCounts[,tumor_sample_ids]
normal_exprs <- expDataCounts[,-tumor_sample_ids]
}
}else{
tumor_sample_ids <- which(substr(barcode,14,15) %in% c('01',"02","03","04","05","06","07","08","09"))
tumor_exprs <- expDataCounts[,tumor_sample_ids]
normal_exprs <- expDataCounts[,-tumor_sample_ids]
}
# calculate purified tumor exprs from mixture RNA-exprs matrix of tumor samples
data.Y <- as.matrix(tumor_exprs) + 1
data.N1 <- as.matrix(normal_exprs) + 1
data.Y <- SummarizedExperiment(list(Counts=as.matrix(data.Y)))
data.N1 <- SummarizedExperiment(list(Counts=as.matrix(data.N1)))
res.TCGA = DeMixT(data.Y = data.Y,
data.N1 = data.N1,
data.N2 = NULL,
niter = 10, nbin = 50, filter.sd = 0.6, #nspikein = 6,
if.filter = TRUE, ngene.Profile.selected = 1500,
mean.diff.in.CM = 0.25, ngene.selected.for.pi = 1500,
tol = 10^(-5))
MY INPUTDATA Due to files size limitation of github (less than 25 MB), kindly access the inputdata (TCGA-PRAD_RNASeq_Counts.RData, size of 43MB) from Google Drive by the following link: https://drive.google.com/file/d/1Nh05Z3-4mPZuc-q6jmdZzko4B0h8zitd/view?usp=sharing
All the best, Wenyi Jin
@Jwenyi Sorry for the inconvenience. Your data may need a preprocessing before feeding into DeMixT. I am composing a tutorial and will release it to this repository soon. Will let you know when it is available. Thanks.
Thanks @jiyunmaths I fed DeMixT with raw read counts data, but there's another ERROR raised.
Error in inputdata[id1, ] : (subscript) logical subscript too long
I checked original code of DeMixT_GS and found that this error might be ascribed to a code in Line 433 and 291inputdatamat1 <- inputdata[id1, ]
I thinks this code is to extract a subset ofinputdata
, in which genes expressions are less thanfilter.sd
. So I guess that maybe the inputdata contains too many rows (over 52k), thus[]
is unable to process subset operation. This is a very common case, because I also get an error when I use "[ ]" to take a subset of the very large dataframe. So I useinputdatamat1 <- subset(inputdata,row.names(inputdata) %in% names(id1)[id1]==TRUE)
to replaceinputdatamat1 <- inputdata[id1, ]
, and found that DemixT works well. However, I still wonder if whether my code changed the workflow of DemixT, if so, could you pls send me some advice? I will be very grateful of it.And I also got two questions as below:
- I found that the raw read counts of some genes are 0, could you kindly pls give me some suggestion about how should I to process it? Cuz I found that the original code of
DemixT_GS
need to log2-convert inputdata, which will reportNA
when raw read counts is 0.- I found that the shape of deconvoluted tumor expression is different from original tumor expression. The inputdata has 56602 rows(genes), but the output data only has 27531 rows. Did I do something wrong? If not, what the reason that lead to genes reduction and is this reduction affects the downstream statistical analysis?
> View(res.S2) > dim(res.S2[["decovExprT"]]) [1] 27531 36 > dim(tumor_exprs) [1] 56602 36
Look forward to your kindly suggestion.
Wenyi Jin
The TCGA raw count data contains numerous genes, over 50000 genes in the expression matrix I guess. I pre-filtered out the extremely low expressed genes with counts less than 5 in half of the entire samples, and it works. Also, the DeMixT built-in function will log2 the count data. So I used count = count +1
before performing the algorithm. Hope it works for you.
Dear DeMixT team,
I'm trying to use DeMixT to get purified tumor expression profiles from pan-cancer RNA-seq data of TCGA. However, DemixT and DeMixT_GS functions always report error of
Error in if (sum(obj == 0) > 1) { : missing value where TRUE/FALSE needed
. I attached my workfolw below. And, I would be very grateful if you could give me any suggestion to fix it.My input data is kind of TPM expression matrix (without log2 convert), which contains over 25k genes and hundreds samples. Normal tissue expression matrix is also obtained from TCGA. In most cases, TCGA provides several normal data (2 to 50 samples) and lots of tumor data (hundreds).
I found that this error is raised by function "Optimum_KernelC", which is used in "DeMixT_GS ". The
obj
returnNaN NaN
, soif(sum(obj == 0)>1)
failed.Preview of my input data for "DemixT "function
My full code as shown below:
All the best, Wenyi Jin