Oh I see the problem. Thanks for the help.
Hello,
I am trying to use CIBERSORT to deconvolute the immune cells in pancreatic cancer after my treatments. I have 3 biological replicates of Control, Treatments A,B,C.
Using edgeR, I created the cpm matrix which is not log transformed. and converted it to the required format as follows:
# Load Packages ----
library(edgeR)
library(org.Mm.eg.db)
# Load the data ----
data<- read.csv("gene_count_matrix.csv", header = T, row.names = 1L) # n=55401
pheno<- read.csv("pheno_sheet.csv", header = T, row.names = 1L)
# Load the data into edgeR ----
dge<- DGEList(counts=data, group = pheno$Sample) # n=55401
# Filtering low count genes ----
keep<- filterByExpr(dge)
dge<- dge[keep,,keep.lib.sizes=FALSE] # n=21476
# Normalising the data ----
dge<- calcNormFactors(dge)
cpm<- cpm(dge, log=F) # n=21476
cpm<- data.frame(cpm)
cpm$ENTREZID<- mapIds(org.Mm.eg.db, keys = rownames(cpm), keytype = "ENSEMBL", column = "ENTREZID")
cpm<- cpm[!duplicated(cpm$ENTREZID),]
cpm$SYMBOL<- mapIds(org.Mm.eg.db, keys = rownames(cpm), keytype = "ENSEMBL", column = "SYMBOL")
cpm<- na.omit(cpm)
rownames(cpm) = cpm$SYMBOL
cpm<- subset(cpm, select = -c(ENTREZID, SYMBOL))
write.csv(cpm, "CPM_CIBERSORTX.csv")
I then converted it to a tab delimited file and uploaded it to CIBERSORTx.
Using the default LM22 matrix, I used the following job parameters:
Date: 2022-10-12 14:39:40
Job type: Impute Cell Fractions
Signature matrix file: LM22.update-gene-symbols.txt
Mixture file: CPM_CIBERSORTX.txt
Batch correction: enabled
Batch correction mode: B-mode
Disable quantile normalization: true
Run mode (relative or absolute): relative
Permutations: 100
And then this is the error I got:
Error: $ operator is invalid for atomic vectors
In addition: Warning message:
In mclapply(1:svn_itor, res, mc.cores = svn_itor) :
all scheduled cores encountered errors in user code
Execution halted
Does anyone know how to resolve this?
Thanks for your time.
2 answers
So, your file contains double quotation marks? See CIBERSORTx instructions
Sure no problem. Please consider marking the answer as accepted :).
Hi, I am having the same problem. Just wondering how you got rid of the quotes in the matrix? thanks
write.table(counts, file = "mixture.txt", sep = "\t", quote = F)
Also either save with row.names = T, then manually add "Gene_Symbol" as the header.
Or use
counts <- tibble::rownames_to_column(counts, "Gene_Symbol")
Then row.names = F when saving to get it into format :)
Hello,
For me, double quotation marks were not the issue and I have spent a lot of time debugging various errors produced by CIBERSORTxHiRes. I have been having the current issue for a while now when using the Docker version of CIBERSORTx. I found that the origin of the issue is in the CIBERSORTxGEP module. Thankfully the source code for this module is available (as opposed to the HiRes module)
The fix for me was specifying the amount of cores used for parallelization (--threads). By default, the program uses all cores available on the system. This seems to introduce an error in the indexing of one of the matrices.
Log in to answer this question.
Maybe try to convert the atomic vector to a data frame and print it already tab separated with:
Also make sure before running
CIBERSORTthat you have the gene symbols in the first column of your file.Hi, Thanks for your suggestion. Unfortunately, I got the same error when I did it with your suggestion.
Hmm.. could you show the content of the file?
This is the file. Of note, after saving it as a tsv file, I added "Gene" over rownames as per requirements of CIBERSORT
So the final File looked like this.
Hello. I faced the same problem but not able to resolve it. I don't have double quotation and no NA values and the dataset used is in the form of dataset not any other type. Would anyone could help me resolve this error? I can provide more info on that. Thanks.
For me, this error was produced when the difference between the number of samples (in the mixture file) to the number of cell types (in the signature matrix) was not large enough.