File: getMeanVariance_call.R

package info (click to toggle)
r-bioc-bitseq 1.26.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,620 kB
  • sloc: cpp: 6,506; sh: 4; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 1,288 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#   args.addOptionS("o","outFile","outFileName",1,"Name of the output file.");
#   args.addOptionB("l","log","log",0,"Use logged values.");
#   args.addOptionS("t","type","type",0,"Type of variance, possible values: [sample,sqDif] for sample variance or squared difference.","sample");

getMeanVariance <- function(sampleFiles, outFile, log=NULL, type=NULL, verbose=NULL, norm=NULL, pretend=FALSE){
   ## we want sampleFiles and norm to be a vector
   sampleFiles <- unlist(sampleFiles);
   norm <- unlist(norm);
   args <- c('getVariance', sampleFiles, '--outFile', outFile);
   if ((!is.null(log)) && (log)) {
      args <- c(args, '--log')
   }
   if (!is.null(type)) {
      args <- c(args, '--type', type)
   } 
   if (!is.null(verbose) && (verbose)) {
      args <- c(args, '--verbose')
   }
   if (!is.null(norm)) {
      if(length(sampleFiles) != length(norm)){
         stop("The number of normalization constants has to match the number of sample files.");
      }
      args <- c(args, '--norm', paste(norm, collapse=","));
   }
   if(pretend){
      writeLines(.specialPaste(args))
   }else{
      argc <- length(args);
      ## dyn.load(paste("src/getVariance", .Platform$dynlib.ext, sep=""));
      result <- .C("_getVariance", as.integer(argc), as.character(args));
   }
}