What's the recommended way to overwrite the seqinfo of a GRanges?
1
0
Entering edit mode
maltethodberg ▴ 170
@maltethodberg-9690
Last seen 8 days 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 • 1.1k views
ADD COMMENT
4
Entering edit mode
@michael-lawrence-3846
Last seen 2.4 years 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
ADD COMMENT

Login before adding your answer.

Traffic: 1057 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6