Skip to content

star/genomegenerate: round genomeSAindexNbases down, as STAR requires - #13464

Merged
SPPearce merged 1 commit into
masterfrom
star-genomegenerate-saindexnbases-floor
Oct 27, 2026
Merged

SPPearce merged 1 commit into
masterfrom
star-genomegenerate-saindexnbases-floor

Conversation

@danilomonge

@danilomonge danilomonge commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

When ext.args does not set --genomeSAindexNbases, star/genomegenerate computes it from the genome length. The STAR manual says that for small genomes the value must be scaled down to min(14, log2(GenomeLength)/2 - 1) (parametersDefault). STAR warns when the value is larger than log2(GenomeLength)/2 - 1 and recommends int(log2(GenomeLength)/2 - 1) (Genome_genomeGenerate.cpp). The module rounded log2(GenomeLength)/2 - 1 to the nearest integer (printf "%.0f"), so whenever the fraction was 0.5 or more it chose one more than the limit:

Genome length log2(L)/2 - 1 Before After (STAR's value)
40,001 bp (test genome.fasta) 6.64 7 6
140 Mb 12.53 13 12
600 Mb 13.58 14 13
3.1 Gb 14.77 14 14

With 7, STAR 2.7.11b logs --genomeSAindexNbases 7 is too large for the genome size=40001, which may cause seg-fault at the mapping step. Re-run genome generation with recommended --genomeSAindexNbases 6. This PR rounds down with int(), so the module uses the value STAR recommends and the warning is gone. Genomes above about 1 Gb (capped at 14) and runs that set --genomeSAindexNbases in ext.args are not affected.

The snapshots do not change. The star/genomegenerate snapshot records the index file names and the versions, and the star/starsolo outputs, the only other CPU test that uses the computed value, have the same md5 sums with 6 as with 7. The other tests that build an index with this module set --genomeSAindexNbases 9 in their configs.

#13453 also edits this gawk line (it adds $args3), so whichever of the two PRs is merged second needs a one-line merge.

Generated by Claude Opus 5.5

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests! (the existing tests run the computed value; their snapshots are unchanged)
  • Remove all TODO statements.
  • Broadcast software version numbers to topic: versions - See version_topics
  • Follow the naming conventions.
  • Follow the parameters requirements.
  • Follow the input/output options guidelines.
  • Add a resource label
  • Use BioConda and BioContainers if possible to fulfil software requirements.
  • Ensure that the test works with either Docker / Singularity. Conda CI tests can be quite flaky:
    • For modules:
      • nf-core modules test <MODULE> --profile docker (at a6f93fe, on linux/amd64 with nf-test 0.9.5 and Nextflow 26.04.0: nf-test test --profile=+docker --ci on star/genomegenerate and on star/align, star/starsolo, arriba/arriba, arriba/visualisation and fastq_align_star, whose tests use it: 26 of 26 passed against the snapshots; nf-core modules lint star/genomegenerate: 0 failed)
      • nf-core modules test <MODULE> --profile singularity (not run locally; CI runs it)
      • nf-core modules test <MODULE> --profile conda (not run locally; CI runs it)

The STAR manual says that for small genomes --genomeSAindexNbases must
be scaled down to min(14, log2(GenomeLength)/2 - 1). STAR warns when the
value is larger than log2(GenomeLength)/2 - 1 and recommends
int(log2(GenomeLength)/2 - 1). The module rounded log2(GenomeLength)/2 - 1
to the nearest integer, so whenever the fraction was 0.5 or more it chose
one more than the limit: 7 instead of 6 for the 40 kb test genome, 13
instead of 12 for a 140 Mb genome. STAR then warned that the index may
cause a seg-fault at the mapping step. Round down instead.

Generated by Claude Opus 5.5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@danilomonge
danilomonge force-pushed the star-genomegenerate-saindexnbases-floor branch from 7707495 to a6f93fe Compare October 26, 2026 21:52
@danilomonge
danilomonge marked this pull request as ready for review October 26, 2026 22:07
@SPPearce
SPPearce added this pull request to the merge queue Oct 27, 2026
@danilomonge
danilomonge requested review from SPPearce and removed request for SPPearce October 27, 2026 09:10
Merged via the queue into master with commit fe7edbd Oct 27, 2026
64 checks passed
@SPPearce
SPPearce deleted the star-genomegenerate-saindexnbases-floor branch October 27, 2026 09:12
danilomonge added a commit that referenced this pull request Oct 27, 2026
Resolve the conflict with #13464 on the NUM_BASES line by keeping both
changes: gawk gets $args3, and the computed genomeSAindexNbases is
rounded down with int().

Generated by Claude Opus 5.5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants