Coder Social home page Coder Social logo

Errors in getSnpMats, getSnpMats10X, and getCellAlleleCount: unable to find an inherited method for function ‘seqnames’ for signature ‘"DataFrame"’ about honeybadger HOT 6 CLOSED

jefworks-lab avatar jefworks-lab commented on June 19, 2024
Errors in getSnpMats, getSnpMats10X, and getCellAlleleCount: unable to find an inherited method for function ‘seqnames’ for signature ‘"DataFrame"’

from honeybadger.

Comments (6)

JEFworks avatar JEFworks commented on June 19, 2024

from honeybadger.

koetjen avatar koetjen commented on June 19, 2024

from honeybadger.

koetjen avatar koetjen commented on June 19, 2024

It looks like GenomicRanges deprecated seqnames in the most recent version

CHANGES IN VERSION 1.34.0

DEPRECATED AND DEFUNCT

o Deprecate several RangedData methods: seqinfo, seqinfo<-, seqnames, and
  findOverlaps#RangedData#GenomicRanges

from honeybadger.

koetjen avatar koetjen commented on June 19, 2024

I apologize, closing this issue was inadvertent.

from honeybadger.

JEFworks avatar JEFworks commented on June 19, 2024

Thanks for the excellent debugging.

As you've seen, the getSnpMats, getCellAlleleCount, and getSnpMats10X functions are using the information provided in your snps object to obtain pileups in your provided bams with help from your provided index files.

As a result, the chromosome names in your snps object must match those used in your bams and subsequently your index files. By default, the chromosome names are provided in NCBI/Ensemble style (ie. without the 'chr'):

> library(HoneyBADGER)
> load(system.file("ExAC", "ExAC_chr1.RData", package = "HoneyBADGER"))
> seqlevelsStyle(snps)
[1] "NCBI"    "Ensembl"

If your snps object does not have 'chr' in its seqname but your reads are indexed with chr in their chromosome names (because you are using a different style), you will get errors as you've seen. Luckily, you can toggle between styles as follows:

> seqlevelsStyle(snps) <- "UCSC"
> seqlevels(snps)
 [1] "chr1"       "chr2"       "chr3"       "chr4"       "chr5"      
 [6] "chr6"       "chr7"       "chr8"       "chr9"       "chr10"     
[11] "chr11"      "chr12"      "chr13"      "chr14"      "chr15"     
[16] "chr16"      "chr17"      "chr18"      "chr19"      "chr20"     
[21] "chr21"      "chr22"      "chrX"       "chrY"       "chrM"      
[26] "GL000207.1" "GL000226.1" "GL000229.1" "GL000231.1" "GL000210.1"
[31] "GL000239.1" "GL000235.1" "GL000201.1" "GL000247.1" "GL000245.1"
[36] "GL000197.1" "GL000203.1" "GL000246.1" "GL000249.1" "GL000196.1"
[41] "GL000248.1" "GL000244.1" "GL000238.1" "GL000202.1" "GL000234.1"
[46] "GL000232.1" "GL000206.1" "GL000240.1" "GL000236.1" "GL000241.1"
[51] "GL000243.1" "GL000242.1" "GL000230.1" "GL000237.1" "GL000233.1"
[56] "GL000204.1" "GL000198.1" "GL000208.1" "GL000191.1" "GL000227.1"
[61] "GL000228.1" "GL000214.1" "GL000221.1" "GL000209.1" "GL000218.1"
[66] "GL000220.1" "GL000213.1" "GL000211.1" "GL000199.1" "GL000217.1"
[71] "GL000216.1" "GL000215.1" "GL000205.1" "GL000219.1" "GL000224.1"
[76] "GL000223.1" "GL000195.1" "GL000212.1" "GL000222.1" "GL000200.1"
[81] "GL000193.1" "GL000194.1" "GL000225.1" "GL000192.1" "NC_007605" 

Hope that helps.

  • Jean

from honeybadger.

koetjen avatar koetjen commented on June 19, 2024

I found that the problem arose from the initial structure of snps
In the tutorial:
snps <- rowData(vcf) # result is a data frame, with incorrect results for seqlevels() and does not contain seqnames()
Instead, it needs to be:
snps <- rowRanges(vcf) # result is a GRanges object, so seqlevels() matches the expected output and contains seqnames()
Thanks for all your help, Kary

from honeybadger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.