Skip to content

Commit 646ebf6

Browse files
committed
Merge remote-tracking branch 'origin/master' into Haploflow-test1
2 parents 0777234 + 2e64c4d commit 646ebf6

File tree

3 files changed

+45
-15
lines changed

3 files changed

+45
-15
lines changed

.github/workflows/build-and-test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ jobs:
7575
run: docker run micall --help
7676
- name: Check docker image entrypoint
7777
run: docker run micall --help | grep -i -e 'docker'
78+
- name: Check docker image microtest
79+
run: python micall/main.py release_test_microtest micall --docker
7880

7981
singularity-test:
8082
runs-on: ubuntu-20.04

micall/utils/release_test_microtest.py

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,9 @@ def create_sample_scratch(fastq_file):
391391

392392

393393
class SampleRunner:
394-
def __init__(self, image_path: Path):
394+
def __init__(self, image_path: Path, is_docker: bool = False):
395395
self.image_path = image_path
396+
self.is_docker = is_docker
396397
self.is_denovo = False
397398
self.bad_cycles_path = None
398399

@@ -572,21 +573,46 @@ def process_resistance(self, sample_group: SampleGroup):
572573
def build_command(self, inputs, outputs, app_name=None):
573574
input_path = inputs[0].parent
574575
output_path = outputs[0].parent
575-
command = ['singularity',
576-
'run',
577-
'--contain',
578-
'--cleanenv',
579-
'-B',
580-
'{}:/mnt/input,{}:/mnt/output'.format(input_path,
581-
output_path)]
582-
if app_name:
583-
command.append('--app')
584-
command.append(app_name)
585-
command.append(self.image_path)
576+
577+
if self.is_docker:
578+
command = ['docker',
579+
'run',
580+
'--rm',
581+
'--read-only',
582+
'--volume', '{}:/mnt/input'.format(input_path),
583+
'--volume', '{}:/mnt/output'.format(output_path),
584+
'--volume', '{}:/tmp'.format(output_path / 'tmp'),
585+
'--entrypoint', 'micall',
586+
'--', str(self.image_path),
587+
]
588+
589+
app_arguments = {
590+
None: ['micall_kive'],
591+
'filter_quality': ['filter_quality'],
592+
'resistance': ['micall_kive_resistance'],
593+
'denovo': ['micall_kive', '--denovo'],
594+
}[app_name]
595+
596+
command.extend(app_arguments)
597+
598+
else:
599+
command = ['singularity',
600+
'run',
601+
'--contain',
602+
'--cleanenv',
603+
'-B',
604+
'{}:/mnt/input,{}:/mnt/output'.format(input_path,
605+
output_path)]
606+
if app_name:
607+
command.append('--app')
608+
command.append(app_name)
609+
command.append(str(self.image_path))
610+
586611
for arguments, guest_path in zip((inputs, outputs),
587612
('/mnt/input', '/mnt/output')):
588613
for argument in arguments:
589614
command.append(os.path.join(guest_path, argument.name))
615+
590616
return command
591617

592618

@@ -622,6 +648,8 @@ def main():
622648
help='Folder to copy microtest samples into.')
623649
parser.add_argument('--sample',
624650
help='Prefix of sample name to run.')
651+
parser.add_argument('--docker', action='store_true',
652+
help='If to use docker instead of Singularity.')
625653
# noinspection PyTypeChecker
626654
parser.add_argument('image',
627655
type=Path,
@@ -642,7 +670,7 @@ def main():
642670
for source_file in source_files:
643671
target_file: Path = sandbox_path / source_file.name
644672
shutil.copy(str(source_file), str(target_file))
645-
runner = SampleRunner(args.image)
673+
runner = SampleRunner(args.image, is_docker=args.docker)
646674
with ProcessPoolExecutor() as pool:
647675
search_pattern = '*_R1_*.fastq'
648676
if args.sample:

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ dependencies = [
4545
test = [
4646
# Dependencies required for running the test suite
4747
"pytest==8.3.4",
48-
"coverage==7.6.9",
48+
"coverage==7.6.10",
4949
"pandas==2.2.3",
5050
"seaborn==0.13.2",
5151
"ete3",
@@ -59,7 +59,7 @@ test = [
5959
dev = [
6060
# Dependencies required for development (linting, type checking, etc.)
6161
"ruff==0.8.4",
62-
"mypy==1.14.0",
62+
"mypy==1.14.1",
6363
"mypy-extensions==1.0.0",
6464
"gprof2dot==2024.6.6",
6565
"codecov==2.1.13", # For reporting the code coverage.

0 commit comments

Comments
 (0)