bio-grumpy 1.2.3__tar.gz → 1.2.5__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.
Files changed (36) hide show
  1. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/.github/workflows/release.yaml +3 -1
  2. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/.github/workflows/test.yaml +4 -4
  3. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/.gitignore +2 -1
  4. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/Cargo.lock +11 -11
  5. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/Cargo.toml +1 -1
  6. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/PKG-INFO +1 -1
  7. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/pyproject.toml +1 -1
  8. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/gene.rs +34 -0
  9. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/genome.rs +25 -13
  10. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/lib.rs +4 -0
  11. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/.github/workflows/gitleaks.yaml +0 -0
  12. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/.gitleaks.toml +0 -0
  13. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/CITATION.bib +0 -0
  14. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/LICENSE +0 -0
  15. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/README-python.md +0 -0
  16. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/README.md +0 -0
  17. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/reference/MN908947.3.gb +0 -0
  18. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/reference/NC_000962.3.gbk +0 -0
  19. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/reference/NZ_CP085945.1.gbk +0 -0
  20. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/reference/TEST-DNA-double.gbk +0 -0
  21. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/reference/TEST-DNA.gbk +0 -0
  22. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/common.rs +0 -0
  23. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/difference.rs +0 -0
  24. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/main.rs +0 -0
  25. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/src/vcf.rs +0 -0
  26. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/TEST-DNA-4-minor.vcf +0 -0
  27. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/TEST-DNA-4.vcf +0 -0
  28. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/TEST-DNA-misc-indel.vcf +0 -0
  29. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/TEST-DNA.vcf +0 -0
  30. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/complex.vcf +0 -0
  31. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/dummy.vcf +0 -0
  32. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/intracellulare.vcf +0 -0
  33. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/minor-populations-revcomp-AD.vcf +0 -0
  34. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/minor-populations-revcomp.vcf +0 -0
  35. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/revcomp-del-first-pos.vcf +0 -0
  36. {bio_grumpy-1.2.3 → bio_grumpy-1.2.5}/test/tb-snp-after-del.vcf +0 -0
@@ -31,7 +31,9 @@ jobs:
31
31
  platform:
32
32
  - runner: ubuntu-latest
33
33
  target: x86_64
34
- - runner: ubuntu-latest
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
35
37
  target: x86
36
38
  - runner: ubuntu-latest
37
39
  target: aarch64
@@ -21,11 +21,11 @@ jobs:
21
21
  with:
22
22
  rust-version: stable
23
23
 
24
- - name: cargo test
25
- run: cargo test --all-features
26
-
27
24
  - name: rustfmt
28
25
  run: cargo fmt --all -- --check
29
26
 
30
27
  - name: clippy
31
- run: cargo clippy --all --all-features --tests -- -D warnings
28
+ run: cargo clippy --all --all-features --tests -- -D warnings
29
+
30
+ - name: cargo test
31
+ run: cargo test --all-features
@@ -20,4 +20,5 @@ tarpaulin-*.html
20
20
  edge-cases.md
21
21
 
22
22
  *.fasta
23
- *.msh
23
+ *.msh
24
+ uv.lock
@@ -78,9 +78,9 @@ checksum = "b0fc239e0f6cb375d2402d48afb92f76f5404fd1df208a41930ec81eda078bea"
78
78
 
79
79
  [[package]]
80
80
  name = "clap"
81
- version = "4.6.7"
81
+ version = "4.6.9"
82
82
  source = "registry+https://github.com/rust-lang/crates.io-index"
83
- checksum = "aa8876b300ab35ba921adea3dfd70157a46249b33f95c9084ae5709785478946"
83
+ checksum = "844c5c0b65be192cb68d570cca1b21a6444431d24e39c084dc0336177015337c"
84
84
  dependencies = [
85
85
  "clap_builder",
86
86
  "clap_derive",
@@ -100,9 +100,9 @@ dependencies = [
100
100
 
101
101
  [[package]]
102
102
  name = "clap_derive"
103
- version = "4.6.7"
103
+ version = "4.6.9"
104
104
  source = "registry+https://github.com/rust-lang/crates.io-index"
105
- checksum = "f9c751b79415d4e559e3d1fcf128e09e720eb673a06d26cf6f392d37d75b66e0"
105
+ checksum = "b4c174f11f949b9ca8c60580925e282b9cbd5454750e506f08648b2038080cd7"
106
106
  dependencies = [
107
107
  "heck",
108
108
  "proc-macro2",
@@ -112,9 +112,9 @@ dependencies = [
112
112
 
113
113
  [[package]]
114
114
  name = "clap_lex"
115
- version = "1.1.1"
115
+ version = "1.1.2"
116
116
  source = "registry+https://github.com/rust-lang/crates.io-index"
117
- checksum = "1c133bc6a41be0d194c306b5506d15e6feeea7b1d6604bd3f8310dfb2ca96486"
117
+ checksum = "e0921b3876b3a1df8a1c9f912e7f94342458022c2e84288015893d83c4d62a79"
118
118
 
119
119
  [[package]]
120
120
  name = "colorchoice"
@@ -174,7 +174,7 @@ dependencies = [
174
174
 
175
175
  [[package]]
176
176
  name = "grumpy"
177
- version = "1.2.3"
177
+ version = "1.2.5"
178
178
  dependencies = [
179
179
  "clap",
180
180
  "gb-io",
@@ -496,9 +496,9 @@ checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256"
496
496
 
497
497
  [[package]]
498
498
  name = "smallvec"
499
- version = "1.16.5"
499
+ version = "1.16.6"
500
500
  source = "registry+https://github.com/rust-lang/crates.io-index"
501
- checksum = "149309498a5f7334b12ddae0cad8aba81ce785fe91755068867e017cf98fee46"
501
+ checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59"
502
502
 
503
503
  [[package]]
504
504
  name = "string_cache"
@@ -543,9 +543,9 @@ dependencies = [
543
543
 
544
544
  [[package]]
545
545
  name = "target-lexicon"
546
- version = "0.13.5"
546
+ version = "0.13.6"
547
547
  source = "registry+https://github.com/rust-lang/crates.io-index"
548
- checksum = "adb6935a6f5c20170eeceb1a3835a49e12e19d792f6dd344ccc76a985ca5a6ca"
548
+ checksum = "8c447be3a2abfa84b2d91680c56600bd6b2873866de27b36ec911be705e291da"
549
549
 
550
550
  [[package]]
551
551
  name = "thiserror"
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "grumpy"
3
- version = "1.2.3"
3
+ version = "1.2.5"
4
4
  edition = "2021"
5
5
  description = "Genetic analysis in Rust."
6
6
  license-file = "LICENSE"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bio-grumpy
3
- Version: 1.2.3
3
+ Version: 1.2.5
4
4
  Classifier: Development Status :: 5 - Production/Stable
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
@@ -18,7 +18,7 @@ classifiers = [
18
18
  description = "gumpy re-implemented in Rust"
19
19
  readme = "README-python.md"
20
20
  license = "University of Oxford, see license file for details."
21
- license-files = ["LICENSE"]
21
+ license-file = "LICENSE"
22
22
  dynamic = ["version"]
23
23
  authors = [
24
24
  { name = "Jeremy Westhead", email = "jeremy.westhead@ndm.ox.ac.uk" }
@@ -18,6 +18,40 @@ pub enum GenePos {
18
18
  Codon(CodonType),
19
19
  }
20
20
 
21
+ #[pymethods]
22
+ impl GenePos {
23
+ pub fn __repr__(&self) -> String {
24
+ match self {
25
+ GenePos::Nucleotide(nuc) => format!("GenePos::Nucleotide({:?})", nuc),
26
+ GenePos::Codon(codon) => format!("GenePos::Codon({:?})", codon),
27
+ }
28
+ }
29
+ pub fn get_bases(&self) -> Vec<char> {
30
+ match self {
31
+ GenePos::Nucleotide(nuc) => vec![nuc.reference],
32
+ GenePos::Codon(codon) => codon.codon.iter().map(|n| n.reference).collect(),
33
+ }
34
+ }
35
+ pub fn get_aa(&self) -> Option<char> {
36
+ match self {
37
+ GenePos::Nucleotide(_) => None,
38
+ GenePos::Codon(codon) => Some(codon.amino_acid),
39
+ }
40
+ }
41
+ pub fn get_start_index(&self) -> i64 {
42
+ match self {
43
+ GenePos::Nucleotide(nuc) => nuc.nucleotide_index,
44
+ GenePos::Codon(codon) => codon.codon[0].nucleotide_index,
45
+ }
46
+ }
47
+ pub fn get_end_index(&self) -> i64 {
48
+ match self {
49
+ GenePos::Nucleotide(nuc) => nuc.nucleotide_index,
50
+ GenePos::Codon(codon) => codon.codon[2].nucleotide_index,
51
+ }
52
+ }
53
+ }
54
+
21
55
  #[pyclass(eq, from_py_object)]
22
56
  #[derive(Clone, Debug, Eq, PartialEq)]
23
57
  /// Tracks each constituent nucleotide in the codon, along with the amino acid it codes for
@@ -359,27 +359,39 @@ impl Genome {
359
359
  let mut nucleotide_index = Vec::new();
360
360
  let mut genome_positions: Vec<GenomePosition> = Vec::new();
361
361
  if !gene_def.reverse_complement && gene_def.promoter_start != -1 {
362
- for idx in
363
- (gene_def.promoter_start as usize).saturating_sub(1)..gene_def.ranges[0].0 as usize
362
+ for position in self
363
+ .genome_positions
364
+ .iter()
365
+ .take(gene_def.ranges[0].0 as usize)
366
+ .skip((gene_def.promoter_start as usize).saturating_sub(1))
364
367
  {
365
- nucleotide_sequence.push(self.genome_positions[idx].reference);
366
- nucleotide_index.push(self.genome_positions[idx].genome_idx);
367
- genome_positions.push(self.genome_positions[idx].clone());
368
+ nucleotide_sequence.push(position.reference);
369
+ nucleotide_index.push(position.genome_idx);
370
+ genome_positions.push(position.clone());
368
371
  }
369
372
  }
370
373
  for (start, end) in gene_def.ranges.iter() {
371
- for i in *start as usize..*end as usize {
372
- nucleotide_sequence.push(self.genome_positions[i].reference);
373
- nucleotide_index.push(self.genome_positions[i].genome_idx);
374
- genome_positions.push(self.genome_positions[i].clone());
374
+ for position in self
375
+ .genome_positions
376
+ .iter()
377
+ .take(*end as usize)
378
+ .skip(*start as usize)
379
+ {
380
+ nucleotide_sequence.push(position.reference);
381
+ nucleotide_index.push(position.genome_idx);
382
+ genome_positions.push(position.clone());
375
383
  }
376
384
  }
377
385
  if gene_def.reverse_complement && gene_def.promoter_start != -1 {
378
- for idx in gene_def.ranges.last().unwrap().1 as usize..=gene_def.promoter_start as usize
386
+ for position in self
387
+ .genome_positions
388
+ .iter()
389
+ .take(gene_def.promoter_start as usize + 1)
390
+ .skip(gene_def.ranges.last().unwrap().1 as usize)
379
391
  {
380
- nucleotide_sequence.push(self.genome_positions[idx].reference);
381
- nucleotide_index.push(self.genome_positions[idx].genome_idx);
382
- genome_positions.push(self.genome_positions[idx].clone());
392
+ nucleotide_sequence.push(position.reference);
393
+ nucleotide_index.push(position.genome_idx);
394
+ genome_positions.push(position.clone());
383
395
  }
384
396
  }
385
397
  // I hate implicit returns, but appease clippy
@@ -63,6 +63,10 @@ fn grumpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
63
63
  m.add_class::<genome::Genome>()?;
64
64
 
65
65
  m.add_class::<gene::Gene>()?;
66
+ m.add_class::<gene::GenePosition>()?;
67
+ m.add_class::<gene::GenePos>()?;
68
+ m.add_class::<gene::CodonType>()?;
69
+ m.add_class::<gene::NucleotideType>()?;
66
70
 
67
71
  m.add_class::<vcf::VCFFile>()?;
68
72
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes