vcf-subset 1.1.2__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ on:
2
+ pull_request:
3
+ branches:
4
+ - develop
5
+ - main
6
+ push:
7
+ tags:
8
+ - '*.*.*'
9
+ - '*.*.*-rc*'
10
+
11
+ jobs:
12
+ gitleaks:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ with:
17
+ fetch-depth: 0
18
+
19
+ - name: Check for GitLeaks
20
+ uses: gacts/gitleaks@v1
@@ -0,0 +1,123 @@
1
+ # This file is autogenerated by maturin v1.7.0
2
+ # To update, run
3
+ #
4
+ # maturin generate-ci github
5
+ #
6
+ name: Release package
7
+
8
+ on:
9
+ release:
10
+ types: [published]
11
+
12
+ permissions:
13
+ contents: read
14
+
15
+ jobs:
16
+ cargo:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v3
20
+ - uses: actions-rs/toolchain@v1
21
+ with:
22
+ toolchain: stable
23
+ override: true
24
+ - uses: katyo/publish-crates@v2
25
+ with:
26
+ registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
27
+ linux:
28
+ runs-on: ${{ matrix.platform.runner }}
29
+ strategy:
30
+ matrix:
31
+ platform:
32
+ - runner: ubuntu-latest
33
+ target: x86_64
34
+ # The manylinux2014 i686 container can't resolve vault.centos.org on
35
+ # ubuntu-26.04. See https://github.com/PyO3/maturin-action/issues/484
36
+ - runner: ubuntu-24.04
37
+ target: x86
38
+ - runner: ubuntu-latest
39
+ target: aarch64
40
+ - runner: ubuntu-latest
41
+ target: armv7
42
+ - runner: ubuntu-latest
43
+ target: s390x
44
+ - runner: ubuntu-latest
45
+ target: ppc64le
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+ - uses: actions/setup-python@v5
49
+ with:
50
+ python-version: 3.x
51
+ - name: Build wheels
52
+ uses: PyO3/maturin-action@v1
53
+ with:
54
+ target: ${{ matrix.platform.target }}
55
+ args: --release --out dist --find-interpreter
56
+ sccache: 'true'
57
+ manylinux: auto
58
+ - name: Upload wheels
59
+ uses: actions/upload-artifact@v4
60
+ with:
61
+ name: wheels-linux-${{ matrix.platform.target }}
62
+ path: dist
63
+
64
+ musllinux:
65
+ runs-on: ${{ matrix.platform.runner }}
66
+ strategy:
67
+ matrix:
68
+ platform:
69
+ - runner: ubuntu-latest
70
+ target: x86_64
71
+ - runner: ubuntu-latest
72
+ target: x86
73
+ - runner: ubuntu-latest
74
+ target: aarch64
75
+ - runner: ubuntu-latest
76
+ target: armv7
77
+ steps:
78
+ - uses: actions/checkout@v4
79
+ - uses: actions/setup-python@v5
80
+ with:
81
+ python-version: 3.x
82
+ - name: Build wheels
83
+ uses: PyO3/maturin-action@v1
84
+ with:
85
+ target: ${{ matrix.platform.target }}
86
+ args: --release --out dist --find-interpreter
87
+ sccache: 'true'
88
+ manylinux: musllinux_1_2
89
+ - name: Upload wheels
90
+ uses: actions/upload-artifact@v4
91
+ with:
92
+ name: wheels-musllinux-${{ matrix.platform.target }}
93
+ path: dist
94
+
95
+ sdist:
96
+ runs-on: ubuntu-latest
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+ - name: Build sdist
100
+ uses: PyO3/maturin-action@v1
101
+ with:
102
+ command: sdist
103
+ args: --out dist
104
+ - name: Upload sdist
105
+ uses: actions/upload-artifact@v4
106
+ with:
107
+ name: wheels-sdist
108
+ path: dist
109
+
110
+ release:
111
+ name: Release
112
+ runs-on: ubuntu-latest
113
+ if: "startsWith(github.ref, 'refs/tags/')"
114
+ needs: [linux, musllinux, sdist]
115
+ steps:
116
+ - uses: actions/download-artifact@v4
117
+ - name: Publish to PyPI
118
+ uses: PyO3/maturin-action@v1
119
+ env:
120
+ MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
121
+ with:
122
+ command: upload
123
+ args: --non-interactive --skip-existing wheels-*/*
@@ -0,0 +1,31 @@
1
+ # https://gist.github.com/domnikl/ccb8d0b82056fbe5cf7f4f145ac7f44b
2
+ name: Tests
3
+
4
+ on:
5
+ push:
6
+
7
+ env:
8
+ CARGO_TERM_COLOR: always
9
+
10
+ jobs:
11
+ build_and_test:
12
+ name: Rust tests
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - uses: Swatinem/rust-cache@v2
18
+
19
+ - name: setup toolchain
20
+ uses: hecrj/setup-rust-action@v1
21
+ with:
22
+ rust-version: stable
23
+
24
+ - name: cargo test
25
+ run: cargo test --all-features
26
+
27
+ - name: rustfmt
28
+ run: cargo fmt --all -- --check
29
+
30
+ - name: clippy
31
+ run: cargo clippy --all --all-features --tests -- -D warnings
@@ -0,0 +1,72 @@
1
+ /target
2
+
3
+ # Byte-compiled / optimized / DLL files
4
+ __pycache__/
5
+ .pytest_cache/
6
+ *.py[cod]
7
+
8
+ # C extensions
9
+ *.so
10
+
11
+ # Distribution / packaging
12
+ .Python
13
+ .venv/
14
+ env/
15
+ bin/
16
+ build/
17
+ develop-eggs/
18
+ dist/
19
+ eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ include/
26
+ man/
27
+ venv/
28
+ *.egg-info/
29
+ .installed.cfg
30
+ *.egg
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+ pip-selfcheck.json
36
+
37
+ # Unit test / coverage reports
38
+ htmlcov/
39
+ .tox/
40
+ .coverage
41
+ .cache
42
+ nosetests.xml
43
+ coverage.xml
44
+
45
+ # Translations
46
+ *.mo
47
+
48
+ # Mr Developer
49
+ .mr.developer.cfg
50
+ .project
51
+ .pydevproject
52
+
53
+ # Rope
54
+ .ropeproject
55
+
56
+ # Django stuff:
57
+ *.log
58
+ *.pot
59
+
60
+ .DS_Store
61
+
62
+ # Sphinx documentation
63
+ docs/_build/
64
+
65
+ # PyCharm
66
+ .idea/
67
+
68
+ # VSCode
69
+ .vscode/
70
+
71
+ # Pyenv
72
+ .python-version
@@ -0,0 +1,132 @@
1
+ # This file is automatically @generated by Cargo.
2
+ # It is not intended for manual editing.
3
+ version = 4
4
+
5
+ [[package]]
6
+ name = "heck"
7
+ version = "0.5.0"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
10
+
11
+ [[package]]
12
+ name = "libc"
13
+ version = "0.2.159"
14
+ source = "registry+https://github.com/rust-lang/crates.io-index"
15
+ checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
16
+
17
+ [[package]]
18
+ name = "once_cell"
19
+ version = "1.21.4"
20
+ source = "registry+https://github.com/rust-lang/crates.io-index"
21
+ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
22
+
23
+ [[package]]
24
+ name = "portable-atomic"
25
+ version = "1.9.0"
26
+ source = "registry+https://github.com/rust-lang/crates.io-index"
27
+ checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
28
+
29
+ [[package]]
30
+ name = "proc-macro2"
31
+ version = "1.0.107"
32
+ source = "registry+https://github.com/rust-lang/crates.io-index"
33
+ checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9"
34
+ dependencies = [
35
+ "unicode-ident",
36
+ ]
37
+
38
+ [[package]]
39
+ name = "pyo3"
40
+ version = "0.30.1"
41
+ source = "registry+https://github.com/rust-lang/crates.io-index"
42
+ checksum = "229ca13b8a15bb0d1487b81ab975bfcd97513416499a8312011b6036e42e0de4"
43
+ dependencies = [
44
+ "libc",
45
+ "once_cell",
46
+ "portable-atomic",
47
+ "pyo3-build-config",
48
+ "pyo3-ffi",
49
+ "pyo3-macros",
50
+ ]
51
+
52
+ [[package]]
53
+ name = "pyo3-build-config"
54
+ version = "0.30.1"
55
+ source = "registry+https://github.com/rust-lang/crates.io-index"
56
+ checksum = "70130e2b6dd1ee589a8788026a429561ca5c40fa7a2fa7914c2282eddae24700"
57
+ dependencies = [
58
+ "target-lexicon",
59
+ ]
60
+
61
+ [[package]]
62
+ name = "pyo3-ffi"
63
+ version = "0.30.1"
64
+ source = "registry+https://github.com/rust-lang/crates.io-index"
65
+ checksum = "5e7ff73c555c286d212d4ce7e5fbda845a973c4f61bd5f160f5f2c3c2a04d1c4"
66
+ dependencies = [
67
+ "libc",
68
+ "pyo3-build-config",
69
+ ]
70
+
71
+ [[package]]
72
+ name = "pyo3-macros"
73
+ version = "0.30.1"
74
+ source = "registry+https://github.com/rust-lang/crates.io-index"
75
+ checksum = "c46d2e5862c7bb8207e3b639f713dda3c499933444784154c11d013c5a691b60"
76
+ dependencies = [
77
+ "proc-macro2",
78
+ "pyo3-macros-backend",
79
+ "quote",
80
+ "syn",
81
+ ]
82
+
83
+ [[package]]
84
+ name = "pyo3-macros-backend"
85
+ version = "0.30.1"
86
+ source = "registry+https://github.com/rust-lang/crates.io-index"
87
+ checksum = "38b89f066f2ae72a2aef52d1537ca2fcd104440ebfadee06e97aa90738a25b9b"
88
+ dependencies = [
89
+ "heck",
90
+ "proc-macro2",
91
+ "quote",
92
+ "syn",
93
+ ]
94
+
95
+ [[package]]
96
+ name = "quote"
97
+ version = "1.0.37"
98
+ source = "registry+https://github.com/rust-lang/crates.io-index"
99
+ checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
100
+ dependencies = [
101
+ "proc-macro2",
102
+ ]
103
+
104
+ [[package]]
105
+ name = "syn"
106
+ version = "3.0.10"
107
+ source = "registry+https://github.com/rust-lang/crates.io-index"
108
+ checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79"
109
+ dependencies = [
110
+ "proc-macro2",
111
+ "quote",
112
+ "unicode-ident",
113
+ ]
114
+
115
+ [[package]]
116
+ name = "target-lexicon"
117
+ version = "0.13.5"
118
+ source = "registry+https://github.com/rust-lang/crates.io-index"
119
+ checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
120
+
121
+ [[package]]
122
+ name = "unicode-ident"
123
+ version = "1.0.13"
124
+ source = "registry+https://github.com/rust-lang/crates.io-index"
125
+ checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe"
126
+
127
+ [[package]]
128
+ name = "vcf_subset"
129
+ version = "2.0.2"
130
+ dependencies = [
131
+ "pyo3",
132
+ ]
@@ -0,0 +1,21 @@
1
+ [package]
2
+ name = "vcf_subset"
3
+ version = "2.0.2"
4
+ edition = "2021"
5
+ readme = "README.md"
6
+
7
+ # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
8
+ [lib]
9
+ name = "vcf_subset"
10
+ crate-type = ["cdylib"]
11
+
12
+ [dependencies]
13
+ pyo3 = { version = "0.30", features = ["extension-module", "abi3-py39", "abi3-py310", "abi3-py311", "abi3-py312", "abi3-py313"] }
14
+
15
+ [profile.dev]
16
+ opt-level = 3
17
+ debug = 1
18
+ lto = true
19
+
20
+ [profile.release]
21
+ opt-level = 3
@@ -0,0 +1,85 @@
1
+ LICENCE TERMS FOR ACCESS TO SOFTWARE AND DATABASE FOR ACADEMIC USE
2
+
3
+ These licence terms apply to all licences granted by THE CHANCELLOR, MASTERS AND SCHOLARS OF THE UNIVERSITY
4
+ OF OXFORD whose administrative offices are at University Offices, Wellington Square, Oxford OX1 2JD,
5
+ United Kingdom (the "University") for use of or access to vcf_subset software ("the Software")
6
+ through this website (the "Website").
7
+
8
+ PLEASE READ THESE LICENCE TERMS CAREFULLY BEFORE USING THE DATABASE OR THE SOFTWARE THROUGH THIS WEBSITE.
9
+ IF YOU DO NOT AGREE TO THESE LICENCE TERMS YOU SHOULD NOT DOWNLOAD OR USE THE SOFTWARE.
10
+
11
+ THE SOFTWARE ARE INTENDED FOR ACADEMICS CARRYING OUT RESEARCH AND NOT FOR USE BY CONSUMERS OR COMMERCIAL BUSINESSES.
12
+
13
+ 1. Academic Use Licence
14
+
15
+ 1.1 The User is granted a limited non-exclusive and non-transferable royalty free licence to access and
16
+ use the Software provided that the User will:
17
+
18
+ (a) limit their use of the Software to their own internal academic non-commercial research which is
19
+ undertaken for the purposes of education or other scholarly use;
20
+
21
+ (b) not use the Software for or on behalf of any third party or to provide a service or integrate all
22
+ or part of the Software into a product for sale or license to third parties;
23
+
24
+ (c) use the Software in accordance with the prevailing instructions and guidance for use given on the
25
+ Website and comply with procedures on the Website for user identification, authentication and access;
26
+
27
+ (d) comply with all applicable laws and regulations with respect to their use of the Software;
28
+
29
+ (e) except to the extent expressly permitted under these terms, not attempt to: reverse compile, disassemble
30
+ or copy, modify, duplicate, create derivative works from, frame, mirror, republish, download, display, transmit,
31
+ or distribute all or any portion of the Software or Website in any form or media or by any means; and
32
+
33
+ (f) ensure that the Copyright Notice “Copyright © 2022, University of Oxford” appears prominently wherever
34
+ results from the Software are used, and is referenced or cited with the Copyright Notice when the Software
35
+ is described in any research publication or on any documents or other material created using the Software.
36
+
37
+ 1.2 the University reserves the right at any time and without liability or prior notice to the User to
38
+ revise, modify and replace the functionality and performance of the access to and operation of the Software.
39
+
40
+ 1.3 The User acknowledges and agrees that the University owns all intellectual property rights in the Software.
41
+ The User shall not have any right, title or interest in or to any results or other output from the Software.
42
+
43
+ 1.4 This Licence will terminate immediately and the User will no longer have any right exercise any of the
44
+ rights granted to the User upon any breach of the conditions in Section 1.1 of this Licence.
45
+
46
+ 2. Indemnity and Liability
47
+
48
+ 2.1 The User shall defend, indemnify and hold harmless the University against any claims, actions, proceedings,
49
+ losses, damages, expenses and costs (including without limitation court costs and reasonable legal fees) arising
50
+ out of or in connection with the User's possession or use of the Software, or any breach of these terms by the User.
51
+
52
+ 2.2 The Software are provided on an ‘as is’ basis and the User uses the Software at their own risk. No representations,
53
+ conditions, warranties or other terms of any kind are given in respect of the Software and all statutory warranties
54
+ and conditions are excluded to the fullest extent permitted by law. Without affecting the generality of the previous
55
+ sentences, the University gives no implied or express warranty and makes no representation that the Software or
56
+ any part of them: (a) will enable specific results to be obtained; or (b) meets a particular specification or is
57
+ comprehensive within its field or that it is error free or will operate without interruption; or (c) is suitable
58
+ for any particular, or the User's specific purposes.
59
+
60
+ 2.3 Except in relation to fraud, death or personal injury, the University's liability to the User for any use of
61
+ the Software, in negligence or arising in any other way out of the subject matter of these licence terms, will not
62
+ extend to any incidental or consequential damages or losses, or any loss of profits, loss of revenue, loss of data,
63
+ loss of contracts or opportunity, whether direct or indirect.
64
+
65
+ 2.4 The User hereby irrevocably undertakes to the University not to make any claim against any employee, student,
66
+ researcher or other individual engaged by the University, being a claim which seeks to enforce against any of them
67
+ any liability whatsoever in connection with this agreement or its subject-matter.
68
+
69
+ 3. General
70
+
71
+ 3.1 Severability - If any provision (or part of a provision) of these licence terms is found by any court or
72
+ administrative body of competent jurisdiction to be invalid, unenforceable or illegal, the other provisions shall
73
+ remain in force.
74
+
75
+ 3.2 Entire Agreement - These licence terms and any documents referred to in them, constitute the whole agreement
76
+ between the parties and supersede any previous arrangement, understanding or agreement between them relating to
77
+ the Software.
78
+
79
+ 3.3 Law and Jurisdiction - These licence terms and any disputes or claims arising out of or in connection with them
80
+ shall be governed by, and construed in accordance with, the law of England. The User irrevocably submits to the
81
+ exclusive jurisdiction of the English courts for any dispute or claim that arises out of or in connection with
82
+ these licence terms.
83
+
84
+ If you are interested in using the Software commercially, please contact Oxford University Innovation Limited to
85
+ negotiate a licence. Contact details are enquiries@innovation.ox.ac.uk quoting reference (TBD).
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: vcf_subset
3
+ Version: 2.0.2
4
+ Classifier: Programming Language :: Rust
5
+ Classifier: Programming Language :: Python :: Implementation :: CPython
6
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.8, <3.13
@@ -0,0 +1,19 @@
1
+ # vcf_subset
2
+ Efficient VCF subsetting by genome position. Written in Rust, but provided as a python module to save ~3 minutes per TB GVCF. This code
3
+ is functionall part of `gnomonicus` but is in a seperate repository
4
+ so it can effecitvely be a python package.
5
+
6
+ ## Install
7
+ ```
8
+ pip install vcf_subset
9
+ ```
10
+
11
+ ## Local (dev) install
12
+ ```
13
+ # Optional virtual environment
14
+ python -m virtualenv env
15
+ source env/bin/activate
16
+
17
+ # Install
18
+ pip install .
19
+ ```
@@ -0,0 +1,15 @@
1
+ [build-system]
2
+ requires = ["maturin>=1.7,<2.0"]
3
+ build-backend = "maturin"
4
+
5
+ [project]
6
+ name = "vcf_subset"
7
+ requires-python = ">=3.8,<3.13"
8
+ classifiers = [
9
+ "Programming Language :: Rust",
10
+ "Programming Language :: Python :: Implementation :: CPython",
11
+ "Programming Language :: Python :: Implementation :: PyPy",
12
+ ]
13
+ dynamic = ["version"]
14
+ [tool.maturin]
15
+ features = ["pyo3/extension-module"]
@@ -0,0 +1,86 @@
1
+ use std::{
2
+ fs::File,
3
+ io::{BufRead, BufReader},
4
+ };
5
+
6
+ use pyo3::prelude::*;
7
+
8
+ /// Subset a VCF file by a list of positions.
9
+ ///
10
+ /// # Arguments
11
+ /// vcf_path: String - Path to the VCF file.
12
+ /// positions: Vec<u64> - List of positions to subset the VCF file by.
13
+ ///
14
+ /// # Returns
15
+ /// Tuple of two lists of strings. The first list contains the header lines of the VCF file, and the second list contains the subsetted VCF lines.
16
+ #[pyfunction]
17
+ fn subset_vcf(vcf_path: String, positions: Vec<u64>) -> (Vec<String>, Vec<String>) {
18
+ let file = File::open(vcf_path).unwrap();
19
+ let reader = BufReader::new(file);
20
+ let mut header = Vec::new();
21
+ let mut output = Vec::new();
22
+
23
+ for line in reader.lines() {
24
+ let line = line.unwrap();
25
+ if line.starts_with("#") {
26
+ header.push(line);
27
+ } else {
28
+ let mut fields = line.split("\t");
29
+ let pos = fields.nth(1).unwrap().parse::<u64>().unwrap();
30
+ if positions.is_empty() || positions.contains(&pos) {
31
+ output.push(line);
32
+ }
33
+ }
34
+ }
35
+
36
+ (header, output)
37
+ }
38
+
39
+ /// A Python module implemented in Rust.
40
+ #[pymodule]
41
+ fn vcf_subset(m: &Bound<'_, PyModule>) -> PyResult<()> {
42
+ m.add_function(wrap_pyfunction!(subset_vcf, m)?)?;
43
+ Ok(())
44
+ }
45
+
46
+ #[cfg(test)]
47
+ mod tests {
48
+ use super::*;
49
+
50
+ #[test]
51
+ fn test_subset_vcf() {
52
+ let vcf_path = "test_data/test.vcf".to_string();
53
+
54
+ // None of these positions lie in the VCF, so nothing should be returned
55
+ let positions = vec![1, 2, 3, 4, 5];
56
+ let (header, output) = subset_vcf(vcf_path.clone(), positions);
57
+
58
+ assert_eq!(header.len(), 19);
59
+ assert_eq!(output.len(), 0);
60
+
61
+ let positions = vec![1043, 2, 3, 4, 5];
62
+ let (header, output) = subset_vcf(vcf_path.clone(), positions);
63
+
64
+ assert_eq!(header.len(), 19);
65
+ assert_eq!(output.len(), 1);
66
+
67
+ let positions = vec![1043, 1815, 1977, 4, 5];
68
+ let (header, output) = subset_vcf(vcf_path.clone(), positions);
69
+
70
+ assert_eq!(header.len(), 19);
71
+ assert_eq!(output.len(), 3);
72
+
73
+ let positions = vec![1043, 1815, 1977];
74
+ let (header, output) = subset_vcf(vcf_path.clone(), positions);
75
+
76
+ assert_eq!(header.len(), 19);
77
+ assert_eq!(output.len(), 3);
78
+
79
+ // No positions should return all rows
80
+ let positions = vec![];
81
+ let (header, output) = subset_vcf(vcf_path.clone(), positions);
82
+
83
+ assert_eq!(header.len(), 19);
84
+ assert_eq!(output.len(), 9);
85
+ }
86
+ }
@@ -0,0 +1,28 @@
1
+ ##fileformat=VCFv4.2
2
+ ##source=minos, version 0.12.5
3
+ ##fileDate=2024-08-29
4
+ ##FORMAT=<ID=ALLELE_DP,Number=R,Type=Float,Description="Mean read depth of ref and each allele">
5
+ ##FORMAT=<ID=COV,Number=R,Type=Integer,Description="Number of reads on ref and alt alleles">
6
+ ##FORMAT=<ID=COV_TOTAL,Number=1,Type=Integer,Description="Total reads mapped at this site, from gramtools">
7
+ ##FORMAT=<ID=DP,Number=1,Type=Float,Description="Mean read depth of called allele (ie the ALLELE_DP of the called allele)">
8
+ ##FORMAT=<ID=FRS,Number=1,Type=Float,Description="Fraction of reads that support the genotype call">
9
+ ##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
10
+ ##FORMAT=<ID=GT_CONF,Number=1,Type=Float,Description="Genotype confidence. Difference in log likelihood of most likely and next most likely genotype">
11
+ ##minosMeanReadDepth=20.62
12
+ ##minosReadDepthVariance=91.382
13
+ ##contig=<ID=NC_000962.3,length=4411532>
14
+ ##FORMAT=<ID=GT_CONF_PERCENTILE,Number=1,Type=Float,Description="Percentile of GT_CONF">
15
+ ##FILTER=<ID=MIN_FRS,Description="Minimum FRS of 0.9">
16
+ ##FILTER=<ID=MIN_DP,Description="Minimum DP of 3">
17
+ ##FILTER=<ID=MIN_GCP,Description="Minimum GT_CONF_PERCENTILE of 0.5">
18
+ ##FILTER=<ID=MAX_DP,Description="Maximum DP of 49.298179858561454 (= 3.0 standard deviations from the mean read depth 20.62)">
19
+ #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT sample
20
+ NC_000962.3 1043 . T C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:26:0,26:1.0:26:0,26:175.93:74.97
21
+ NC_000962.3 1815 . T TG . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:31:1,31:1.0:31:0,30:198.78:83.18
22
+ NC_000962.3 1977 . A G . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:17:0,17:1.0:17:0,17:120.44:40.22
23
+ NC_000962.3 2532 . T C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:23:0,23:1.0:23:0,23:157.51:64.84
24
+ NC_000962.3 4013 . T C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:20:0,20:1.0:20:0,20:139.02:53.38
25
+ NC_000962.3 6112 . G C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:20:0,20:1.0:20:0,20:139.02:53.38
26
+ NC_000962.3 7362 . G C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:27:0,27:1.0:27:0,27:182.06:77.44
27
+ NC_000962.3 7585 . G C . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:19:0,19:1.0:19:0,19:132.83:49.06
28
+ NC_000962.3 8452 . C T . PASS . GT:DP:ALLELE_DP:FRS:COV_TOTAL:COV:GT_CONF:GT_CONF_PERCENTILE 1/1:22:0,22:1.0:22:0,22:151.35:61.22
vcf_subset-1.1.2/PKG-INFO DELETED
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vcf_subset
3
- Version: 1.1.2
4
- Summary: Efficient VCF subsetting by genome position.
5
- Home-page: https://github.com/GlobalPathogenAnalysisService/vcf_subset
6
- Author: Jeremy Westhead
7
- Author-email: jeremy.westhead@ndm.ox.ac.uk
8
- License: MIT
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
-
12
- Efficient VCF subsetting by genome position.
@@ -1,23 +0,0 @@
1
- # vcf_subset
2
- Efficient VCF subsetting by genome position. Written in C++, but provided as a python module to save ~3 minutes per TB GVCF
3
-
4
- ## Install
5
- ```
6
- pip install vcf_subset
7
- ```
8
-
9
- ## Local (dev) install
10
- ```
11
- # Optional virtual environment
12
- python -m virtualenv env
13
- source env/bin/activate
14
-
15
- # Install requirements
16
- pip install build
17
-
18
- # Build dist
19
- python -m build --sdist --outdir dist
20
-
21
- # Install
22
- pip install .
23
- ```
@@ -1,6 +0,0 @@
1
- [build-system]
2
- requires = [
3
- "setuptools>=42",
4
- "pybind11>=2.10.0",
5
- ]
6
- build-backend = "setuptools.build_meta"
@@ -1,4 +0,0 @@
1
- [egg_info]
2
- tag_build =
3
- tag_date = 0
4
-
vcf_subset-1.1.2/setup.py DELETED
@@ -1,37 +0,0 @@
1
- # Based on example https://github.com/pybind/python_example
2
- from pybind11.setup_helpers import Pybind11Extension
3
- from setuptools import setup
4
-
5
- __version__ = "v1.1.2"
6
-
7
- long_description = "Efficient VCF subsetting by genome position."
8
-
9
- files = sorted(["vcf_subset.cpp"])
10
-
11
- ext_modules = [
12
- Pybind11Extension(
13
- "vcf_subset",
14
- files,
15
- include_dirs=[],
16
- extra_compile_args=["-std=c++2a", "-O3"],
17
- # Example: passing in the version to the compiled code
18
- define_macros=[("VERSION_INFO", __version__)],
19
- ),
20
- ]
21
-
22
- setup(
23
- name="vcf_subset",
24
- version=__version__,
25
- author="Jeremy Westhead",
26
- author_email="jeremy.westhead@ndm.ox.ac.uk",
27
- url="https://github.com/GlobalPathogenAnalysisService/vcf_subset",
28
- description="Efficient VCF subsetting by genome position.",
29
- ext_modules=ext_modules,
30
- zip_safe=False,
31
- python_requires=">=3.7",
32
- license="MIT",
33
- long_description=long_description,
34
- long_description_content_type='text/markdown',
35
- include_package_data=True,
36
- package_data={'vcf_subset': ['./**']}
37
- )
@@ -1,111 +0,0 @@
1
- #include<iostream>
2
- #include<fstream>
3
- #include<vector>
4
- #include<tuple>
5
- #include<algorithm>
6
-
7
- #include <pybind11/pybind11.h>
8
- #include <pybind11/stl.h>
9
-
10
- #define STRINGIFY(x) #x
11
- #define MACRO_STRINGIFY(x) STRINGIFY(x)
12
-
13
- using namespace std;
14
- namespace py = pybind11;
15
-
16
- /**
17
- * @brief Subset a given VCF file to just the given positions (and the header).
18
- *
19
- * @param filename Path to the VCF file to subset. Must not be gzipped.
20
- * @param positions Vector of genome positions to keep. Pass empty vector to keep all positions.
21
- * @return Tuple of values (Vector of VCF header lines, Lines of the VCF file that match the given positions)
22
- */
23
- tuple<vector<string>, vector<string>> subset_gvcf(string filename, vector<int> positions){
24
- vector<string> header;
25
- vector<string> output;
26
- fstream fin(filename, fstream::in);
27
- if(!fin.good()){
28
- throw invalid_argument("Invalid gvcf path: " + filename);
29
- }
30
- char ch;
31
- string acc;
32
- size_t pos = 0;
33
- while (fin >> noskipws >> ch) {
34
- if(ch == '\n'){
35
- if(acc[0] == '#'){
36
- header.push_back(acc);
37
- acc = "";
38
- continue;
39
- }
40
- // Pull out the second column (which should be the position)
41
- string line = acc;
42
- pos = acc.find("\t");
43
- acc.erase(0, pos + 1);
44
- pos = acc.find("\t");
45
- string p = acc.substr(0, pos);
46
- int genome_pos = stoi(p);
47
-
48
- if(positions.size() == 0 || binary_search(positions.begin(), positions.end(), genome_pos)){
49
- output.push_back(line);
50
- }
51
-
52
- acc = "";
53
- }
54
- else{
55
- acc += ch;
56
- }
57
- }
58
- fin.close();
59
-
60
- // Catch last line if needed
61
- if(acc != ""){
62
- if(acc[0] == '#'){
63
- header.push_back(acc);
64
- acc = "";
65
- }
66
- else{
67
- // Pull out the second column (which should be the position)
68
- string line = acc;
69
- pos = acc.find("\t");
70
- acc.erase(0, pos + 1);
71
- pos = acc.find("\t");
72
- string p = acc.substr(0, pos);
73
- int genome_pos = stoi(p);
74
-
75
- if(positions.size() == 0 || binary_search(positions.begin(), positions.end(), genome_pos)){
76
- output.push_back(line);
77
- }
78
- }
79
- }
80
-
81
- return {header, output};
82
-
83
- }
84
-
85
- PYBIND11_MODULE(vcf_subset, m) {
86
- m.doc() = R"pbdoc(
87
- Efficient VCF subsetting by genome position.
88
- Designed for subsetting a gVCF file, but should work for any VCF.
89
- -----------------------
90
- subset_gvcf
91
- )pbdoc";
92
- #ifdef VERSION_INFO
93
- m.attr("__version__") = MACRO_STRINGIFY(VERSION_INFO);
94
- #else
95
- m.attr("__version__") = "dev";
96
- #endif
97
- m.def("subset_vcf", &subset_gvcf, R"pbdoc(
98
- Subset a given VCF file to just the given positions (and the header).
99
- -----------------------
100
-
101
- Args:
102
- str filename: Path to the VCF file to subset. Must not be gzipped.
103
- list[int] positions: List of genome positions to keep or empty list to keep all positions.
104
-
105
- Returns:
106
- tuple[list[str], list[str]]: Tuple of values (
107
- VCF header lines,
108
- Lines of the VCF file that match the given positions
109
- )
110
- )pbdoc", py::arg("filename"), py::arg("positions"));
111
- }
@@ -1,12 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: vcf_subset
3
- Version: 1.1.2
4
- Summary: Efficient VCF subsetting by genome position.
5
- Home-page: https://github.com/GlobalPathogenAnalysisService/vcf_subset
6
- Author: Jeremy Westhead
7
- Author-email: jeremy.westhead@ndm.ox.ac.uk
8
- License: MIT
9
- Requires-Python: >=3.7
10
- Description-Content-Type: text/markdown
11
-
12
- Efficient VCF subsetting by genome position.
@@ -1,9 +0,0 @@
1
- README.md
2
- pyproject.toml
3
- setup.py
4
- vcf_subset.cpp
5
- vcf_subset.egg-info/PKG-INFO
6
- vcf_subset.egg-info/SOURCES.txt
7
- vcf_subset.egg-info/dependency_links.txt
8
- vcf_subset.egg-info/not-zip-safe
9
- vcf_subset.egg-info/top_level.txt
@@ -1 +0,0 @@
1
- vcf_subset