DESeq Error in round(assay(se)) : non-numeric argument to mathematical function
5
0
Entering edit mode
@rodriguezvarenka-7495
Last seen 9.8 years ago
United States

Hi

I essentially have a counts data frame from featurecounts (Rsubread) and its giving me the error seen above.....
Does anyone know how I can check input counts file "test4", find if it needs reformating and how to fix it.

I found this person with similar problem:
http://cbtngs.blogspot.com/


(ddsMat <- DESeqDataSetFromMatrix(countData =test4 ,colData = sampleTable,design = ~Cell ))
Error in round(assay(se)) : non-numeric argument to mathematical function

> dim(test4)
[1] 25368 136
> dim(sampleTable)
[1] 136 4
This is not a fault of row names which I have checked.
 

deseq rna-seq • 11k views
ADD COMMENT
0
Entering edit mode

Sounds like your test4 data is hosed.

I bet the round function is being called to do a quick & dirty test to see if the input data (test4) are integers.

Is test4 really a data.frame? If so, what is the output of sapply(test4, class)?

ADD REPLY
0
Entering edit mode

> class(test4)
[1] "data.frame"

 

 sapply(test4, class)
  accepted_hits_38_5_1.bam   accepted_hits_38_5_2.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_3.bam   accepted_hits_38_5_4.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_5.bam   accepted_hits_38_5_6.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_7.bam   accepted_hits_38_5_8.bam
                 "numeric"                  "numeric"

 

etc....

ADD REPLY
0
Entering edit mode
@rodriguezvarenka-7495
Last seen 9.8 years ago
United States

> class(test4)
[1] "data.frame"

 sapply(test4, class)
  accepted_hits_38_5_1.bam   accepted_hits_38_5_2.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_3.bam   accepted_hits_38_5_4.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_5.bam   accepted_hits_38_5_6.bam
                 "numeric"                  "numeric"
  accepted_hits_38_5_7.bam   accepted_hits_38_5_8.bam
                 "numeric"                  "numeric"

ADD COMMENT
0
Entering edit mode
@mikelove
Last seen 10 days ago
United States

I can't reproduce this with the current DESeq2 release. Can you provide a small reproducible example?

Otherwise, can you try converting to matrix first? (I just tested and data.frame input works for me with the release and devel branch).

ADD COMMENT
0
Entering edit mode

 

Hi Michael

Reproducible example of what exactly? The test4 are just RNA seq counts from feature counts (rsubread).

I followed http://bioconductor.org/help/workflows/rnaseqGene/#construct

Starting from "counts"

 

 

 

ADD REPLY
0
Entering edit mode
Can you show your sessionInfo() Can you try converting to matrix? as.matrix(test4)
ADD REPLY
0
Entering edit mode

> sessionInfo()
R version 3.1.1 Patched (2014-10-16 r66782)
Platform: x86_64-unknown-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] parallel  stats4    stats     graphics  grDevices datasets  utils    
[8] methods   base     

other attached packages:
 [1] ggplot2_1.0.0             genefilter_1.48.1        
 [3] DESeq2_1.6.3              RcppArmadillo_0.4.650.1.1
 [5] Rcpp_0.11.5               GenomicRanges_1.18.4     
 [7] GenomeInfoDb_1.2.4        IRanges_2.0.1            
 [9] S4Vectors_0.4.0           BiocGenerics_0.12.1      
[11] PoiClaClu_1.0.2           RColorBrewer_1.1-2       
[13] gplots_2.16.0            

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3      annotate_1.44.0      AnnotationDbi_1.28.1
 [4] base64enc_0.1-2      BatchJobs_1.5        BBmisc_1.9          
 [7] Biobase_2.26.0       BiocParallel_1.0.3   bitops_1.0-6        
[10] brew_1.0-6           caTools_1.17.1       checkmate_1.5.1     
[13] cluster_1.15.3       codetools_0.2-9      colorspace_1.2-6    
[16] DBI_0.3.1            digest_0.6.8         fail_1.2            
[19] foreach_1.4.2        foreign_0.8-61       Formula_1.2-0       
[22] gdata_2.13.3         geneplotter_1.44.0   grid_3.1.1          
[25] gtable_0.1.2         gtools_3.4.1         Hmisc_3.15-0        
[28] iterators_1.0.7      KernSmooth_2.23-13   lattice_0.20-29     
[31] latticeExtra_0.6-26  locfit_1.5-9.1       MASS_7.3-35         
[34] munsell_0.4.2        nnet_7.3-8           plyr_1.8.1          
[37] proto_0.3-10         reshape2_1.4.1       rpart_4.1-8         
[40] RSQLite_1.0.0        scales_0.2.4         sendmailR_1.2-1     
[43] splines_3.1.1        stringr_0.6.2        survival_2.37-7     
[46] tools_3.1.1          XML_3.98-1.1         xtable_1.7-4        
[49] XVector_0.6.0

I have done the conversion to matrix and ran the function again got the same error

 as.matrix(test4)
                       accepted_hits_38_5_1.bam accepted_hits_38_5_2.bam
WASH7P                 "   0"                   "    0"                 
MIR6859-2              "   0"                   "    0"                 
MIR6859-1              "   0"                   "    0"                 
FAM138A                "   0"                   "    0"                 
FAM138F                "   0"                   "    0"                 
OR4F5                  "   0"                   "    0"                 
LOC729737              "   0"                   "    0"                 
LOC100132287           "   0"                   "    0"               

 

(ddsMat <- DESeqDataSetFromMatrix(countData = test4 ,colData = sampleTable,design = ~ Passage ))
Error in round(assay(se)) : non-numeric argument to mathematical function

ADD REPLY
1
Entering edit mode

Huh, despite the earlier sapply() call which said numeric, these look like character columns. How about:

countMatrix <- sapply(test4, as.numeric)

Or if that doesn't work:

countMatrix <- sapply(as.matrix(test4), as.numeric)
ADD REPLY
0
Entering edit mode

It might be that the previous code snipped posted only showed the results of some of the columns (which appeared to be numeric).

OP, please try again, but use this code snippet so we can see:

table(sapply(test4, class))

You've got some data somewhere that isn't numeric/counts and your whole count matrix is being subsequently turned into a matrix of characters, which is what is giving rise to your non-numeric argument to mathematical function error

ADD REPLY
0
Entering edit mode

Thanks!! I was able to remove that column!

ADD REPLY
0
Entering edit mode
@rodriguezvarenka-7495
Last seen 9.8 years ago
United States

Yes Steve you are correct there appears to be

1 column that is still a "character", whereas the rest are "numeric"

I believe it may have to be with how test4 was loaded into R.

test4=read.table("resultsA3_and_A4.txt",row.names=1,colClasses=c("character","NULL","NULL","NULL","NULL", "NULL", "numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric","numeric"),header=TRUE,as.is=TRUE,fill=TRUE)

 

ADD COMMENT
0
Entering edit mode

If you just directly use the R object which is output from the featureCounts() function, and if necessary save() and load() an RData, you can get around the num/char issues of reading and writing these data to txt file.

ADD REPLY
0
Entering edit mode
@rodriguezvarenka-7495
Last seen 9.8 years ago
United States
                 

From my Featurecounts txt file of results the file has the following columns :

Where I want to use Geneid names for rows in the test4 data frame and keep the columns of accepted_hits_38_5_1 .... etc

 

Geneid Chr Start End Strand

Length            accepted_hits_38_5_1   accepted_hits_38_5_2 etc....

ADD COMMENT
0
Entering edit mode
@rodriguezvarenka-7495
Last seen 9.8 years ago
United States

Hi Everyone turns out one of my columns was character....  thanks for the  comments and solution :)

 

ADD COMMENT

Login before adding your answer.

Traffic: 620 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6