jvarkit

VcfSetSequenceDictionary

Last commit

Set the ##contig lines in a VCF header on the fly

Usage

Usage: vcfsetdict [options] Files
  Options:
    -ho, --header-only
      only change the vcf header. Keep the whole VCF body unchanged. The idea 
      is to use a faster(?) `sed sed 's/^chr//' ` for the VCF body.
      Default: false
    -h, --help
      print help and exit
    --helpFormat
      What kind of help. One of [usage,markdown,xml].
    -n, --onNotFound
      Contig converter. I will do my best to convert the contig names (e.g 
      'chr1' -> '1'): But what should I do when comparing two dictionaries 
      with different notations
      Default: SKIP
      Possible Values: [RAISE_EXCEPTION, SKIP, RETURN_ORIGINAL]
    -o, --output
      Output file. Optional . Default: stdout
  * -r, -R, --reference
      Indexed fasta Reference file. This file must be indexed with samtools 
      faidx and with picard CreateSequenceDictionary
    --version
      print version and exit

Keywords

Compilation

Requirements / Dependencies

Download and Compile

$ git clone "https://github.com/lindenb/jvarkit.git"
$ cd jvarkit
$ ./gradlew vcfsetdict

The java jar file will be installed in the dist directory.

Source code

https://github.com/lindenb/jvarkit/tree/master/src/main/java/com/github/lindenb/jvarkit/tools/misc/VcfSetSequenceDictionary.java

Unit Tests

https://github.com/lindenb/jvarkit/tree/master/src/test/java/com/github/lindenb/jvarkit/tools/misc/VcfSetSequenceDictionaryTest.java

Contribute

License

The project is licensed under the MIT license.

Citing

Should you cite vcfsetdict ? https://github.com/mr-c/shouldacite/blob/master/should-I-cite-this-software.md

The current reference is:

http://dx.doi.org/10.6084/m9.figshare.1425030

Lindenbaum, Pierre (2015): JVarkit: java-based utilities for Bioinformatics. figshare. http://dx.doi.org/10.6084/m9.figshare.1425030

The tool will try to convert the contig names (β€˜1’ -> β€˜chr1’) according to the new dictionary.

Example

java  -jar jvarkit-git/vcfsetdict.jar --onNotFound SKIP -r ref.fasta input.vcf > out.vcf

History