-
Notifications
You must be signed in to change notification settings - Fork 1
/
blastn.py
57 lines (42 loc) 路 1.47 KB
/
blastn.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python
__author__ = "Vini Salazar"
__license__ = "MIT"
__maintainer__ = "Vini Salazar"
__url__ = "https://github.com/vinisalazar/bioprov"
__version__ = "0.1.18a"
"""
BLAST nucleotide alignment workflow
'Align nucleotide data to a reference database with BLASTN'
This can be run by itself as a script or called
with the BioProv CLI application (recommended).
"""
from bioprov.src.workflow import Workflow, Step
from bioprov.programs import blastn
def blastn_alignment(**kwargs):
_blastn_alignment = Workflow(
name="blastn",
description="Align nucleotide data to a reference database with BLASTN.",
input_type="dataframe",
index_col="sample-id",
file_columns="query",
**kwargs,
)
try:
_blastn_alignment.db = kwargs["db"]
except KeyError:
_blastn_alignment.db = None
blastn_preset = blastn(db=_blastn_alignment.db)
_blastn_alignment.add_step(Step(blastn_preset, default=True))
# Workflow specific arguments must be added AFTER the steps.
# That is because adding a Step updates the parser with the default arguments
# of the Workflow class.
_blastn_alignment.parser.add_argument(
"-db",
"--database",
help="BLASTn reference database. Must be a valid BLAST database created with the `makeblastdb` command.",
required=True,
)
return _blastn_alignment
if __name__ == "__main__":
workflow = blastn_alignment()
workflow.main()