Skip to content

Commit e91433a

Browse files
pinin4fjordsclaude
andcommitted
revert(stats): drop Log.out / Log.progress.out stub writers
The previous commit added writers that mimicked STAR's section-header structure with placeholder content (a Debug-format params dump + three timestamps for Log.out, a header + final-timestamp line for Log.progress.out). That closes the file-existence gap but makes the output look like STAR-equivalent verbose logging when it isn't — downstream tools parsing for memory usage, per-chunk progress, or warnings would silently get nothing. Drop the stub writers. The SJ.pass1.out.tab → <prefix>_STARpass1/SJ.out.tab placement fix stays — that's a real path-parity change with no fakery. Real STAR-equivalent Log.out / Log.progress.out content (per-phase progress, warnings, memory, periodic updates during long runs) is a separate engineering effort, not a stub. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1a55cae commit e91433a

3 files changed

Lines changed: 0 additions & 165 deletions

File tree

src/lib.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,6 @@ fn align_reads(params: &Parameters) -> anyhow::Result<()> {
258258
stats.write_log_final(&log_path, time_start, time_map_start, time_finish)?;
259259
info!("Wrote {}", log_path.display());
260260

261-
let log_out_path = params.out_file_name_prefix.join("Log.out");
262-
crate::stats::write_log_out(
263-
&log_out_path,
264-
&params,
265-
time_start,
266-
time_map_start,
267-
time_finish,
268-
)?;
269-
info!("Wrote {}", log_out_path.display());
270-
271-
let log_progress_path = params.out_file_name_prefix.join("Log.progress.out");
272-
let total_reads = stats.total_reads.load(std::sync::atomic::Ordering::Relaxed);
273-
crate::stats::write_log_progress(&log_progress_path, total_reads, time_map_start, time_finish)?;
274-
info!("Wrote {}", log_progress_path.display());
275-
276261
// Write ReadsPerGene.out.tab if quantMode GeneCounts was requested.
277262
if let Some(ref ctx) = quant_ctx {
278263
let quant_path = params.out_file_name_prefix.join("ReadsPerGene.out.tab");

src/stats.rs

Lines changed: 0 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -5,74 +5,6 @@ use std::sync::atomic::{AtomicU64, Ordering};
55

66
use crate::align::transcript::{CigarOp, Transcript};
77
use crate::junction::encode_motif;
8-
use crate::params::Parameters;
9-
10-
/// Shared timestamp format used across Log.final.out / Log.out / Log.progress.out.
11-
pub const LOG_TIME_FMT: &str = "%b %d %H:%M:%S";
12-
13-
/// Write a minimal STAR-compatible Log.out alongside Log.final.out.
14-
///
15-
/// Carries a parameters dump and per-phase timestamps. Intentionally a stub
16-
/// rather than a full STAR-verbose-log reproduction.
17-
pub fn write_log_out(
18-
path: &Path,
19-
params: &Parameters,
20-
time_start: chrono::DateTime<chrono::Local>,
21-
time_map_start: chrono::DateTime<chrono::Local>,
22-
time_finish: chrono::DateTime<chrono::Local>,
23-
) -> std::io::Result<()> {
24-
use std::io::Write;
25-
26-
let mut f = std::fs::File::create(path)?;
27-
28-
writeln!(f, "##### Run parameters")?;
29-
writeln!(f, "{:#?}", params)?;
30-
writeln!(f)?;
31-
writeln!(f, "##### Run started")?;
32-
writeln!(f, "{}", time_start.format(LOG_TIME_FMT))?;
33-
writeln!(f)?;
34-
writeln!(f, "##### Mapping started")?;
35-
writeln!(f, "{}", time_map_start.format(LOG_TIME_FMT))?;
36-
writeln!(f)?;
37-
writeln!(f, "##### Mapping finished")?;
38-
writeln!(f, "{}", time_finish.format(LOG_TIME_FMT))?;
39-
40-
Ok(())
41-
}
42-
43-
/// Write a minimal STAR-compatible Log.progress.out alongside Log.final.out.
44-
///
45-
/// A header line plus a single "done" line with the final timestamp and
46-
/// mapping speed (million reads per hour). Intentionally a stub.
47-
pub fn write_log_progress(
48-
path: &Path,
49-
total_reads: u64,
50-
time_map_start: chrono::DateTime<chrono::Local>,
51-
time_finish: chrono::DateTime<chrono::Local>,
52-
) -> std::io::Result<()> {
53-
use std::io::Write;
54-
55-
let elapsed_hours = {
56-
let elapsed = time_finish - time_map_start;
57-
elapsed.num_milliseconds() as f64 / 3_600_000.0
58-
};
59-
let mapping_speed = if elapsed_hours > 0.0 {
60-
total_reads as f64 / elapsed_hours / 1_000_000.0
61-
} else {
62-
0.0
63-
};
64-
65-
let mut f = std::fs::File::create(path)?;
66-
writeln!(f, "# completed\tmapping_speed_M_reads_per_hour")?;
67-
writeln!(
68-
f,
69-
"{}\t{:.2}",
70-
time_finish.format(LOG_TIME_FMT),
71-
mapping_speed
72-
)?;
73-
74-
Ok(())
75-
}
768

779
/// Reason a read could not be mapped
7810
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -1086,69 +1018,4 @@ mod tests {
10861018
stats.record_half_mapped();
10871019
assert_eq!(stats.half_mapped_pairs.load(Ordering::Relaxed), 3);
10881020
}
1089-
1090-
#[test]
1091-
fn test_write_log_out_minimal() {
1092-
use chrono::TimeZone;
1093-
use clap::Parser;
1094-
1095-
let params = Parameters::parse_from(["rustar-aligner", "--readFilesIn", "reads.fq"]);
1096-
let t_start = chrono::Local
1097-
.with_ymd_and_hms(2026, 5, 12, 14, 14, 23)
1098-
.unwrap();
1099-
let t_map = chrono::Local
1100-
.with_ymd_and_hms(2026, 5, 12, 14, 14, 30)
1101-
.unwrap();
1102-
let t_finish = chrono::Local
1103-
.with_ymd_and_hms(2026, 5, 12, 14, 14, 58)
1104-
.unwrap();
1105-
1106-
let dir = tempfile::tempdir().unwrap();
1107-
let path = dir.path().join("Log.out");
1108-
write_log_out(&path, &params, t_start, t_map, t_finish).unwrap();
1109-
1110-
let content = std::fs::read_to_string(&path).unwrap();
1111-
assert!(!content.is_empty(), "Log.out should not be empty");
1112-
assert!(content.contains("##### Run parameters"));
1113-
assert!(content.contains("##### Run started"));
1114-
assert!(content.contains("##### Mapping started"));
1115-
assert!(content.contains("##### Mapping finished"));
1116-
// Each phase header should be followed by a timestamp shaped like "May 12 14:14:23".
1117-
assert!(content.contains("May 12 14:14:23"));
1118-
assert!(content.contains("May 12 14:14:58"));
1119-
// The parameters dump should mention at least one familiar field.
1120-
assert!(content.contains("read_files_in"));
1121-
}
1122-
1123-
#[test]
1124-
fn test_write_log_progress_minimal() {
1125-
use chrono::TimeZone;
1126-
1127-
let t_map = chrono::Local
1128-
.with_ymd_and_hms(2026, 5, 12, 14, 14, 30)
1129-
.unwrap();
1130-
let t_finish = chrono::Local
1131-
.with_ymd_and_hms(2026, 5, 12, 14, 14, 58)
1132-
.unwrap();
1133-
1134-
let dir = tempfile::tempdir().unwrap();
1135-
let path = dir.path().join("Log.progress.out");
1136-
write_log_progress(&path, 10_000, t_map, t_finish).unwrap();
1137-
1138-
let content = std::fs::read_to_string(&path).unwrap();
1139-
let lines: Vec<&str> = content.lines().collect();
1140-
assert!(lines.len() >= 2, "expected header + data line");
1141-
assert!(lines[0].starts_with('#'), "first line should be a header");
1142-
assert!(
1143-
lines[1].contains("May 12 14:14:58"),
1144-
"second line should contain the finish timestamp, got: {}",
1145-
lines[1]
1146-
);
1147-
// Mapping speed column should be a number with two decimals.
1148-
let cols: Vec<&str> = lines[1].split('\t').collect();
1149-
assert_eq!(cols.len(), 2, "expected 2 tab-separated columns");
1150-
cols[1]
1151-
.parse::<f64>()
1152-
.expect("second column should parse as a float");
1153-
}
11541021
}

tests/alignment_features.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -795,23 +795,6 @@ fn test_two_pass_mode() {
795795
"SJ.pass1.out.tab should no longer be emitted at the top level"
796796
);
797797

798-
let log_out = output_dir.join("Log.out");
799-
assert!(log_out.exists(), "Log.out not found");
800-
let log_out_content = fs::read_to_string(&log_out).unwrap();
801-
assert!(!log_out_content.is_empty(), "Log.out is empty");
802-
assert!(
803-
log_out_content.contains("##### Run parameters"),
804-
"Log.out missing parameters section"
805-
);
806-
807-
let log_progress = output_dir.join("Log.progress.out");
808-
assert!(log_progress.exists(), "Log.progress.out not found");
809-
let log_progress_content = fs::read_to_string(&log_progress).unwrap();
810-
assert!(
811-
log_progress_content.lines().count() >= 2,
812-
"Log.progress.out should have a header and at least one data line"
813-
);
814-
815798
let sam_path = output_dir.join("Aligned.out.sam");
816799
assert!(sam_path.exists(), "Aligned.out.sam not found");
817800

0 commit comments

Comments
 (0)