Skip to content

Commit 304a39c

Browse files
ewelsclaude
andcommitted
fix(params): don't require --sjdbGTFfile at alignReads when the index has it
Previously, `--quantMode TranscriptomeSAM` at alignReads rejected invocations without --sjdbGTFfile, even when the user had already persisted transcriptInfo.tab + friends in --genomeDir at genomeGenerate. That's STAR-incompatible: STAR loads the files directly and only re-parses the GTF if explicitly passed at mapping time. Move the hard check to genomeGenerate mode only. GenomeIndex::load already surfaces a clear error if neither source is available at alignReads (via `index.transcriptome.is_none()` in src/lib.rs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2b1b342 commit 304a39c

1 file changed

Lines changed: 29 additions & 5 deletions

File tree

src/params.rs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,18 @@ impl Parameters {
826826
}
827827
self.rg_ids()?;
828828

829-
// quantMode TranscriptomeSAM requires a GTF file
830-
if self.quant_transcriptome_sam() && self.sjdb_gtf_file.is_none() {
829+
// quantMode TranscriptomeSAM requires transcript annotations —
830+
// either via --sjdbGTFfile or pre-generated transcriptInfo.tab
831+
// et al in --genomeDir (persisted at genomeGenerate time). At
832+
// validation time we can only enforce the genomeGenerate rule;
833+
// for alignReads, GenomeIndex::load checks for the on-disk files
834+
// and surfaces a clear error if neither source is available.
835+
if self.run_mode == RunMode::GenomeGenerate
836+
&& self.quant_transcriptome_sam()
837+
&& self.sjdb_gtf_file.is_none()
838+
{
831839
return Err(crate::error::Error::Parameter(
832-
"--quantMode TranscriptomeSAM requires --sjdbGTFfile".into(),
840+
"--quantMode TranscriptomeSAM requires --sjdbGTFfile at genomeGenerate".into(),
833841
));
834842
}
835843

@@ -1265,13 +1273,29 @@ mod tests {
12651273
}
12661274

12671275
#[test]
1268-
fn validate_transcriptome_sam_needs_gtf() {
1269-
let p = parse(&["--readFilesIn", "r.fq", "--quantMode", "TranscriptomeSAM"]);
1276+
fn validate_transcriptome_sam_at_genome_generate_needs_gtf() {
1277+
let p = parse(&[
1278+
"--runMode",
1279+
"genomeGenerate",
1280+
"--genomeFastaFiles",
1281+
"g.fa",
1282+
"--quantMode",
1283+
"TranscriptomeSAM",
1284+
]);
12701285
let err = p.validate().unwrap_err();
12711286
assert!(err.to_string().contains("TranscriptomeSAM"));
12721287
assert!(err.to_string().contains("sjdbGTFfile"));
12731288
}
12741289

1290+
#[test]
1291+
fn validate_transcriptome_sam_at_align_reads_tolerates_no_gtf() {
1292+
// alignReads: if --sjdbGTFfile is absent, the check is deferred to
1293+
// GenomeIndex::load which will either find transcriptInfo.tab in
1294+
// --genomeDir or surface a clear error at load time.
1295+
let p = parse(&["--readFilesIn", "r.fq", "--quantMode", "TranscriptomeSAM"]);
1296+
assert!(p.validate().is_ok());
1297+
}
1298+
12751299
#[test]
12761300
fn validate_transcriptome_sam_with_gtf_ok() {
12771301
let p = parse(&[

0 commit comments

Comments
 (0)