Giter Club home page Giter Club logo

Comments (2)

ACEnglish avatar ACEnglish commented on July 24, 2024 1

The base SVs don't have an INFO/END defined.

For example, if I take the first entry from your base VCF:

##fileformat=VCFv4.0
##FILTER=<ID=PASS,Description="All filters passed">
##fileDate=99991122
##contig=<ID=2L,length=23513712>
##contig=<ID=2R,length=25286936>
##contig=<ID=3L,length=28110227>
##contig=<ID=3R,length=32079331>
##contig=<ID=4,length=1348131>
##contig=<ID=X,length=23542271>
##contig=<ID=Y,length=3667352>
##ALT=<ID=INS,Description=Insertion of novel sequence relative to the reference>
##ALT=<ID=DEL,Description=Deletion relative to the reference>
##ALT=<ID=DUP,Description=Region of elevated copy number relative to the reference>
##ALT=<ID=INV,Description=Inversion of reference sequence>
##ALT=<ID=BND,Description=Breakend of translocation>
##INFO=<ID=SVTYPE,Number=1,Type=String,Description=Type of structural variant>
##INFO=<ID=SVLEN,Number=1,Type=Integer,Description=Difference in length between REF and ALT alleles>
##FORMAT=<ID=GT,Number=1,Type=String,Description=Genotype>
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	Hifi_60x_0.999_1_cute
2L	61980	idINS61980	a	<INS>	30	PASS	SVTYPE=INS;SVLEN=89	GT	1/1

And run it through htslib:

import pysam
import sys

v = pysam.VariantFile(sys.argv[1])
o = pysam.VariantFile("delme.vcf", 'w', header=v.header)

for e in v:
    o.write(e)

I get the error:

[E::vcf_format] Invalid BCF, the INFO tag id=4 is too large at 2L:61980
Traceback (most recent call last):
  File "/Users/english/code/truvari/tickets/long/tmp.py", line 8, in <module>
    o.write(e)
  File "pysam/libcbcf.pyx", line 4482, in pysam.libcbcf.VariantFile.write
  File "pysam/libcbcf.pyx", line 4519, in pysam.libcbcf.VariantFile.write
OSError: [Errno 22] b'Invalid argument'

But when I add INFO/END:

##fileformat=VCFv4.0
##FILTER=<ID=PASS,Description="All filters passed">
##fileDate=99991122
##contig=<ID=2L,length=23513712>
##contig=<ID=2R,length=25286936>
##contig=<ID=3L,length=28110227>
##contig=<ID=3R,length=32079331>
##contig=<ID=4,length=1348131>
##contig=<ID=X,length=23542271>
##contig=<ID=Y,length=3667352>
##ALT=<ID=INS,Description=Insertion of novel sequence relative to the reference>
##ALT=<ID=DEL,Description=Deletion relative to the reference>
##ALT=<ID=DUP,Description=Region of elevated copy number relative to the reference>
##ALT=<ID=INV,Description=Inversion of reference sequence>
##ALT=<ID=BND,Description=Breakend of translocation>
##INFO=<ID=SVTYPE,Number=1,Type=String,Description=Type of structural variant>
##INFO=<ID=SVLEN,Number=1,Type=Integer,Description=Difference in length between REF and ALT alleles>
##INFO=<ID=END,Number=1,Type=Integer,Description=End position>
##FORMAT=<ID=GT,Number=1,Type=String,Description=Genotype>
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	Hifi_60x_0.999_1_cute
2L	61980	idINS61980	a	<INS>	30	PASS	SVTYPE=INS;SVLEN=89;END=61981	GT	1/1

I do not get the error.

from truvari.

jyw-atgithub avatar jyw-atgithub commented on July 24, 2024

Thank you!!

from truvari.

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.