File: getWithinGeneExpression_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 (40 lines) | stat: -rw-r--r-- 1,508 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
33
34
35
36
37
38
39
40

getWithinGeneExpression <- function(sampleFile, outFile=NULL, trInfo=NULL, trInfoFile=NULL, pretend=FALSE, keepOrder=FALSE){
   if(!is.null(trInfo)){
      if(!tri.hasGeneNames(trInfo))stop("The trInfo object does not contain necessary information.");
      trInfoFile <- tempfile("data",fileext=c(".tr"));
      if(!pretend){
         tri.save(trInfo,trInfoFile);
      } else{
         message(paste(c("# Save trInfo object as ",trInfoFile," file.")));
      }
   }else {
      if(is.null(trInfoFile)){
         trInfoFile<-.changeExt(sampleFile);
      }
   }
   if(!file.exists(trInfoFile)){
      stop("Please provide valid transcript information either through trInfo object or trInfoFile file.");
   }
   if(!(pretend || tri.file.hasGeneNames(trInfoFile)))stop(paste(c("File ",trInfoFile," does not contain necessary information.")));
   if(is.null(outFile)){
      fName <- tail(unlist(strsplit(tail( unlist(strsplit(sampleFile,"/")),1),"\\\\")),1)
      if(fName != ""){
         outFile <- tempfile(paste(fName,"-",sep=""),fileext =".WGE");
      }else{
         outFile <- tempfile("dataBS-E-",fileext=".WGE");
      }
   }
   args <- c('getWithinGeneExpression', sampleFile, '--outFile', outFile, '--trInfoFile', trInfoFile);
   if(!keepOrder){
      args <- c(args, '--groupByGene')
   }

   if(pretend){
      writeLines(.specialPaste(args))
   }else{
      argc <- length(args);
      result <- .C("_getWithinGeneExpression", as.integer(argc), as.character(args));
   }
   return(outFile);
}