Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KNOT
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
MARIJON Pierre
KNOT
Commits
23c3b22f
Commit
23c3b22f
authored
Oct 25, 2018
by
MARIJON Pierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add module to select not assign read and read at extrimity to build SG
parent
440c256e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
11 deletions
+52
-11
knot/__main__.py
knot/__main__.py
+5
-6
knot/extremity_search/__init__.py
knot/extremity_search/__init__.py
+2
-2
knot/extremity_search/__main__.py
knot/extremity_search/__main__.py
+2
-2
knot/path_search/__main__.py
knot/path_search/__main__.py
+1
-1
knot/sg_generation/__init__.py
knot/sg_generation/__init__.py
+0
-0
knot/sg_generation/__main__.py
knot/sg_generation/__main__.py
+41
-0
setup.py
setup.py
+1
-0
No files found.
knot/__main__.py
View file @
23c3b22f
...
...
@@ -21,7 +21,6 @@ class MyArgumentParser(argparse.ArgumentParser):
def
main
(
args
=
None
):
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
...
...
@@ -70,11 +69,11 @@ def main(args = None):
snakemake_config_path
=
os
.
path
.
join
(
package_path
,
"config.yaml"
)
config
=
[
"contigs="
+
args
[
"contigs"
],
"out_prefix="
+
args
[
"output"
],
"contigs_graph="
+
args
[
"contigs_graph"
],
"read_type="
+
args
[
"read_type"
],
"package_path="
+
package_path
"contigs="
+
args
[
"contigs"
],
"out_prefix="
+
args
[
"output"
],
"contigs_graph="
+
args
[
"contigs_graph"
],
"read_type="
+
args
[
"read_type"
],
"package_path="
+
package_path
,
]
if
args
[
"raw_reads"
]
is
not
None
:
...
...
knot/extremity_search/__init__.py
View file @
23c3b22f
...
...
@@ -25,10 +25,10 @@ def get_tig2posread(read2tig, valid_read):
reader
=
csv
.
reader
(
read2tig
,
delimiter
=
"
\t
"
)
for
row
in
reader
:
if
row
[
0
]
not
in
valid_read
:
if
valid_read
and
row
[
0
]
not
in
valid_read
:
continue
if
int
(
row
[
3
])
-
int
(
row
[
2
])
>
0.7
*
int
(
row
[
1
]):
result
[
row
[
5
]
].
append
((
int
(
row
[
7
]),
int
(
row
[
8
]),
row
[
0
],
row
[
4
]))
result
[
(
row
[
5
],
int
(
row
[
6
]))
].
append
((
int
(
row
[
7
]),
int
(
row
[
8
]),
row
[
0
],
row
[
4
]))
return
result
knot/extremity_search/__main__.py
View file @
23c3b22f
...
...
@@ -31,11 +31,11 @@ def main(args=None):
print
(
"tig"
,
"read"
,
"strand_to_tig"
,
sep
=
","
,
file
=
args
[
"output"
])
for
tig
in
tig2posread
.
keys
():
ext
=
tig
+
"_begin"
ext
=
tig
[
0
]
+
"_begin"
print
(
ext
,
tig2posread
[
tig
][
0
][
2
],
tig2posread
[
tig
][
0
][
3
],
sep
=
","
,
file
=
args
[
"output"
])
ext
=
tig
+
"_end"
ext
=
tig
[
0
]
+
"_end"
tig2posread
[
tig
].
sort
(
key
=
lambda
x
:
x
[
1
])
print
(
ext
,
tig2posread
[
tig
][
-
1
][
2
],
tig2posread
[
tig
][
-
1
][
3
],
sep
=
","
,
file
=
args
[
"output"
])
...
...
knot/path_search/__main__.py
View file @
23c3b22f
...
...
@@ -46,7 +46,7 @@ def main(args=None):
# get info about contig
valid_read
=
extremity_search
.
get_valid_read
(
args
[
"ovl_graph"
])
tig2reads
=
{
tig
:
{
v
[
2
]
for
v
in
val
}
for
tig
,
val
in
extremity_search
.
get_tig2posread
(
args
[
"read2asm"
],
valid_read
).
items
()}
tig2reads
=
{
tig
[
0
]
:
{
v
[
2
]
for
v
in
val
}
for
tig
,
val
in
extremity_search
.
get_tig2posread
(
args
[
"read2asm"
],
valid_read
).
items
()}
# build list of search
...
...
knot/sg_generation/__init__.py
0 → 100644
View file @
23c3b22f
knot/sg_generation/__main__.py
0 → 100644
View file @
23c3b22f
#!/usr/bin/env python3
# std import
import
sys
import
argparse
# pip import
from
Bio
import
SeqIO
# project import
from
knot
import
extremity_search
def
main
(
args
=
None
):
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
parser
=
argparse
.
ArgumentParser
(
prog
=
"knot.sg_generation"
)
parser
.
add_argument
(
"reads2contig"
,
type
=
argparse
.
FileType
(
'r'
))
parser
.
add_argument
(
"input"
,
type
=
argparse
.
FileType
(
'r'
))
parser
.
add_argument
(
"output"
,
type
=
argparse
.
FileType
(
'w'
))
args
=
vars
(
parser
.
parse_args
(
args
))
tig2readspos
=
extremity_search
.
get_tig2posread
(
args
[
"reads2contig"
],
set
())
skip_read
=
set
()
for
tig
,
val
in
tig2readspos
.
items
():
t
=
max
(
tig
[
1
]
*
0.2
,
100000
)
for
v
in
val
:
if
v
[
0
]
>
t
and
v
[
1
]
<
tig
[
1
]
-
t
:
skip_read
.
add
(
v
[
2
])
for
record
in
SeqIO
.
parse
(
args
[
"input"
],
"fasta"
):
if
record
.
id
not
in
skip_read
:
SeqIO
.
write
(
record
,
args
[
"output"
],
"fasta"
)
if
__name__
==
"__main__"
:
main
()
setup.py
View file @
23c3b22f
...
...
@@ -41,6 +41,7 @@ setup(
'console_scripts'
:
[
'knot = knot.__main__:main'
,
'knot.path_search = knot.path_search.__main__:main'
,
'knot.sg_generation = knot.sg_generation.__main__:main'
,
'knot.extremity_search = knot.extremity_search.__main__:main'
]
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment