brentp / vcfanno

annotate a VCF with other VCFs/BEDs/tabixed files
https://genomebiology.biomedcentral.com/articles/10.1186/s13059-016-0973-5
MIT License
365 stars 56 forks source link

Type mismatch for 'shared.Annotation.Columns': Expected integer but found 'string'. #34

Closed komalsrathi closed 8 years ago

komalsrathi commented 8 years ago

I am using vcfanno v0.0.11 and the cosmic annotation that comes with gemini installation v0.18.3:

I have the snpEff annotated .gvcf file here: https://drive.google.com/open?id=0B-8gQV1WZcYdR0J1TWVkYS1QMVk

command:

vcfanno -p 4 -base-path /path/to/gemini_data -lua vcfanno.lua vcfanno.conf sample_new.snpeff.gvcf | bgzip -c > sample_new.snpeff.gvcf.anno.gz

vcfanno.conf:

[[annotation]]
file = "cosmic-v68-GRCh37.tidy.vcf.gz"
columns = ["ID", "AA", "CDS", "GENE", "STRAND"]
names = ["cosmic_id", "cosmic_aa", "cosmic_cds", "cosmic_gene", "cosmic_strand"]
ops = ["self", "self", "self", "self", "self"]

cosmic:

#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO
1       69345   COSM911918      C       A       .       .       AA=p.I85I;CDS=c.255C>A;CNT=1;GENE=OR4F5;STRAND=+
1       69523   COSM426644      G       T       .       .       AA=p.G145C;CDS=c.433G>T;CNT=1;GENE=OR4F5;STRAND=+
1       69538   COSM75742       G       A       .       .       AA=p.V150M;CDS=c.448G>A;CNT=1;GENE=OR4F5;STRAND=+
1       69539   COSM1343690     T       C       .       .       AA=p.V150A;CDS=c.449T>C;CNT=1;GENE=OR4F5;STRAND=+

vcfanno.lua (although I don't really need the lua):

function divfunc(a, b)
    if(a == 0) then 
        return 0.0
    else 
        return string.format("%.9f", a / b)
    end
end

Error:

=============================================
vcfanno version 0.0.11-beta [built with devel +5ec87ba Thu Apr 28 15:36:34 2016 +0000]

see: https://github.com/brentp/vcfanno
=============================================
panic: Type mismatch for 'shared.Config.Annotation': Type mismatch for 'shared.Annotation.Columns': Expected integer but found 'string'.

goroutine 1 [running]:
panic(0x7c1340, 0xc8201621f0)
    /usr/local/src/go-git/src/runtime/panic.go:500 +0x18c
main.main()
    /usr/local/src/gocode/src/github.com/brentp/vcfanno/vcfanno.go:81 +0x17f5

If you have encountered an error, please include:

brentp commented 8 years ago

Instead of

columns = ["ID", "AA", "CDS", "GENE", "STRAND"]

use:

fields = ["ID", "AA", "CDS", "GENE", "STRAND"]
komalsrathi commented 8 years ago

So ID is a column but AA, CDS, GENE and STRAND are not.

when I use:

[[annotation]]
file = "cosmic-v68-GRCh37.tidy.vcf.gz"
fields = ["ID", "AA", "CDS", "GENE", "STRAND"]
names = ["cosmic_id", "cosmic_aa", "cosmic_cds", "cosmic_gene", "cosmic_strand"]
ops = ["self", "self", "self", "self", "self"]

I get the following warning (but it works):

=============================================
vcfanno version 0.0.11-beta [built with devel +5ec87ba Thu Apr 28 15:36:34 2016 +0000]

see: https://github.com/brentp/vcfanno
=============================================
vcfanno.go:111: found 5 sources from 1 files
api.go:192: Info Error: AA not found in row
api.go:192: Info Error: CDS not found in row
vcfanno.go:208: annotated 33336 variants in 0.16 seconds (214450.9 / second)

Does that mean it couldn't map the AA, CDS to the variants in the vcf?

brentp commented 8 years ago

You must use "ID" as a field. It's just a special-case for pulling out the vcf id.

Regarding the error message, it just means that some rows in cosmic do not contain AA or CDS so it tried to grab them but didn't find them.

brentp commented 8 years ago

FYI, I have made a pre-release of vcfanno with some improvements: https://github.com/brentp/vcfanno/releases right now, only the linux binary is available but after some testing I'll make the full release.