Question: What's the recommended way to overwrite the seqinfo of a GRanges?
0
gravatar for maltethodberg
8 months ago by
maltethodberg140
Sweden
maltethodberg140 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 months ago by Michael Lawrence11k • written 8 months ago by maltethodberg140
Answer: What's the recommended way to overwrite the seqinfo of a GRanges?
4
gravatar for Michael Lawrence
8 months ago by
United States
Michael Lawrence11k 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 months ago by Michael Lawrence11k
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: 219 users visited in the last hour