Git Product home page Git Product logo

Comments (4)

deflaux avatar deflaux commented on August 27, 2024

@danielemerico Is it correct that the goal is to annotate variants and ignore the non-variant segments?

If so, here is a workaround:

# Filter non-variant segments out
onlyVariants <- variants[lapply(variants, function(v){ v$alternateBases[[1]]}) != "<NON_REF>"]
granges <- variantsToGRanges(onlyVariants)

@ttriche here's the stack trace. Do you have any BioConductor-specific suggestions as to how we might work with data containing non-variant segments? Is filtering them out before hand the common approach? I would also imagine we would hit this if the alternate allele value was <DEL> Thanks in advance for any pointers/advice!

> granges <- variantsToGRanges(variants)
Error in .Call2("new_XString_from_CHARACTER", classname, x, start(solved_SEW),  : 
  key 60 (char '<') not in lookup table
Calls: variantsToGRanges ... XString -> XString -> .charToXString -> .Call2 -> .Call
> traceback()
19: .Call(.NAME, ..., PACKAGE = PACKAGE)
18: .Call2("new_XString_from_CHARACTER", classname, x, start(solved_SEW), 
        width(solved_SEW), get_seqtype_conversion_lookup("B", seqtype), 
        PACKAGE = "Biostrings")
17: .charToXString(seqtype, x, start, end, width)
16: XString(seqtype, x)
15: XString(seqtype, x)
14: .oneSeqToXStringSet(seqtype, x, start, end, width, use.names)
13: .charToXStringSet(seqtype, x, start, end, width, use.names)
12: XStringSet(seqtype, unlisted_y)
11: XStringSet(seqtype, unlisted_y)
10: .new_XStringSetList_from_list(seqtype, x)
9: XStringSetList("DNA", ..., use.names = use.names)
8: DNAStringSetList(v$alternateBases)
7: DataFrame(...)
6: newGRanges("GRanges", seqnames = seqnames, ranges = ranges, strand = strand, 
       mcols = DataFrame(...), seqlengths = seqlengths, seqinfo = seqinfo)
5: GRanges(seqnames = Rle(as.character(v$referenceName), 1), ranges = IRanges(start = position, 
       end = as.integer(v$end)), REF = DNAStringSet(v$referenceBases), 
       ALT = DNAStringSetList(v$alternateBases), QUAL = as.numeric(v$quality), 
       FILTER = as.character(v$filter))
4: FUN(X[[1L]], ...)
3: lapply(variants, variantsToGRangesHelper)
2: do.call("c", lapply(variants, variantsToGRangesHelper))
1: variantsToGRanges(variants)

from googlegenomics.

pgrosu avatar pgrosu commented on August 27, 2024

@deflaux, it's probably just easier to use FilterRules via VariantTools or directly from IRanges:

http://www.bioconductor.org/packages/release/bioc/html/VariantTools.html

http://www.bioconductor.org/packages/release/bioc/html/IRanges.html

~p

from googlegenomics.

danielemerico avatar danielemerico commented on August 27, 2024

Workaround works. I tried something similar, but this implementation does not break the object while mine did. More than sufficient for current purposes.

from googlegenomics.

deflaux avatar deflaux commented on August 27, 2024

Closing this issue in favor of #46

from googlegenomics.

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.