Mercurial > repos > idot > coverage_correlation
diff corr.R @ 13:de452b96da8e
added bam input
author | Ido Tamir <ido.tamir@imp.ac.at> |
---|---|
date | Mon, 23 Sep 2013 13:46:24 +0200 |
parents | f3e037496c18 |
children |
line wrap: on
line diff
--- a/corr.R Sun Aug 18 21:33:43 2013 +0200 +++ b/corr.R Mon Sep 23 13:46:24 2013 +0200 @@ -17,10 +17,13 @@ options("useFancyQuotes" = FALSE) +TEST=FALSE + library(rtracklayer) library(lattice) library(latticeExtra) library(hexbin) +library(Rsamtools) ## creates the union of coverages i.e. mappable regions ## todo: add mappability argument @@ -109,7 +112,11 @@ getCoverage <- function(infile, format){ print(paste("reading", infile, format)) - values <- import(infile, format=format, asRangedData = FALSE) + values <- if(format == "bam"){ + import(infile, format=format) + }else{ + import(infile, format=format, asRangedData = FALSE) + } if(tolower(format) %in% c("bigwig","wig")){ values }else{ @@ -157,6 +164,17 @@ args <- commandArgs(TRUE) +if(TEST){ + args[1] <- c("file1.bed,file2.bed,file3.bed,file4.bed") + args[1] <- c("file1.bam,file2.bam,file3.bam,file4.bam") + args[2] <- c("file1,file2,file3,file4") + args[3] <- c("bam,bam,bam,bam") + args[4] <- "out.pdf" + args[5] <- "mat.mat" + args[6] <- "title" + args[7] <- NA +} + infiles <- unlist(strsplit(args[1], ",")) outnames <- unlist(strsplit(args[2], ",")) formats <- unlist(strsplit(args[3], ","))