This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Issue with RAPIDR

Hi all! I'm trying to use RAPIDR package, but when I start with the first command with the code:

    > makeBinnedCountsFile(bam.file.list=c("NIPD01.bam","NIPD02.bam"),
    + sampleIDs = c("sample1", "sample"),
    + binned.counts.fname = output.fname,
    + k=20000)

It give to me this error:

Error in assays(olap) : function "assays" not found

Do you know how can I resolve this?

rapidr r nipt bam

It is sometimes helpful to include the output of sessionInfo when reporting R package bugs/problems.

I am using RAPIDR package for NIPT data analysis but I am getting error in creating reference set

This is my code :

makeBinnedCountsFile(bam.file.list = c("sample1.bam","sample2.bam","sample3.bam","sample4.bam"),sampleIDs = c("sample1","sample2","sample3","sample4"),  binned.counts.fname = "Rapidr-output", k = 20000)    

library(RAPIDR)

rapidr.dir <- system.file(package = "RAPIDR")

data(finalref)
data(gcContent)
 T21.pos <- which(finalref$Dx == "T21")
chr.lens <- sapply(gcContent, length)
chr.names <- names(chr.lens)
header <- c("SampleID")
for (i in 1:length(chr.lens)) {
  header <- c(header, rep(chr.names[i], chr.lens[i]))  
}  
nbins <- sum(chr.lens)
ncols <- nbins + 1
binned.counts <- matrix(nrow = nrow(finalref), ncol = ncols)
for (i in 1:nrow(binned.counts)) {
  binned.counts[i,] <- rpois(ncols, lambda = 100)  
  if (i %in% T21.pos) {  
    binned.counts[i, 139087:141493] <- rpois(chr.lens[21], lambda = 115)    
  }
}    
binned.counts[,1] <- finalref$sampleID
colnames(binned.counts) <- header
t <- tempfile()
write.table(binned.counts, file = t, col.names = TRUE, row.names = FALSE, quote = FALSE, sep = ",")
"Rapidr-output" <- t
message(t)  
gcContent.fname <- paste(rapidr.dir, "C:/Users/Pooja/Documents/R/win-library/3.4/RAPIDR/data/gcContent.rda", sep = "")
head(finalref)
ref.set <- createReferenceSetFromCounts("Rapidr-output",finalref,                                        
                                        gcCorrect = FALSE,                                        
                                        PCA = FALSE,                                        
                                        filterBin = FALSE,                                        
                                        gcContentFile = gcContent.fname)                                        
print(ref.set)

I am getting following error:

Loading binned counts file
Checking every sampleID has an outcome
No outcomes for Sample sample1
No outcomes for Sample sample2
No outcomes for Sample sample3
No outcomes for Sample sample4
Error in `[.data.frame`(sampleIDs.with.outcomes, , "Gender") : 
  undefined columns selected

My finalref looks like this

head(finalref)
  sampleID Gender     Dx
1  sample1 Female Normal
2  sample2 Female Normal
3  sample3   Male Normal
4  sample4   Male Normal

my session info is :

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.1252  LC_CTYPE=English_India.1252   
[3] LC_MONETARY=English_India.1252 LC_NUMERIC=C                  
[5] LC_TIME=English_India.1252    

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

other attached packages:
 [1] SummarizedExperiment_1.8.1       
 [2] DelayedArray_0.4.1               
 [3] matrixStats_0.53.1               
 [4] Biobase_2.38.0                   
 [5] BSgenome.Hsapiens.UCSC.hg19_1.4.0
 [6] BSgenome_1.46.0                  
 [7] rtracklayer_1.38.3               
 [8] Biostrings_2.46.0                
 [9] XVector_0.18.0                   
[10] GenomicRanges_1.30.3             
[11] GenomeInfoDb_1.14.0              
[12] IRanges_2.12.0                   
[13] S4Vectors_0.16.0                 
[14] BiocGenerics_0.24.0              
[15] RAPIDR_0.1.1                     
[16] BiocInstaller_1.28.0             

loaded via a namespace (and not attached):
 [1] zlibbioc_1.24.0          GenomicAlignments_1.14.2
 [3] BiocParallel_1.12.0      lattice_0.20-35         
 [5] tools_3.4.1              grid_3.4.1              
 [7] data.table_1.11.2        Matrix_1.2-10           
 [9] GenomeInfoDbData_1.0.0   PropCIs_0.3-0           
[11] bitops_1.0-6             RCurl_1.95-4.10         
[13] compiler_3.4.1           Rsamtools_1.30.0        
[15] XML_3.98-1.11           
>

Hi pooja.solanki, I have changed your answer to a comment and moved it to the top of the thread. You have posted your question in an old post where the original question was already answered and solved. I have also wrapped your code and data output in your post by using the 101 010 button.

From which line, specifically, is your error being thrown? Have you checked the output of each step in order to ensure that each step is functioning correctly?

Hi Kevin thank you for modifying my post. I am new to this blog so didn't know how to post.

Regarding your query, yes I have checked my script I am getting bin file by running this script :

makeBinnedCountsFile(bam.file.list = c("sample1.bam","sample2.bam","sample3.bam","sample4.bam"),sampleIDs = c("sample1","sample2","sample3","sample4"),  binned.counts.fname = "Rapidr-output", k = 20000)

But after that next step for creating createReferenceSetFromCounts is not working for me.

Have you tried RAPIDR before? So many people are getting this same error.

Please suggest me how should I modify my script?

Hello - no problem, my friend.

Your column sampleID should be SampleID, with a capital 'S'. Please try that.

Hi,

If I change sampleID to SampleID then my script is not working at all.

Please contact the developers of the program. This looks like an issue that cannot be resolved here. It is their duty to follow up on errors with programs that they produce.

1 answer

I'm not sure if the package author monitors biostars, so I'd suggest contacting the author of RAPIDR directly.

That said, you might try adding the SummarizedExperiment package to your R environment and then repeating your command.

source("https://bioconductor.org/biocLite.R")
biocLite("SummarizedExperiment")
library(SummarizedExperiment)

If this works for you, then the package needs to have some imports added.

I corroborate with Sean and that this looks like a dependancy issue where SummarizedExperiment is not installed with RAPIDR. Once you load both RAPIDR and SummarizedExperiment, it should work.

HI, you were right. Now I can create the binned count fille, but I have another question: to perform masking step I need a mask bed file, where I can finds it? Is the output.fname.mask file that the package produce with the first binned? And if it is that file, how can I convert a .mask file in a .bed one?

Log in to answer this question.