Hi Guys,
The below function in R crashes if no score exists for one of the intervals in the bigwig file. This is annoying as the whole run is stopped instead of issuing a warning.
For Het chromosomes, I tried to escape them, as you can see below. But for other cases, this cannot be generalized
Do you know a way to get around ?
"x" is a data frame of three columns
getBigWigScore<- function(x, bwf, type="mean"){
require(rtracklayer)
bwf <- BigWigFile(bwf)
features <- GRanges(x[,1], IRanges(x[,2], x[,3]))
## the summary below dies if a feature has no score found in the bw file instead of throwing a warning or return NA ...
features <- features[!seqnames(features) %in% c("chr2LHet", "chr2RHet", "chr3LHet", "chr3RHet", "chrXHet", "chrYHet", "chrUextra")]
return(unlist(runValue(summary(bwf, features, type=type))))
}
Best and many thanks for any help,
The below function in R crashes if no score exists for one of the intervals in the bigwig file. This is annoying as the whole run is stopped instead of issuing a warning.
For Het chromosomes, I tried to escape them, as you can see below. But for other cases, this cannot be generalized
Do you know a way to get around ?
"x" is a data frame of three columns
getBigWigScore<- function(x, bwf, type="mean"){
require(rtracklayer)
bwf <- BigWigFile(bwf)
features <- GRanges(x[,1], IRanges(x[,2], x[,3]))
## the summary below dies if a feature has no score found in the bw file instead of throwing a warning or return NA ...
features <- features[!seqnames(features) %in% c("chr2LHet", "chr2RHet", "chr3LHet", "chr3RHet", "chrXHet", "chrYHet", "chrUextra")]
return(unlist(runValue(summary(bwf, features, type=type))))
}
Best and many thanks for any help,
Comment