bio-grumpy 0.1.6__tar.gz → 0.1.7__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.
@@ -76,7 +76,7 @@ dependencies = [
76
76
 
77
77
  [[package]]
78
78
  name = "grumpy"
79
- version = "0.1.6"
79
+ version = "0.1.7"
80
80
  dependencies = [
81
81
  "gb-io",
82
82
  "ordered-float",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "grumpy"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  edition = "2021"
5
5
  description = "Genetic analysis in Rust."
6
6
  license-file = "LICENSE"
@@ -1,6 +1,7 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bio-grumpy
3
- Version: 0.1.6
3
+ Version: 0.1.7
4
+ Classifier: Development Status :: 2 - Pre-Alpha
4
5
  Classifier: Programming Language :: Rust
5
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
7
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -7,6 +7,7 @@ build-backend = "maturin"
7
7
  name = "bio-grumpy"
8
8
  requires-python = ">=3.8"
9
9
  classifiers = [
10
+ "Development Status :: 2 - Pre-Alpha",
10
11
  "Programming Language :: Rust",
11
12
  "Programming Language :: Python :: Implementation :: CPython",
12
13
  "Programming Language :: Python :: Implementation :: PyPy",
@@ -183,13 +183,13 @@ impl GenomeDifference{
183
183
  if gene_pos == -1{
184
184
  panic!("Failed to find gene position for indel at genome index {} in gene {}", alt_pos.genome_idx, gene.name);
185
185
  }
186
- if alt.alt_type == AltType::INS{
187
- gene_pos -= 1;
188
- if gene_pos == 0{
189
- // Can't have 0 as a gene position so nudge to promoter start
190
- gene_pos = -1;
191
- }
192
- }
186
+ // if alt.alt_type == AltType::INS{
187
+ // gene_pos -= 1;
188
+ // if gene_pos == 0{
189
+ // // Can't have 0 as a gene position so nudge to promoter start
190
+ // gene_pos = -1;
191
+ // }
192
+ // }
193
193
  gene_position = Some(gene_pos);
194
194
  }
195
195
 
@@ -425,6 +425,10 @@ impl GeneDifference{
425
425
  evidence = Vec::new();
426
426
  for e in alt_cd.alts.iter(){
427
427
  if e.evidence.is_minor{
428
+ if e.alt_type == AltType::REF{
429
+ //Not sure why we get minor ref calls but skip
430
+ continue;
431
+ }
428
432
  if e.alt_type == AltType::SNP || e.alt_type == AltType::HET || e.alt_type == AltType::NULL{
429
433
  these_minor_snps.push(e);
430
434
  minor_snp_exists = true;
@@ -476,7 +480,7 @@ impl GeneDifference{
476
480
  minor_mutations.push(
477
481
  GeneDifference::mixed_indel(
478
482
  gene_name.clone(),
479
- gene_position,
483
+ alt_cd.nucleotide_number,
480
484
  codes_protein,
481
485
  alt_cd.nucleotide_number,
482
486
  alt_cd.nucleotide_index,
@@ -494,7 +498,7 @@ impl GeneDifference{
494
498
  minor_mutations.push(
495
499
  GeneDifference::mixed_indel(
496
500
  gene_name.clone(),
497
- gene_position,
501
+ alt_cd.nucleotide_number,
498
502
  codes_protein,
499
503
  alt_cd.nucleotide_number,
500
504
  alt_cd.nucleotide_index,
@@ -529,7 +533,7 @@ impl GeneDifference{
529
533
  mutation: _mutation.clone(),
530
534
  gene: gene_name.clone(),
531
535
  evidence: evidence.clone(),
532
- gene_position: Some(gene_position),
536
+ gene_position: Some(alt_pos.gene_position),
533
537
  codes_protein: Some(codes_protein),
534
538
  ref_nucleotides: None,
535
539
  alt_nucleotides: None,
@@ -800,6 +804,11 @@ impl GeneDifference{
800
804
  /// # Returns
801
805
  /// - Mutation object for the mixed indel
802
806
  fn mixed_indel(gene_name: String, gene_position: i64, codes_protein: bool, nc_num: i64, nc_idx: i64, these_minors: Vec<Alt>, minor_type: MinorType, mutation_name: String) -> Mutation{
807
+ // println!("{} {} -> ", gene_name, mutation_name);
808
+ // for m in these_minors.clone().iter(){
809
+ // println!("{:?}", m);
810
+ // }
811
+ // println!("");
803
812
  let mut min_coverage = "".to_string();
804
813
  if minor_type == MinorType::COV{
805
814
  min_coverage = these_minors.iter().filter(
@@ -429,6 +429,12 @@ pub fn mutate(reference: &Genome, vcf: VCFFile) -> Genome{
429
429
  evidence: call.clone()
430
430
  });
431
431
 
432
+ // Mark containing gene as containing a mutation
433
+ // Should make finding genes level mutations easier
434
+ for gene_name in position.genes.iter(){
435
+ new_genome.genes_with_mutations.insert(gene_name.clone());
436
+ }
437
+
432
438
  if call.call_type == AltType::DEL{
433
439
  position.is_deleted_minor = true;
434
440
  for del_idx in 0..call.alt.len(){
@@ -40,8 +40,15 @@ pub mod gene;
40
40
  pub mod vcf;
41
41
  pub mod difference;
42
42
 
43
- /// A Python module implemented in Rust.
43
+
44
44
  #[pymodule]
45
+ /// Grumpy, genetic analysis in Rust.
46
+ ///
47
+ /// This library provides a set of tools for genetic analysis, including:
48
+ /// - Genome representation
49
+ /// - Gene representation
50
+ /// - VCF file parsing
51
+ /// - Finding effects of a given VCF file at both genome and gene levels
45
52
  fn grumpy(m: &Bound<'_, PyModule>) -> PyResult<()> {
46
53
  m.add_class::<common::AltType>()?;
47
54
  m.add_class::<common::MinorType>()?;
@@ -25,7 +25,7 @@ fn main() {
25
25
  let vcf_path = &args[2];
26
26
 
27
27
  let vcf_start = SystemTime::now();
28
- let vcf = VCFFile::new(vcf_path.to_string(), false, 5);
28
+ let vcf = VCFFile::new(vcf_path.to_string(), false, 3);
29
29
  let vcf_end = SystemTime::now();
30
30
 
31
31
  let reference_start = SystemTime::now();
@@ -50,6 +50,7 @@ fn main() {
50
50
  }
51
51
  let gene_end = SystemTime::now();
52
52
 
53
+ println!("\n-----------------------------------\n");
53
54
  println!("VCF took {:?}", vcf_end.duration_since(vcf_start).unwrap());
54
55
  println!("Reference took {:?}", reference_end.duration_since(reference_start).unwrap());
55
56
  println!("Sample took {:?}", sample_end.duration_since(sample_start).unwrap());
@@ -136,7 +136,6 @@ impl VCFFile{
136
136
  }
137
137
 
138
138
 
139
-
140
139
  // println!("{:?}\t{:?}\t{:?}\t{:?}\t{:?}", record.position, String::from_utf8_lossy(&record.reference), alts, filters, fields);
141
140
 
142
141
  records.push(VCFRow{
@@ -152,6 +151,17 @@ impl VCFFile{
152
151
  // println!("Calls {:?}", record_calls);
153
152
  // println!("Minor calls {:?}\n", record_minor_calls);
154
153
 
154
+ // if record.position == 3339734{
155
+ // println!("{:?}\t{:?}\t{:?}\t{:?}\t{:?}", record.position, String::from_utf8_lossy(&record.reference), alts, filters, fields);
156
+ // for call in record_calls.iter(){
157
+ // println!("{:?}\n", call);
158
+ // }
159
+ // println!("--");
160
+ // for call in record_minor_calls.iter(){
161
+ // println!("{:?}\n", call);
162
+ // }
163
+ // }
164
+
155
165
  for call in record_calls{
156
166
  let mut added = false;
157
167
  if calls_map.contains_key(&call.genome_index){
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes