jeffbhasin / goldmine

Annotate genomic contexts and discover functional element enrichments
http://jeffbhasin.github.io/goldmine
MIT License
7 stars 5 forks source link

mm10 rmsk colname failure #6

Open AMChalkie opened 5 years ago

AMChalkie commented 5 years ago

R.3.5.2.>features.rmsk <- getFeatures(tables=c("rmsk"),genome="mm10", cachedir=cachedir,sync=TRUE) |==================================================| Error in setnames(x, c("chrom", "chromStart", "chromEnd"), c("chr", "start", : Items of 'old' not found in column names: chrom,chromStart,chromEnd R.3.5.2.> R.3.5.2.>traceback() 6: stop("Items of 'old' not found in column names: ", paste(old[is.na(i)], collapse = ",")) 5: setnames(x, c("chrom", "chromStart", "chromEnd"), c("chr", "start", "end")) 4: FUN(X[[i]], ...) 3: lapply(tab.dt, togr) 2: lapply(tab.dt, togr) 1: getFeatures(tables = c("rmsk"), genome = genome, cachedir = cachedir, sync = TRUE)

Suggested partial fix:

if ("chrom" in colnames(x)){ setnames(x, c("chrom"), c("chr")) } else { stopifnot("chr" in colnames(x)) } setnames(x, c("chromStart", "chromEnd"), c("start", "end"))

jeffbhasin commented 5 years ago

Hello,

I believe the rmsk table has a different schema, and causes this error. When I have needed rmsk I have used the underlying goldmine:::getUCSCTable() function. This can pull the table data, but will not adjust for 0-based start coordinates the way getFeatures() does. However, this way the rmsk data can still be pulled from within R and the column names could be changed manually. This is just a workaround, the code you have could also provide a fix. Please make a pull request if you think you could get getFeatures() working for the "rmsk" table in this manner.

Jeff