Skip to content
Prev 17124 / 21318 Next

[Bioc-devel] glitches with releaseName() and seqlevelsStyle()

Hi Herv?,
On 02/09/2020 21:44, Pages, Herve wrote:
ah ok, i see, this is fine, but the purpose of the 'releaseName()' 
function in the documentation is confusing, 'help(releaseName)' says:

?releaseName(x)?: Return the release name of this genome, which is
 ????????? generally made of the name of the organization who assembled
 ????????? it plus its Build version.? For example, UCSC uses ?"hg18"?
 ????????? for the version of the Human genome corresponding to the
 ????????? Build 36.1 from NCBI hence the release name for this genome
 ????????? is ?"NCBI Build 36.1"?.

but, if i'm interpreting you correctly, genomes in BSgenome.* packages 
have no release name anymore. maybe the help page of 'releaseName', 
which is the one of the 'GenomeDescription' class should say only:

'releaseName(x)': Return the release name of 'x'.

for whatever 'x' may be and whatever a release name may mean.
i see, this makes sense, i've followed the discussion about the 
mitochondrian sequence naming, but didn't connect it with this behavior.

i'd like to set the sequence style of a TxDb object to whatever the 
sequence style is of the BSgenome object, dropping the levels in the 
TxDb object that are not common to the BSgenome object (removing the 
mitochondrial chromosome in the case of hg19/GRCh37), so that the TxDb 
object has a single sequence style, i thought this would work but i get 
an error:

library(BSgenome.Hsapiens.1000genomes.hs37d5)
library(TxDb.Hsapiens.UCSC.hg19.knownGene)

txdb <- TxDb.Hsapiens.UCSC.hg19.knownGene
bsgenome <- hs37d5

seqlevelsStyle(txdb) <- seqlevelsStyle(bsgenome)
Warning message:
In .normarg_seqlevelsStyle(value) :
 ? more than one seqlevels style supplied, using the 1st one only
seqlevelsStyle(txdb)
[1] "NCBI" "UCSC"

commonChr <- intersect(seqlevels(txdb), seqlevels(bsgenome))
commonChr
 ?[1] "1"? "2"? "3"? "4"? "5"? "6"? "7"? "8"? "9"? "10" "11" "12" "13" 
"14" "15"
[16] "16" "17" "18" "19" "20" "21" "22" "X"? "Y"
txdb <- keepSeqlevels(txdb, commonChr)
seqlevelsStyle(txdb)
Error in .normarg_genome(value, seqnames(x)) :
 ? when length of supplied 'genome' vector is not 1, then it must equal
 ? the number of sequences
traceback()
9: stop(wmsg("when length of supplied 'genome' vector is not 1, ",
 ?????? "then it must equal the number of sequences"))
8: .normarg_genome(value, seqnames(x))
7: `genome<-`(`*tmp*`, value = x$user_genome)
6: `genome<-`(`*tmp*`, value = x$user_genome)
5: seqinfo(x)
4: seqinfo(x)
3: seqlevelsStyle(seqinfo(x))
2: seqlevelsStyle(txdb)
1: seqlevelsStyle(txdb)

i guess this should have worked, right?

thanks!

robert.