Question: What's the recommended way to overwrite the seqinfo of a GRanges?
0
gravatar for maltethodberg
10 days ago by
maltethodberg110
UCPH
maltethodberg110 wrote:

I'm having some difficulties when using rtracklayer to import BigWig-files:

import.bed includes the genome argument, which correctly sets the seqinfo on the resulting GRanges. However, import.bw does not have a similar argument; The resulting GRanges will have the seqinfo stored in the BigWigFile.

This can lead to some downstream inconsistencies when using a GRanges from a BigWigFile with other Bioconductor resources, like TxDb's and BSGenomes, since the number and ordering of chromosomes won't be identical (even if they are fully compatible, e.g. using checkCompatibleSeqinfo)

If I'm using import.bw to create a GRanges, and then wish to "overwrite" the seqinfo with something SeqinfoForBSGenome(), what's the best way of doing so? Using seqinfo(x) <- y, seems cumbersome since the new2old mapping have to be supplied.

ADD COMMENTlink modified 8 days ago by Michael Lawrence10k • written 10 days ago by maltethodberg110
Answer: What's the recommended way to overwrite the seqinfo of a GRanges?
4
gravatar for Michael Lawrence
8 days ago by
United States
Michael Lawrence10k wrote:

This is an easy way to get the seqlevels consistent:

seqlevels(gr, pruning.mode="coarse") <- seqlevels(si2)

Note that it prunes ranges that fall into the seqlevels unique to the original object.

Once you've forced consistent seqlevels, you can bring over the rest of the info:

seqinfo(gr) <- si2
ADD COMMENTlink written 8 days ago by Michael Lawrence10k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 291 users visited in the last hour