|
|
@@ -37,7 +37,7 @@ use noodles_fasta::indexed_reader::Builder as FastaBuilder;
|
|
|
use noodles_gff as gff;
|
|
|
|
|
|
use rayon::prelude::*;
|
|
|
-use serde::{Deserialize, Serialize};
|
|
|
+use serde::{Deserialize, Serialize, Serializer, ser::SerializeStruct};
|
|
|
use std::io::Write;
|
|
|
use std::{
|
|
|
env::temp_dir,
|
|
|
@@ -62,6 +62,23 @@ pub struct Variants {
|
|
|
pub mp: MultiProgress,
|
|
|
}
|
|
|
|
|
|
+impl Serialize for Variants {
|
|
|
+ fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
|
+ where
|
|
|
+ S: Serializer,
|
|
|
+ {
|
|
|
+ // 3 is the number of fields in the struct.
|
|
|
+ let mut state = serializer.serialize_struct("Variants", 5)?;
|
|
|
+ state.serialize_field("name", &self.name)?;
|
|
|
+ state.serialize_field("data", &self.data)?;
|
|
|
+ state.serialize_field("constit", &self.constit)?;
|
|
|
+ state.serialize_field("stats_vcf", &self.stats_vcf)?;
|
|
|
+ state.serialize_field("stats_bam", &self.stats_bam)?;
|
|
|
+ state.end()
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
|
|
pub struct StatsVCF {
|
|
|
n_tumoral_init: usize,
|
|
|
@@ -1439,6 +1456,7 @@ pub fn run_pipe(name: &str, multi: &MultiProgress) -> Result<()> {
|
|
|
variants.keep_somatics_un();
|
|
|
info!("Variants retained: {}", variants.len());
|
|
|
|
|
|
+ // TODO check if SNP are matching
|
|
|
if variants.len() > 100_000 {
|
|
|
return Err(anyhow!("Too many variants, verify if somatic and tumoral samples match."));
|
|
|
}
|