Skip to content

infernal cmscan: fix --FZ value and Python 2 <> comparisons - #2145

Open
jmchilton wants to merge 1 commit into
bgruening:masterfrom
jmchilton:infernal_cmscan_py3_fz
Open

jmchilton wants to merge 1 commit into
bgruening:masterfrom
jmchilton:infernal_cmscan_py3_fz

Conversation

@jmchilton

Copy link
Copy Markdown
Collaborator

FOR CONTRIBUTOR:

  • I have read the CONTRIBUTING.md document and this tool is appropriate for the tools-iuc repo.
  • License permits unrestricted use (educational + commercial)
  • This PR adds a new tool or tool collection
  • This PR updates an existing tool or tool collection
  • This PR does something else (explain below)

Two bugs in the cmscan command template:

  • --FZ $$acceleration_huristics.FZ rendered as --FZ $125.0. The shell expands $1 (empty), so cmscan got --FZ 25.0 instead of the chosen value. It is now --FZ $acceleration_huristics.FZ, still only inside the FZ branch of the acceleration conditional.
  • #if $other_opts.smxsize <> 128.0 and #if $other_opts.mxsize <> 128.0 used Python 2's <> operator. They only work because the tool has no profile, so Galaxy compiles the template through its Python 2 compatibility path. As plain Python 3 Cheetah the template doesn't compile. Both are now !=.

VERSION_SUFFIX in macros.xml goes from 0 to 1, so all six infernal tools become 1.1.5+galaxy1 and the shed version check passes without a skip-version-check label. Only cmscan's behaviour changes.

Testing:

  • Added a cmscan test that selects --FZ 500 and non-default --mxsize/--smxsize, and checks the command line with assert_command.
  • planemo test --biocontainers on cmscan.xml against Galaxy release_26.1, the same Galaxy branch and container options CI uses: all 3 tests pass. The new test's command line contains --FZ 500.0 --mxsize 256.0 --smxsize 256.0.
  • planemo lint: no new warnings. The existing DatatypesCustomConf warning is the same as on master.
  • The command template now compiles as Python 3 Cheetah. On master it fails with a SyntaxError.

Possible follow-ups, not changed here:

  • --tblout '\$temp_tabular_output' writes to a file literally named $temp_tabular_output, not to the mktemp path. It works because the later tail reads the same literal name, but the mktemp call does nothing.
  • --acyk has truevalue="--cyk", so the "Use the CYK algorithm to align hits" option passes --cyk, not --acyk.
  • cmsearch.xml has the same --FZ $$acceleration_huristics.FZ bug.

🤖 Generated with Claude Code

`--FZ $$acceleration_huristics.FZ` rendered as `--FZ $125.0`, which
the shell expands to `--FZ 25.0`, so the chosen search space size was
never passed. Drop the extra `$`.

Replace the Python 2 `<>` operator in the --smxsize/--mxsize checks
with `!=`. They only worked through Galaxy's Python 2 template
compatibility path, since the tool has no profile.

Add a test that sets --FZ, --mxsize and --smxsize and checks the
command line. Bump the shared VERSION_SUFFIX to 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bgruening bgruening added the tool-bot:review ask gxy-tool-bot to review a pr label Nov 27, 2026
@bgruening
bgruening deployed to fork-review November 27, 2026 21:44 — with GitHub Actions Active
@github-actions github-actions Bot removed the tool-bot:review ask gxy-tool-bot to review a pr label Nov 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tool Review: tools/rna_tools/

Summary: 🔴 8 critical · 🟡 10 warning(s)


🔴 Critical

[validation] infernal/cmalign.xml:164

outfile specifies format="text", which is not a valid Galaxy datatype. This causes planemo lint to fail with ERROR (ValidDatatypes): Unknown datatype [text] used in data element.

Suggestion: Change format="text" to format="txt" (or use <change_format> based on other_opts.outformat_selector to emit stockholm, fasta, clustal, or txt depending on the chosen --outformat).

[validation] infernal/.shed.yml:11

remote_repository_url is set to https://github.com/bgruening/galaxytools/tree/master/tools/infernal, which triggers WARNING: remote_repository_url may be incorrect: expected it to end with a significant part of '.../tools/rna_tools/infernal' in planemo shed_lint. Because CI runs planemo shed_lint --fail_level warn, this warning fails the CI lint job.

Suggestion: Update remote_repository_url to https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/infernal.

[security_bugs] infernal/cmbuild.xml:285

In the <filter> elements for hfile, sfile, qqfile, ffile, and xfile (lines 285, 294, 303, 312, 321), the condition checks Calibrate['selector'] is True. However, Calibrate.selector (line 210) is a <param type="select"> whose option values are the strings "true" and "false", not booleans. Because "true" is True always evaluates to False, none of the optional calibration output files (hfile, sfile, qqfile, ffile, xfile) will ever be collected.

Suggestion: Change Calibrate['selector'] is True to Calibrate['selector'] == 'true' in all five output <filter> blocks.

[security_bugs] infernal/cmsearch.xml:58

When acceleration_huristics_selector == "FZ", the command template emits --FZ $$acceleration_huristics.FZ with a double dollar sign ($$). In addition, <param argument="--FZ" type="float" value="" .../> at line 136 sets an empty string default on a non-optional float parameter, which fails numeric validation if left blank.

Suggestion: Use single $ (--FZ $acceleration_huristics.FZ) and set a valid numeric default such as value="125" (matching infernal/cmscan.xml).

[security_bugs] infernal/cmsearch.xml:97

The --acyk boolean parameter defines truevalue="--cyk" instead of truevalue="--acyk" (the exact same bug also exists in infernal/cmscan.xml:212). Selecting --acyk passes --cyk (which changes the hit scoring algorithm rather than the hit alignment algorithm) and can pass --cyk twice if --cyk is also enabled.

Suggestion: Change truevalue="--cyk" to truevalue="--acyk" in both infernal/cmsearch.xml:97 and infernal/cmscan.xml:212.

[security_bugs] infernal/cmalign.xml:138

The --mapstr boolean parameter is misconfigured as truevalue="--small" with checked="true" and label "Use small memory divide and conquer algorithm". Checking --mapali thus silently passes --small to cmalign, which fails unless --cyk, --noprob, --nonbanded, and --notrunc are all active, and fails to pass --mapstr.

Suggestion: Set truevalue="--mapstr", checked="false", and an accurate label/help explaining that --mapstr incorporates the consensus secondary structure from --mapali.

[security_bugs] infernal/cmalign.xml:72

The <param argument="-g" .../> glocal alignment option is declared in <inputs>, but $g is never referenced anywhere in <command>. Enabling -g in the UI has no effect.

Suggestion: Include ${g} in the cmalign command line in <command>.

[security_bugs] infernal/cmscan.xml:84

The post-processing in cmscan.xml prepends a 19-column header (#target\tname\taccession\t...) by splitting Infernal's first column (#target name) on whitespace into two tab-separated header fields (#target and name). Infernal --tblout produces 18 columns (17 non-whitespace columns plus description of target), so every header from column 2 onward is shifted by one column relative to the data (visible in infernal/test-data/test_cmscan.tabular). Furthermore, tail -n +3 only strips the top 2 comment lines and leaves the 10-line # Program: ... footer at the bottom, which awk/paste turns into malformed 18-column rows with 17 leading tabs.

Suggestion: Fix the header to #target name\taccession\t... (18 columns) and filter out all comment lines (grep -v '^#' or awk '!/^#/') before splitting fields 1–17 and 18+.

🟡 Warning

[validation] infernal/datatypes_conf.xml:1

datatypes_conf.xml (and infernal.py) defines a custom datatype, which triggers WARNING (DatatypesCustomConf): Tool uses a custom datatypes_conf.xml which is discouraged on every tool in planemo shed_lint. Under planemo shed_lint --fail_level warn, this fails CI.

Suggestion: Ensure the cm datatype is registered in core Galaxy (if not already present) and remove the custom datatypes_conf.xml and infernal.py from the tool directory.

[security_bugs] infernal/cmpress.xml:15

In the else branch of <command>, ln -s '$cmfile' ./cm_model/ references $cmfile directly instead of $cm_opts.cmfile (the parameter is nested inside <conditional name="cm_opts"> from the DB macro).

Suggestion: Use ln -s '$cm_opts.cmfile' ./cm_model/ for consistency and compatibility with strict parameter scoping.

[security_bugs] infernal/cmsearch.xml:222

multiple_alignment_output (produced by cmsearch -A) declares format="tabular", whereas cmsearch -A outputs a Stockholm-format multiple sequence alignment. Additionally, line 77 uses sed -e 's/#.*$//' to strip comments, which deletes text after # inside sequence names or descriptions instead of only skipping comment lines (/^#/d).

Suggestion: Change multiple_alignment_output to format="stockholm", and replace s/#.*$// with /^#/d (or use the same 18-column awk post-processing as cmscan.xml once fixed).

[brittleness] infernal/cmstat.xml:14

outfile declares format="tabular", but <command> redirects cmstat stdout directly without converting spaces to tabs or stripping # header/comment lines (infernal/test-data/cmstat_out.tabular contains space-padded columns).

Suggestion: Either convert the cmstat output into a proper tab-delimited table with a single # header line, or use format="txt".

[brittleness] infernal/cmscan.xml:21

tar xvf '$aux_files' followed by ln -s `find *.i1f` cmdb.cm.i1f assumes all four index files sit flat in the tar root with no spaces or subdirectories and fails if find returns empty or multiple paths. In addition, <help> (line 301) instructs users to include the .cm file inside the tar archive, contradicting cmpress.xml (which only tars *.i1{f,i,m,p}).

Suggestion: Extract safely (e.g. handling subdirectories or stripping components, quoting paths) and update <help> to match cmpress's tar output.

[brittleness] infernal/cmalign.xml:59

Several file paths in <command> are unquoted: $cm_opts.database.fields.path (cmalign.xml:59, cmsearch.xml:67, cmstat.xml:17), $cm_opts.cmfile (cmsearch.xml:69, cmstat.xml:19), and $getVar($j) (cmbuild.xml:76). Unquoted paths will break if a .loc path or filename contains spaces or shell metacharacters.

Suggestion: Wrap all file path variables in single quotes ('...').

[conventions] infernal/cmalign.xml:106

banding_selector options --hbanded and --nonbanded (lines 106–107) have empty option text (></option>), and outformat_selector (line 143) has an empty label="". In infernal/cmbuild.xml, option --wpb is mislabeled Henikoff (--wgb) (lines 120 and 428), is_summery_output has a typo (summery -> summary, line 205), and output_options (line 237) uses display="checkboxes" on a multi-select parameter.

Suggestion: Add descriptive labels for --hbanded, --nonbanded, and outformat_selector; fix the --wpb and summary typos; and remove display="checkboxes" in cmbuild.xml.

[conventions] infernal/macros.xml:1

None of the six tools include a <version_command> (or a version_command macro in macros.xml). Four tools (cmalign.xml:9, cmbuild.xml:10, cmsearch.xml:10, cmstat.xml:7) omit detect_errors="aggressive" on <command>, rely on <expand macro="stdio" /> instead, and omit the profile attribute (defaulting to legacy 16.01). cmpress.xml and cmscan.xml specify both detect_errors="aggressive" and <expand macro="stdio" />.

Suggestion: Add a version_command macro (cmstat -h or cmsearch -h / cmalign -h parsed for version) and @PROFILE@ token in macros.xml, use detect_errors="aggressive" on all <command> tags, and remove the redundant stdio macro.

[conventions] infernal/cmalign.xml:192

All six tool <help> sections use reStructuredText syntax instead of Markdown (<help format="markdown">). Additionally, cmalign.xml lines 209–229 describe the 18-column cmsearch/cmscan hit table format rather than cmalign's multiple sequence alignment output.

Suggestion: Convert all <help> blocks to <help format="markdown"> with Markdown formatting and replace the hit-table documentation in cmalign.xml with cmalign alignment output documentation.

[test_coverage] infernal/cmalign.xml:167

expect_num_outputs is missing from all <test> elements in cmalign.xml, cmpress.xml, cmscan.xml, and cmstat.xml. In addition:

  • cmpress.xml tests (lines 31–50) do not assert anything on <output name="outfile">, only stdout.
  • cmsearch.xml (lines 234, 242) and cmstat.xml (lines 38, 52) omit ftype="tabular" on <output>, and cmstat.xml only checks header strings (idx, accession, nseq) without verifying data rows.
  • cmscan.xml uses lines_diff="8" to ignore unstripped footer/timestamp lines rather than verifying clean tabular output.
  • Key modes and conditional outputs are untested: cmsearch -A (multiple_alignment_output) and --FZ, cmbuild --refine / -o (summary_outfile) / extra calibration outputs, and cmalign output format / --mapali options.

Suggestion: Add expect_num_outputs and explicit ftype attributes to all tests, validate cmpress tar output contents, strengthen cmstat and cmscan output assertions, and add tests covering conditional outputs and key options.

This branch was successfully deployed

1 active deployment
fork-review — 0e2db69a Deployed Nov 27, 2026 by bgruening via Review fork PR #29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants