diff --git a/CHANGELOG.md b/CHANGELOG.md index 59106a4f..2f6417c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#218](https://github.com/nf-core/mag/pull/218) - Update to nf-core 2.0.1 `TEMPLATE` (DSL2) +### `Fixed` + +- [#226](https://github.com/nf-core/mag/pull/226) - Fix handling of `BUSCO` output when run in auto lineage selection mode and selected specific lineage is the same as the generic one. + ## v2.0.0 - 2021/06/01 ### `Added` diff --git a/modules/local/busco.nf b/modules/local/busco.nf index 2144759d..0c74d194 100644 --- a/modules/local/busco.nf +++ b/modules/local/busco.nf @@ -111,15 +111,18 @@ process BUSCO { echo "Domain and specific lineage could be selected by BUSCO." cp BUSCO/short_summary.specific.\${db_name_spec}.BUSCO.txt short_summary.specific_lineage.\${db_name_spec}.${bin}.txt + db_name_gen="" summaries_gen=(BUSCO/short_summary.generic.*.BUSCO.txt) - if [ \${#summaries_gen[@]} -ne 1 ]; then - echo "ERROR: none or multiple 'BUSCO/short_summary.generic.*.BUSCO.txt' files found. Expected one." - exit 1 + if [ \${#summaries_gen[@]} -lt 1 ]; then + echo "No 'BUSCO/short_summary.generic.*.BUSCO.txt' file found. Assuming selected domain and specific lineages are the same." + cp BUSCO/short_summary.specific.\${db_name_spec}.BUSCO.txt short_summary.domain.\${db_name_spec}.${bin}.txt + db_name_gen=\${db_name_spec} + else + [[ \$summaries_gen =~ BUSCO/short_summary.generic.(.*).BUSCO.txt ]]; + db_name_gen="\${BASH_REMATCH[1]}" + echo "Used generic lineage dataset: \${db_name_gen}" + cp BUSCO/short_summary.generic.\${db_name_gen}.BUSCO.txt short_summary.domain.\${db_name_gen}.${bin}.txt fi - [[ \$summaries_gen =~ BUSCO/short_summary.generic.(.*).BUSCO.txt ]]; - db_name_gen="\${BASH_REMATCH[1]}" - echo "Used generic lineage dataset: \${db_name_gen}" - cp BUSCO/short_summary.generic.\${db_name_gen}.BUSCO.txt short_summary.domain.\${db_name_gen}.${bin}.txt for f in BUSCO/run_\${db_name_gen}/busco_sequences/single_copy_busco_sequences/*faa; do cat BUSCO/run_\${db_name_gen}/busco_sequences/single_copy_busco_sequences/*faa | gzip >${bin}_buscos.\${db_name_gen}.faa.gz