|
|
@@ -2,7 +2,7 @@ use anyhow::Context;
|
|
|
use log::{info, warn};
|
|
|
use ordered_float::Float;
|
|
|
use pandora_lib_graph::cytoband::{svg_chromosome, AdditionalRect, RectPosition};
|
|
|
-use plotly::{common::Marker, layout::BarMode, Bar, Layout, Plot, Scatter};
|
|
|
+use plotly::{color::Rgb, common::Marker, layout::BarMode, Bar, Layout, Plot, Scatter};
|
|
|
use rand::{thread_rng, Rng};
|
|
|
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
|
|
use serde::{
|
|
|
@@ -245,7 +245,12 @@ impl Counts {
|
|
|
Ok(*data.get(index(percentile)).context("Error in percentile")?)
|
|
|
}
|
|
|
|
|
|
- pub fn save_contig(&mut self, contig: &str, prefix: &str, breaks: Vec<u32>) -> anyhow::Result<()> {
|
|
|
+ pub fn save_contig(
|
|
|
+ &mut self,
|
|
|
+ contig: &str,
|
|
|
+ prefix: &str,
|
|
|
+ breaks: Vec<u32>,
|
|
|
+ ) -> anyhow::Result<()> {
|
|
|
self.mask_low_mrd(contig, 6)?;
|
|
|
self.mask_low_quality(contig, 0.1)?;
|
|
|
|
|
|
@@ -268,18 +273,13 @@ impl Counts {
|
|
|
let distribution_path = format!("{prefix}_{contig}_distrib.svg");
|
|
|
info!("Saving graph: {distribution_path}");
|
|
|
let mut plot = Plot::new();
|
|
|
- let colors: Vec<plotly::color::Rgb> = data_x
|
|
|
+ let colors: Vec<Rgb> = data_x
|
|
|
.iter()
|
|
|
- .map(|&x| {
|
|
|
- if x < 2.0 {
|
|
|
- plotly::color::Rgb::new(193, 18, 31)
|
|
|
- } else if x >= 15.0 {
|
|
|
- plotly::color::Rgb::new(138, 201, 38)
|
|
|
- } else if x < 6.0 {
|
|
|
- plotly::color::Rgb::new(243, 114, 44)
|
|
|
- } else {
|
|
|
- plotly::color::Rgb::new(255, 202, 58)
|
|
|
- }
|
|
|
+ .map(|&x| match x {
|
|
|
+ x if x < 2.0 => Rgb::new(193, 18, 31),
|
|
|
+ x if x < 6.0 => Rgb::new(243, 114, 44),
|
|
|
+ x if x < 15.0 => Rgb::new(255, 202, 58),
|
|
|
+ _ => Rgb::new(138, 201, 38),
|
|
|
})
|
|
|
.collect();
|
|
|
|
|
|
@@ -379,7 +379,6 @@ impl Counts {
|
|
|
.collect();
|
|
|
|
|
|
let hm = self.counts_annotations(contig)?;
|
|
|
-
|
|
|
let len = d.len();
|
|
|
let mut masked: Vec<(String, f64)> = hm
|
|
|
.iter()
|