Skip to content

Commit

Permalink
in online mode download db to temp directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Sann5 committed May 14, 2024
1 parent 9b62f7b commit c5400c6
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion q2_moshpit/busco/busco.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def _run_busco(
"-o",
sample
])
run_command(cmd)
run_command(cmd, cwd=os.path.dirname(output_dir))

path_to_run_summary = os.path.join(
output_dir, sample, "batch_summary.txt"
Expand Down
20 changes: 13 additions & 7 deletions q2_moshpit/busco/tests/test_busco.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,21 @@ def test_run_busco(self, mock_run):
self.assertDictEqual(obs, exp)
mock_run.assert_has_calls([
call(
['busco', '--lineage_dataset', 'bacteria_odb10',
'--cpu', '7', '--in', self.get_data_path('mags/sample1'),
'--out_path', self.temp_dir.name, '-o', 'sample1'],
[
'busco', '--lineage_dataset', 'bacteria_odb10',
'--cpu', '7', '--in', self.get_data_path('mags/sample1'),
'--out_path', self.temp_dir.name, '-o', 'sample1'
],
cwd=os.path.dirname(self.temp_dir.name)
),
call(
['busco', '--lineage_dataset', 'bacteria_odb10',
'--cpu', '7', '--in', self.get_data_path('mags/sample2'),
'--out_path', self.temp_dir.name, '-o', 'sample2'],
)
[
'busco', '--lineage_dataset', 'bacteria_odb10',
'--cpu', '7', '--in', self.get_data_path('mags/sample2'),
'--out_path', self.temp_dir.name, '-o', 'sample2'
],
cwd=os.path.dirname(self.temp_dir.name)
),
])

@patch('q2_moshpit.busco.busco._run_busco')
Expand Down
41 changes: 22 additions & 19 deletions q2_moshpit/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,21 @@
description="Collates BUSCO results."
)

plugin.visualizers.register_function(
function=q2_moshpit.busco._visualize_busco,
inputs={
"busco_results": BUSCOResults,
},
parameters={},
input_descriptions={
"busco_results": "BUSCO results table.",
},
parameter_descriptions={},
name="Visualize BUSCO results.",
description="This method generates a visualization "
"from the BUSCO results table.",
citations=[citations["manni_busco_2021"]],
)

plugin.methods.register_function(
function=q2_moshpit.busco._evaluate_busco,
Expand All @@ -1117,7 +1132,9 @@
input_descriptions={
"bins": "MAGs to be analyzed.",
"busco_db": "BUSCO database. If provided BUSCO will run in offline "
"mode."
"mode. If not provided a BUSCO database "
"will be downloaded to a temporary location and then "
"deleted."
},
parameter_descriptions=busco_param_descriptions,
output_descriptions={
Expand All @@ -1131,22 +1148,6 @@
citations=[citations["manni_busco_2021"]],
)

plugin.visualizers.register_function(
function=q2_moshpit.busco._visualize_busco,
inputs={
"busco_results": BUSCOResults,
},
parameters={},
input_descriptions={
"busco_results": "BUSCO results table.",
},
parameter_descriptions={},
name="Visualize BUSCO results.",
description="This method generates a visualization "
"from the BUSCO results table.",
citations=[citations["manni_busco_2021"]],
)

plugin.pipelines.register_function(
function=q2_moshpit.busco.evaluate_busco,
inputs={
Expand All @@ -1161,7 +1162,9 @@
input_descriptions={
"bins": "MAGs to be analyzed.",
"busco_db": "BUSCO database. If provided BUSCO will run in offline "
"mode."
"mode. If not provided a BUSCO database "
"will be downloaded to a temporary location and then "
"deleted."
},
parameter_descriptions={
**busco_param_descriptions, **partition_param_descriptions
Expand All @@ -1174,7 +1177,7 @@
description="This method uses BUSCO "
"(Benchmarking Universal Single-Copy Ortholog assessment "
"tool) to assess the quality of assembled MAGs and generates "
"visualizations summarizing the results.",
"a table summarizing the results.",
citations=[citations["manni_busco_2021"]],
)

Expand Down

0 comments on commit c5400c6

Please sign in to comment.