GithubHelp home page GithubHelp logo

vcflib / vcflib Goto Github PK

View Code? Open in Web Editor NEW
609.0 39.0 219.0 33.73 MB

C++ library and cmdline tools for parsing and manipulating VCF files with python and zig bindings

Home Page: https://github.com/vcflib/vcflib#vcflib

License: MIT License

Makefile 0.05% C++ 87.36% C 0.81% Python 1.43% R 2.44% TeX 2.27% Perl 0.84% Shell 0.51% CMake 1.09% Scheme 0.43% HTML 0.17% Ruby 0.65% Zig 1.95%
variant-calling genomics vcf-manipulation genotyping haplotypecaller

vcflib's Introduction

vcflib

A C++ library for parsing and manipulating VCF files.

Github-CI AnacondaBadge DL BrewBadge GuixBadge DebianBadge C++0x Chat on Matrix

Vcflib and related tools are the workhorses in bioinformatics for processing the VCF variant calling format. See

A spectrum of free software tools for processing the VCF variant call format: vcflib, bio-vcf, cyvcf2, hts-nim and slivar. Garrison E, Kronenberg ZN, Dawson ET, Pedersen BS, Prins P (2022), PLoS Comput Biol 18(5): e1009123. https://doi.org/10.1371/journal.pcbi.1009123

(bibtex reference at the end of this page)

news

Humpty Logo - CC0 license

January 2023: this is vcflib's first Humpty Dumpty release: vcfcreatemulti is the natural companion to vcfwave. Often variant callers are not perfect. vcfwave with its companion tool vcfcreatemulti can take an existing VCF file that contains multiple complex overlapping and even nested alleles and, unlike Humpty Dumpty, take them apart and put them together again. Thereby, hopefully, creating sane VCF output that is useful for analysis and getting rid of false positives.

We created these tools by including the state-of-the-art biWFA wavefront aligner. The tools are particularly useful for the output from structural variation callers and pangenome genotypers, such as used by the Human Pangenome Reference Consortium (HPRC) because of overlapping ALT segments.

See also RELEASE_NOTES.md

May 2022: the vcflib paper has been published on PLoS Computational Biology!

April 2022: vcflib has just gone pangenome!

By introducing the wavefront algorithm we can now realign long sequences and reduce call complexity (and FPs!) introduced by pangenome variant callers using the new vcfwave tool.

See also RELEASE_NOTES.md

overview

The Variant Call Format (VCF) is a flat-file, tab-delimited textual format that describes reference-indexed variations between individuals. VCF provides a common interchange format for the description of variation in individuals and populations of samples, and has become the de facto standard reporting format for a wide array of genomic variant detectors.

vcflib provides methods to manipulate and interpret sequence variation described by VCF. It is both:

  • an API for parsing and operating on records of genomic variation as it can be described by the VCF format
  • a collection of command-line utilities for executing complex manipulations on VCF files

vclib is both a library (with an API) and a collection of useful tools. The API provides a quick and extremely permissive method to read and write VCF files. Extensions and applications of the library provided in the included utilities (*.cpp) comprise the vast bulk of the library's utility.

We have also added infrastructure to write Python bindings. See below.


Short index:


INSTALL

For latest updates see RELEASE NOTES.

Conda installs in user land without root access

conda install -c bioconda vcflib

Homebrew installs on Linux and Mac OSX

brew install brewsci/bio/vcflib

For Debian and Ubuntu

apt-get install libvcflib-tools libvcflib-dev

We develop against guix and vcflib is packaged as

guix package -i vcflib

See also the Guix shell below.

USAGE

Users are encouraged to drive the utilities in the library in a streaming fashion, using Unix pipes to fully utilize resources on multi-core systems. Piping provides a convenient method to interface with other libraries (vcf-tools, BedTools, GATK, htslib, bio-vcf, bcftools, freebayes) which interface via VCF files, allowing the composition of an immense variety of processing functions. Examples can be found in the scripts, e.g. ./scripts.

TOOLS

filter

filter command description
vcfuniq List unique genotypes. Similar to GNU uniq, but aimed at VCF records. vcfuniq removes records which have the same position, ref, and alt as the previous record on a sorted VCF file. Note that it does not adjust/combine genotypes in the output, but simply takes the first record. See also vcfcreatemulti for combining records.
vcfuniqalleles List unique alleles For each record, remove any duplicate alternate alleles that may have resulted from merging separate VCF files.
vcffilter VCF filter the specified vcf file using the set of filters

metrics

metrics command description
vcfhethomratio Generates the het/hom ratio for each individual in the file
vcfhetcount Calculate the heterozygosity rate: count the number of alternate alleles in heterozygous genotypes in all records in the vcf file
vcfdistance Adds a tag to each variant record which indicates the distance to the nearest variant. (defaults to BasesToClosestVariant if no custom tag name is given.
vcfentropy Annotate VCF records with the Shannon entropy of flanking sequence. Anotates the output VCF file with, for each record, EntropyLeft, EntropyRight, EntropyCenter, which are the entropies of the sequence of the given window size to the left, right, and center of the record. Also adds EntropyRef and EntropyAlt for each alt.
vcfcheck Validate integrity and identity of the VCF by verifying that the VCF record's REF matches a given reference file.

phenotype

phenotype command description
permuteGPAT++ permuteGPAT++ is a method for adding empirical p-values to a GPAT++ score.

genotype

genotype command description
hapLrt HapLRT is a likelihood ratio test for haplotype lengths. The lengths are modeled with an exponential distribution. The sign denotes if the target has longer haplotypes (1) or the background (-1).
normalize-iHS normalizes iHS or XP-EHH scores.
abba-baba abba-baba calculates the tree pattern for four indviduals. This tool assumes reference is ancestral and ignores non abba-baba sites. The output is a boolian value: 1 = true , 0 = false for abba and baba. the tree argument should be specified from the most basal taxa to the most derived.

transformation

transformation command description
vcfintersect VCF set analysis
vcfleftalign Left-align indels and complex variants in the input using a pairwise ref/alt alignment followed by a heuristic, iterative left realignment process that shifts indel representations to their absolute leftmost (5') extent.
vcfglxgt Set genotypes using the maximum genotype likelihood for each sample.
vcfkeepsamples outputs each record in the vcf file, removing samples not listed on the command line
vcfallelicprimitives Note that this tool is considered legacy and will emit a warning! Use vcfwave instead.
vcfcommonsamples Generates each record in the first file, removing samples not present in the second
vcfcreatemulti Go through sorted VCF and if overlapping alleles are represented across multiple records, merge them into a single record. Currently only for indels.
vcfld Compute LD
vcfsamplenames List sample names
vcfsample2info Take annotations given in the per-sample fields and add the mean, median, min, or max to the site-level INFO.
vcflength Add length info field
vcfstreamsort Sorts the input (either stdin or file) using a streaming sort algorithm. Guarantees that the positional order is correct provided out-of-order variants are no more than 100 positions in the VCF file apart.
dumpContigsFromHeader Dump contigs from header
vcfgeno2haplo Convert genotype-based phased alleles within --window-size into haplotype alleles. Will break haplotype construction when encountering non-phased genotypes on input.
vcfinfo2qual Sets QUAL from info field tag keyed by [key]. The VCF file may be omitted and read from stdin. The average of the field is used if it contains multiple values.
vcfevenregions Generates a list of regions, e.g. chr20:10..30 using the variant density information provided in the VCF file to ensure that the regions have even numbers of variants. This can be use to reduce the variance in runtime when dividing variant detection or genotyping by genomic coordinates.
vcfbreakmulti If multiple alleles are specified in a single record, break the record into multiple lines, preserving allele-specific INFO fields.
vcfwave Realign reference and alternate alleles with WFA, parsing out the primitive alleles into multiple VCF records. New records have IDs that reference the source record ID. Genotypes are handled. Deletions generate haploid/missing genotypes at overlapping sites.
vcfafpath Display genotype paths
vcfremoveaberrantgenotypes strips samples which are homozygous but have observations implying heterozygosity. Remove samples for which the reported genotype (GT) and observation counts disagree (AO, RO).
vcf2tsv Converts VCF to per-allelle or per-genotype tab-delimited format, using null string to replace empty values in the table. Specifying -g will output one line per sample with genotype information. When there is more than one alt allele there will be multiple rows, one for each allele and, the info will match the 'A' index
vcfqual2info Puts QUAL into an info field tag keyed by [key].
vcfnumalt outputs a VCF stream where NUMALT has been generated for each record using sample genotypes
vcfprimers For each VCF record, extract the flanking sequences, and write them to stdout as FASTA records suitable for alignment.
vcf2fasta Generates sample_seq:N.fa for each sample, reference sequence, and chromosomal copy N in [0,1... ploidy]. Each sequence in the fasta file is named using the same pattern used for the file name, allowing them to be combined.
vcffixup Generates a VCF stream where AC and NS have been generated for each record using sample genotypes
vcfkeepinfo To decrease file size remove INFO fields not listed on the command line
vcfsamplediff Establish putative somatic variants using reported differences between germline and somatic samples. Tags each record where the listed sample genotypes differ with . The first sample is assumed to be germline, the second somatic. Each record is tagged with ={germline,somatic,loh} to specify the type of variant given the genotype difference between the two samples.
vcfflatten Removes multi-allelic sites by picking the most common alternate. Requires allele frequency specification 'AF' and use of 'G' and 'A' to specify the fields which vary according to the Allele or Genotype. VCF file may be specified on the command line or piped as stdin.
vcfglbound Adjust GLs so that the maximum GL is 0 by dividing all GLs for each sample by the max.
vcfecho Echo VCF to stdout (simple demo)
vcfgeno2alleles modifies the genotypes field to provide the literal alleles rather than indexes
vcf2dag Modify VCF to be able to build a directed acyclic graph (DAG)
vcfannotategenotypes Examine genotype correspondence. Annotate genotypes in the first file with genotypes in the second adding the genotype as another flag to each sample filed in the first file. annotation-tag is the name of the sample flag which is added to store the annotation. also adds a 'has_variant' flag for sites where the second file has a variant.
vcfremap For each alternate allele, attempt to realign against the reference with lowered gap open penalty. If realignment is possible, adjust the cigar and reference/alternate alleles. Observe how different alignment parameters, including context and entropy-dependent ones, influence variant classification and interpretation.
vcfremovesamples outputs each record in the vcf file, removing samples listed on the command line
vcfcleancomplex Removes reference-matching sequence from complex alleles and adjusts records to reflect positional change.
vcfindex Adds an index number to the INFO field (id=position)
vcfannotate Intersect the records in the VCF file with targets provided in a BED file. Intersections are done on the reference sequences in the VCF file. If no VCF filename is specified on the command line (last argument) the VCF read from stdin.
smoother smoothes is a method for window smoothing many of the GPAT++ formats.
vcfkeepgeno Reduce file size by removing FORMAT fields not listed on the command line from sample specifications in the output
vcfcombine Combine VCF files positionally, combining samples when sites and alleles are identical. Any number of VCF files may be combined. The INFO field and other columns are taken from one of the files which are combined when records in multiple files match. Alleles must have identical ordering to be combined into one record. If they do not, multiple records will be emitted.
vcfcat Concatenates VCF files
vcfinfosummarize Take annotations given in the per-sample fields and add the mean, median, min, or max to the site-level INFO.
vcfclassify Creates a new VCF where each variant is tagged by allele class: snp, ts/tv, indel, mnp
vcfoverlay Overlay records in the input vcf files with order as precedence.
vcfaddinfo Adds info fields from the second file which are not present in the first vcf file.
vcfnullgenofields Makes the FORMAT for each variant line the same (uses all the FORMAT fields described in the header). Fills out per-sample fields to match FORMAT. Expands GT values of '.' with number of alleles based on ploidy (eg: './doc/.' for dipolid).
vcfgenosamplenames Get samplenames

statistics

statistics command description
permuteSmooth permuteSmooth is a method for adding empirical p-values smoothed wcFst scores.
plotHaps plotHaps provides the formatted output that can be used with 'bin/plotHaplotypes.R'.
pVst pVst calculates vst, a measure of CNV stratification.
wcFst wcFst is Weir & Cockerham's Fst for two populations. Negative values are VALID, they are sites which can be treated as zero Fst. For more information see Evolution, Vol. 38 N. 6 Nov 1984. Specifically wcFst uses equations 1,2,3,4.
popStats General population genetic statistics for each SNP
vcfsitesummarize Summarize by site
vcfrandomsample Randomly sample sites from an input VCF file, which may be provided as stdin. Scale the sampling probability by the field specified in KEY. This may be used to provide uniform sampling across allele frequencies, for instance.
vcfroc Generates a pseudo-ROC curve using sensitivity and specificity estimated against a putative truth set. Thresholding is provided by successive QUAL cutoffs.
vcfstats Prints statistics about variants in the input VCF file.
bFst bFst is a Bayesian approach to Fst. Importantly bFst accounts for genotype uncertainty in the model using genotype likelihoods. For a more detailed description see: `A Bayesian approach to inferring population structure from dominant markers' by Holsinger et al. Molecular Ecology Vol 11, issue 7 2002. The likelihood function has been modified to use genotype likelihoods provided by variant callers. There are five free parameters estimated in the model: each subpopulation's allele frequency and Fis (fixation index, within each subpopulation), a free parameter for the total population's allele frequency, and Fst.
vcfcountalleles Count alleles
vcfparsealts Alternate allele parsing method. This method uses pairwise alignment of REF and ALTs to determine component allelic primitives for each alternate allele.
genotypeSummary Generates a table of genotype counts. Summarizes genotype counts for bi-allelic SNVs and indel
vcfgenosummarize Adds summary statistics to each record summarizing qualities reported in called genotypes. Uses: RO (reference observation count), QR (quality sum reference observations) AO (alternate observation count), QA (quality sum alternate observations)
vcfaltcount count the number of alternate alleles in all records in the vcf file
meltEHH
iHS iHS calculates the integrated haplotype score which measures the relative decay of extended haplotype homozygosity (EHH) for the reference and alternative alleles at a site (see: voight et al. 2006, Spiech & Hernandez 2014).
segmentFst segmentFst creates genomic segments (bed file) for regions with high wcFst
pFst pFst is a probabilistic approach for detecting differences in allele frequencies between two populations.
sequenceDiversity The sequenceDiversity program calculates two popular metrics of haplotype diversity: pi and extended haplotype homozygoisty (eHH). Pi is calculated using the Nei and Li 1979 formulation. eHH a convenient way to think about haplotype diversity. When eHH = 0 all haplotypes in the window are unique and when eHH = 1 all haplotypes in the window are identical.
vcfgenotypecompare adds statistics to the INFO field of the vcf file describing the amount of discrepancy between the genotypes (GT) in the vcf file and the genotypes reported in the . use this after vcfannotategenotypes to get correspondence statistics for two vcfs.
vcfrandom Generate a random VCF file
segmentIhs Creates genomic segments (bed file) for regions with high wcFst
vcfgenotypes Report the genotypes for each sample, for each variant in the VCF. Convert the numerical represenation of genotypes provided by the GT field to a human-readable genotype format.

See also vcflib.md.

scripts

The vcflib source repository contains a number of additional scripts. Click on the link to see the source code.

script description
vcfclearinfo clear INFO field
vcfqualfilter quality filter
vcfnulldotslashdot rewrite null genotypes to ./.
vcfprintaltdiscrepancy.r show ALT discrepancies in a table
vcfremovenonATGC remove non-nucleotides in REF or ALT
plotSmoothed.R smooth plot of wcFst, pFst or abba-baba
vcf_strip_extra_headers strip headers
plotHapLrt.R plot results of pFst
vcfbiallelic remove anything that is not biallelic
vcfsort sort VCF using shell script
vcfnosnps remove SNPs
vcfmultiwayscripts more multiway comparisons
vcfgtcompare.sh annotates records in the first file with genotypes and sites from the second
plotPfst.R plot pFst
vcfregionreduce_and_cut reduce, gzip, and tabix
plotBfst.R plot results of pFst
vcfnobiallelicsnps remove biallelic SNPs
vcfindels show INDELS
vcfmultiway multiway comparison
vcfregionreduce reduce VCFs using a BED File, gzip them up and create tabix index
vcfprintaltdiscrepancy.sh runner
vcfclearid clear ID field
vcfcomplex remove all SNPs but keep SVs
vcffirstheader show first header
plotXPEHH.R plot XPEHH
vcfregionreduce_pipe reduce, gzip and tabix in a pipe
vcfplotaltdiscrepancy.sh plot ALT discrepancy runner
vcfplottstv.sh runner
vcfnoindels remove INDELs
bgziptabix runs bgzip on the input and tabix indexes the result
plotHaplotypes.R plot results
vcfplotsitediscrepancy.r plot site discrepancy
vcfindelproximity show SNPs around an INDEL
bed2region convert VCF CHROM column in VCF file to region
vcfplotaltdiscrepancy.r plot ALT discrepancies
plot_roc.r plot ROC
vcfmultiallelic remove anything that is not multiallelic
vcfsnps show SNPs
vcfvarstats use fastahack to get stats
vcfregionreduce_uncompressed reduce, gzip and tabix
plotWCfst.R plot wcFst
vcf2bed.py transform VCF to BED file
vcfjoincalls overlay files using QUAL and GT from a second VCF
vcf2sqlite.py push VCF file into SQLite3 database using dbname

python

vcflib has rudimentary python bindings, but the are easy to build up on. See pyvcflib.

Development

build from source

VCFLIB uses the cmake build system, after a recursive checkout of the sources make the files in the 'build' directory with:

git clone --recursive https://github.com/vcflib/vcflib.git
cd vcflib
mkdir -p build && cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DZIG=OFF -DOPENMP=OFF ..
cmake --build .
cmake --install .

and to run the tests

ctest . --verbose

Executables are built into the ./build directory in the repository.

Note, if you have an existing repo update submodules with

git submodule update --init --recursive --progress
cd build
cmake --build . --target clean

The most interesting one, perhaps, is wfa2lib. Bundling is no longer the default, but it is a submodule that will install an optimized libwfa2.so. Set up compilation with

cmake -DCMAKE_BUILD_TYPE=Release -DWFA_GITMODULE=ON  ..
cmake --build .
ctest .
cmake --install .

Build dependencies can be viewed in the github-CI scripts (see badges above), as well as guix.scm used by us to create the build environment (for instructions see the header of guix.scm). Essentially:

  • cmake
  • C++ compiler
  • htslib
  • tabixpp
  • WFA2 (wfa2lib)
  • pybind11 (for testing)

For include files add

  • libhts-dev
  • libtabixpp-dev
  • libtabixpp0

And for some of the VCF executables

  • zig 0.10 (disable with cmake -DZIG=OFF)
  • python
  • perl

To use Zig compiled tools, such as vcfcreatemulti, make sure the zig compiler is in the PATH. The zig dependency is for the recently upgraded vcfcreatemulti that can be run after vcfwave to combine overlapping records. It is unfortunate that zig is not part of some large Linux distributions. More on zig can be found in the souce code README.

Using a recent C++ compiler

You may encounter something like libstdc++.so.6: version `GLIBCXX_3.4.32' not found (required by ...vcflib/build/pyvcflib.cpython-310-x86_64-linux-gnu.so). This is caused by the python pyvcflib not running against a python interpreter compiled with the same libstdc++ dependency. That is a bit nasty to solve. For now make sure to match C++ compilers for the python module.

Using a different htslib

Check out htslib in tabixpp (recursively) and

cmake -DHTSLIB_LOCAL:STRING=./htslib/ ..
cmake --build .

link library

The standard build creates build/vcflib.a. Take a hint from the cmake file that builds all the vcflib tools.

distro builds

Distros, such as Debian, should build with something like

cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DZIG=OFF ..

See the CMakeLists.txt header for more.

source code

See vcfecho.cpp for basic usage. Variant.h and Variant.cpp describe methods available in the API. vcflib is incorporated into several projects, such as freebayes, which may provide a point of reference for prospective developers. Note vcflib contains submodules (git repositories) comprising some dependencies. A full Guix development environment we use is defined here.

adding tests

vcflib uses different test systems. The most important one is the doctest because it doubles as documentation. For an example see vcf2tsv.md which can be run from the command line with

cd test
python3 -m doctest -o NORMALIZE_WHITESPACE -o REPORT_UDIFF pytest/vcf2tsv.md

We also added support for python bindings and unit tests. See realign.py for an example.

Support

The developers are on the vcflib matrix channel. Please do not use the github issue tracker for support issues!

Contributing

To contribute code to vcflib send a github pull request. We may ask you to add a working test case as described in 'adding tests'.

LICENSE

This software is distributed under the free software MIT LICENSE.

CREDIT

Citations are the bread and butter of Science. If you are using this software in your research and want to support our future work, please cite the following publication:

Please cite:

A spectrum of free software tools for processing the VCF variant call format: vcflib, bio-vcf, cyvcf2, hts-nim and slivar. Garrison E, Kronenberg ZN, Dawson ET, Pedersen BS, Prins P (2022), PLoS Comput Biol 18(5): e1009123. https://doi.org/10.1371/journal.pcbi.1009123

Bibtex reference

@article{10.1371/journal.pcbi.1009123,
    doi = {10.1371/journal.pcbi.1009123},
    author = {Garrison, Erik AND Kronenberg, Zev N. AND Dawson, Eric T. AND Pedersen, Brent S. AND Prins, Pjotr},
    journal = {PLOS Computational Biology},
    publisher = {Public Library of Science},
    title = {A spectrum of free software tools for processing the VCF variant call format: vcflib, bio-vcf, cyvcf2, hts-nim and slivar},
    year = {2022},
    month = {05},
    volume = {18},
    url = {https://doi.org/10.1371/journal.pcbi.1009123},
    pages = {1-15}
}

Below the prepublished version of our paper

@article {Garrison2021.05.21.445151,
	author = {Garrison, Erik and Kronenberg, Zev N. and Dawson, Eric T. and Pedersen, Brent S. and Prins, Pjotr},
	title = {Vcflib and tools for processing the VCF variant call format},
	elocation-id = {2021.05.21.445151},
	year = {2021},
	doi = {10.1101/2021.05.21.445151},
	publisher = {Cold Spring Harbor Laboratory},
	URL = {https://www.biorxiv.org/content/early/2021/05/23/2021.05.21.445151},
	eprint = {https://www.biorxiv.org/content/early/2021/05/23/2021.05.21.445151.full.pdf},
	journal = {bioRxiv}
}

vcflib's People

Contributors

adamnovak avatar alexreg avatar andreaguarracino avatar arq5x avatar bgspiegl avatar blaiseli avatar ccoulombe avatar chapmanb avatar edawson avatar ekg avatar ezcn avatar genisysram avatar glebanister avatar glennhickey avatar ivanthedugtrio avatar jeizenga avatar josephliccini avatar jts avatar mphschmitt avatar mr-c avatar pettyalex avatar pjotrp avatar selkovjr avatar tillea avatar timmassingham avatar tseemann avatar tsibley avatar winterfor avatar wlokhorst avatar zeeev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vcflib's Issues

vcfcombine - terminate called after throwing an instance of 'std::out_of_range' error

Hi,

I am trying to combine two vcf files and when I run the executable vcfcombine and pass in the two file names as arguments I receive the following error message:

terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
Aborted

The version I am using was downloaded about 40 mins prior to this message being sent to you. Would like to know if there is a workaround for this, or if I am doing something wrong.

Thanks

Al

__off64_t in fastahack/LargeFileSupport.h cause compilation issues

Not sure why this is, but it won't compile on my Mac (gcc 4.2.1). If I change to "typedef off_t off_type;", all is well.

In file included from Fasta.h:19,
from Fasta.cpp:9:
LargeFileSupport.h:12: error: โ€˜__off64_tโ€™ does not name a type
make[1]: *** [Fasta.o] Error 1
make: *** [fastahack/Fasta.o] Error 2

vcf2tsv (with snpeff vcd) parsing problem

Hi,
I tried convert vcf to tsp with vcf2tsv in vcflib package.
but, I have a problem when I parsing.

for example, I can't get an snpeff annotation on tsv file (converted)
what is the problem?

root@GR0002:/gg/tmp/t6_out# grep 47123898 out_snpeff.geneSets.vcf
chr1 47123898 . TAAA TAAAA 554.27 PASS AC=1;AF=0.167;AN=6;BaseQRankSum=-0.710;DP=63;FS=2.251;HaplotypeScore=16.2535;MLEAC=1;MLEAF=0.167;MQ=60.28;MQ0=0;MQRankSum=0.127;QD=12.32;RPA=15,16,12;RU=A;ReadPosRankSum=-0.091;STR;EFF=INTRON(MODIFIER||||177|ATPAF1||CODING|NM_001256418.1|4|1),INTRON(MODIFIER||||240|ATPAF1||CODING|NM_001243728.1|3|1),INTRON(MODIFIER||||283|ATPAF1||CODING|NM_001042546.2|3|1),INTRON(MODIFIER||||351|ATPAF1||CODING|NM_022745.4|3|1);PhastCons=0.001;MSigDb=CAGGTG_V$E12_Q6,CREIGHTON_ENDOCRINE_THERAPY_RESISTANCE_3,GCTTGAA_MIR-498,GOBERT_OLIGODENDROCYTE_DIFFERENTIATION_DN,GSE11864_CSF1_IFNG_VS_CSF1_IFNG_PAM3CYS_IN_MAC_UP,GSE11864_CSF1_VS_CSF1_IFNG_PAM3CYS_IN_MAC_UP,GSE13229_IMM_VS_MATURE_NKCELL_UP,GSE14308_TH2_VS_NAIVE_CD4_TCELL_DN,GSE14769_UNSTIM_VS_40MIN_LPS_BMDM_DN,GSE14769_UNSTIM_VS_80MIN_LPS_BMDM_UP,GSE18791_CTRL_VS_NEWCASTLE_VIRUS_DC_18H_UP,GSE2197_CPG_DNA_VS_UNTREATED_IN_DC_DN,GSE25087_FETAL_VS_ADULT_TREG_UP,GSE27786_CD4_TCELL_VS_MONO_MAC_UP,GSE27786_CD8_TCELL_VS_MONO_MAC_UP,GSE27786_CD8_TCELL_VS_NEUTROPHIL_UP,GSE27786_ERYTHROBLAST_VS_NEUTROPHIL_DN,GSE27786_LSK_VS_MONO_MAC_UP,GSE27786_NKTCELL_VS_MONO_MAC_UP,GSE27786_NKTCELL_VS_NEUTROPHIL_UP,GSE7460_CTRL_VS_FOXP3_OVEREXPR_TCONV_DN,GSE7460_FOXP3_MUT_VS_HET_ACT_TCONV_DN,GSE7460_FOXP3_MUT_VS_WT_ACT_TCONV_DN,GSE7460_WT_VS_FOXP3_HET_ACT_TCONV_UP,IVANOVA_HEMATOPOIESIS_EARLY_PROGENITOR,KRIEG_KDM3A_TARGETS_NOT_HYPOXIA,LASTOWSKA_NEUROBLASTOMA_COPY_NUMBER_DN,LU_IL4_SIGNALING,NFE2L2.V2,NUYTTEN_EZH2_TARGETS_DN,NUYTTEN_NIPP1_TARGETS_DN,PILON_KLF1_TARGETS_DN,SENESE_HDAC3_TARGETS_DN,TACTTGA_MIR-26A_MIR-26B,TCTGATA_MIR-361,V$E2F_Q2,V$TEF1_Q6,WEI_MIR34A_TARGETS,chr1p33 GT:AD:DP:GQ:PL 0/0:10,1,0:18:4:0,4,274,42,314,654 ./0:3,0,7:22:49:255,281,378,0,49,220 ./1:1,5,6:23:99:414,287,347,127,0,354
chr1 47123898 . TAAA T 554.27 PASS AC=2;AF=0.333;AN=6;BaseQRankSum=-0.710;DP=63;FS=2.251;HaplotypeScore=16.2535;MLEAC=2;MLEAF=0.333;MQ=60.28;MQ0=0;MQRankSum=0.127;QD=12.32;RPA=15,16,12;RU=A;ReadPosRankSum=-0.091;STR;EFF=INTRON(MODIFIER||||177|ATPAF1||CODING|NM_001256418.1|4|1),INTRON(MODIFIER||||240|ATPAF1||CODING|NM_001243728.1|3|1),INTRON(MODIFIER||||283|ATPAF1||CODING|NM_001042546.2|3|1),INTRON(MODIFIER||||351|ATPAF1||CODING|NM_022745.4|3|1);PhastCons=0.001;MSigDb=CAGGTG_V$E12_Q6,CREIGHTON_ENDOCRINE_THERAPY_RESISTANCE_3,GCTTGAA_MIR-498,GOBERT_OLIGODENDROCYTE_DIFFERENTIATION_DN,GSE11864_CSF1_IFNG_VS_CSF1_IFNG_PAM3CYS_IN_MAC_UP,GSE11864_CSF1_VS_CSF1_IFNG_PAM3CYS_IN_MAC_UP,GSE13229_IMM_VS_MATURE_NKCELL_UP,GSE14308_TH2_VS_NAIVE_CD4_TCELL_DN,GSE14769_UNSTIM_VS_40MIN_LPS_BMDM_DN,GSE14769_UNSTIM_VS_80MIN_LPS_BMDM_UP,GSE18791_CTRL_VS_NEWCASTLE_VIRUS_DC_18H_UP,GSE2197_CPG_DNA_VS_UNTREATED_IN_DC_DN,GSE25087_FETAL_VS_ADULT_TREG_UP,GSE27786_CD4_TCELL_VS_MONO_MAC_UP,GSE27786_CD8_TCELL_VS_MONO_MAC_UP,GSE27786_CD8_TCELL_VS_NEUTROPHIL_UP,GSE27786_ERYTHROBLAST_VS_NEUTROPHIL_DN,GSE27786_LSK_VS_MONO_MAC_UP,GSE27786_NKTCELL_VS_MONO_MAC_UP,GSE27786_NKTCELL_VS_NEUTROPHIL_UP,GSE7460_CTRL_VS_FOXP3_OVEREXPR_TCONV_DN,GSE7460_FOXP3_MUT_VS_HET_ACT_TCONV_DN,GSE7460_FOXP3_MUT_VS_WT_ACT_TCONV_DN,GSE7460_WT_VS_FOXP3_HET_ACT_TCONV_UP,IVANOVA_HEMATOPOIESIS_EARLY_PROGENITOR,KRIEG_KDM3A_TARGETS_NOT_HYPOXIA,LASTOWSKA_NEUROBLASTOMA_COPY_NUMBER_DN,LU_IL4_SIGNALING,NFE2L2.V2,NUYTTEN_EZH2_TARGETS_DN,NUYTTEN_NIPP1_TARGETS_DN,PILON_KLF1_TARGETS_DN,SENESE_HDAC3_TARGETS_DN,TACTTGA_MIR-26A_MIR-26B,TCTGATA_MIR-361,V$E2F_Q2,V$TEF1_Q6,WEI_MIR34A_TARGETS,chr1p33 GT:AD:DP:GQ:PL 0/0:10,1,0:18:4:0,4,274,42,314,654 0/1:3,0,7:22:49:255,281,378,0,49,220 ./1:1,5,6:23:99:414,287,347,127,0,354

root@GR0002:/gg/tmp/t6_out# /gg/bio/tools/vcflib/bin/vcf2tsv -n . out_snpeff.geneSets.vcf > z

grep 47123898 zroot@GR0002:/gg/tmp/t6_out# grep 47123898 z
chr1 47123898 . TAAA TAAAA 554.27 PASS . 1 0.167 . . . 6 . -0.710 63 . . . 2.251 . 16.2535 . 1 0.167 60.28 0 0.127 . 0.001 12.32 . A -0.091 0 1
chr1 47123898 . TAAA T 554.27 PASS . 2 0.333 . . . 6 . -0.710 63 . . . 2.251 . 16.2535 . 2 0.333 60.28 0 0.127 . 0.001 12.32 . A -0.091 0 1
root@GR0002:/gg/tmp/t6_out# /gg/bio/tools/vcflib/bin/vcf2tsv out_snpeff.geneSets.vcf | grep 47123898
chr1 47123898 . TAAA TAAAA 554.27 PASS 1 0.167 6 -0.710 63 2.251 16.2535 1 0.167 60.28 0 0.127 0.001 12.32 A -0.091 0 1
chr1 47123898 . TAAA T 554.27 PASS 2 0.333 6 -0.710 63 2.251 16.2535 2 0.333 60.28 0 0.127 0.001 12.32 A -0.091 0 1

Can't make vcflib tools. Missing vcfnumalt.cpp?

Hi Erik,

I am back to hacking on VCF files and wanted to work with your latest repo. I am having troubles making the existing tools. The underlying objects (e.g., Variant.o) seem to compile just fine, but I get an error message when attempting to make the first tool (vcfecho.cpp). It complains about a missing rule for vcfnumalt.cpp. This source file doesn't seem to exist in the repo, and looking at the code for vcfecho, I can't tell why it would need it. Perhaps the Makefile needs to be tweaked?

Best,
Aaron

$ make clean; make
rm -f vcfecho vcfaltcount vcfhetcount vcffilter vcf2tsv vcfgenotypes vcfannotategenotypes vcfcommonsamples vcfgenotypecompare vcffixup vcfclassify vcfsamplediff vcfremoveaberrantgenotypes vcfrandom vcfparsealts vcfstats vcfflatten vcfprimers vcfnumalt Variant.o split.o
cd tabixpp && make clean
rm -fr gmon.out .o a.out *.dSYM tabix bgzip tabix++ *~ *.a tabix.aux tabix.log tabix.pdf *.class libtabix..dylib libtabix.so*
cd smithwaterman && make clean
Cleaning up.
cd fastahack && make clean
rm -f fastahack .o
cd tabixpp && make
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE bgzf.c -o bgzf.o
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE kstring.c -o kstring.o
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE knetfile.c -o knetfile.o
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE index.c -o index.o
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE bedidx.c -o bedidx.o
ar -cru libtabix.a bgzf.o kstring.o knetfile.o index.o bedidx.o
ranlib libtabix.a
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE main.c -o main.o
gcc -g -Wall -O2 -fPIC -o tabix main.o -lm -lz -L. -ltabix
gcc -c -g -Wall -O2 -fPIC -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE bgzip.c -o bgzip.o
gcc -g -Wall -O2 -fPIC -o bgzip bgzip.o bgzf.o knetfile.o -lz
g++ -g -Wall -O2 -fPIC -c tabix.cpp
g++ -g -Wall -O2 -fPIC -o tabix++ main.cpp tabix.o bgzf.o -lm -lz -L. -ltabix
g++ -c -o Variant.o Variant.cpp -lm -lz -L. -Ltabixpp/ -ltabix -O3
i686-apple-darwin10-g++-4.2.1: -lm: linker input file unused because linking not done
i686-apple-darwin10-g++-4.2.1: -lz: linker input file unused because linking not done
i686-apple-darwin10-g++-4.2.1: -ltabix: linker input file unused because linking not done
g++ -c -o split.o split.cpp -lm -lz -L. -Ltabixpp/ -ltabix -O3
i686-apple-darwin10-g++-4.2.1: -lm: linker input file unused because linking not done
i686-apple-darwin10-g++-4.2.1: -lz: linker input file unused because linking not done
i686-apple-darwin10-g++-4.2.1: -ltabix: linker input file unused because linking not done
make: *
* No rule to make target vcfnumalt.cpp', needed byvcfecho'. Stop.

Segfault and other errors with a version 4.1 VCF

Hello, I'm writing to ask if this lib should support version 4.1 VCF files because I'm trying various tools on a file (gotten from the GEUVADIS consortium) and I encounter different kind of errors (the same tools on the given sample vcf runs without problems), for example a segfault with vcfstats and a "terminate called after throwing an instance of 'std::out_of_range'
what(): vector::_M_range_check" with vcf2fasta, while for example vcfsamplenames works.

Thanks,
E.

Use build system (autotools or cmake)

Hello,

Are you guys open to adding support for a proper build system (either autotools or cmake) ?
I saw an old PR from 2012 (#9 ), but it was never incorporated.

The current 'makefile' is making it hard for project to add VCFLIB as a dependency in a clean way...

If so, I could perhaps send a PR with updated build system for your consideration.

vcffilter

Hey,

Does the vcffilter work on string data types? I couldn't get to work but my syntax could have been wrong. If not, it would be a most definitely appreciated feature.

i.e.

##INFO=<ID=VT,Number=1,Type=String,Description="Variant type, can be SNP, INS or DEL">

Daryl

vcfaddinfo skips rows in vcfA

If vcf B is shorter than vcfA, or if vcfA has rows from chromosomes that sort after those in vcfB, the loop pumping rows of vcfA into the output will shut down when vcfB hits its EOF, and strand the remaining lines in vcfA.

vcffilter

Hi Erik
I am having a problem filtering my vcf file to create an output with few missing genotypes across all individuals.
I tried the -g and the -geno options but there is no output file
for exemple
vcffilter -gno .9 Optimisation_1_ApekI_filtred.vcf out_filtered
d
error: no VCF header

tabixpp build issue

Hi Erik, could you update the tabixpp submodule, I see you fixed the libz build issue in the tabixpp repo but vcflib still points to an older tabixpp commit and so vcflib won't make on Ubuntu.

Call rate

Hello,

I generated a vcf file from potato (tetraploid) genotyping by sequencing data with Freebayes. Although my file has over 21,000 markers most of them are of limited use because there contain a lot of missing data. I would like to filter this file to keep only markers with a call rate of at least 0.75.

I have made many attempts to do this with vcflib, but to no avail. The best result I get is with these commands:

vcffilter -g "geno = .75" mpileup20140318_1153.vcf > Test.vcf
vcffilter -g "min_call_rate = .75" mpileup20140318_1153.vcf > Test.vcf

They both generate a file where all genotype calls are replaced with missing data.

Is there a way to use vcflib to filter my file based on call rate?

Thank you.

Maxime

Help information for vcfgeno2haplo is not consistent

Tool invocation produces:

usage: vcfgeno2haplo [options] [<vcf file>]

options:
    -r, --reference FILE    FASTA reference file, required with -i and -u
    -w, --window-size N     Merge variants at most this many bp apart (default 30)
    -o, --only-variants     Don't output the entire haplotype, just concatenate
                            REF/ALT strings (delimited by ":")

while vcflib README file only lists -w and -r options but not -i and -u (which I guess are a copy/paste artifact).

VariantCallFile.header includes extra "\n"

Hi Erik,

It looks like an extra newline is being added to the header attribute when parsing the VCF file header. This is best illustrated by the vcfecho tool. Note the extra newline after the field definition.

$ ./vcfecho sample.vcf 
##fileformat=VCFv4.0
##fileDate=20090805
##source=myImputationProgramV3.1
##reference=1000GenomesPilot-NCBI36
##phasing=partial
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=AC,Number=.,Type=Integer,Description="Allele count in genotypes, for each ALT allele, in the same order as listed">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
##INFO=<ID=AF,Number=.,Type=Float,Description="Allele Frequency">
##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele">
##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP membership, build 129">
##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
##FILTER=<ID=q10,Description="Quality below 10">
##FILTER=<ID=s50,Description="Less than 50% of samples have data">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
##ALT=<ID=DEL:ME:ALU,Description="Deletion of ALU element">
##ALT=<ID=CNV,Description="Copy number variable region">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  NA00001 NA00002 NA00003

19  111 .   A   C   9.6 .       GT:HQ   0|0:10,10   0|0:10,10   0/1:3,3
19  112 .   A   G   10  .       GT:HQ   0|0:10,10   0|0:10,10   0/1:3,3
20  14370   rs6054257   G   A   29  PASS    AF=0.5;DP=14;NS=3;DB;H2 GT:GQ:DP:HQ 0|0:48:1:51,51  1|0:48:8:51,51  1/1:43:5:.,.
20  17330   .   T   A   3   q10 AF=0.017;DP=11;NS=3 GT:GQ:DP:HQ 0|0:49:3:58,50  0|1:3:5:65,3    0/0:41:3:.,.
20  1110696 rs6040355   A   G,T 67  PASS    AA=T;AF=0.333,0.667;DP=10;NS=2;DB   GT:GQ:DP:HQ 1|2:21:6:23,27  2|1:2:0:18,2    2/2:35:4:.,.
20  1230237 .   T   .   47  PASS    AA=T;DP=13;NS=3 GT:GQ:DP:HQ 0|0:54:.:56,60  0|0:48:4:51,51  0/0:61:2:.,.
20  1234567 microsat1   G   GA,GAC  50  PASS    AA=G;AC=3,1;AN=6;DP=9;NS=3  GT:GQ:DP    0/1:.:4 0/2:17:2    1/1:40:3
20  1235237 .   T   .   50  .       GT  0/0 0|0 .
X   10  rsTest  AC  A,ATG   10  PASS        GT  0   0/1 0|2

Variant.originalLine is never set

The string member of Variant, originalLine, should be set in Variant::parse(string& line, bool parseSamples) of Variant.cpp:

originalLine = line;

Inserted at line 13 or there-abouts should do the trick.

There are edge cases where vcfallelicprimitives doesn't always split apart indels and SNPs

I've encountered a case of an adjacent indel and SNP that were unable to be picked apart by vcfallelicprimitives. The variant is an T insertion into a T homopolymer run and an A->T SNP at the end of the run. A more complete representation would be: TTTTTTTTA -> TTTTTTTTT

The indel as reported is this:
5 132267859 . A TT

Running through vcfallelicprimitives doesn't change the representation at all, even though this is a SNP and an indel. Adding padding allows this to be split out as I would have expected.

5 132267858 . TA TTT is then reported as

5   132267858   .   T   TT
5   132267859   .   A   T

Lack of a build system for installation

By build system, I mean something like autotools (IMO to be avoided) or cmake (preferred - it's also used in other scientific projects).

The advantages of using a build system over a plain makefile are:

  • possibility for the user to change parameters (install prefix, etc.)
  • easier installation and uninstallation
  • possibility of being packaged by Linux distribution
  • possibility of using vcflib as an external libraries by other projects

vcfdistance usage

the usage for this tool states
usage: /usr/local/vcflib/vcfdistance

shouldn't it be

usage: /usr/local/vcflib/vcfdistance >

add "prependcol" script for ROC plotting routine

Reading this post leads me to believe that the plot_roc.r script relies on a simple script that prepends "freebayes" or "truth" to each thresholded set generated by vcfroc. Could you add this script to your repository, or (even better) modify vcfroc to just produce this format by default?

vcfcombine drops fileformat & filedate lines, leaving a .vcf file that bcftools (for instance) can't parse

Reproducer:

$ cd samples
$ head -2 sample.vcf
##fileformat=VCFv4.0
##fileDate=20090805

$ bcftools view -h sample.vcf  | head -2
##fileformat=VCFv4.0
##FILTER=<ID=PASS,Description="All filters passed">

$ ../bin/vcfcombine sample.vcf sample.vcf > combined.vcf
$ head -2 combined.vcf
##source=myImputationProgramV3.1
##reference=1000GenomesPilot-NCBI36

$ bcftools view -h combined.vcf
Failed to open combined.vcf: unknown file type

The issue seems to be in how the header lines and header lists maps are constructed and used: so when vcfcombine reads through the header of the first file and adds meta information lines, it lowercases all the keys:

void VCFHeader::addMetaInformationLine(const string& meta_line)
 {

        //.... 
        // all map keys are lower case so when we check we need to be lower case too!
        std::transform(meta_line_prefix.begin(), meta_line_prefix.end(), meta_line_prefix.begin(), ::tolower);
}

But some keys, including fileFormat, in header_line_names_ordered are mixed case:

    VCFHeader::VCFHeader()
    {
        // ...
        // the order is used when outputting as a string
        this->header_line_names_ordered.push_back("##fileFormat");
        this->header_line_names_ordered.push_back("##fileDate");
        //...

Thus when it comes time to get the header string:

    string VCFHeader::getHeaderString()
    {
        // getHeaderString generates the string each time it is called
        string header_string;

        // start by adding the header_lines
        for (vector<string>::const_iterator header_lines_iter = this->header_line_names_ordered.begin(); header_lines_iter != this->header_line_names_ordered.end(); ++header_lines_iter)
        {
            if (this->header_lines[(*header_lines_iter)] != "")
            {
                header_string += this->header_lines[(*header_lines_iter)] + "\n";
            }
        }
        //...

nothing is ever found for fileFormat, since only fileformat exists in the map.

I've confirmed that this can be fixed by either using all-lowercase keys in header_line_names_ordered, or using a custom comparitor in the header_lines and header_lists map to make insert and find operations on the map case-insensitive. I can submit a PR either way, but they're pretty different solutions.

Command line option to the format of filtered genotype

Hi Erik.

We were trying to add some filtering options to the genotype level in vcffilter. Mainly making it possible to replace the "." used for filtered genotype with a format of โ€œ./.:GQ:DP:RO:QR:AO:QA:GLโ€ (e.g. ./.:11.8728:1:1:37:0:0:0,-0.30077,-3.22336) where the "./." at the beginning replaces the assigned genotype, but we keep the rest of the data. Preferably, the distinction between these two filtering choices would be decided from command line as a setting.

It would be helpful to know within the code:

-Where GT:GQ:DP:RO:QR:AO:QA:GL final values are stored before being filtered/best way to access them.
-Where the "." filtering is decided that replaces the data.
-Where command line options are evaluated.

Could you please point us in the right direction? We will share the new version with you in case you want to merge it to yours.

Thank you!
Leandro

VcfAllelicPrimitives segfault with -m option

VcfAllelicPrimitives consistently segfaults with -m option when used on sample.vcf file. This occurs on the build of the latest release (8a5602b). All other options appear to work as expected. The command line generating segfault is:

cat sample.vcf | vcfallelicprimitives --use-mnps -t "Split primitives" -L "200"

vcfbreakmulti modifies GT calls incorrectly

When i process a vcf file using vcfbreakmulti, it modifies some GT calls oddly.

Look at the second sample GT.

Original record:
5 113698544 rs40179 G C 104439.72 PASS AC=1;AF=0.500;AN=2;BaseQRankSum=-7.310e-01;DB;DP=0;FS=0.523;GQ_MEAN=1678.26;GQ_STDDEV=1388.36;InbreedingCoeff=-0.2664;MQ=40.70;MQ0=0;MQRankSum=-2.960e-01;NCC=1;POSITIVE_TRAIN_SITE;QD=20.02;ReadPosRankSum=-2.170e-01;VQSLOD=2.53;culprit=FS GT:AD:DP:GQ:PL 0/1:3,7:.:58:162,0,58 ./.:0,0:0

After vcfbreakmulti:
5 113698544 rs40179 G C 104440 PASS AC=1;AF=0.500;AN=2;BaseQRankSum=-7.310e-01;DP=0;FS=0.523;GQ_MEAN=1678.26;GQ_STDDEV=1388.36;InbreedingCoeff=-0.2664;MQ=40.70;MQ0=0;MQRankSum=-2.960e-01;NCC=1;QD=20.02;ReadPosRankSum=-2.170e-01;VQSLOD=2.53;culprit=FS;DB;POSITIVE_TRAIN_SITE GT:AD:DP:GQ:PL 0/1:3,7:.:58:162,0,58 1/2:0,2,4:.:35:129,65,49,36,0,75

Suddenly the second sample's GT goes from nocall to having multiple alternative alleles.

And vcfbrakemulti should not even touch this record since there are no multiple alternative allels in the original file or am I missing something?

error building

Hi Erik,

I'm trying to build vcflib on mac osx maverick with:
gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.2.0
Thread model: posix

I get the following error when trying to build:
In file included from src/Variant.h:6:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1192:17: error: no matching function for call to object of type 'const vcf::ChromNameCompare'
if (_tree.value_comp().key_comp()(__k, __nd->_value.__cc.first))
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/map:1361:36: note: in instantiation of member function 'std::__1::mapstd::__1::basic_string<char,
std::__1::map<long, std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char,
std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > >,
std::__1::less, std::__1::allocator<std::__1::pair<const long, std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >,
std::__1::lessstd::__1::vector<std::__1::basic_string<char, std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const
std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>,
std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > > > > >, vcf::ChromNameCompare, std::__1::allocator<std::__1::pair<const std::__1::basic_string,
std::__1::map<long, std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char,
std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > >,
std::__1::less, std::__1::allocator<std::__1::pair<const long, std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >,
std::__1::lessstd::__1::vector<std::__1::basic_string<char, std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const
std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>,
std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > > > > > > > >::__find_equal_key' requested here
__node_base_pointer& __child = __find_equal_key(__parent, __k);
^
src/vcfcombine.cpp:109:42: note: in instantiation of member function 'std::__1::mapstd::__1::basic_string<char, std::__1::map<long, std::__1::map<std::__1::vector<std::__1::basic_string,
std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>,
std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char, std::__1::allocatorstd::__1::basic_string >
>, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > >, std::__1::less, std::__1::allocator<std::__1::pair<const long,
std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char,
std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > > > > >,
vcf::ChromNameCompare, std::__1::allocator<std::__1::pair<const std::__1::basic_string, std::__1::map<long, std::__1::map<std::__1::vector<std::__1::basic_string,
std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>,
std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char, std::__1::allocatorstd::__1::basic_string >
>, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > >, std::__1::less, std::__1::allocator<std::__1::pair<const long,
std::__1::map<std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >, std::__1::map<vcf::VariantCallFile *, vcf::Variant *,
std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > >, std::__1::lessstd::__1::vector<std::__1::basic_string<char,
std::__1::allocatorstd::__1::basic_string > >, std::__1::allocator<std::__1::pair<const std::__1::vector<std::__1::basic_string, std::__1::allocatorstd::__1::basic_string >,
std::__1::map<vcf::VariantCallFile *, vcf::Variant *, std::__1::less<vcf::VariantCallFile *>, std::__1::allocator<std::__1::pair<vcf::VariantCallFile *const, vcf::Variant *> > > > > > > > > > >
>::operator[]' requested here
variantsByChromPosAltFile[var->sequenceName][var->position][var->alt][vcf] = var;
^
src/Variant.h:487:10: note: candidate function not viable: 'this' argument has type 'const vcf::ChromNameCompare', but method is not marked const
bool operator()(const string& a, const string& b) {
^
1 error generated.
make: *** [bin/vcfcombine] Error 1

vcfbreakmulti keeps all AD values instead of using only two

I tried using vcfbreakmulti (If multiple alleles are specified in a single record, break the record into
multiple lines, preserving allele-specific INFO fields). It works mostly as specified, but there seems to be a problem with the AD values. It keeps the original values. Although there is only one alt allele listed after running the script, there are still more than two values in the AD field.

compiling on Ubuntu 12.04 64-bit

I got an issue trying to compile on an Ubuntu 12.04 64-bit VM:
...
gcc -g -Wall -O2 -fPIC -o tabix main.o -lm -lz -L. -ltabix
./libtabix.a(bgzf.o): In function deflate_block': /home/avilella/src/vcflib/tabixpp/bgzf.c:311: undefined reference todeflate'
/home/avilella/src/vcflib/tabixpp/bgzf.c:313: undefined reference to deflateEnd' /home/avilella/src/vcflib/tabixpp/bgzf.c:305: undefined reference todeflateInit2_'
/home/avilella/src/vcflib/tabixpp/bgzf.c:329: undefined reference to deflateEnd' /home/avilella/src/vcflib/tabixpp/bgzf.c:345: undefined reference tocrc32'
/home/avilella/src/vcflib/tabixpp/bgzf.c:346: undefined reference to crc32' ./libtabix.a(bgzf.o): In functioninflate_block':
/home/avilella/src/vcflib/tabixpp/bgzf.c:380: undefined reference to inflateInit2_' /home/avilella/src/vcflib/tabixpp/bgzf.c:385: undefined reference toinflate'
/home/avilella/src/vcflib/tabixpp/bgzf.c:391: undefined reference to inflateEnd' /home/avilella/src/vcflib/tabixpp/bgzf.c:387: undefined reference toinflateEnd'
./libtabix.a(bedidx.o): In function ks_getuntil': /home/avilella/src/vcflib/tabixpp/bedidx.c:11: undefined reference togzread'
./libtabix.a(bedidx.o): In function bed_read': /home/avilella/src/vcflib/tabixpp/bedidx.c:103: undefined reference togzdopen'
./libtabix.a(bedidx.o): In function ks_getc': /home/avilella/src/vcflib/tabixpp/bedidx.c:11: undefined reference togzread'
./libtabix.a(bedidx.o): In function bed_read': /home/avilella/src/vcflib/tabixpp/bedidx.c:138: undefined reference togzclose'
/home/avilella/src/vcflib/tabixpp/bedidx.c:103: undefined reference to gzopen64' collect2: ld returned 1 exit status make[2]: *** [tabix] Error 1 make[2]: g++ -O3 -D_FILE_OFFSET_BITS=64 -c -o smithwaterman/IndelAllele.o smithwaterman/IndelAllele.cpp *** Waiting for unfinished jobs.... make[2]: Leaving directory/home/avilella/src/vcflib/tabixpp'
make[1]: *** [all-recur] Error 1
make[1]: Leaving directory /home/avilella/src/vcflib/tabixpp' make: *** [tabixpp/tabix.o] Error 2 make: *** Waiting for unfinished jobs.... make[1]: Leaving directory/home/avilella/src/vcflib/fastahack'

vcfkeepsamples for a large number of samples

Hi Erik,

I want to use 'vcfkeepsamples' for a large number (290) of samples but this is not working for me. I have tried inputting sample names in the command line as well as using a shell script. Is there any solution to use this tool for large number of samples? or by feeding sample names by a file??

Regards,
Sanjeev

vcfcombine drops sites

This has been reported, but I haven't developed a test. I believe that attempting to combine multiple chromosomes may be the issue. It's possible that this can be reproduced by attempting to combine the VCFs produced by the SV group in the 1000G.

Error compiling with clang

vcflib seems to have some troubles compiling on OS X, with clang (Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn) from clang --version). I'm not quite sure what's going on here:

make all
cd tabixpp && /Applications/Xcode.app/Contents/Developer/usr/bin/make
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  bgzf.c -o bgzf.o
bgzf.c:44:1: warning: unused function 'kh_clear_cache' [-Wunused-function]
KHASH_MAP_INIT_INT64(cache, cache_t)
^
./khash.h:468:2: note: expanded from macro 'KHASH_MAP_INIT_INT64'
        KHASH_INIT(name, uint64_t, khval_t, 1, kh_int64_hash_func, kh_int64_hash_equal)
        ^
./khash.h:140:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_clear_##name(kh_##name##_t *h)                            \
                           ^
<scratch space>:11:1: note: expanded from here
kh_clear_cache
^
1 warning generated.
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  kstring.c -o kstring.o
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  knetfile.c -o knetfile.o
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  index.c -o index.o
index.c:34:1: warning: unused function 'kh_clear_i' [-Wunused-function]
KHASH_MAP_INIT_INT(i, ti_binlist_t)
^
./khash.h:453:2: note: expanded from macro 'KHASH_MAP_INIT_INT'
        KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)
        ^
./khash.h:140:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_clear_##name(kh_##name##_t *h)                            \
                           ^
<scratch space>:25:1: note: expanded from here
kh_clear_i
^
index.c:34:1: warning: unused function 'kh_del_i' [-Wunused-function]
./khash.h:453:2: note: expanded from macro 'KHASH_MAP_INIT_INT'
        KHASH_INIT(name, uint32_t, khval_t, 1, kh_int_hash_func, kh_int_hash_equal)
        ^
./khash.h:259:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_del_##name(kh_##name##_t *h, khint_t x)           \
                           ^
<scratch space>:39:1: note: expanded from here
kh_del_i
^
index.c:35:1: warning: unused function 'kh_clear_s' [-Wunused-function]
KHASH_MAP_INIT_STR(s, int)
^
./khash.h:484:2: note: expanded from macro 'KHASH_MAP_INIT_STR'
        KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
        ^
./khash.h:140:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_clear_##name(kh_##name##_t *h)                            \
                           ^
<scratch space>:54:1: note: expanded from here
kh_clear_s
^
index.c:35:1: warning: unused function 'kh_del_s' [-Wunused-function]
./khash.h:484:2: note: expanded from macro 'KHASH_MAP_INIT_STR'
        KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
        ^
./khash.h:259:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_del_##name(kh_##name##_t *h, khint_t x)           \
                           ^
<scratch space>:68:1: note: expanded from here
kh_del_s
^
4 warnings generated.
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  bedidx.c -o bedidx.o
bedidx.c:20:1: warning: unused function 'kh_clear_reg' [-Wunused-function]
KHASH_MAP_INIT_STR(reg, bed_reglist_t)
^
./khash.h:484:2: note: expanded from macro 'KHASH_MAP_INIT_STR'
        KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
        ^
./khash.h:140:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_clear_##name(kh_##name##_t *h)                            \
                           ^
<scratch space>:212:1: note: expanded from here
kh_clear_reg
^
bedidx.c:20:1: warning: unused function 'kh_del_reg' [-Wunused-function]
./khash.h:484:2: note: expanded from macro 'KHASH_MAP_INIT_STR'
        KHASH_INIT(name, kh_cstr_t, khval_t, 1, kh_str_hash_func, kh_str_hash_equal)
        ^
./khash.h:259:21: note: expanded from macro 'KHASH_INIT'
        static inline void kh_del_##name(kh_##name##_t *h, khint_t x)           \
                           ^
<scratch space>:226:1: note: expanded from here
kh_del_reg
^
2 warnings generated.
ar -cru libtabix.a bgzf.o kstring.o knetfile.o index.o bedidx.o
ranlib libtabix.a
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  main.c -o main.o
gcc -g -Wall -O2 -fPIC  -o tabix main.o -lm  -L. -ltabix -lz
gcc -c -g -Wall -O2 -fPIC  -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE  bgzip.c -o bgzip.o
gcc -g -Wall -O2 -fPIC  -o bgzip bgzip.o bgzf.o knetfile.o -lz
g++ -g -Wall -O2 -fPIC  -c tabix.cpp
g++ -g -Wall -O2 -fPIC  -o tabix++ main.cpp tabix.o bgzf.o -lm  -L. -ltabix -lz
g++ -c -o src/Variant.o src/Variant.cpp -I. -L. -Ltabixpp/ -ltabix -lz -lm  -O3 -D_FILE_OFFSET_BITS=64
clang: warning: -ltabix: 'linker' input unused
clang: warning: -lz: 'linker' input unused
clang: warning: -lm: 'linker' input unused
clang: warning: argument unused during compilation: '-L.'
clang: warning: argument unused during compilation: '-Ltabixpp/'
src/Variant.cpp:212:5: warning: control may reach end of non-void function [-Wreturn-type]
    }
    ^
src/Variant.cpp:334:5: warning: control may reach end of non-void function [-Wreturn-type]
    }
    ^
src/Variant.cpp:368:5: warning: control may reach end of non-void function [-Wreturn-type]
    }
    ^
src/Variant.cpp:406:5: warning: control may reach end of non-void function [-Wreturn-type]
    }
    ^
4 warnings generated.
g++ -c -o src/split.o src/split.cpp -I. -L. -Ltabixpp/ -ltabix -lz -lm  -O3 -D_FILE_OFFSET_BITS=64
clang: warning: -ltabix: 'linker' input unused
clang: warning: -lz: 'linker' input unused
clang: warning: -lm: 'linker' input unused
clang: warning: argument unused during compilation: '-L.'
clang: warning: argument unused during compilation: '-Ltabixpp/'
cd smithwaterman && /Applications/Xcode.app/Contents/Developer/usr/bin/make
c++    -c -o smithwaterman.o smithwaterman.cpp
c++    -c -o BandedSmithWaterman.o BandedSmithWaterman.cpp
c++    -c -o SmithWatermanGotoh.o SmithWatermanGotoh.cpp
c++    -c -o Repeats.o Repeats.cpp
c++    -c -o LeftAlign.o LeftAlign.cpp
LeftAlign.cpp:679:26: warning: '&&' within '||' [-Wlogical-op-parentheses]
            && (indel.insertion && indel.position == referenceSequence.size()
                ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LeftAlign.cpp:679:26: note: place parentheses around the '&&' expression to silence this warning
            && (indel.insertion && indel.position == referenceSequence.size()
                                ^
                (                                                            )
1 warning generated.
c++    -c -o IndelAllele.o IndelAllele.cpp
cc -Wall -O3   -c -o disorder.o disorder.c
  * linking smithwaterman
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated
ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZNKSt3__16vectorINS_4pairIicEENS_9allocatorIS2_EEE8max_sizeEv) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [smithwaterman] Error 1
make: *** [smithwaterman/SmithWatermanGotoh.o] Error 2

VCFfilter gives no header error

Hello Eric,
I am trying to use vcffilter on a vcf file that i got from bcftools. Though the vcf file have header in it, the vcffilter reports an error: no VCF header

Here is my command for the vcffilter
opt/vcflib-master/vcflib/bin/vcffilter --info-filter "DP > 2 & QUAL > 20" --tag-pass BM.vcf.recode.vcf > BM_filtered.vcf

Thank you.

Build Error

When I run make I get the following error:

cd fsom && g++ -O3 -D_FILE_OFFSET_BITS=64 -c fsom.c -lm
fsom.h:77: error: non-local function 'void som_network_destroy(som_network_t*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:78: error: non-local function 'void som_set_inputs(som_network_t*, double*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:79: error: non-local function 'void som_train(som_network_t*, double**, size_t, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:80: error: non-local function 'void som_serialize(som_network_t*, const char*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:81: error: non-local function 'void som_init_weights(som_network_t*, double**, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:82: error: non-local function 'double som_get_best_neuron_coordinates(som_network_t*, size_t*, size_t*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:83: error: non-local function 'som_network_t* som_deserialize(const char*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.h:84: error: non-local function 'som_network_t* som_network_new(size_t, size_t, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:249: error: non-local function 'som_network_t* som_network_new(size_t, size_t, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:397: error: non-local function 'void som_network_destroy(som_network_t*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:417: error: non-local function 'void som_set_inputs(som_network_t*, double*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:436: error: non-local function 'double som_get_best_neuron_coordinates(som_network_t*, size_t*, size_t*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:560: error: non-local function 'double som_learning_rate_fast(som_network_t*, size_t, double, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c: In function 'void som_train_iteration(som_network_t*, double*, size_t)':
fsom.c:597: warning: converting to 'size_t' from 'double'
fsom.c: At global scope:
fsom.c:616: error: non-local function 'void som_init_weights(som_network_t*, double**, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:859: error: non-local function 'void som_train(som_network_t*, double**, size_t, size_t)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:887: error: non-local function 'void som_serialize(som_network_t*, const char*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
fsom.c:927: error: non-local function 'som_network_t* som_deserialize(const char*)' uses anonymous type
fsom.h:75: error: 'typedef struct<anonymous> som_network_t' does not refer to the unqualified type, so it is not used for linkage
make[1]: *** [fsom/fsom.o] Error 1

GCC version:

gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)

vcffilter flagging/removing heterozygous genotypes

Hi Eric

I am having a hard time implementing a filter with vcffilter to flag/remove heterozygous sites and I was hoping you could help. Here is the situation:

The vcf file has individuals with 0/0, 1/1 and 0/1 genotypes. From this file I tried to achieve two things:
1- Convert sample assigned as heterozygous to missing.
2- Flag sites with at least one sample assigned as heterozygous (0/1).

The details of what I tried is below. I appreciate if you could help me identify if I am doing something wrong or if there is a bug here.

Thanks much.

Leandro

DETAILS

For 1 I tried the following:
vcffilter --genotype-filter "GT = 0/1" $VCFFILTER
This converts all 0/0 and 1/1 samples to missing. I wanted the opposite, so I tried adding --invert but it produced the exact same output. I also tried adding --genotype-filter ! "(GT = 0/1)", but there was no output being generated.
As a workaround I wrote a perl script for this.

For 2 I tried the following:
vcffilter --tag --genotype-filter "GT = 0/1" $VCFFILE

And returned and error
terminate called after throwing an instance of 'std::out_of_range'
what(): basic_string::substr
Aborted
I could not find a workaround for this issue yet.

VERSION: vcflib/20121207

Source files lack license headers

Even though the README.md specifies this project's license, it would be very useful if vcflib were to be used by other projects to have MIT license headers in every source file.

vcffilter -r/--region

Hi Erik,
I'm getting an error when trying to filter a vcf file to a genomic region. Further I couldn't see any documentation re the expected format of the --region setting, so hopefully this is correct usage:

vcffilter -r chrM:1-100 dbsnp_137.hg19.vcf.gz

terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr
Aborted

any ideas?
cheers,
Mark

using vcflib created on 2013-07-09

Downloading and installing problem

Hello
I am trying to download vcflib onto server. But i couldn't download it. I followed the instructions given, all I am able to get is index.html and 2 png files. Please help me to download it. Thanks in advance.

vcf2fasta error

Hi
I am trying to use the vcf2fasta tool . I am getting an error :
variant scaffold79:110 is not phased, cannot convert to fasta

Can you help me out to resolve this.

Best

Documentation for vcfgenotypecompare?

Firstly thanks for this great toolkit. Very useful to me.

The above function provides me with lots of INFO tags. The AR_AR types are fine, and fairly self explanatory. However I am having some trouble interpreting the meaning of the 'discrepancy' columns. Particularly the pos/null/neg.

Apologies if I've got this wrong, but can't see anything in the documentation.
Thank you!

eg:
genotypes.alternate_count"
genotypes.count"
site.alternate_negative_discrepancy"
site.alternate_null_discrepancy"
site.alternate_positive_discrepancy"
site.call_concordance"
site.call_discrepancy"
site.non_reference_discrepancy"
site.non_reference_discrepancy.count"
site.non_reference_discrepancy.normalizer"
site.non_reference_sensitivity"
site.non_reference_sensitivity.count"
site.non_reference_sensitivity.normalizer"
has_variant"

Coding standards for contributions -- is it ok to use c++11 syntax?

Hi there,
I'm looking at modifying some vcflib code to later contribute back to the project. Looking at vcfbreakmulti, it looks like it was written in pre-c++11. Nothing wrong with that, but is it ok for me to use c++11? Is there a project policy about such things?

het/hom ratio counts wildtypes (ref/ref) as hom

The het/hom ratio program incorrectly counts wild-type reference positions as homozygous. This is particularly a problem with multi-sample files.

This can be corrected by adding a condition to your else clause on line 48:

        } else if (isHomNonRef(genotype)) {

vcffilter related error

I am applying vcffilter on a Freebayes vcf file but having the following error message:
error: no VCF header

my command line is:
qsub -V -cwd -j yes -b y -l hostname="n13*" vcffilter -g "DP > 15" TSB_GBS_geno384_bwt2_vsensN1_L_0_-0.37_08MM.bam.SNPs.vcf | vcffixup - | > TSB_8MM_FB_geno384_fltdDP15_fixed.vcf

Previously I have tested exactly same commands on the similar file but it worked fine though at that time I just tested it on a smaller subset.

At first I applied vcffilter on vcfindex parsed file and thought the issue could be related to that but then I also attempted this filter on the original vcf file but got the same error.

Is this a known issue? Any help on this would be highly appreciated.

Regards,
Sanjeev

unexpected vcfannotategenotypes behaviour: does not annotate whole of fileA.

Hi,

When I compare genotype calls from two VCFs I have noticed that FileA is only evaluated up to the last variant in FileB.

vcfannotategenotypes

This is problematic where the lack of a variant call is meaningful. eg comparing a strict vs lax SNV calls to a gold standard dataset. For the strict dataset, the gold standard will only be evaluated to the last call made by the strict caller. Subsequent false negatives are not identified.

Upon closer inspection the problem seems to be with the vcfannotategeneotypes step.

Would be very grateful for a workaround- I appreciate this may not be the expected use case of this tool.

Here is some code that should illustrate the problem:

#!/bin/bash
VCFFILE=ALL.chr7.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz
if [ ! -e $VCFFILE ]
then 
  curl -O ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/$VCFFILE.tbi
  curl -O ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/$VCFFILE
fi

# attenuate to first 2k for speed
zcat $VCFFILE | head -n 2000 > subset.1kg.vcf

# take 1st variant only
perl -n -e 'if ($_ =~ m/^#/) { print } else {print; last;}' subset.1kg.vcf > subset.first.vcf

# take last variant only
perl -n -e 'if ($_ =~ m/^#/) { print } elsif (eof) {print;}' subset.1kg.vcf > subset.last.vcf

# run vcfgtcompare
vcfgtcompare.sh TEST subset.1kg.vcf subset.first.vcf | vcf2tsv > result.first
vcfgtcompare.sh TEST subset.1kg.vcf subset.last.vcf | vcf2tsv > result.last

wc result.first result.last
     2     98   1179 result.first
  1971  68558 343877 result.last
  1973  68656 345056 total

vcffilter tag only (-F)

vcffilter --tag-fail isn't working for me... probably my fault, but the usage is at least unclear.

If I do a command like:
vcffilter -f 'AC > 10' -F TEST
It just removes removes the failing lines as if -F were not given.

It would also be nice to know what INFO fields vcffilter updates (if any). There other filtering programs, but I'm assuming vcflib/vcftools will tend to handle freebayes output more completely/properly than something like bcftools would.

vcfcleancomplex segfault

vcfcleancomplex (with no options) is segfaulting on a freebayes generated vcf.
Here is a test vcf reduced down to a single failing variant line:
http://popi.ucdavis.edu/~travc/tmp/vcfcleancomplex_fail.vcf
(Cloned fresh about 24 hours ago... version numbers should be in the vcf header.)

I don't really know what vcfcleancomplex is supposed to do, which is why I was trying to run it to find out.

UPDATE: vcfstats segfaults on the same file. Which is more annoying to me since vcfstats seem potentially useful to me.
vcfallelicprimitives runs fine though, so it isn't something wrong with my build of everything in vcflib.

vcfgeno2haplo has REF as one of the ALT alleles

Hi Erik,

When running vcfgeno2haplo, sometimes ALT contains the exact REF sequence as one of the alleles, which causes an error with GATK. For example,

1 17220305 . A G . PASS callers=cortex;isPolymorphic=1;editDistance=2 GT:ED 1|1:4
1 17220318 . C T . PASS callers=bwa,isaac;isPolymorphic=1;editDistance=2 GT:ED 1|0:6

gets combined to:
1 17220305 . GCACCATTTGGCCC GCACCATTTGGCCC,GCACCATTTGGCCT 6.95323e-310 . callers=cortex;editDistance=2;isPolymorphic=1 GT:ED 2|1:.

Do you have another tool to fix this?

Thanks!
Justin

vcflatten segfaults on sample.vcf file

user@host$ vcfflatten sample.vcf 
##fileformat=VCFv4.0
##fileDate=20090805
##source=myImputationProgramV3.1
##reference=1000GenomesPilot-NCBI36
##phasing=partial
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=AC,Number=.,Type=Integer,Description="Allele count in genotypes, for each ALT allele, in the same order as listed">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Total Depth">
##INFO=<ID=AF,Number=.,Type=Float,Description="Allele Frequency">
##INFO=<ID=AA,Number=1,Type=String,Description="Ancestral Allele">
##INFO=<ID=DB,Number=0,Type=Flag,Description="dbSNP membership, build 129">
##INFO=<ID=H2,Number=0,Type=Flag,Description="HapMap2 membership">
##FILTER=<ID=q10,Description="Quality below 10">
##FILTER=<ID=s50,Description="Less than 50% of samples have data">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=GQ,Number=1,Type=Integer,Description="Genotype Quality">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
##FORMAT=<ID=HQ,Number=2,Type=Integer,Description="Haplotype Quality">
##ALT=<ID=DEL:ME:ALU,Description="Deletion of ALU element">
##ALT=<ID=CNV,Description="Copy number variable region">
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  NA00001 NA00002 NA00003
19  111 .   A   C   9.6 .   .   GT:HQ   0|0:10,10   0|0:10,10   0/1:3,3
19  112 .   A   G   10  .   .   GT:HQ   0|0:10,10   0|0:10,10   0/1:3,3
20  14370   rs6054257   G   A   29  PASS    AF=0.5;DP=14;NS=3;DB;H2 GT:GQ:DP:HQ 0|0:48:1:51,51  1|0:48:8:51,51  1/1:43:5:.,.
20  17330   .   T   A   3   q10 AF=0.017;DP=11;NS=3 GT:GQ:DP:HQ 0|0:49:3:58,50  0|1:3:5:65,3    0/0:41:3:.,.
20  1110696 rs6040355   A   T   67  PASS    AA=T;AF=0.333,0.667;DP=10;NS=2;DB   GT:GQ:DP:HQ 1|2:21:6:23,27  2|1:2:0:18,2    2/2:35:4:.,.
20  1230237 .   T   .   47  PASS    AA=T;DP=13;NS=3 GT:GQ:DP:HQ 0|0:54:.:56,60  0|0:48:4:51,51  0/0:61:2:.,.
Segmentation fault

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.