DESeq2 - Invalid class “GRangesList” object - r

I've just updated my DESeq2 package from version 1.4.5 to version 1.6.3 and my scripts are no longer working. Specifically, I get the following error when generating a DESeqDataSet object with the function DESeqDataSetFromMatrix:
Error in validObject(.Object) :
invalid class “GRangesList” object: number of rows in DataTable 'mcols(x)' must match length of 'x'
To replicate this error one may either use the example shown in the DESeq2 vignette:
library("pasilla")
library("Biobase")
data("pasillaGenes")
countData <- counts(pasillaGenes)
colData <- pData(pasillaGenes)[,c("condition","type")]
dds <- DESeqDataSetFromMatrix(countData = countData,
colData = colData,
design = ~ condition)
or the example shown in the DESeq2 Reference Manual:
countData <- matrix(1:4,ncol=2)
colData <- data.frame(condition=factor(c("a","b")))
dds <- DESeqDataSetFromMatrix(countData, colData, formula(~ condition))
Thanks in advance for your help,
Alessia
sessionInfo()
R version 3.1.0 (2014-04-10)
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 utils datasets
[8] methods base
other attached packages:
[1] DESeq2_1.6.3 RcppArmadillo_0.4.400.0 Rcpp_0.11.2
[4] GenomicRanges_1.16.4 GenomeInfoDb_1.0.2 IRanges_1.22.10
[7] S4Vectors_0.4.0 BiocGenerics_0.12.1 BiocInstaller_1.16.1
loaded via a namespace (and not attached):
[1] acepack_1.3-3.3 annotate_1.42.1 AnnotationDbi_1.26.0
[4] BatchJobs_1.3 BBmisc_1.7 Biobase_2.24.0
[7] BiocParallel_0.6.1 brew_1.0-6 checkmate_1.4
[10] cluster_1.15.3 codetools_0.2-9 colorspace_1.2-4
[13] DBI_0.3.0 digest_0.6.4 fail_1.2
[16] foreach_1.4.2 foreign_0.8-61 Formula_1.1-2
[19] genefilter_1.46.1 geneplotter_1.42.0 ggplot2_1.0.0
[22] grid_3.1.0 gtable_0.1.2 Hmisc_3.14-5
[25] iterators_1.0.7 lattice_0.20-29 latticeExtra_0.6-26
[28] locfit_1.5-9.1 MASS_7.3-34 munsell_0.4.2
[31] nnet_7.3-8 plyr_1.8.1 proto_0.3-10
[34] RColorBrewer_1.0-5 reshape2_1.4 rpart_4.1-8
[37] RSQLite_0.11.4 scales_0.2.4 sendmailR_1.1-2
[40] splines_3.1.0 stringr_0.6.2 survival_2.37-7
[43] tools_3.1.0 XML_3.98-1.1 xtable_1.7-4
[46] XVector_0.4.0
source("http://bioconductor.org/biocLite.R")
Bioconductor version 3.0 (BiocInstaller 1.16.1), ?biocLite for help

Related

Facing difficulties in regression with mxnet in R

I was following this tutorial http://mxnet.io/tutorials/r/fiveMinutesNeuralNetwork.html#regression
Everything worked accordingly but when I changed:
fc1 <- mx.symbol.FullyConnected(data, num_hidden=1)
to
fc1 <- mx.symbol.FullyConnected(data, num_hidden=2)
And among the stacks of error logs I thought may be this is the most interesting:
Error in exec$update.arg.arrays(arg.arrays, match.name, skip.null) :
[20:22:59] src/ndarray/ndarray.cc:239: Check failed: from.shape() == to->shape()
shape mismatchfrom.shape = (20,) to.shape=(20,2)
How do I diagnose this problem?
Here is the output of sessionInfo():
R version 3.3.3 RC (2017-02-27 r72279)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] mlbench_2.1-1 mxnet_0.9.5
loaded via a namespace (and not attached):
[1] igraph_1.0.1 Rcpp_0.12.10 rstudioapi_0.6 magrittr_1.5 munsell_0.4.3 colorspace_1.3-2
[7] viridisLite_0.2.0 R6_2.2.0 brew_1.0-6 stringr_1.2.0 plyr_1.8.4 dplyr_0.5.0
[13] visNetwork_1.0.3 Rook_1.1-1 tools_3.3.3 grid_3.3.3 gtable_0.2.0 DBI_0.6
[19] influenceR_0.1.0 DiagrammeR_0.9.0 htmltools_0.3.5 lazyeval_0.2.0 digest_0.6.12 assertthat_0.1
[25] tibble_1.2 gridExtra_2.2.1 RColorBrewer_1.1-2 ggplot2_2.2.1 codetools_0.2-8 htmlwidgets_0.8
[31] viridis_0.4.0 rgexf_0.15.3 stringi_1.1.3 scales_0.4.1 XML_3.98-1.6 jsonlite_1.3
The thing is that below the fc1 <- mx.symbol.FullyConnected(data, num_hidden=1) line, tutorial uses linear regression for the output lro <- mx.symbol.LinearRegressionOutput(fc1).
LinearRegressionOutput is used to compute the l2-loss between it's input symbol and the labels provided to it. It assumes 1 label per example, and passing 2 breaks it. In my case it is a little bit different from your message, maybe because the difference in versions:
Error in symbol$infer.shape(list(...)) :
Error in operator linearregressionoutput5: Shape inconsistent, Provided=(20,), inferred shape=(20,2)
Fixing of this depends of what exactly you want to achieve. If you are solving classification task and want to receive probabilities for both classes, then you need to use Softmax:
fc1 <- mx.symbol.FullyConnected(data, num_hidden=2)
lro <- mx.symbol.SoftmaxOutput(fc1)

Error when Using BiomartGeneRegionTrack in cummeRbund package

I am trying to plot a gene of interest using cummeRbund package. Using this script:
biomTrack<-BiomartGeneRegionTrack(genome=genome, chromosome=as.character(myChr), start=myStart, end=myEnd, name="ENSEMBL", showId=T)
I encountered this error:
Error in .getBiomart(genome) :
Gviz thinks that the UCSC genome identifier 'hg38' should map to the current Biomart head as 'GRCh38', but its current version is 'GRCh38.p5'.
Please manually provide biomaRt object.
using useMart("ensembl",dataset="hsapiens_gene_ensembl") also couldn't help. Would you please tell me how can I fix this?
Here is the sessionInfo()
> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid stats4 parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] biomaRt_2.28.0 cummeRbund_2.14.0 Gviz_1.16.1 rtracklayer_1.32.1 GenomicRanges_1.24.2
[6] GenomeInfoDb_1.8.1 IRanges_2.6.0 S4Vectors_0.10.1 fastcluster_1.1.20 reshape2_1.4.1
[11] ggplot2_2.1.0 RSQLite_1.0.0 DBI_0.4-1 BiocGenerics_0.18.0
loaded via a namespace (and not attached):
[1] SummarizedExperiment_1.2.3 VariantAnnotation_1.18.1 splines_3.3.0
[4] lattice_0.20-33 colorspace_1.2-6 htmltools_0.3.5
[7] GenomicFeatures_1.24.2 chron_2.3-47 interactiveDisplayBase_1.10.3
[10] XML_3.98-1.4 survival_2.39-4 foreign_0.8-66
[13] ensembldb_1.4.2 BiocParallel_1.6.2 RColorBrewer_1.1-2
[16] matrixStats_0.50.2 plyr_1.8.4 stringr_1.0.0
[19] zlibbioc_1.18.0 Biostrings_2.40.2 munsell_0.4.3
[22] gtable_0.2.0 latticeExtra_0.6-28 Biobase_2.32.0
[25] BiocInstaller_1.22.2 httpuv_1.3.3 AnnotationDbi_1.34.3
[28] Rcpp_0.12.5 xtable_1.8-2 acepack_1.3-3.3
[31] BSgenome_1.40.1 scales_0.4.0 Hmisc_3.17-4
[34] XVector_0.12.0 mime_0.4 Rsamtools_1.24.0
[37] gridExtra_2.2.1 AnnotationHub_2.4.2 digest_0.6.9
[40] stringi_1.1.1 biovizBase_1.20.0 shiny_0.13.2
[43] tools_3.3.0 bitops_1.0-6 magrittr_1.5
[46] RCurl_1.95-4.8 dichromat_2.0-0 Formula_1.2-1
[49] cluster_2.0.4 Matrix_1.2-6 data.table_1.9.6
[52] httr_1.2.0 R6_2.1.2 rpart_4.1-10
[55] GenomicAlignments_1.8.3 nnet_7.3-12

Error in simple_triplet_matrix when creating bigrams with RTextTools and tm

I am trying to create bigrams from text following different approaches proposed on the web. The simplest example is the following:
library(RTextTools)
texts <- c("This is the first document.", "This is the second file.", "This is the third text.")
matrix <- create_matrix(texts,ngramLength=3)
which results in:
Error in simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), :
'i, j, v' different lengths
In addition: Warning messages:
1: In mclapply(unname(content(x)), termFreq, control) :
all scheduled cores encountered errors in user code
2: In simple_triplet_matrix(i = i, j = j, v = as.numeric(v), nrow = length(allTerms), :
NAs introduced by coercion
This is my set up:
R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
[7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] graphics grDevices utils datasets stats methods base
other attached packages:
[1] tm_0.6-2 NLP_0.1-8 RTextTools_1.4.2 SparseM_1.6
[5] SnowballC_0.5.1 reshape2_1.4.1 ggplot2_1.0.0 plyr_1.8.1
loaded via a namespace (and not attached):
[1] bitops_1.0-6 caTools_1.17.1 class_7.3-11
[4] codetools_0.2-9 colorspace_1.2-4 digest_0.6.8
[7] e1071_1.6-4 foreach_1.4.2 glmnet_2.0-2
[10] grid_3.1.1 gtable_0.1.2 ipred_0.9-4
[13] iterators_1.0.7 lattice_0.20-29 lava_1.4.1
[16] MASS_7.3-34 Matrix_1.1-4 maxent_1.3.3.1
[19] munsell_0.4.2 nnet_7.3-8 parallel_3.1.1
[22] prodlim_1.5.1 proto_0.3-10 randomForest_4.6-10
[25] Rcpp_0.11.3 rpart_4.1-8 scales_0.2.4
[28] slam_0.1-32 splines_3.1.1 stringr_0.6.2
[31] survival_2.37-7 tau_0.0-18 tcltk_3.1.1
[34] tools_3.1.1 tree_1.0-36
Any hints on what is happening?

Suppressing readOGR Messages in knitr [duplicate]

This question already has answers here:
In R and knitr, can I suppress the message of readOGR?
(3 answers)
Closed 7 years ago.
I wonder how to suppress readOGR error messages in knitr. My MWE is below:
\documentclass{article}
\begin{document}
<< Test >>=
library(rgdal)
dsn <- system.file("vectors", package = "rgdal")[1]
setwd(dsn)
cities <- readOGR(dsn=dsn, layer="cities")
#
\end{document}
The function readOGR gives the message like this:
OGR data source with driver: ESRI Shapefile
Source: "/home/asd/R/i686-pc-linux-gnu-library/3.2/rgdal/vectors", layer: "cities"
with 606 features
It has 4 fields
But I want to suppress this message. I tried message=FALSE, but it did not work for me.
Edited
sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 14.04.2 LTS
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] grid tools stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggmap_2.4 mapproj_1.2-2 maps_2.3-9 leaflet_1.0.0 rgeos_0.3-11 rgdal_1.0-4
[7] maptools_0.8-36 sp_1.1-1 Hmisc_3.16-0 Formula_1.2-1 survival_2.38-2 lattice_0.20-31
[13] psych_1.5.4 ggbiplot_0.55 plyr_1.8.3 gplots_2.17.0 rsm_2.7-2 scales_0.2.5
[19] ggplot2_1.0.1 xtable_1.7-4 highr_0.5 knitr_1.10.12 brew_1.0-6 stringr_1.0.0
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-2 jsonlite_0.9.16 reshape2_1.4.1 cluster_2.0.2 rstudioapi_0.3.1
[6] magrittr_1.5 acepack_1.3-3.3 gtable_0.1.2 htmltools_0.2.6 splines_3.2.1
[11] dplyr_0.4.2 KernSmooth_2.23-14 htmlwidgets_0.5 gridExtra_0.9.1 R6_2.0.1
[16] digest_0.6.8 colorspace_1.2-6 proto_0.3-10 stringi_0.5-2 yaml_2.1.13
[21] lazyeval_0.1.10.9000 evaluate_0.7 labeling_0.3 RJSONIO_1.3-0 gdata_2.16.1
[26] rpart_4.1-9 munsell_0.4.2 DBI_0.3.1 Rcpp_0.11.6 RgoogleMaps_1.2.0.7
[31] png_0.1-7 MASS_7.3-41 parallel_3.2.1 assertthat_0.1 rjson_0.2.15
[36] caTools_1.17.1 gtools_3.5.0 jpeg_0.1-8 latticeExtra_0.6-26 foreign_0.8-63
[41] bitops_1.0-6 nnet_7.3-9 geosphere_1.3-13 formatR_1.2 mnormt_1.5-3
Just add verbose=FALSE to the readOGR call to suppress the messages (which are helpful during an interactive session but are cruft when in scripts or notebooks).
Try this:
<<Test, message=FALSE, results='hide', echo=FALSE>>=

R RODBC sqlSave crashing/disconnecting when too many columns supplied to existing table

I've found a situation where R hangs due to sqlSave not handling cases where the are more columns being inserted than are present in the table.
Does anyone have any insight on how I can resolve this behaviour? I had the idea of retrieving the number of columns already in the table but this would be a siginificant performance drain and add significant complexity to the code.
The error (reproduction will require a dsn/database connection locally)
channel <- odbcConnect("mydb")
odbcClearError(channel)
sqlSave(channel, dat=data.frame(a=1:3,b=letters[1:3]),
tablename="R_update_test",
# rownames=FALSE,
append=TRUE)
odbcClose(channel)
Or
channel <- odbcConnect("mydb")
odbcClearError(channel)
sqlSave(channel, dat=data.frame(a=1:3,b=letters[1:3],c=letters[1:3])]),
tablename="R_update_test",
rownames=FALSE,
append=TRUE)
odbcClose(channel)
sessionInfo included below, and target db is mysql 5.6
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] splines grid stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.8.10 Hmisc_3.13-0 Formula_1.1-1 survival_2.37-4 caret_5.17-7 reshape2_1.2.2 plyr_1.8
[8] lattice_0.20-24 foreach_1.4.1 cluster_1.14.4 RODBC_1.3-9 Nemo_1.0 testthat_0.7.1 devtools_1.4
loaded via a namespace (and not attached):
[1] MASS_7.3-29 RColorBrewer_1.0-5 RCurl_1.95-4.1 codetools_0.2-8 colorspace_1.2-4 dichromat_2.0-0 digest_0.6.3
[8] evaluate_0.5.1 ggplot2_0.9.3.1 gtable_0.1.2 httr_0.2 iterators_1.0.6 labeling_0.2 memoise_0.1
[15] munsell_0.4.2 parallel_3.0.2 proto_0.3-10 scales_0.2.3 stringr_0.6.2 tools_3.0.2 whisker_0.3-2

Resources