Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
UNLOCK
scripts
Commits
6eb19d18
Commit
6eb19d18
authored
3 years ago
by
Jasper Koehorst
Browse files
Options
Downloads
Patches
Plain Diff
sync
parent
5617ab74
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
medaka/medaka.py
+11
-10
11 additions, 10 deletions
medaka/medaka.py
with
11 additions
and
10 deletions
medaka/medaka.py
+
11
−
10
View file @
6eb19d18
...
...
@@ -10,7 +10,7 @@ def main():
args
=
parse_arguments
()
mini_align
(
args
)
medaka_consensus
(
args
)
medaka_stich
(
args
)
def
parse_arguments
():
# Initialize parser
...
...
@@ -23,7 +23,7 @@ def parse_arguments():
parser
.
add_argument
(
"
-m
"
,
help
=
"
fill MD tag
"
)
parser
.
add_argument
(
"
-p
"
,
help
=
"
output file prefix (default: reads)
"
,
nargs
=
'
?
'
,
default
=
"
reads
"
,
type
=
str
)
parser
.
add_argument
(
"
-c
"
,
"
--contig-chunks
"
,
help
=
"
Number of contigs per medaka_consensus step
"
,
nargs
=
'
?
'
,
default
=
100
,
type
=
int
)
parser
.
add_argument
(
"
--model
"
,
help
=
"
Model definition, default is equivalent to r94.
"
,
default
=
"
r94
"
)
parser
.
add_argument
(
"
--model
"
,
help
=
"
Model definition, default is equivalent to r94
1_min_fast_g303
.
"
,
default
=
"
r94
1_min_fast_g303
"
)
# Adding optional argument for ....
# ...
...
...
@@ -42,9 +42,10 @@ def parse_arguments():
# -p calls_to_draft.bam -t <threads>
def
mini_align
(
args
):
if
os
.
path
.
exists
(
args
.
reference
+
"
.mmi
"
):
print
(
"
Index file is already present
"
)
# Checks for mmi and bam file?
if
os
.
path
.
exists
(
args
.
reference
+
"
.mmi
"
)
and
os
.
path
.
exists
(
args
.
p
+
"
.bam
"
):
print
(
"
Index and bam file are already present
"
)
return
print
(
args
)
arguments
=
[
"
mini_align
"
,
"
-i
"
,
args
.
input
,
"
-r
"
,
args
.
reference
,
"
-m
"
,
"
-p
"
,
args
.
p
,
"
-t
"
,
args
.
threads
]
command
=
'
'
.
join
(
map
(
str
,
arguments
))
...
...
@@ -94,12 +95,12 @@ def medaka_consensus(args):
reader
.
close
()
# Run this in parallel for each chunk by number of threads / 2
commands
=
set
()
commands
=
[]
for
chunk
in
chunks
:
arguments
=
[
"
medaka
"
,
"
consensus
"
,
args
.
p
+
"
.bam
"
,
"
results/chunk_
"
+
str
(
chunk
),
"
--model
"
,
args
.
model
,
"
--threads
"
,
"
2
"
,
"
--region
"
,
'
'
.
join
(
chunks
[
chunk
])]
arguments
=
'
'
.
join
(
map
(
str
,
arguments
))
commands
.
a
d
d
(
arguments
)
commands
.
a
ppen
d
(
arguments
)
# Multi thread section
from
functools
import
partial
from
multiprocessing.dummy
import
Pool
...
...
@@ -110,9 +111,9 @@ def medaka_consensus(args):
pool
=
Pool
(
jobs
)
# two concurrent commands at a time
for
i
,
returncode
in
enumerate
(
pool
.
imap
(
partial
(
call
,
shell
=
True
),
commands
)):
if
returncode
!=
0
:
print
(
"
%d command failed
: %d
"
%
(
i
,
returncode
))
print
(
"
%d command failed
with exit code %d and command %s
"
%
(
i
,
returncode
,
commands
[
i
]
))
else
:
print
(
"
%d command finished: %d
"
%
(
i
,
returncode
))
print
(
"
%d command finished: %d
%s
"
%
(
i
,
returncode
,
commands
[
i
]
))
## SINGLE RUN
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment