{"id":13704187,"url":"https://github.com/brentp/cyvcf2","last_synced_at":"2026-01-27T03:36:34.767Z","repository":{"id":36300685,"uuid":"40605275","full_name":"brentp/cyvcf2","owner":"brentp","description":"cython + htslib == fast VCF and BCF processing","archived":false,"fork":false,"pushed_at":"2025-10-13T16:18:05.000Z","size":15143,"stargazers_count":421,"open_issues_count":46,"forks_count":75,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-12-07T08:55:42.988Z","etag":null,"topics":["bioinformatics","cython","genomics","htslib","vcf"],"latest_commit_sha":null,"homepage":"","language":"Cython","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brentp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2015-08-12T14:30:29.000Z","updated_at":"2025-12-05T07:47:12.000Z","dependencies_parsed_at":"2023-01-17T00:15:24.228Z","dependency_job_id":"d0c286d7-944f-4fe6-964a-1403f54af6ff","html_url":"https://github.com/brentp/cyvcf2","commit_stats":{"total_commits":461,"total_committers":42,"mean_commits":"10.976190476190476","dds":"0.26464208242950105","last_synced_commit":"70cc9b3cd6a8e64521fee2a74165906ee997f256"},"previous_names":[],"tags_count":101,"template":false,"template_full_name":null,"purl":"pkg:github/brentp/cyvcf2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentp%2Fcyvcf2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentp%2Fcyvcf2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentp%2Fcyvcf2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentp%2Fcyvcf2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brentp","download_url":"https://codeload.github.com/brentp/cyvcf2/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brentp%2Fcyvcf2/sbom","scorecard":{"id":252388,"data":{"date":"2025-08-11","repo":{"name":"github.com/brentp/cyvcf2","commit":"541ab16a255a5287c331843d8180ed6b9ef10e00"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":3,"reason":"Found 6/16 approved changesets -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/build.yml:1","Warn: no topLevel permission defined: .github/workflows/wheels.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:133: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:138: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:191: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:195: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:234: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/build.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:75: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/build.yml:79: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/build.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:62: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheels.yml:68: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheels.yml:71: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheels.yml:104: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:106: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:115: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:118: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:130: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/wheels.yml:141: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/wheels.yml:147: update your workflow using https://app.stepsecurity.io/secureworkflow/brentp/cyvcf2/wheels.yml/main?enable=pin","Warn: containerImage not pinned by hash: ci/Dockerfile.alpine.test:3","Warn: containerImage not pinned by hash: ci/Dockerfile.slim.test:3","Warn: pipCommand not pinned by hash: ci/Dockerfile.alpine.test:11","Warn: pipCommand not pinned by hash: ci/Dockerfile.alpine.test:11","Warn: pipCommand not pinned by hash: ci/Dockerfile.slim.test:13","Warn: pipCommand not pinned by hash: ci/Dockerfile.slim.test:13","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:104","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:105","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:117","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:122","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:201","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:215","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:221","Warn: pipCommand not pinned by hash: .github/workflows/build.yml:229","Warn: pipCommand not pinned by hash: .github/workflows/wheels.yml:125","Info:   0 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   8 third-party GitHubAction dependencies pinned","Info:   0 out of   2 containerImage dependencies pinned","Info:   0 out of  13 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/build.yml:6"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2018-34 / GHSA-2fc2-6r4j-p65h","Warn: Project is vulnerable to: PYSEC-2021-856 / GHSA-5545-2q6w-2gh6","Warn: Project is vulnerable to: PYSEC-2019-108 / GHSA-9fq2-x9r6-wfmf","Warn: Project is vulnerable to: PYSEC-2018-33 / GHSA-cw6w-4rcx-xphc","Warn: Project is vulnerable to: PYSEC-2021-857 / GHSA-f7c7-j99h-c22f","Warn: Project is vulnerable to: GHSA-fpfv-jqm9-f5jm","Warn: Project is vulnerable to: PYSEC-2017-1 / GHSA-frgw-fgh6-9g52","Warn: Project is vulnerable to: PYSEC-2013-22 / GHSA-27x4-j476-jp5f","Warn: Project is vulnerable to: PYSEC-2025-49 / GHSA-5rjg-fvgr-3xxf","Warn: Project is vulnerable to: GHSA-cx63-2mw6-8hw5","Warn: Project is vulnerable to: PYSEC-2022-43012 / GHSA-r9hx-vwmv-q579"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 20 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-17T08:49:04.687Z","repository_id":36300685,"created_at":"2025-08-17T08:49:04.688Z","updated_at":"2025-08-17T08:49:04.688Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28799828,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T01:07:07.743Z","status":"online","status_checked_at":"2026-01-27T02:00:07.755Z","response_time":168,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bioinformatics","cython","genomics","htslib","vcf"],"created_at":"2024-08-02T21:01:05.362Z","updated_at":"2026-01-27T03:36:34.752Z","avatar_url":"https://github.com/brentp.png","language":"Cython","funding_links":[],"categories":["Next Generation Sequencing"],"sub_categories":["Python Modules"],"readme":"cyvcf2\n======\n\nNote: cyvcf2 versions \u003c 0.20.0 require htslib \u003c 1.10. cyvcf2 versions \u003e= 0.20.0 require htslib \u003e= 1.10\n\n\u003c!-- ghp-import -p docs/build/html/ --\u003e\nThe latest documentation for cyvcf2 can be found here:\n\n[![Docs](https://img.shields.io/badge/docs-latest-blue.svg)](http://brentp.github.io/cyvcf2/)\n\nIf you use cyvcf2, please cite the [paper](https://academic.oup.com/bioinformatics/article/2971439/cyvcf2)\n\n\nFast python **(2 and 3)** parsing of VCF and BCF including region-queries.\n\n\n[![Build](https://github.com/brentp/cyvcf2/actions/workflows/build.yml/badge.svg)](https://github.com/brentp/cyvcf2/actions/workflows/build.yml)\n\ncyvcf2 is a cython wrapper around [htslib](https://github.com/samtools/htslib) built for fast parsing of [Variant Call Format](https://en.m.wikipedia.org/wiki/Variant_Call_Format) (VCF) files.\n\nAttributes like `variant.gt_ref_depths` work for diploid samples and return a numpy array directly so they are immediately ready for downstream use.\n**note** that the array is backed by the underlying C data, so, once `variant` goes out of scope. The array will contain nonsense.\nTo persist a copy, use: `cpy = np.array(variant.gt_ref_depths)` instead of just `arr = variant.gt_ref_depths`.\n\nExample\n=======\n\nThe example below shows much of the use of cyvcf2.\n\n```Python\nfrom cyvcf2 import VCF\n\nfor variant in VCF('some.vcf.gz'): # or VCF('some.bcf')\n    variant.REF, variant.ALT # e.g. REF='A', ALT=['C', 'T']\n\n    variant.CHROM, variant.start, variant.end, variant.ID, \\\n                variant.FILTER, variant.QUAL\n\n    # numpy arrays of specific things we pull from the sample fields.\n    # gt_types is array of 0,1,2,3==HOM_REF, HET, UNKNOWN, HOM_ALT\n    variant.gt_types, variant.gt_ref_depths, variant.gt_alt_depths # numpy arrays\n    variant.gt_phases, variant.gt_quals, variant.gt_bases # numpy array\n\n    ## INFO Field.\n    ## extract from the info field by it's name:\n    variant.INFO.get('DP') # int\n    variant.INFO.get('FS') # float\n    variant.INFO.get('AC') # float\n\n    # convert back to a string.\n    str(variant)\n\n\n    ## sample info...\n\n    # Get a numpy array of the depth per sample:\n    dp = variant.format('DP')\n    # or of any other format field:\n    sb = variant.format('SB')\n    assert sb.shape == (n_samples, 4) # 4-values per\n\n# to do a region-query:\n\nvcf = VCF('some.vcf.gz')\nfor v in vcf('11:435345-556565'):\n    if v.INFO[\"AF\"] \u003e 0.1: continue\n    print(str(v))\n```\n\nInstallation\n============\n\n## pip with bundled htslib\n```\npip install cyvcf2\n```\n\n## pip with system htslib\n\nAssuming you have already built and installed htslib version 1.12 or higher.\n```\nCYVCF2_HTSLIB_MODE=EXTERNAL pip install --no-binary cyvcf2 cyvcf2\n```\n\n## windows (experimental, only test on MSYS2)\n\nAssuming you have already built and installed htslib.\n```\nSETUPTOOLS_USE_DISTUTILS=stdlib pip install cyvcf2\n```\n\n## github (building htslib and cyvcf2 from source)\n\n```\ngit clone --recursive https://github.com/brentp/cyvcf2\npip install -r requirements.txt\n# sometimes it can be required to remove old files:\n# python setup.py clean_ext\nCYVCF2_HTSLIB_MODE=BUILTIN CYTHONIZE=1 python setup.py install\n# or to use a system htslib.so\nCYVCF2_HTSLIB_MODE=EXTERNAL python setup.py install\n```\n\nOn **OSX**, using brew, you may have to set the following as indicated by the brew install:\n\n```\nFor compilers to find openssl you may need to set:\n  export LDFLAGS=\"-L/usr/local/opt/openssl/lib\"\n  export CPPFLAGS=\"-I/usr/local/opt/openssl/include\"\n\nFor pkg-config to find openssl you may need to set:\n  export PKG_CONFIG_PATH=\"/usr/local/opt/openssl/lib/pkgconfig\"\n```\n\nTesting\n=======\n\nInstall `pytest`, then tests can be run with:\n\n```\npytest\n```\n\nCLI\n=======\nRun with `cyvcf2 path_to_vcf`\n\n```\n$ cyvcf2 --help\nUsage: cyvcf2 [OPTIONS] \u003cvcf_file\u003e or -\n\n  fast vcf parsing with cython + htslib\n\nOptions:\n  -c, --chrom TEXT                Specify what chromosome to include.\n  -s, --start INTEGER             Specify the start of region.\n  -e, --end INTEGER               Specify the end of the region.\n  --include TEXT                  Specify what info field to include.\n  --exclude TEXT                  Specify what info field to exclude.\n  --loglevel [DEBUG|INFO|WARNING|ERROR|CRITICAL]\n                                  Set the level of log output.  [default:\n                                  INFO]\n  --silent                        Skip printing of vcf.\n  --help                          Show this message and exit.\n```\n\n\nSee Also\n========\n\nPysam also [has a cython wrapper to htslib](https://github.com/pysam-developers/pysam/blob/master/pysam/libcbcf.pyx) and one block of code here is taken directly from that library. But, the optimizations that we want for gemini are very specific so we have chosen to create a separate project.\n\nPerformance\n===========\n\nFor the performance comparison in the paper, we used [thousand genomes chromosome 22](ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/ALL.chr22.phase3_shapeit2_mvncall_integrated_v5a.20130502.genotypes.vcf.gz)\nWith the full comparison runner [here](https://github.com/brentp/cyvcf2/blob/main/scripts/compare.sh).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentp%2Fcyvcf2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrentp%2Fcyvcf2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrentp%2Fcyvcf2/lists"}