Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Patro committed Aug 12, 2020
1 parent 241231d commit 05068e4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 0 additions & 1 deletion libradicl/src/cellfilter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ fn get_knee(freq: &[u64], max_iterations: usize, log: &slog::Logger) -> usize {
max_idx
}


/// Given the input RAD file `input_file`, compute
/// and output (in `output_dir`) the list of valid
/// (i.e. "permitted") barcode values, as well as
Expand Down
7 changes: 6 additions & 1 deletion libradicl/src/quant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ use std::io;
use std::io::Read;
use std::io::Write;
use std::io::{BufReader, BufWriter};
use std::string::ToString;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
Expand Down Expand Up @@ -582,13 +583,17 @@ pub fn quantify(
pbar.finish_with_message(&pb_msg);

let meta_info = json!({
"resolution_strategy" : resolution.to_string(),
"num_quantified_cells" : hdr.num_chunks,
"num_genes" : num_genes,
"alt_resolved_cell_numbers" : *alt_res_cells.lock().unwrap()
});

let mut meta_info_file = File::create(output_path.join("meta_info.json"))
.expect("couldn't create meta_info.json file.");
let aux_info_str = serde_json::to_string_pretty(&meta_info).expect("could not format json.");
meta_info_file
.write_all(meta_info.to_string().as_bytes())
.write_all(aux_info_str.as_bytes())
.expect("cannot write to meta_info.json file");

Ok(())
Expand Down
7 changes: 7 additions & 0 deletions libradicl/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate as libradicl;
use bio_types::strand::Strand;
use fasthash::{sea, RandomState};
use std::collections::HashMap;
use std::fmt;
use std::str::FromStr;

/**
Expand Down Expand Up @@ -46,6 +47,12 @@ pub enum ResolutionStrategy {
Parsimony,
}

impl fmt::Display for ResolutionStrategy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:?}", self)
}
}

// Implement the trait
impl FromStr for ResolutionStrategy {
type Err = &'static str;
Expand Down
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use rand::Rng;
use slog::{crit, o, warn, Drain};
use std::unimplemented;


#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;

Expand Down

0 comments on commit 05068e4

Please sign in to comment.