Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcf.to.sigs.input breaks when file contains annotations (ID field) #24

Open
markozecevic opened this issue Nov 14, 2017 · 0 comments
Open

Comments

@markozecevic
Copy link

Hi,

when processing VCF files with partially (or fully) annotated ID field using the readGT function, what you get back is a matrix looking like this:

> gt <- readGT(vcf, nucleotides = TRUE)
> head(gt)
               tumor
1:6610695_G/A  "G/A"
1:15654752_C/T "C/T"
1:16248740_A/T "A/T"
1:40928079_A/T "A/T"
rs2596251      "G/A"
rs75758917     "G/T"

Some row names are dbSNP IDs, which makes it impossible to obtain chromosome, position or reference information the way it is done in the vcf.to.sigs.input function.

    chr <- sub(":.+", "", rownames(gt))
    pos <- as.numeric(sub("_.+", "", sub(".+:", "", rownames(gt))))
    ref <- sub("[/|].+", "", sub(".+_", "", rownames(gt)))

Is there a reason other than readGT being lightweight, that a more general solution like this below is not used?

    auxVcf <- readVcf(vcf)
    chr <- as.character(seqnames(auxVcf))
    pos <- start(auxVcf)
    ref <- as.character(ref(auxVcf))

Thanks for all the work!

Marko

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant