CNSeg no method coercing S4 class to vector
0
0
Entering edit mode
@julianstanleya-16158
Last seen 6.5 years ago

I'm attempting to analyze some genomic data with the CNSeg package. The package is located here and the documentation is here.

My input data looks like:

> str(segments)
'data.frame':    11897 obs. of  7 variables:
 $ X                : int  0 1 2 3 4 5 6 7 8 9 ...
 $ SegmentID        : int  72 73 74 75 76 77 78 79 80 81 ...
 $ Chromosome       : int  1 1 2 2 2 3 3 3 3 3 ...
 $ StartPosition    : int  754192 145260908 21494 141215321 141275624 63411 69812903 69884262 126473310 126790130 ...
 $ StopPosition     : int  145258178 249212878 141214996 141275051 243052331 69811900 69884106 126457276 126772699 197852564 ...
 $ Median.Log2.Ratio: num  -0.014 0.311 -0.003 0.059 -0.012 -0.018 -0.106 0.007 -0.171 0.001 ...
 $ FileName         : Factor w/ 95 levels "TSB02183","TSB02184",..: 1 1 1 1 1 1 1 1 1 1 ..

(Note: I did import the segments data with FileName as a vector instead of a factor as well. No difference in the error below).

I followed the vignette to the letter and, at the end of the vignette, the creator tells me that I can use the dist() method. When I try to use it, I get an error: Error in as.vector(data) : no method for coercing this S4 class to a vector.

Here is my session information:

> segments <- read.csv("Probe_Segments_CN.csv")
> cnseg <- CNSeg(segList = segments, chromosome = "Chromosome", end = "StopPosition", start = "StartPosition", segMean = "Median.Log2.Ratio", id = "FileName")
> rdseg <- getRS(cnseg, by = "region", imput = FALSE, XY = FALSE, what = "mean")
Processing samples ... Done
> data("geneInfo")
> geneInfo <- geneInfo[sample(1:nrow(geneInfo), 2000), ]
> 
> rdByGene <- getRS(cnseg, by = "gene", imput = FALSE, XY = FALSE, geneMap = geneInfo, what = "median")
> 
> reducedseg <- rs(rdseg)
> f1 <- kOverA(5, 1)
> 
> ffun <- filterfun(f1)
> 
> filteredrs <- genefilter(rdseg, ffun)
> filteredrs <- madFilter(rdseg, 0.8)
> dist(filteredrs)
Error in as.vector(data) : 
  no method for coercing this S4 class to a vector
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] tools     stats     graphics  grDevices
[5] utils     datasets  methods   base     

other attached packages:
[1] CNTools_1.34.0    genefilter_1.60.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.17         AnnotationDbi_1.40.0
 [3] BiocGenerics_0.24.0  splines_3.4.0       
 [5] IRanges_2.12.0       bit_1.1-14          
 [7] lattice_0.20-35      xtable_1.8-2        
 [9] blob_1.1.1           parallel_3.4.0      
[11] grid_3.4.0           Biobase_2.38.0      
[13] DBI_1.0.0            survival_2.41-3     
[15] bit64_0.9-7          digest_0.6.15       
[17] Matrix_1.2-9         S4Vectors_0.16.0    
[19] bitops_1.0-6         RCurl_1.95-4.10     
[21] memoise_1.1.0        RSQLite_2.1.1       
[23] compiler_3.4.0       stats4_3.4.0        
[25] XML_3.98-1.11        annotate_1.56.2   
software error cntools • 838 views
ADD COMMENT

Login before adding your answer.

Traffic: 702 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