3
3
from types import SimpleNamespace
4
4
5
5
from pyfixtures import fixture
6
- from virtool_workflow import hooks , step
7
- from virtool_workflow . analysis . fastqc import FastQCRunner
8
- from virtool_workflow . analysis . utils import ReadPaths
9
- from virtool_workflow .data .samples import WFNewSample
6
+ from virtool . quality . fastqc import parse_fastqc
7
+ from virtool . workflow import hooks , step , RunSubprocess
8
+ from virtool . workflow . analysis import ReadPaths
9
+ from virtool . workflow .data .samples import WFNewSample
10
10
11
11
12
12
@fixture
@@ -24,19 +24,30 @@ def read_paths(new_sample: WFNewSample) -> ReadPaths:
24
24
25
25
@step (name = "Run FastQC" )
26
26
async def run_fastqc (
27
- fastqc : FastQCRunner ,
28
27
intermediate : SimpleNamespace ,
29
28
read_paths : ReadPaths ,
29
+ run_subprocess : RunSubprocess ,
30
30
work_path : Path ,
31
31
):
32
32
"""
33
33
Run `fastqc` on the read files.
34
34
35
35
Parse the output into a dictionary and add it to the scope.
36
36
"""
37
- output_path = work_path / "fastqc"
38
- await asyncio .to_thread (output_path .mkdir )
39
- intermediate .quality = await fastqc (read_paths , output_path )
37
+ command = [
38
+ "fastqc" ,
39
+ "-f" ,
40
+ "fastq" ,
41
+ "-o" ,
42
+ str (work_path ),
43
+ "--extract" ,
44
+ * [str (path ) for path in read_paths ],
45
+ ]
46
+
47
+ await run_subprocess (command )
48
+
49
+ intermediate .quality = await asyncio .to_thread (parse_fastqc , work_path )
50
+
40
51
41
52
42
53
@step
@@ -51,9 +62,9 @@ async def finalize(
51
62
"""
52
63
for i , path in enumerate (read_paths ):
53
64
new_path = await asyncio .to_thread (path .rename , f"reads_{ i + 1 } .fq.gz" )
54
- await new_sample .upload (new_path , "fastq" )
65
+ await new_sample .upload (new_path )
55
66
56
- await new_sample .finalize (intermediate .quality )
67
+ await new_sample .finalize (intermediate .quality . dict () )
57
68
58
69
59
70
@hooks .on_failure
0 commit comments