NextPyper 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nextpyper/__init__.py +0 -0
- nextpyper/__main__.py +429 -0
- nextpyper/config/config.yaml +80 -0
- nextpyper/config/rich_config.yaml +54 -0
- nextpyper/config/system_config.yaml +10 -0
- nextpyper/data/blosum62.csv +32 -0
- nextpyper/data/cps_seqids.csv +674 -0
- nextpyper/data/mock/mock_args.yaml +17 -0
- nextpyper/data/mock/probes.fasta +56 -0
- nextpyper/data/mock/reads/sample1_R1.fastq +20 -0
- nextpyper/data/mock/reads/sample1_R2.fastq +20 -0
- nextpyper/data/mock/reads/sample2_R1.fastq +20 -0
- nextpyper/data/mock/reads/sample2_R2.fastq +20 -0
- nextpyper/data/mock/reads/sample3_R1.fastq +20 -0
- nextpyper/data/mock/reads/sample3_R2.fastq +20 -0
- nextpyper/data/mock/sample.tsv +4 -0
- nextpyper/nextpyper.CITATION +9 -0
- nextpyper/nextpyper.LICENSE +19 -0
- nextpyper/nextpyper.VERSION +1 -0
- nextpyper/src/divergence_estimation.py +131 -0
- nextpyper/src/diversity.py +93 -0
- nextpyper/src/exon_discovery.py +294 -0
- nextpyper/src/exon_intron.py +197 -0
- nextpyper/src/fix_headers.py +107 -0
- nextpyper/src/gfa2fasta.py +71 -0
- nextpyper/src/gfa_graph.py +1245 -0
- nextpyper/src/gff_parser.py +344 -0
- nextpyper/src/graph_utils.py +201 -0
- nextpyper/src/homolog_filtering.py +411 -0
- nextpyper/src/miniprot.py +1008 -0
- nextpyper/src/multi_seq_probes.py +292 -0
- nextpyper/src/run_orfipy.py +493 -0
- nextpyper/src/sample_table.py +63 -0
- nextpyper/src/seeds_collection.py +387 -0
- nextpyper/src/summarize_results.py +507 -0
- nextpyper/src/union_find.py +65 -0
- nextpyper/src/var_asm_parser.py +229 -0
- nextpyper/test/.gitkeep +0 -0
- nextpyper/workflow/Snakefile +62 -0
- nextpyper/workflow/envs/alignment.yaml +7 -0
- nextpyper/workflow/envs/assembly.yaml +8 -0
- nextpyper/workflow/envs/clustering.yaml +9 -0
- nextpyper/workflow/envs/matching.yaml +8 -0
- nextpyper/workflow/envs/preprocessing.yaml +11 -0
- nextpyper/workflow/envs/saute.yaml +7 -0
- nextpyper/workflow/envs/translating.yaml +8 -0
- nextpyper/workflow/rules/0_preprocessing/0.1_reads.smk +90 -0
- nextpyper/workflow/rules/0_preprocessing/0.2_probes.smk +16 -0
- nextpyper/workflow/rules/1_seeds_assembly/1.1_assembly_spades.smk +48 -0
- nextpyper/workflow/rules/1_seeds_assembly/1.2_seeds_extension.smk +90 -0
- nextpyper/workflow/rules/1_seeds_assembly/1.3_seeds_filtering.smk +64 -0
- nextpyper/workflow/rules/1_seeds_assembly/1.4_seeds_clustering.smk +73 -0
- nextpyper/workflow/rules/2_homologs_assembly/2.1_saute_assembly.smk +228 -0
- nextpyper/workflow/rules/3_homolog_prospection/3.1_allele_collapsing.smk +23 -0
- nextpyper/workflow/rules/3_homolog_prospection/3.2_homologs_filtering.smk +76 -0
- nextpyper/workflow/rules/3_homolog_prospection/3.3_region_separation.smk +189 -0
- nextpyper/workflow/rules/common.smk +160 -0
- nextpyper/workflow/schemas/probes.yaml +12 -0
- nextpyper/workflow/schemas/sample_table.yaml +29 -0
- nextpyper/workflow/scripts/bench_busco.py +572 -0
- nextpyper/workflow/scripts/categories_bench.sh +92 -0
- nextpyper/workflow/scripts/end_recs_parser.py +146 -0
- nextpyper/workflow/scripts/tribble_stats.py +131 -0
- nextpyper-0.1.0.dist-info/METADATA +231 -0
- nextpyper-0.1.0.dist-info/RECORD +69 -0
- nextpyper-0.1.0.dist-info/WHEEL +5 -0
- nextpyper-0.1.0.dist-info/entry_points.txt +3 -0
- nextpyper-0.1.0.dist-info/licenses/nextpyper/nextpyper.LICENSE +19 -0
- nextpyper-0.1.0.dist-info/top_level.txt +1 -0
nextpyper/__init__.py
ADDED
|
File without changes
|
nextpyper/__main__.py
ADDED
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entrypoint for NextPyper
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import sys
|
|
7
|
+
import tempfile
|
|
8
|
+
|
|
9
|
+
import yaml
|
|
10
|
+
import rich_click as click
|
|
11
|
+
from snaketool_utils.cli_utils import run_snakemake, copy_config, echo_click
|
|
12
|
+
|
|
13
|
+
sys.path.append(str((Path(__file__).parent / "src").resolve()))
|
|
14
|
+
|
|
15
|
+
from sample_table import make_table
|
|
16
|
+
from multi_seq_probes import check_probes
|
|
17
|
+
from summarize_results import summarize_workflow
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def snake_base(rel_path):
|
|
21
|
+
"""Get the filepath to a Snaketool system file (relative to __main__.py)"""
|
|
22
|
+
return (Path(__file__).parent / rel_path).resolve()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_version():
|
|
26
|
+
"""Read and print the version from the version file"""
|
|
27
|
+
with open(snake_base("nextpyper.VERSION"), "r") as f:
|
|
28
|
+
version = f.readline()
|
|
29
|
+
return version
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def print_citation():
|
|
33
|
+
"""Read and print the Citation information from the citation file"""
|
|
34
|
+
with open(snake_base("nextpyper.CITATION"), "r") as f:
|
|
35
|
+
for line in f:
|
|
36
|
+
echo_click(line)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def default_to_output(ctx, param, value):
|
|
40
|
+
"""Callback for click options; places value in output directory unless specified"""
|
|
41
|
+
if param.default == value:
|
|
42
|
+
return str(Path(ctx.params["output"]) / value)
|
|
43
|
+
return value
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Load CLI configuration.
|
|
47
|
+
config_path = Path(__file__).parent / "config/rich_config.yaml"
|
|
48
|
+
if config_path.exists():
|
|
49
|
+
# click.rich_click.__dict__.update(yaml.safe_load(config_path.read_text()))
|
|
50
|
+
config_data = yaml.safe_load(config_path.read_text())
|
|
51
|
+
for key, value in config_data.items():
|
|
52
|
+
# Version 1.9.x uses uppercase for global variables
|
|
53
|
+
setattr(click.rich_click, key.upper(), value)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def common_options(func):
|
|
57
|
+
"""Common command line args
|
|
58
|
+
Define common command line args here, and include them with the @common_options decorator below.
|
|
59
|
+
"""
|
|
60
|
+
options = [
|
|
61
|
+
click.option(
|
|
62
|
+
"--configfile",
|
|
63
|
+
default="config.yaml",
|
|
64
|
+
show_default=False,
|
|
65
|
+
callback=default_to_output,
|
|
66
|
+
help="Custom config file [default: (outputDir)/config.yaml]",
|
|
67
|
+
),
|
|
68
|
+
click.option(
|
|
69
|
+
"--threads", help="Number of threads to use", default=1, show_default=True
|
|
70
|
+
),
|
|
71
|
+
click.option(
|
|
72
|
+
"--use-conda/--no-use-conda",
|
|
73
|
+
default=True,
|
|
74
|
+
help="Use conda for Snakemake rules",
|
|
75
|
+
show_default=True,
|
|
76
|
+
),
|
|
77
|
+
click.option(
|
|
78
|
+
"--conda-prefix",
|
|
79
|
+
default=str(snake_base(Path("workflow") / "conda")),
|
|
80
|
+
help="Custom conda env directory",
|
|
81
|
+
type=click.Path(),
|
|
82
|
+
show_default=False,
|
|
83
|
+
),
|
|
84
|
+
click.option(
|
|
85
|
+
"--snake-default",
|
|
86
|
+
multiple=True,
|
|
87
|
+
default=[
|
|
88
|
+
"--printshellcmds",
|
|
89
|
+
"--nolock",
|
|
90
|
+
"--show-failed-logs",
|
|
91
|
+
],
|
|
92
|
+
help="Customise Snakemake runtime args",
|
|
93
|
+
show_default=True,
|
|
94
|
+
),
|
|
95
|
+
click.option(
|
|
96
|
+
"--log",
|
|
97
|
+
default="nextpyper.log",
|
|
98
|
+
callback=default_to_output,
|
|
99
|
+
hidden=True,
|
|
100
|
+
),
|
|
101
|
+
click.option(
|
|
102
|
+
"--system-config",
|
|
103
|
+
default=snake_base(Path("config/config.yaml")),
|
|
104
|
+
hidden=True,
|
|
105
|
+
),
|
|
106
|
+
click.argument("snake_args", nargs=-1),
|
|
107
|
+
]
|
|
108
|
+
for option in reversed(options):
|
|
109
|
+
func = option(func)
|
|
110
|
+
return func
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@click.group(
|
|
114
|
+
cls=click.RichGroup, context_settings=dict(help_option_names=["-h", "--help"])
|
|
115
|
+
)
|
|
116
|
+
@click.version_option(get_version(), "-v", "--version", is_flag=True)
|
|
117
|
+
def cli():
|
|
118
|
+
"""Recovery of homoeologous loci from target capture data in higher ploidy samples.
|
|
119
|
+
\n
|
|
120
|
+
For more options, run:
|
|
121
|
+
nextpyper command --help"""
|
|
122
|
+
pass
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
# ToDo: Refine this help message
|
|
126
|
+
gather_msg = """
|
|
127
|
+
The data directory is expected to have only paired-end read
|
|
128
|
+
files per each sample (forward, reverse).
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
validate_msg = """
|
|
132
|
+
The group summary reports the number of probes per group, whereas the hierarchy details which probes belong to each group.
|
|
133
|
+
"""
|
|
134
|
+
|
|
135
|
+
# ToDo: Refine this help message
|
|
136
|
+
summarize_msg = """
|
|
137
|
+
|
|
138
|
+
"""
|
|
139
|
+
|
|
140
|
+
prepare_msg = """
|
|
141
|
+
By default, the environments will be created in NextPyper's installation folder.
|
|
142
|
+
Use --conda-prefix to specify a custom location.
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
config_msg = """
|
|
146
|
+
Modify the config before running to change the workflow parameters. \n
|
|
147
|
+
Check NextPyper documentation for more details about the config parameters.
|
|
148
|
+
"""
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
@click.command(
|
|
152
|
+
# epilog=help_msg_extra,
|
|
153
|
+
context_settings=dict(
|
|
154
|
+
help_option_names=["-h", "--help"], ignore_unknown_options=True
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
@click.option(
|
|
158
|
+
"--input",
|
|
159
|
+
"input",
|
|
160
|
+
help="Input sample table",
|
|
161
|
+
type=click.Path(readable=True, exists=True),
|
|
162
|
+
required=True,
|
|
163
|
+
)
|
|
164
|
+
@click.option(
|
|
165
|
+
"--output",
|
|
166
|
+
help="Output directory",
|
|
167
|
+
type=click.Path(dir_okay=True, writable=True, readable=True),
|
|
168
|
+
default="nextpyper.out",
|
|
169
|
+
show_default=True,
|
|
170
|
+
)
|
|
171
|
+
@click.option(
|
|
172
|
+
"--probes",
|
|
173
|
+
"probes",
|
|
174
|
+
help="Probes used in the experiment (fasta)",
|
|
175
|
+
type=click.Path(readable=True, exists=True),
|
|
176
|
+
required=True,
|
|
177
|
+
)
|
|
178
|
+
@click.option(
|
|
179
|
+
"--pattern",
|
|
180
|
+
"probe_pattern",
|
|
181
|
+
help="For multi-probes, pattern used to group the probe sequences (RegEx). It needs one capture group.",
|
|
182
|
+
type=str,
|
|
183
|
+
default=r"(.*)",
|
|
184
|
+
show_default=True,
|
|
185
|
+
)
|
|
186
|
+
@click.option(
|
|
187
|
+
"--multi-probes/--single-probes",
|
|
188
|
+
"multi_probes",
|
|
189
|
+
help="Whether the probe set has multiple or a single sequence per probe ",
|
|
190
|
+
default=True,
|
|
191
|
+
show_default=True,
|
|
192
|
+
)
|
|
193
|
+
@click.option(
|
|
194
|
+
"--use-ploidy/--no-ploidy",
|
|
195
|
+
"use_ploidy",
|
|
196
|
+
help="""Whether to use the ploidy information from the samples. An extra
|
|
197
|
+
ploidy column is expected in the input sample table. Ploidy is
|
|
198
|
+
used to inform the expected number of homologs.""",
|
|
199
|
+
default=False,
|
|
200
|
+
show_default=True,
|
|
201
|
+
)
|
|
202
|
+
@click.option(
|
|
203
|
+
"--interseeds",
|
|
204
|
+
"interseeds",
|
|
205
|
+
help="""Which inter-sample seeds to use for SAUTE assembly. Interseeds
|
|
206
|
+
help to boost probe recovery at the expense of higher
|
|
207
|
+
computation time during assembly. The default 'sister' infers
|
|
208
|
+
sister-samples that are likely the most informative to
|
|
209
|
+
get inter-sample seeds from.""",
|
|
210
|
+
type=click.Choice(("all", "sister", "none")),
|
|
211
|
+
default="sister",
|
|
212
|
+
show_default=True,
|
|
213
|
+
)
|
|
214
|
+
@click.option(
|
|
215
|
+
"--reasm-tribble-probes/--no-reasm",
|
|
216
|
+
"reasm",
|
|
217
|
+
help="""Whether to reassemble the most complex ("tribble-inducing") probes found in
|
|
218
|
+
each sample. This second assembly is tailored to better resolve such
|
|
219
|
+
complexity.""",
|
|
220
|
+
default=True,
|
|
221
|
+
show_default=True,
|
|
222
|
+
)
|
|
223
|
+
@click.option(
|
|
224
|
+
"--use-ref-cps/--no-ref-cps",
|
|
225
|
+
"use_ref_cps",
|
|
226
|
+
help="""Download plastid references for cpDNA filtering.""",
|
|
227
|
+
default=True,
|
|
228
|
+
show_default=True,
|
|
229
|
+
)
|
|
230
|
+
@click.option(
|
|
231
|
+
"--ref-cps",
|
|
232
|
+
"ref_cps",
|
|
233
|
+
help="""Comma separated list of reference plastids to download for
|
|
234
|
+
cp filtering. Check cps_seqids.csv for a full list of values.""",
|
|
235
|
+
type=str,
|
|
236
|
+
default="Ambtr,Arath,Orysa,UMUL,RQNK",
|
|
237
|
+
show_default=True,
|
|
238
|
+
)
|
|
239
|
+
@click.option(
|
|
240
|
+
"--custom-cps",
|
|
241
|
+
"custom_cps",
|
|
242
|
+
help="""Custom cps to use for cpDNA filtering (fasta).
|
|
243
|
+
These cps are used in addition to the ref cps.""",
|
|
244
|
+
type=click.Path(readable=True, exists=True),
|
|
245
|
+
required=False,
|
|
246
|
+
default=None,
|
|
247
|
+
)
|
|
248
|
+
@common_options
|
|
249
|
+
def run(**kwargs):
|
|
250
|
+
"""Run NextPyper's workflow"""
|
|
251
|
+
# Config to add or update in configfile
|
|
252
|
+
merge_config = {"nextpyper": {"args": kwargs}}
|
|
253
|
+
|
|
254
|
+
# run!
|
|
255
|
+
run_snakemake(
|
|
256
|
+
# Full path to Snakefile
|
|
257
|
+
snakefile_path=snake_base(Path("workflow/Snakefile")),
|
|
258
|
+
merge_config=merge_config,
|
|
259
|
+
**kwargs,
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
@click.option(
|
|
264
|
+
"-o",
|
|
265
|
+
"--output",
|
|
266
|
+
help="Output sample table",
|
|
267
|
+
type=click.Path(writable=True, readable=True),
|
|
268
|
+
default="sample.tsv",
|
|
269
|
+
show_default=True,
|
|
270
|
+
)
|
|
271
|
+
@click.option(
|
|
272
|
+
"-i",
|
|
273
|
+
"--input",
|
|
274
|
+
"input",
|
|
275
|
+
help="Path to data directory",
|
|
276
|
+
type=click.Path(readable=True, exists=True),
|
|
277
|
+
required=True,
|
|
278
|
+
)
|
|
279
|
+
@click.command(epilog=gather_msg)
|
|
280
|
+
def gather(**kwargs):
|
|
281
|
+
"""Generate a sample table given a data directory"""
|
|
282
|
+
|
|
283
|
+
datadir = Path(kwargs["input"])
|
|
284
|
+
outfile = Path(kwargs["output"])
|
|
285
|
+
|
|
286
|
+
make_table(datadir, outfile)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
@click.option(
|
|
290
|
+
"--out_hierarchy",
|
|
291
|
+
"hierarchy",
|
|
292
|
+
help="Write grouping hierarchy to this file",
|
|
293
|
+
type=click.Path(writable=True, readable=True),
|
|
294
|
+
default="",
|
|
295
|
+
# show_default=True,
|
|
296
|
+
)
|
|
297
|
+
@click.option(
|
|
298
|
+
"--out_summary",
|
|
299
|
+
"output",
|
|
300
|
+
help="Write summary of grouping to this file",
|
|
301
|
+
type=click.Path(writable=True, readable=True),
|
|
302
|
+
default="",
|
|
303
|
+
# show_default=True,
|
|
304
|
+
)
|
|
305
|
+
@click.option(
|
|
306
|
+
"--pattern",
|
|
307
|
+
help="Pattern used to group the probes (RegEx)",
|
|
308
|
+
type=str,
|
|
309
|
+
default=r"(.*)",
|
|
310
|
+
show_default=True,
|
|
311
|
+
)
|
|
312
|
+
@click.option(
|
|
313
|
+
"-p",
|
|
314
|
+
"--probes",
|
|
315
|
+
"probes",
|
|
316
|
+
help="Path to probes files",
|
|
317
|
+
type=click.Path(readable=True, exists=True),
|
|
318
|
+
required=True,
|
|
319
|
+
)
|
|
320
|
+
@click.command(epilog=validate_msg)
|
|
321
|
+
def validate(**kwargs):
|
|
322
|
+
"""Validate a probes file for running NextPyper"""
|
|
323
|
+
|
|
324
|
+
probes_path = Path(kwargs["probes"])
|
|
325
|
+
pattern = kwargs["pattern"]
|
|
326
|
+
outsummary = Path(kwargs["output"]) if kwargs["output"] else None
|
|
327
|
+
outhierarchy = Path(kwargs["hierarchy"]) if kwargs["hierarchy"] else None
|
|
328
|
+
|
|
329
|
+
check_probes(probes_path, pattern, outsummary, outhierarchy)
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
@click.option(
|
|
333
|
+
"-o",
|
|
334
|
+
"--output",
|
|
335
|
+
"output",
|
|
336
|
+
help="Output summary table",
|
|
337
|
+
type=click.Path(writable=True, path_type=Path),
|
|
338
|
+
default="run_stats.csv",
|
|
339
|
+
show_default=True,
|
|
340
|
+
)
|
|
341
|
+
@click.option(
|
|
342
|
+
"-r",
|
|
343
|
+
"--rundir",
|
|
344
|
+
"rundir",
|
|
345
|
+
help="Path to run directory",
|
|
346
|
+
type=click.Path(readable=True, exists=True, path_type=Path),
|
|
347
|
+
required=True,
|
|
348
|
+
)
|
|
349
|
+
@click.command(epilog=summarize_msg)
|
|
350
|
+
def summarize(**kwargs):
|
|
351
|
+
"""Summarize the results of a NextPyper run"""
|
|
352
|
+
|
|
353
|
+
run_directory_path = Path(kwargs["rundir"])
|
|
354
|
+
out_table_path = kwargs["output"]
|
|
355
|
+
|
|
356
|
+
df = summarize_workflow(run_directory_path)
|
|
357
|
+
df.to_csv(out_table_path, index=False)
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
@click.option(
|
|
361
|
+
"--conda-prefix",
|
|
362
|
+
default=str(snake_base(Path("workflow") / "conda")),
|
|
363
|
+
help="Path where to put the conda environments",
|
|
364
|
+
type=click.Path(),
|
|
365
|
+
show_default=False,
|
|
366
|
+
)
|
|
367
|
+
@click.command(epilog=prepare_msg)
|
|
368
|
+
def prepare(**kwargs):
|
|
369
|
+
"""Prepare the conda environments to run NextPyper"""
|
|
370
|
+
|
|
371
|
+
mock_dir = Path(__file__).parent / "data/mock"
|
|
372
|
+
kwargs.update(yaml.safe_load((mock_dir / "mock_args.yaml").read_text()))
|
|
373
|
+
|
|
374
|
+
with tempfile.TemporaryDirectory() as tmpdir:
|
|
375
|
+
tmpdir = Path(tmpdir)
|
|
376
|
+
kwargs["system_config"] = str(Path(__file__).parent / "config/config.yaml")
|
|
377
|
+
kwargs["input"] = str(mock_dir / "sample.tsv")
|
|
378
|
+
kwargs["probes"] = str(mock_dir / "probes.fasta")
|
|
379
|
+
kwargs["configfile"] = str(tmpdir / "config.yaml")
|
|
380
|
+
kwargs["log"] = str(tmpdir / "nextpyper.log")
|
|
381
|
+
kwargs["output"] = str(tmpdir)
|
|
382
|
+
|
|
383
|
+
# Config to add or update in configfile
|
|
384
|
+
merge_config = {"nextpyper": {"args": kwargs}}
|
|
385
|
+
|
|
386
|
+
run_snakemake(
|
|
387
|
+
# Full path to Snakefile
|
|
388
|
+
snakefile_path=snake_base(Path("workflow/Snakefile")),
|
|
389
|
+
merge_config=merge_config,
|
|
390
|
+
**kwargs,
|
|
391
|
+
)
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
@click.command(epilog=config_msg)
|
|
395
|
+
@click.option(
|
|
396
|
+
"-o",
|
|
397
|
+
"--output",
|
|
398
|
+
help="Output directory",
|
|
399
|
+
type=click.Path(dir_okay=True, writable=True, readable=True),
|
|
400
|
+
default="nextpyper.out",
|
|
401
|
+
show_default=True,
|
|
402
|
+
)
|
|
403
|
+
# @common_options
|
|
404
|
+
def config(configfile, system_config, **kwargs):
|
|
405
|
+
"""Copy the default config to modify the workflow parameters before running."""
|
|
406
|
+
copy_config(configfile, system_config=system_config)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
@click.command()
|
|
410
|
+
def citation(**kwargs):
|
|
411
|
+
"""Print the citation(s) for NextPyper"""
|
|
412
|
+
print_citation()
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
cli.add_command(run)
|
|
416
|
+
cli.add_command(gather)
|
|
417
|
+
cli.add_command(validate)
|
|
418
|
+
cli.add_command(summarize)
|
|
419
|
+
cli.add_command(prepare)
|
|
420
|
+
cli.add_command(config)
|
|
421
|
+
cli.add_command(citation)
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
def main():
|
|
425
|
+
cli()
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
if __name__ == "__main__":
|
|
429
|
+
main()
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Namespaced config file example
|
|
2
|
+
nextpyper:
|
|
3
|
+
args: # Command line args will be (over)written here at runtime
|
|
4
|
+
input:
|
|
5
|
+
output:
|
|
6
|
+
probe_pattern: (\d{4})$
|
|
7
|
+
multi_probes:
|
|
8
|
+
# Add customisable config here
|
|
9
|
+
pipeline:
|
|
10
|
+
preprocessing:
|
|
11
|
+
trim_qual: 30
|
|
12
|
+
min_len: 75
|
|
13
|
+
probes_translation:
|
|
14
|
+
translated_prop: 0.95
|
|
15
|
+
stop_per_1Kbp: 2
|
|
16
|
+
min_exon_length: 20
|
|
17
|
+
spades:
|
|
18
|
+
k: auto
|
|
19
|
+
scaffolds_extension:
|
|
20
|
+
filter_low_dp_comps: true
|
|
21
|
+
floor_len_extension: 3000
|
|
22
|
+
ceiling_len_extension: 6000
|
|
23
|
+
probe_len_scaling: 3
|
|
24
|
+
max_intron_size: auto
|
|
25
|
+
max_extensions: 5
|
|
26
|
+
seeds:
|
|
27
|
+
min_sister_sample_freq: 0.5
|
|
28
|
+
cov_by_mapping: true
|
|
29
|
+
saute:
|
|
30
|
+
heuristic:
|
|
31
|
+
primary_target_depth: 15
|
|
32
|
+
secondary_target_depth: 30
|
|
33
|
+
k1_min: 0.35
|
|
34
|
+
k1_max: 0.6
|
|
35
|
+
k2_min: 0.1
|
|
36
|
+
k2_max: 0.2
|
|
37
|
+
k1_floor: 49
|
|
38
|
+
k2_floor: 21
|
|
39
|
+
assembly:
|
|
40
|
+
target_cov: 0.2
|
|
41
|
+
secondary_kmer_threshold: 3
|
|
42
|
+
reassembly:
|
|
43
|
+
k1_rescaling: 0.7
|
|
44
|
+
target_cov: 0.5
|
|
45
|
+
secondary_kmer_threshold: 3
|
|
46
|
+
max_variants: 10
|
|
47
|
+
expected_homologs_per_ploidy: 1
|
|
48
|
+
diamond_matching:
|
|
49
|
+
fields: 'qseqid evalue qstart qend qlen sstart send slen sseqid gapopen nident mismatch'
|
|
50
|
+
sensitivity: '--ultra-sensitive'
|
|
51
|
+
evalue: 1.000E-6
|
|
52
|
+
max_hsps: 20
|
|
53
|
+
min_orf_len: 15
|
|
54
|
+
gapopen: 13
|
|
55
|
+
frameshift: 15
|
|
56
|
+
homolog_filtering:
|
|
57
|
+
seeds:
|
|
58
|
+
max_gc: 0.6
|
|
59
|
+
min_gc: 0.2
|
|
60
|
+
cov_threshold: 4
|
|
61
|
+
cov_dynamic_filt: False
|
|
62
|
+
scf_min_cov: 0.0
|
|
63
|
+
scf_min_idt: 0.6
|
|
64
|
+
homologs:
|
|
65
|
+
max_gc: 0.6
|
|
66
|
+
min_gc: 0.2
|
|
67
|
+
cov_threshold: 2
|
|
68
|
+
cov_dynamic_filt: true
|
|
69
|
+
scf_min_cov: 0.1
|
|
70
|
+
scf_min_idt: 0.6
|
|
71
|
+
divergence_estimation:
|
|
72
|
+
min_cov: 0.5
|
|
73
|
+
flatenning_prop: 0.1
|
|
74
|
+
region_separation:
|
|
75
|
+
enforce_global_idt_threshold: False
|
|
76
|
+
min_global_identity: 0.85
|
|
77
|
+
min_fragment_cov: 0.1
|
|
78
|
+
min_exonic_length: 10
|
|
79
|
+
max_intron_length: 1000
|
|
80
|
+
mafft_params: '--auto --reorder'
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Styling
|
|
2
|
+
THEME: solarized-box
|
|
3
|
+
STYLE_OPTION: "yellow" # Uncomment this to use magenta for flags
|
|
4
|
+
|
|
5
|
+
# ALIGN_OPTIONS_PANEL: true
|
|
6
|
+
STYLE_OPTIONS_TABLE_COLUMN_WIDTH_RATIO: [1, 2]
|
|
7
|
+
# MAX_WIDTH: 150
|
|
8
|
+
OPTION_WIDTH: 40
|
|
9
|
+
# MIN_OPTION_WIDTH: 40
|
|
10
|
+
# Add this to the YAML
|
|
11
|
+
USE_RICH_MARKUP: true
|
|
12
|
+
|
|
13
|
+
# Command Layout
|
|
14
|
+
COMMAND_GROUPS:
|
|
15
|
+
nextpyper:
|
|
16
|
+
- name: "Commands"
|
|
17
|
+
commands:
|
|
18
|
+
- run
|
|
19
|
+
- gather
|
|
20
|
+
- validate
|
|
21
|
+
- summarize
|
|
22
|
+
- prepare
|
|
23
|
+
- config
|
|
24
|
+
- citation
|
|
25
|
+
|
|
26
|
+
# Option Layout for the 'run' command
|
|
27
|
+
OPTION_GROUPS:
|
|
28
|
+
nextpyper run:
|
|
29
|
+
- name: "Basic usage"
|
|
30
|
+
options:
|
|
31
|
+
- "--input"
|
|
32
|
+
- "--probes"
|
|
33
|
+
- "--output"
|
|
34
|
+
- "--multi-probes"
|
|
35
|
+
- "--pattern"
|
|
36
|
+
|
|
37
|
+
- name: "Chloroplast filtering"
|
|
38
|
+
options:
|
|
39
|
+
- "--use-ref-cps"
|
|
40
|
+
- "--ref-cps"
|
|
41
|
+
- "--custom-cps"
|
|
42
|
+
|
|
43
|
+
- name: "Advanced usage"
|
|
44
|
+
options:
|
|
45
|
+
- "--interseeds"
|
|
46
|
+
- "--reasm-tribble-probes"
|
|
47
|
+
- "--use-ploidy"
|
|
48
|
+
|
|
49
|
+
- name: "Snakemake options"
|
|
50
|
+
options:
|
|
51
|
+
- "--use-conda"
|
|
52
|
+
- "--conda-prefix"
|
|
53
|
+
- "--snake-default"
|
|
54
|
+
- "--threads"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
nextpyper:
|
|
2
|
+
# Config you don't want users to change
|
|
3
|
+
blosum62: "../../data/blosum62.csv"
|
|
4
|
+
cp_refs_map: "../../data/cps_seqids.csv"
|
|
5
|
+
regex_patterns:
|
|
6
|
+
seed_pat: '^(?P<sample>.*?)-(?P<probe>.*?)_EDGE_(?P<seed_id>\d+)_length_(?P<len>\d+)_cov_(?P<cov>[\w.]+)$'
|
|
7
|
+
saute_pre_fix_pat: '^Contig_(?P<sample>.*?)-(?P<probe>.*?)_EDGE_(?P<seed_id>\d+)_length_(?P<len>\d+)_cov_(?P<cov>[\w.]+):[^ ]+:(?P<kmers>\d+)$'
|
|
8
|
+
saute_post_fix_pat: '^(?P<sample1>.*?)\|.*?-(?P<probe>.*?)_EDGE_(?P<seed_id>\d+)_length_(?P<len>\d+)_cov_(?P<cov>[\w.]+):[^ ]+:(?P<kmers>\d+)$'
|
|
9
|
+
comp_final_pat: '^(?P<sample1>.*?)\|(?P<sample2>.*?)-(?P<probe>.*?)_EDGE_(?P<seed_id>\d+)_length_(?P<len>\d+)_cov_(?P<cov>[\w.]+):(?P<comp>\d+):(?P<ctg1>\d+):(?P<ctg2>\d+):(?P<kmers>\d+)$'
|
|
10
|
+
saute_target_pat: '^Contig_(?P<seed>.*?)-(?P<probe>.*?)_EDGE_(?P<seed_id>\d+)_length_(?P<seed_len>\d+)_cov_(?P<cov>[\w.]+):(?P<comp>\d+):(?P<ctg1>\d+):(?P<ctg2>\d+):(?P<kmers>\d+)$'
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Taken from https://github.com/tomasbruna/miniprot-boundary-scorer/blob/master/blosum62.csv
|
|
2
|
+
# Matrix made by matblas from blosum62.iij
|
|
3
|
+
# * column uses minimum score
|
|
4
|
+
# BLOSUM Clustered Scoring Matrix in 1/2 Bit Units
|
|
5
|
+
# Blocks Database = /data/blocks_5.0/blocks.dat
|
|
6
|
+
# Cluster Percentage: >= 62
|
|
7
|
+
# Entropy = 0.6979, Expected = -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