What's the recommended way to overwrite the seqinfo of a GRanges?
1
0
Entering edit mode
maltethodberg ▴ 140
@maltethodberg-9690
Last seen 6 weeks ago
Denmark

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.

GRanges seqinfo import.bw BigWigFile rtracklayer • 499 views
4
Entering edit mode
@michael-lawrence-3846
Last seen 5 months ago
United States

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