99from unittest import main
1010from os import makedirs
1111from os .path import dirname , abspath , join , exists
12- from metapool .sample_sheet import (PROTOCOL_NAME_PACBIO_SMRT )
13- from qp_klp .Assays import ASSAY_NAME_METAGENOMIC
12+ from shutil import copyfile
1413from shutil import rmtree
1514from pathlib import Path
16- from qiita_client .testing import PluginTestCase
17- from sequence_processing_pipeline .PipelineError import PipelineError
1815import pandas as pd
16+ from metapool .sample_sheet import (PROTOCOL_NAME_PACBIO_SMRT )
17+ from sequence_processing_pipeline .PipelineError import PipelineError
18+ from qp_klp .Assays import ASSAY_NAME_METAGENOMIC
19+ from qiita_client .testing import PluginTestCase
1920
2021
2122class WorkflowFactoryTests (PluginTestCase ):
@@ -49,23 +50,22 @@ def _inject_data(self, wf):
4950 makedirs (convert_dir , exist_ok = True )
5051 makedirs (reports_dir , exist_ok = True )
5152 Path (f'{ convert_dir } /job_completed' ).touch ()
52- # tellread_dir = f'{self.output_dir}/TellReadJob'
53- # nuqc_dir = f'{self.output_dir}/NuQCJob'
54- # fastqc_dir = f'{self.output_dir}/FastQCJob/logs/'
55- # multiqc_dir = f'{self.output_dir}/MultiQCJob/logs/'
56- # genprep_dir = (f'{self.output_dir}/GenPrepFileJob/'
57- # '211021_A00000_0000_SAMPLE/')
58- # makedirs(nuqc_dir, exist_ok=True)
59- # makedirs(fastqc_dir, exist_ok=True)
60- # makedirs(multiqc_dir, exist_ok=True)
61- # makedirs(genprep_dir, exist_ok=True)
62- # # now let's create the required project folders
63- # for project in wf.pipeline.get_project_info():
64- # sp = project['project_name']
65- # makedirs(f'{convert_dir}/{sp}', exist_ok=True)
66- # makedirs(f'{nuqc_dir}/filtered_sequences/{sp}', exist_ok=True)
67- # makedirs(f'{genprep_dir}/{sp}/filtered_sequences/',
68- # exist_ok=True)
53+ nuqc_dir = f'{ self .output_dir } /NuQCJob'
54+ fastqc_dir = f'{ self .output_dir } /FastQCJob/logs/'
55+ multiqc_dir = f'{ self .output_dir } /MultiQCJob/logs/'
56+ genprep_dir = (f'{ self .output_dir } /GenPrepFileJob/'
57+ '211021_A00000_0000_SAMPLE/' )
58+ makedirs (nuqc_dir , exist_ok = True )
59+ makedirs (fastqc_dir , exist_ok = True )
60+ makedirs (multiqc_dir , exist_ok = True )
61+ makedirs (genprep_dir , exist_ok = True )
62+ # now let's create the required project folders
63+ for project in wf .pipeline .get_project_info ():
64+ sp = project ['project_name' ]
65+ makedirs (f'{ convert_dir } /{ sp } ' , exist_ok = True )
66+ makedirs (f'{ nuqc_dir } /filtered_sequences/{ sp } ' , exist_ok = True )
67+ makedirs (f'{ genprep_dir } /{ sp } /filtered_sequences/' ,
68+ exist_ok = True )
6969
7070 # # then loop over samples and stage all fastq.gz files
7171 dstats = []
@@ -74,28 +74,25 @@ def _inject_data(self, wf):
7474 sp = sample ["Sample_Project" ]
7575 dstats .append ({'SampleID' : sn , '# Reads' : 2 })
7676 dname = f'{ convert_dir } /{ sp } '
77- makedirs (dname , exist_ok = True )
7877 Path (f'{ dname } /{ sn } _R1.fastq.gz' ).touch ()
7978 with open (f'{ dname } /{ sn } _R1.counts.txt' , 'w' ) as f :
8079 f .write ("2" )
8180
82- # # NuQCJob
83- # dname = f'{nuqc_dir}/filtered_sequences/{sp}'
84- # copyfile(self.gz_source, f'{dname}/{rp}_L001_R1_001.fastq.gz')
85- # copyfile(self.gz_source, f'{dname}/{rp}_L001_R2_001.fastq.gz')
81+ # NuQCJob
82+ dname = f'{ nuqc_dir } /filtered_sequences/{ sp } '
83+ copyfile (self .gz_source , f'{ dname } /{ sn } _R1.fastq.gz' )
8684
87- # # GenPrepFileJob
88- # gprep_base = f'{genprep_dir}/{sp}/filtered_sequences/{rp}'
89- # Path(f'{gprep_base}_L001_R1_001.fastq.gz').touch()
90- # Path(f'{gprep_base}_L001_R2_001.fastq.gz').touch()
85+ # GenPrepFileJob
86+ gprep_base = f'{ genprep_dir } /{ sp } /filtered_sequences/{ sn } '
87+ Path (f'{ gprep_base } _R1.fastq.gz' ).touch ()
9188
9289 pd .DataFrame (dstats ).set_index ('SampleID' ).to_csv (
9390 f'{ reports_dir } /Demultiplex_Stats.csv' )
9491
95- # # generating the "*.completed" files
96- # for i in range(len(samples)*3):
97- # Path(f'{fastqc_dir}/FastQCJob_{i}.completed').touch()
98- # Path(f'{multiqc_dir}/MultiQCJob_{i}.completed').touch()
92+ # generating the "*.completed" files
93+ for i in range (len (samples )* 3 ):
94+ Path (f'{ fastqc_dir } /FastQCJob_{ i } .completed' ).touch ()
95+ Path (f'{ multiqc_dir } /MultiQCJob_{ i } .completed' ).touch ()
9996
10097 def test_pacbio_metagenomic_workflow_creation (self ):
10198 kwargs = {"uif_path" : "tests/data/sample-sheets/metagenomic/"
@@ -118,7 +115,9 @@ def test_pacbio_metagenomic_workflow_creation(self):
118115 self .assertEqual (wf .assay_type , ASSAY_NAME_METAGENOMIC )
119116
120117 self ._inject_data (wf )
121- # ConvertJob/ConvertJob.sh
118+
119+ # we can add some checks/tests of the initial scripts (mainly Convert)
120+ # but not doing now as is not required
122121
123122 # Metagenomic is a valid data type in the default qiita test
124123 # database but job-id: 78901 doesn't exist; however, if we get
0 commit comments