What's the recommended way to overwrite the seqinfo of a GRanges?
Entering edit mode
maltethodberg ▴ 170
Last seen 13 months ago

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 • 885 views
Entering edit mode
Last seen 22 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

Login before adding your answer.

Traffic: 427 users visited in the last hour
Help About
Access RSS

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

Powered by the version 2.3.6