Skip to content

Commit

Permalink
Remove all code that populated dead pathlist.
Browse files Browse the repository at this point in the history
  • Loading branch information
macklin-10x committed Apr 18, 2024
1 parent bb1d9b5 commit ffc5e30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
17 changes: 5 additions & 12 deletions enclone_args/src/load_gex_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ struct LoadResult {
cell_type_specified: bool,
error: String,
h5_path: String,
f15: Vec<String>,
feature_metrics: HashMap<(String, String), String>,
json_metrics: HashMap<String, f64>,
metrics: String,
Expand Down Expand Up @@ -70,7 +69,6 @@ pub fn load_gex(
// somehow the parallelism is not working.
// 2. We know where the time is spent in the loop, and this is marked below.
results.par_iter_mut().for_each(|(i, r)| {
let pathlist = &mut r.f15;
let i = *i;
if !gex_outs[i].is_empty() {
// First define the path where the GEX files should live, and make sure that the path
Expand Down Expand Up @@ -102,7 +100,6 @@ pub fn load_gex(
for x in &h5p {
let p = format!("{outs}/{x}");
if path_exists(&p) {
pathlist.push(p.clone());
h5_path = p;
break;
}
Expand Down Expand Up @@ -141,13 +138,13 @@ pub fn load_gex(

// Find files.

let pca_file = find_pca_file(&analysis, pathlist);
let cluster_file = find_cluster_file(&analysis, pathlist);
let pca_file = find_pca_file(&analysis);
let cluster_file = find_cluster_file(&analysis);

let (json_metrics_file, feature_metrics_file, metrics_file) = if !ctl.cr_opt.cellranger {(
find_json_metrics_file(&analysis, pathlist),
find_feature_metrics_file(&analysis, pathlist),
find_metrics_file(&outs, pathlist)
find_json_metrics_file(&analysis),
find_feature_metrics_file(&analysis),
find_metrics_file(&outs)
)} else {
Default::default()
};
Expand All @@ -173,7 +170,6 @@ pub fn load_gex(
);
return;
}
pathlist.push(f.to_string());
}

// Find metrics summary file.
Expand All @@ -195,7 +191,6 @@ pub fn load_gex(
for c in &csvs {
if path_exists(c) {
csv = c.clone();
pathlist.push(c.to_string());
break;
}
}
Expand All @@ -211,7 +206,6 @@ pub fn load_gex(
// Read cell types.

if path_exists(&types_file) {
pathlist.push(types_file.clone());
let f = open_userfile_for_read(&types_file);
let mut count = 0;
for line in f.lines() {
Expand Down Expand Up @@ -540,7 +534,6 @@ pub fn load_gex(

let fref_file = fnx(&outs, "feature_reference.csv");
if path_exists(&fref_file) {
pathlist.push(fref_file.clone());
r.feature_refs = read_to_string(&fref_file).unwrap();
}

Expand Down
17 changes: 5 additions & 12 deletions enclone_args/src/load_gex_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,77 +3,70 @@
use io_utils::{dir_list, path_exists};
use vector_utils::VecUtils;

pub fn find_pca_file(analysis: &[String], pathlist: &mut Vec<String>) -> String {
pub fn find_pca_file(analysis: &[String]) -> String {
let mut pca_file = String::new();
for x in analysis {
pca_file = format!("{x}/pca/10_components/projection.csv");
if path_exists(&pca_file) {
pathlist.push(pca_file.clone());
break;
}
pca_file = format!("{x}/pca/gene_expression_10_components/projection.csv");
if path_exists(&pca_file) {
pathlist.push(pca_file.clone());
break;
}
}
pca_file
}

pub fn find_json_metrics_file(analysis: &[String], pathlist: &mut Vec<String>) -> String {
pub fn find_json_metrics_file(analysis: &[String]) -> String {
let mut json_metrics_file = String::new();
for x in analysis {
let f = format!("{x}/metrics_summary_json.json");
if path_exists(&f) {
json_metrics_file = f.clone();
pathlist.push(f);
break;
}
}

json_metrics_file
}

pub fn find_feature_metrics_file(analysis: &[String], pathlist: &mut Vec<String>) -> String {
pub fn find_feature_metrics_file(analysis: &[String]) -> String {
let mut feature_metrics_file = String::new();
for x in analysis {
let f = format!("{x}/per_feature_metrics.csv");
if path_exists(&f) {
feature_metrics_file = f.clone();
pathlist.push(f);
break;
}
}

feature_metrics_file
}

pub fn find_metrics_file(outs: &str, pathlist: &mut Vec<String>) -> String {
pub fn find_metrics_file(outs: &str) -> String {
let mut metrics_file = String::new();
let summary_dir = format!("{outs}/../multi_web_summary_json/metrics_summary_csv");
if path_exists(&summary_dir) {
let list = dir_list(&summary_dir);
if list.solo() {
let path = format!("{summary_dir}/{}", list[0]);
pathlist.push(path.clone());
metrics_file = path;
}
}

metrics_file
}

pub fn find_cluster_file(analysis: &[String], pathlist: &mut Vec<String>) -> String {
pub fn find_cluster_file(analysis: &[String]) -> String {
let mut cluster_file = String::new();
for x in analysis {
cluster_file = format!("{x}/clustering/graphclust/clusters.csv");
if path_exists(&cluster_file) {
pathlist.push(cluster_file.clone());
break;
}
cluster_file = format!("{x}/clustering/gene_expression_graphclust/clusters.csv");
if path_exists(&cluster_file) {
pathlist.push(cluster_file.clone());
break;
}
}
Expand Down

0 comments on commit ffc5e30

Please sign in to comment.