Skip to content

Add Transvar - #8250

Open
joachimwolff wants to merge 6 commits into
galaxyproject:mainfrom
joachimwolff:transvar
Open

Add Transvar#8250
joachimwolff wants to merge 6 commits into
galaxyproject:mainfrom
joachimwolff:transvar

Conversation

@joachimwolff

@joachimwolff joachimwolff commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

This adds transvar with the wrapper and a datamanger to download lookup databases. TransVar is a multi-way annotator for genetic elements and genetic variations, see https://bioinformatics.mdanderson.org/public-software/transvar/ and https://github.com/zwdzwd/transvar and is under MIT license.

FOR CONTRIBUTOR:

  • I have read the CONTRIBUTING.md document and this tool is appropriate for the tools-iuc repo.
  • Use of AI
    • The contribution is mostly AI generated
    • The contribution has been assisted by AI
  • 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)

There are two labels that allow to ignore specific (false positive) tool linter errors:

  • skip-version-check: Use it if only a subset of the tools has been updated in a suite.
  • skip-url-check: Use it if github CI sees 403 errors, but the URLs work.

To request a review once your PR is ready, comment "please review" on the PR. This will
automatically apply the ready-for-review label if the PR is not a draft, all review
threads are resolved, and all CI checks have passed.

joachimwolff and others added 4 commits July 30, 2026 10:03
TransVar annotates genomic, cDNA and protein variants against one or more
transcript sets. This adds the tool wrapper plus a data manager that puts
its transcript annotation databases in a Galaxy managed location.

Wrapper:
- Single variants typed into the form are passed with "-i". A positional
  query is not valid TransVar syntax, and the default text sanitizer
  replaces the ">" of an HGVS substitution, so the valid character set is
  spelled out for the query parameter.
- VCF input is offered only in genomic mode, the only mode that accepts it,
  and produces VCF output.
- A minimal generated config is passed through TRANSVAR_CFG. TransVar looks
  up a section for the reference version before reading the command line and
  aborts if it is missing, and this keeps it away from the config inside the
  installed Python package.
- The reference genome comes from fasta_indexes or the history. TransVar
  needs it to resolve codons; without it every query returns an empty table.
- version_command tolerates "transvar --version" exiting 1, which otherwise
  aborts the job before the tool command runs.

Data manager:
- Downloads the pre-built .transvardb files into a Galaxy managed directory
  instead of the installed Python package directory, and registers them in
  the transvar_annotations data table.
- URLs come from the installed TransVar release, so they follow the
  requirement version. Files are renamed after the command line flag that
  consumes them, so the wrapper needs no knowledge of TransVar's internal
  file naming.
- Offers only openly licensed, redistributable annotation sets: RefSeq,
  CCDS, Ensembl, GENCODE and the UCSC RefGene and knownGene tables. AceView
  is excluded for lack of a stated redistribution licence, and the genome
  and dbSNP downloads are left to Galaxy's own reference data management.
- mm9 is not offered: TransVar lists it, but no pre-built databases are
  published for it.

Tested with planemo against release_24.2: 7/7 tool tests and 1/1 data
manager test pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ment

Galaxy reduces a job's environment to HOME, LC_CTYPE, PATH and TMPDIR
(galaxy.util.commands.new_clean_env), so a proxy configured for the Galaxy
server itself never reaches this tool and the download fails with a
connection timeout. Document how to set it on the job destination and say
so in the error message, since the failure otherwise gives no hint.

Also make the download survive a hiccup: a full annotation set is around 35
files and a few hundred megabytes from a single academic server, and a
single failure part way through used to abort the whole run. Retry up to
three times with backoff and a socket timeout, but do not retry a 4xx, which
is how an absent optional idmap index is detected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Galaxy merges the fields of several data table rows that share a value into
one comma-joined string, so a stale or duplicated transvar_annotations entry
produced a command line with --refversion 'hg19,hg19' and a database path
made of two paths glued together. TransVar then fell back to resolving the
path relative to TRANSVAR_DOWNLOAD_DIR and crashed inside posixpath.join
with "expected str, bytes or os.PathLike object, not NoneType", which says
nothing about the real problem.

allow_duplicate_entries="False" does not help here: Galaxy hashes the whole
row, so two rows with the same value but different paths both survive.

Check each selected database file up front and name the missing source and
the table it came from, and set TRANSVAR_DOWNLOAD_DIR so TransVar's own
fallback cannot dereference None. Adds a test with a data table entry that
claims a source it does not contain.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The IUC lint job runs planemo with --biocontainers at fail-level warn, and
requiring transvar together with samtools has no registered BioContainer, so
linting failed with "Failed to find a BioContainer registered for these
requirements". samtools was only there to index a reference FASTA taken from
the history.

Drop that option and read the genome from the fasta_indexes data table, which
leaves transvar as the single requirement and its own BioContainer is found.
Nothing is really lost: the transcript databases exist only for a handful of
assemblies and have to be installed by an administrator with the data manager
anyway, so the matching genome comes from the same hands, and pairing the two
from curated lists makes it harder to annotate against the wrong assembly.

Also replace the example proxy URL in the data manager help with a
placeholder, since shed_lint --urls tries to fetch every URL it finds there.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joachimwolff

Copy link
Copy Markdown
Contributor Author

please review

@tools-iuc tools-iuc Bot moved this from Triage/Discuss to Needs Review in Galaxy Tool Developers SIG Board Jul 31, 2026
<expand macro="requirements"/>
<!-- TransVar prints its version to stderr and then exits 1, which would
abort the job before the tool command runs. -->
<version_command>transvar --version 2>&amp;1 || true</version_command>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this || true

Comment thread tools/transvar/transvar.xml Outdated
## If a database is missing, TransVar falls back to looking it up relative to
## TRANSVAR_DOWNLOAD_DIR and crashes with an unreadable TypeError when that is
## unset. Check up front so the cause is stated instead. This also catches a
## transvar_annotations table holding several rows with the same value, which

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is not true, you can specify on the data table that duplicates are not allowed.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this entire thing here is needed or if its just made up by an LLM to work around another issue.

#end if
]]></command>
<configfiles>
<configfile name="transvar_cfg"><![CDATA[[DEFAULT]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could fill out this config file instead of using the parameters do you? Is that maybe easier, especially when you need to have the config eitherway?

Review feedback: the config file has to be generated anyway, so it can carry
the reference and the database paths instead of repeating them on the command
line. TransVar is built for this. --reference defaults to _DEF_ and a bare
--ucsc/--refseq/... takes const=_DEF_, both of which mean "read the value from
the config", so the command line only has to name which databases to switch
on:

  transvar panno --refversion 'hg19' --ccds --refseq --ucsc -i 'KRAS:p.G12D'

Also drop the shell loop that checked every database file up front. It was
guarding against a data table holding several rows with the same value, which
is not something the tool should paper over. Keeping TRANSVAR_DOWNLOAD_DIR set
is enough: without it TransVar dies in posixpath.join with "expected str,
bytes or os.PathLike object, not NoneType" when it cannot open a database,
with it the same case reports a plain FileNotFoundError naming the path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@joachimwolff

Copy link
Copy Markdown
Contributor Author

Thanks for the review, three of the four are addressed in the commit.

|| true on the version command: transvar --version prints the version to stderr and then exits 1, which is an upstream bug. Galaxy puts the version command ahead of the tool command in tool_script.sh under set -e, so without suppressing it the job dies before TransVar runs, every test failed with exit 1 and an empty output until I added it. The version string is captured correctly either way. I can switch it to the ( ... || true ) form used in tools/vapor if you prefer that style; there's no way to distinguish a real failure from the usual exit 1, since upstream always returns it.

@joachimwolff

Copy link
Copy Markdown
Contributor Author

please review

@tools-iuc

tools-iuc Bot commented Aug 7, 2026

Copy link
Copy Markdown

💬 There are unresolved review comments on this PR. Please resolve them before requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

2 participants