Skip to content

Commit e4b5e81

Browse files
authored
Merge pull request #47 from gbouras13/dev
v1.6.0
2 parents 6d1cb2a + fc92663 commit e4b5e81

12 files changed

Lines changed: 329 additions & 71 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ jobs:
3636
shell: bash -l {0}
3737
run: |
3838
mamba install python=${{ matrix.python-version }}
39-
just install
4039
python -m pip install --upgrade pip
41-
pip3 install git+https://github.com/rrwick/Unicycler.git
40+
pip install -e .
41+
pip install black
42+
pip install isort
43+
pip install pytest
44+
pip install pytest-cov
45+
pip install git+https://github.com/rrwick/Unicycler.git
4246
unicycler --help
4347
- name: Check formatting
4448
shell: bash -l {0}

HISTORY.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# History
22

3+
1.6.0 (2024-03-01)
4+
------------------
5+
6+
* Addes `--depth_filter`. This will filter out all contigs that have long- (and short-read for `plassembler run`) read copy numbers that are less than the specified depth filter. Defaults to 0.25x.
7+
* Adds `--unicycler_options` and `--spades_options` which allows passing extra Unicycler options (#46)
8+
39
1.5.1 (2024-02-01)
410
------------------
511

justfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ check-fmt:
1212
poetry run black --check .
1313
poetry run isort --check .
1414

15-
# lint code with flake8
16-
lint:
17-
poetry run flake8 .
1815

1916
# install latest version with poetry
2017
install:

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "plassembler"
3-
version = "1.5.1" # change VERSION too
3+
version = "1.6.0" # change VERSION too
44
description = "Quickly and accurately assemble plasmids in hybrid sequenced bacterial isolates"
55
authors = ["George Bouras <george.bouras@adelaide.edu.au>"]
66
license = "MIT"
@@ -32,7 +32,6 @@ black = ">=22.3.0"
3232
isort = ">=5.10.1"
3333
pytest = ">=6.2.5"
3434
pytest-cov = ">=3.0.0"
35-
flake8 = ">=3.0.1"
3635

3736
[[tool.poetry.source]]
3837
name = "pypi-test"

src/plassembler/__init__.py

Lines changed: 75 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,24 @@ def common_options(func):
268268
type=click.Path(),
269269
default="nothing",
270270
),
271+
click.option(
272+
"--depth_filter",
273+
help="Filters all contigs low than this fraction of the chromosome read depth. Will apply on both long- and short-read sets for plassembler run.",
274+
type=float,
275+
default=0.25,
276+
),
277+
click.option(
278+
"--unicycler_options",
279+
help='Extra Unicycler options - must be encapsulated by quotation marks if multiple "--no_rotate --mode conservative" ',
280+
type=str,
281+
default=None,
282+
),
283+
click.option(
284+
"--spades_options",
285+
help='Extra spades options for Unicycler - must be encapsulated by quotation marks "--tmp-dir /tmp" ',
286+
type=str,
287+
default=None,
288+
),
271289
]
272290
for option in reversed(options):
273291
func = option(func)
@@ -374,6 +392,9 @@ def run(
374392
flye_assembly,
375393
flye_info,
376394
no_chromosome,
395+
depth_filter,
396+
unicycler_options,
397+
spades_options,
377398
**kwargs,
378399
):
379400
"""Runs Plassembler"""
@@ -401,6 +422,9 @@ def run(
401422
logger.info(f"--flye_info is {flye_info}")
402423
logger.info(f"--no_chromosome is {no_chromosome}")
403424
logger.info(f"--use_raven is {use_raven}")
425+
logger.info(f"--depth_filter is {depth_filter}")
426+
logger.info(f"--unicycler_options is {unicycler_options}")
427+
logger.info(f"--spades_options is {spades_options}")
404428
logdir = Path(f"{outdir}/logs")
405429

406430
# check deps
@@ -605,7 +629,14 @@ def run(
605629
unicycler_dir: Path = Path(outdir) / "unicycler_output"
606630

607631
run_unicycler(
608-
threads, logdir, short_r1, short_r2, long_reads, unicycler_dir
632+
threads,
633+
logdir,
634+
short_r1,
635+
short_r2,
636+
long_reads,
637+
unicycler_dir,
638+
unicycler_options,
639+
spades_options,
609640
)
610641

611642
# check for successful unicycler completion
@@ -631,7 +662,7 @@ def run(
631662
# processes output
632663
plass.process_mash_tsv(database)
633664
# combine depth and mash tsvs
634-
plass.combine_depth_mash_tsvs(prefix)
665+
plass.combine_depth_mash_tsvs(prefix, depth_filter)
635666

636667
# rename contigs and update copy bumber with plsdb
637668
plass.finalise_contigs(prefix)
@@ -790,7 +821,14 @@ def run(
790821
unicycler_dir: Path = Path(outdir) / "unicycler_output"
791822

792823
run_unicycler(
793-
threads, logdir, short_r1, short_r2, long_reads, unicycler_dir
824+
threads,
825+
logdir,
826+
short_r1,
827+
short_r2,
828+
long_reads,
829+
unicycler_dir,
830+
unicycler_options,
831+
spades_options,
794832
)
795833

796834
# check for successful unicycler completion
@@ -822,7 +860,7 @@ def run(
822860
# processes output
823861
plass.process_mash_tsv(database)
824862
# combine depth and mash tsvs
825-
plass.combine_depth_mash_tsvs(prefix)
863+
plass.combine_depth_mash_tsvs(prefix, depth_filter)
826864

827865
# rename contigs and update copy bumber with plsdb
828866
plass.finalise_contigs(prefix)
@@ -948,6 +986,7 @@ def assembled(
948986
logger.info(f"--skip_qc is {skip_qc}")
949987
logger.info(f"--pacbio_model is {pacbio_model}")
950988
logger.info(f"--no_copy_numbers is {no_copy_numbers}")
989+
logger.info(f"--no_copy_numbers is {no_copy_numbers}")
951990
logdir = Path(f"{outdir}/logs")
952991

953992
# check deps
@@ -1189,6 +1228,24 @@ def long_options(func):
11891228
type=float,
11901229
default=0.12,
11911230
),
1231+
click.option(
1232+
"--depth_filter",
1233+
help="Filters all contigs low than this fraction of the chromosome read depth. Will apply on both long- and short-read sets for plassembler run.",
1234+
type=float,
1235+
default=0.25,
1236+
),
1237+
click.option(
1238+
"--unicycler_options",
1239+
help='Extra Unicycler options - must be encapsulated by quotation marks if multiple "--no_rotate --mode conservative" ',
1240+
type=str,
1241+
default=None,
1242+
),
1243+
click.option(
1244+
"--spades_options",
1245+
help='Extra spades options for Unicycler - must be encapsulated by quotation marks "--tmp-dir /tmp" ',
1246+
type=str,
1247+
default=None,
1248+
),
11921249
]
11931250
for option in reversed(options):
11941251
func = option(func)
@@ -1222,6 +1279,9 @@ def long(
12221279
canu_flag,
12231280
corrected_error_rate,
12241281
no_chromosome,
1282+
depth_filter,
1283+
unicycler_options,
1284+
spades_options,
12251285
**kwargs,
12261286
):
12271287
"""
@@ -1248,6 +1308,9 @@ def long(
12481308
logger.info(f"--flye_info is {flye_info}")
12491309
logger.info(f"--corrected_error_rate is {corrected_error_rate}")
12501310
logger.info(f"--no_chromosome is {no_chromosome}")
1311+
logger.info(f"--depth_filter is {depth_filter}")
1312+
logger.info(f"--unicycler_options is {unicycler_options}")
1313+
logger.info(f"--spades_options is {spades_options}")
12511314
logdir = Path(f"{outdir}/logs")
12521315

12531316
# check deps
@@ -1509,7 +1572,13 @@ def long(
15091572

15101573
unicycler_dir: Path = Path(outdir) / "unicycler_output"
15111574
run_unicycler_long(
1512-
threads, logdir, corrected_fastqs, entropy_filtered_fastq, unicycler_dir
1575+
threads,
1576+
logdir,
1577+
corrected_fastqs,
1578+
entropy_filtered_fastq,
1579+
unicycler_dir,
1580+
unicycler_options,
1581+
spades_options,
15131582
)
15141583
remove_file(corrected_fastqs)
15151584
assembled_fasta = os.path.join(outdir, "unicycler_output", "assembly.fasta")
@@ -1557,7 +1626,7 @@ def long(
15571626
plass.process_mash_tsv(database)
15581627

15591628
# combine depth and mash tsvs
1560-
plass.combine_depth_mash_tsvs(prefix)
1629+
plass.combine_depth_mash_tsvs(prefix, depth_filter)
15611630

15621631
# rename contigs and update copy number with plsdb
15631632
plass.finalise_contigs_long(prefix)

src/plassembler/utils/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.1
1+
1.6.0

0 commit comments

Comments
 (0)