@sjcrh/proteinpaint-rust 2.132.0 → 2.132.1-0

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/gdcGRIN2.rs +32 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.132.0",
2
+ "version": "2.132.1-0",
3
3
  "name": "@sjcrh/proteinpaint-rust",
4
4
  "type": "module",
5
5
  "description": "Rust-based utilities for proteinpaint",
package/src/gdcGRIN2.rs CHANGED
@@ -89,6 +89,11 @@ struct FilteredMafDetails {
89
89
  t_alt_count: usize,
90
90
  t_depth: usize,
91
91
  invalid_rows: usize,
92
+ excluded_by_min_depth: usize,
93
+ excluded_by_min_alt_count: usize,
94
+ excluded_by_consequence_type: usize,
95
+ total_processed: usize,
96
+ total_included: usize,
92
97
  }
93
98
 
94
99
  // struct for CNV filter details
@@ -97,6 +102,11 @@ struct FilteredCnvDetails {
97
102
  segment_mean: usize,
98
103
  seg_length: usize,
99
104
  invalid_rows: usize,
105
+ excluded_by_loss_threshold: usize,
106
+ excluded_by_gain_threshold: usize,
107
+ excluded_by_segment_length: usize,
108
+ total_processed: usize,
109
+ total_included: usize,
100
110
  }
101
111
 
102
112
  // struct for per-case filter details
@@ -326,6 +336,13 @@ async fn process_row(
326
336
 
327
337
  let case_details = filtered_map.get_mut(case_id).unwrap();
328
338
 
339
+ // Track total processed records
340
+ if data_type == "maf" {
341
+ case_details.maf.total_processed += 1;
342
+ } else if data_type == "cnv" {
343
+ case_details.cnv.total_processed += 1;
344
+ }
345
+
329
346
  // Handle consequence filtering and counting for MAF files
330
347
  if data_type == "maf" {
331
348
  if let Some(var_class_idx) = variant_classification_index {
@@ -347,6 +364,7 @@ async fn process_row(
347
364
  .rejected_consequences
348
365
  .entry(variant_classification.to_string())
349
366
  .or_insert(0) += 1;
367
+ case_details.maf.excluded_by_consequence_type += 1;
350
368
  filtered_maf_records.fetch_add(1, Ordering::Relaxed);
351
369
  return Ok(None);
352
370
  }
@@ -396,6 +414,15 @@ async fn process_row(
396
414
  element = process_segment_mean(&element, case_id, data_type, gain_threshold, loss_threshold)?;
397
415
  if element.is_empty() {
398
416
  case_details.cnv.segment_mean += 1;
417
+ let seg_mean = cont_lst[x].parse::<f32>().unwrap_or(0.0);
418
+ if seg_mean > loss_threshold && seg_mean < gain_threshold {
419
+ // Between thresholds - not a significant gain or loss
420
+ if seg_mean >= 0.0 {
421
+ case_details.cnv.excluded_by_gain_threshold += 1;
422
+ } else {
423
+ case_details.cnv.excluded_by_loss_threshold += 1;
424
+ }
425
+ }
399
426
  filtered_cnv_records.fetch_add(1, Ordering::Relaxed);
400
427
  return Ok(None);
401
428
  }
@@ -433,11 +460,13 @@ async fn process_row(
433
460
 
434
461
  if alle_depth < min_total_depth {
435
462
  case_details.maf.t_depth += 1;
463
+ case_details.maf.excluded_by_min_depth += 1;
436
464
  filtered_maf_records.fetch_add(1, Ordering::Relaxed);
437
465
  return Ok(None);
438
466
  }
439
467
  if alt_count < min_alt_allele_count {
440
468
  case_details.maf.t_alt_count += 1;
469
+ case_details.maf.excluded_by_min_alt_count += 1;
441
470
  filtered_maf_records.fetch_add(1, Ordering::Relaxed);
442
471
  return Ok(None);
443
472
  }
@@ -447,6 +476,7 @@ async fn process_row(
447
476
  out_lst.push("mutation".to_string());
448
477
 
449
478
  // Update counters for included MAF records
479
+ case_details.maf.total_included += 1;
450
480
  included_maf_records.fetch_add(1, Ordering::Relaxed);
451
481
  }
452
482
 
@@ -475,9 +505,11 @@ async fn process_row(
475
505
  let cnv_length = end_position - start_position;
476
506
  if seg_length > 0 && cnv_length > seg_length {
477
507
  case_details.cnv.seg_length += 1;
508
+ case_details.cnv.excluded_by_segment_length += 1;
478
509
  filtered_cnv_records.fetch_add(1, Ordering::Relaxed);
479
510
  return Ok(None);
480
511
  }
512
+ case_details.cnv.total_included += 1;
481
513
  included_cnv_records.fetch_add(1, Ordering::Relaxed);
482
514
  }
483
515