generated from bokulich-lab/q2-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: add action
fetch-busco-db
and modify evaluate-busco
accordin…
…gly (#162) Co-authored-by: Christos Konstantinos Matzoros <[email protected]> Co-authored-by: Michal Ziemski <[email protected]>
- Loading branch information
1 parent
4d7ccf8
commit 7ab7588
Showing
81 changed files
with
7,995 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,10 +36,29 @@ jobs: | |
- run: unzip coverage.zip | ||
|
||
- name: Find associated PR | ||
id: pr | ||
uses: actions/[email protected] | ||
with: | ||
script: | | ||
const response = await github.rest.search.issuesAndPullRequests({ | ||
q: 'repo:${{ github.repository }} is:pr sha:${{ github.event.workflow_run.head_sha }}', | ||
per_page: 1, | ||
}) | ||
const items = response.data.items | ||
if (items.length < 1) { | ||
console.error('No PRs found') | ||
return | ||
} | ||
const pullRequestNumber = items[0].number | ||
console.info("Pull request number is", pullRequestNumber) | ||
return pullRequestNumber | ||
- uses: codecov/codecov-action@v4 | ||
name: Upload coverage report | ||
with: | ||
files: ./coverage.xml | ||
fail_ci_if_error: true | ||
override_pr: ${{ steps.pr.outputs.result }} | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2023, QIIME 2 development team. | ||
# | ||
# Distributed under the terms of the Modified BSD License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ---------------------------------------------------------------------------- | ||
import subprocess | ||
from q2_moshpit._utils import colorify, run_command | ||
from q2_moshpit.busco.types import BuscoDatabaseDirFmt | ||
|
||
|
||
def fetch_busco_db( | ||
virus: bool = False, | ||
prok: bool = False, | ||
euk: bool = False | ||
) -> BuscoDatabaseDirFmt: | ||
busco_db = BuscoDatabaseDirFmt(path=None, mode='w') | ||
|
||
# Parse kwargs | ||
if all([virus, prok, euk]): | ||
args = ["all"] | ||
else: | ||
variable_and_flag = [ | ||
('virus', virus), | ||
('prokaryota', prok), | ||
('eukaryota', euk) | ||
] | ||
args = [name for name, flag in variable_and_flag if flag] | ||
|
||
# Download | ||
print(colorify("Downloading BUSCO database...")) | ||
try: | ||
run_command(cmd=["busco", "--download", *args], cwd=str(busco_db)) | ||
except subprocess.CalledProcessError as e: | ||
raise Exception( | ||
f"Error during BUSCO database download: {e.returncode}" | ||
) | ||
|
||
# Let user know that the process is complete but it still needs | ||
# some time to copy files over. | ||
print(colorify( | ||
"Download completed. \n" | ||
"Copying files from temporary directory to final location..." | ||
)) | ||
|
||
return busco_db |
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
2,454 changes: 2,454 additions & 0 deletions
2,454
...a/busco_db/busco_downloads/placement_files/supermatrix.aln.eukaryota_odb10.2019-12-16.faa
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# ---------------------------------------------------------------------------- | ||
# Copyright (c) 2022-2023, QIIME 2 development team. | ||
# | ||
# Distributed under the terms of the Modified BSD License. | ||
# | ||
# The full license is in the file LICENSE, distributed with this software. | ||
# ---------------------------------------------------------------------------- | ||
from q2_moshpit.busco.database import fetch_busco_db | ||
from unittest.mock import patch | ||
from qiime2.plugin.testing import TestPluginBase | ||
|
||
|
||
class TestFetchBUSCO(TestPluginBase): | ||
package = "q2_moshpit.busco.tests" | ||
|
||
@patch("subprocess.run") | ||
def test_fetch_busco_db_virus(self, subp_run): | ||
busco_db = fetch_busco_db(virus=True, prok=False, euk=False) | ||
|
||
# Check that command was called in the expected way | ||
cmd = ["busco", "--download", "virus"] | ||
subp_run.assert_called_once_with(cmd, check=True, cwd=str(busco_db)) | ||
|
||
@patch("subprocess.run") | ||
def test_fetch_busco_db_prok_euk(self, subp_run): | ||
busco_db = fetch_busco_db(virus=False, prok=True, euk=True) | ||
|
||
# Check that command was called in the expected way | ||
cmd = ["busco", "--download", "prokaryota", "eukaryota"] | ||
subp_run.assert_called_once_with(cmd, check=True, cwd=str(busco_db)) | ||
|
||
@patch("subprocess.run") | ||
def test_fetch_busco_db_all(self, subp_run): | ||
busco_db = fetch_busco_db(virus=True, prok=True, euk=True) | ||
|
||
# Check that command was called in the expected way | ||
cmd = ["busco", "--download", "all"] | ||
subp_run.assert_called_once_with(cmd, check=True, cwd=str(busco_db)) |
Oops, something went wrong.