why there are multiple calls to cnmops C function?
1
0
Entering edit mode
@mohammad-alkhamis-10862
Last seen 7.9 years ago
Canada/ Victoria, BC / University of Vi…

Hello everyone,

I am trying to play with the source code for cn.mops. I inserted the following line at the beginning of the C function "cnmops", which is defined in cnmops.cpp file: 

Rprintf("*** cnmops C function call ***\n");

 

After building the package and importing it into RStudio, I used the following script for testing:

-------------------------------

library(cn.mops)
BAMFiles <- list.files(system.file("extdata", package="cn.mops"),pattern=".bam$",
                       full.names=TRUE)
bamDataRanges <- getReadCountsFromBAM(BAMFiles,
                                      sampleNames=paste("Sample",1:3),
                                      refSeqName="20",
                                      WL=100,
                                      mode="unpaired", 
                                      parallel=0)

res <-cn.mops(bamDataRanges, I = c(0.025, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 8, 16, 32, 64),classes = c("CN0", "CN1", "CN2", "CN3", "CN4", "CN5", "CN6",
                 "CN7","CN8","CN16","CN32","CN64","CN128"),
              priorImpact = 1, cyc = 20, parallel = 0, norm = 0,
              normType = "poisson", sizeFactor = "mean", normQu = 0.25,
              quSizeFactor = 0.75, upperThreshold = 0.5, lowerThreshold = -0.9,
              minWidth = 3, segAlgorithm = "DNACopy", minReadCount = 5,
              useMedian = FALSE, returnPosterior = FALSE)

-------------------------------

 

what I noticed is that the function cnmops is called multiple times despite that I don't see any call to the cnmops function recursively or within a loop.

 

the following is the output from the R console.. I would appreciate it if I can get help for why there are multiple calls to the function.

> library(cn.mops)
> BAMFiles <- list.files(system.file("extdata", package="cn.mops"),pattern=".bam$",
+                        full.names=TRUE)
> bamDataRanges <- getReadCountsFromBAM(BAMFiles,
+                                       sampleNames=paste("Sample",1:3),
+                                       refSeqName="20",
+                                       WL=100,
+                                       mode="unpaired", 
+                                       parallel=0)
Identified the following reference sequences:  20
Using 20 as reference.
Using indexed BAM files.
Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test1.bam
  20


Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test2.bam
  20


Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test3.bam
  20


> 
> res <-cn.mops(bamDataRanges, I = c(0.025, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 8, 16, 32, 64),
+               classes = c("CN0", "CN1", "CN2", "CN3", "CN4", "CN5", "CN6",
+                           "CN7","CN8","CN16","CN32","CN64","CN128"),
+               priorImpact = 1, cyc = 20, parallel = 0, norm = 0,
+               normType = "poisson", sizeFactor = "mean", normQu = 0.25,
+               quSizeFactor = 0.75, upperThreshold = 0.5, lowerThreshold = -0.9,
+               minWidth = 3, segAlgorithm = "DNACopy", minReadCount = 5,
+               useMedian = FALSE, returnPosterior = FALSE)
***cn.mops R function call ***
Starting local modeling, please be patient...  
Reference sequence:  20
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
*** cnmops C function call ***
Starting segmentation algorithm...
Using "fastseg" for segmentation.
*** segmentation call ***
*** segmentation call ***
*** segmentation call ***
> warnings()
NULL

 

Regards

Mohammad Alkhamis

cn.mops • 1.0k views
ADD COMMENT
0
Entering edit mode
@gunter-klambauer-5426
Last seen 3.8 years ago
Austria
Hello, Yes, the cn.mops function is called for each row of the read count matrix. This is as intended. Another option would be to pass the whole read count matrix to the Cpp function and -- again -- run cn.mops rowwise. Regards, Günter On 2016-08-09 03:14, malkhamis [bioc] wrote: > Activity on a post you are following on support.bioconductor.org > <https: support.bioconductor.org=""> > > User malkhamis <https: support.bioconductor.org="" u="" 10862=""/> wrote > Question: why there are multiple calls to cnmops C function? > <https: support.bioconductor.org="" p="" 85923=""/>: > > Hello everyone, > > I am trying to play with the source code for cn.mops. I inserted the > following line at the beginning of the C function "cnmops", which is > defined in *cnmops.cpp* file: > > Rprintf("*** cnmops C function call ***\n"); > > After building the package and importing it into RStudio, I used the > following script for testing: > > ------------------------------- > > library(cn.mops) > BAMFiles <- list.files(system.file("extdata", package="cn.mops"),pattern=".bam$", > full.names=TRUE) > bamDataRanges <- getReadCountsFromBAM(BAMFiles, > sampleNames=paste("Sample",1:3), > refSeqName="20", > WL=100, > mode="unpaired", > parallel=0) > > res <-cn.mops(bamDataRanges, I = c(0.025, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 8, 16, 32, 64),classes = c("CN0", "CN1", "CN2", "CN3", "CN4", "CN5", "CN6", > "CN7","CN8","CN16","CN32","CN64","CN128"), > priorImpact = 1, cyc = 20, parallel = 0, norm = 0, > normType = "poisson", sizeFactor = "mean", normQu = 0.25, > quSizeFactor = 0.75, upperThreshold = 0.5, lowerThreshold = -0.9, > minWidth = 3, segAlgorithm = "DNACopy", minReadCount = 5, > useMedian = FALSE, returnPosterior = FALSE) > > ------------------------------- > > what I noticed that the function cnmops is called multiple times > despite that I don't see any call to the cnmops function recursively > or within a loop. > > the following the output from the R console.. I would appreciate it if > I can get help for why there are multiple calls to the function. > > > library(cn.mops) > > BAMFiles <- list.files(system.file("extdata", package="cn.mops"),pattern=".bam$", > + full.names=TRUE) > > bamDataRanges <- getReadCountsFromBAM(BAMFiles, > + sampleNames=paste("Sample",1:3), > + refSeqName="20", > + WL=100, > + mode="unpaired", > + parallel=0) > Identified the following reference sequences: 20 > Using 20 as reference. > Using indexed BAM files. > Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test1.bam > 20 > > > Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test2.bam > 20 > > > Reading file: /home/alkhamis/R/x86_64-pc-linux-gnu-library/3.3/cn.mops/extdata/test3.bam > 20 > > > > > > res <-cn.mops(bamDataRanges, I = c(0.025, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 8, 16, 32, 64), > + classes = c("CN0", "CN1", "CN2", "CN3", "CN4", "CN5", "CN6", > + "CN7","CN8","CN16","CN32","CN64","CN128"), > + priorImpact = 1, cyc = 20, parallel = 0, norm = 0, > + normType = "poisson", sizeFactor = "mean", normQu = 0.25, > + quSizeFactor = 0.75, upperThreshold = 0.5, lowerThreshold = -0.9, > + minWidth = 3, segAlgorithm = "DNACopy", minReadCount = 5, > + useMedian = FALSE, returnPosterior = FALSE) > ***cn.mops R function call *** > Starting local modeling, please be patient... > Reference sequence: 20 > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > *** cnmops C function call *** > Starting segmentation algorithm... > Using "fastseg" for segmentation. > *** segmentation call *** > *** segmentation call *** > *** segmentation call *** > > warnings() > NULL > > Regards > > Mohammad Alkhamis > > ------------------------------------------------------------------------ > > Post tags: cn.mops > > You may reply via email or visit > why there are multiple calls to cnmops C function? > -- Günter Klambauer, PhD Institute of Bioinformatics Johannes Kepler University, Linz, Austria http://www.bioinf.jku.at/people/klambauer/
ADD COMMENT
0
Entering edit mode

Thank you so much Günter for your response.. that was very helpful

ADD REPLY

Login before adding your answer.

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