broadinstitute / viral-ngs

Viral genomics analysis pipelines
Other
190 stars 67 forks source link

address snpEff database build failures #873

Closed tomkinsc closed 6 years ago

tomkinsc commented 6 years ago

Sometimes the snpEff test can fail:

test/integration/test_intrahost.py::TestSnpEff::test_snpeff 00:00:00    ERROR while connecting to http://downloads.sourceforge.net/pro\
ject/snpeff/databases/v4_3/snpEff_v4_3_35420824d4be308c07afde83d507288ed3f5395596628c14fb8f38e.zip
java.lang.RuntimeException: java.lang.RuntimeException: File not found on the server. Make sure the database name is correct.
       at org.snpeff.util.Download.download(Download.java:178)
       at org.snpeff.snpEffect.commandLine.SnpEffCmdDownload.downloadAndInstall(SnpEffCmdDownload.java:32)
       at org.snpeff.snpEffect.commandLine.SnpEffCmdDownload.runDownloadGenome(SnpEffCmdDownload.java:86)
       at org.snpeff.snpEffect.commandLine.SnpEffCmdDownload.run(SnpEffCmdDownload.java:72)
       at org.snpeff.SnpEff.run(SnpEff.java:1183)
       at org.snpeff.SnpEff.main(SnpEff.java:162)
Caused by: java.lang.RuntimeException: File not found on the server. Make sure the database name is correct.
       at org.snpeff.util.Download.download(Download.java:127)
       ... 5 more

[gw1] [100%] FAILED test/integration/test_intrahost.py::TestSnpEff::test_snpeff

This happens when there are database hash lines in the snpEff config (<conda_env>/share/snpeff-4.3.1t-1/snpEff.config, toward the bottom), but no database directory named with same hash within <conda_env>/share/snpeff-4.3.1t-1/data/. snpEff checks for databases within data/ first based on database names within the config file, and then attempts to download them if it can't find a corresponding database directory. It downloads pre-built databases from the snpEff sourceforge site rather than GenBank, which is why we go through the process of building custom databases based on accessions.

We should move the add_genomes_to_snpeff_config_file() call within snpeff.py to be after the execute('build') call, and make it contingent on a successful exit code from snpEff build.