SEQanswers

Go Back   SEQanswers > Bioinformatics > Bioinformatics



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bam to bigwig gokhulkrishnakilaru Bioinformatics 6 11-21-2016 11:54 AM
new tool for bigWig data AndyP Bioinformatics 0 11-02-2013 07:35 AM
rtracklayer error yuchioj Bioinformatics 0 02-18-2013 11:44 AM
bigwig file help in UCSC abh Bioinformatics 0 12-05-2012 04:15 PM
convert wig to bigwig khb Bioinformatics 1 12-16-2010 07:02 AM

Reply
 
Thread Tools
Old 03-20-2014, 09:25 AM   #1
klebsiella
Member
 
Location: Heidelberg

Join Date: Jul 2010
Posts: 10
Default summary bigWig rtracklayer

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,

Last edited by klebsiella; 03-20-2014 at 09:35 AM.
klebsiella is offline   Reply With Quote
Old 03-20-2014, 09:33 AM   #2
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

I'm not even sure how you could have a valid bigWig (or even Wig) file without all of the positions having scores. It would seem to make sense to just remove those regions by adding multiple "definition" lines.
dpryan is offline   Reply With Quote
Old 03-20-2014, 10:52 AM   #3
klebsiella
Member
 
Location: Heidelberg

Join Date: Jul 2010
Posts: 10
Default

Thanks for the reply,
Well I validated the bigwig files and they contain no errors.
For instance, the problem occurred for a feature starting with "0" (0 based coordinates file).
I agree with you, a wig file is supposed to contain continuous data.
Also, could you please elaborate on what you mean by adding a few definition lines ?

A work around for me now was to use either Java Genomics Toolkit or bwtool (very very fast) via the system call from R.
Thanks

Last edited by klebsiella; 03-20-2014 at 11:42 AM.
klebsiella is offline   Reply With Quote
Old 03-24-2014, 08:43 AM   #4
dpryan
Devon Ryan
 
Location: Freiburg, Germany

Join Date: Jul 2011
Posts: 3,480
Default

Sorry for the delay, I just realized that I never replied to this!

You can have multiple definition lines like the following the remove the need for having lines with no values:

Code:
fixedStep chrom=chr1 start=200601 step=100
11
22
33
fixedStep chrom=chr1 start=401601 step=100
111
122
133
That way, you can just leave out whatever portions aren't covered.
dpryan is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off




All times are GMT -8. The time now is 10:17 PM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Single Sign On provided by vBSSO