Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nested
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matej Lexa
nested
Commits
ccd3edb1
There was an error fetching the commit references. Please try again later.
Commit
ccd3edb1
authored
6 years ago
by
rlapar
Browse files
Options
Downloads
Patches
Plain Diff
remove main
parent
b1bf9fee
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
main.py
+0
-84
0 additions, 84 deletions
main.py
nested/cli/nester.py
+1
-1
1 addition, 1 deletion
nested/cli/nester.py
nested/config/config.py
+1
-1
1 addition, 1 deletion
nested/config/config.py
nested/config/gt.style
+0
-0
0 additions, 0 deletions
nested/config/gt.style
with
2 additions
and
86 deletions
main.py
deleted
100644 → 0
+
0
−
84
View file @
b1bf9fee
#!/usr/bin/env python3
import
sys
import
os
import
shutil
import
click
from
datetime
import
datetime
from
subprocess
import
CalledProcessError
from
Bio
import
SeqIO
from
nested.core.nester
import
Nester
from
nested.core.generator
import
Generator
from
nested.output.sketcher
import
Sketcher
def
setup
():
if
not
os
.
path
.
exists
(
'
data
'
):
os
.
makedirs
(
'
data
'
)
if
not
os
.
path
.
exists
(
'
generated_data
'
):
os
.
makedirs
(
'
generated_data
'
)
if
not
os
.
path
.
exists
(
'
tmp
'
):
os
.
makedirs
(
'
tmp
'
)
def
cleanup
():
shutil
.
rmtree
(
'
tmp/
'
)
@click.command
()
@click.option
(
'
--input_fasta
'
,
'
-i
'
,
type
=
str
,
help
=
'
Input fasta file.
'
)
@click.option
(
'
--sketch_only
'
,
'
-s
'
,
is_flag
=
True
,
help
=
'
If true, nesting is not computed. Genes are sketched only from existing gff files.
'
)
@click.option
(
'
--generate_from_fasta
'
,
'
-g
'
,
type
=
str
,
help
=
'
Generate nested elements for source_db.
'
)
@click.option
(
'
--baselength
'
,
'
-gb
'
,
type
=
int
,
help
=
'
Baselength for generated elements.
'
)
@click.option
(
'
--number_of_iterations
'
,
'
-gi
'
,
type
=
int
,
help
=
'
Number of iterations in generating.
'
)
@click.option
(
'
--filter_string
'
,
'
-gf
'
,
type
=
str
,
help
=
'
Filter string in generating.
'
)
@click.option
(
'
--number_of_elements
'
,
'
-ge
'
,
type
=
int
,
help
=
'
Number of generated elements.
'
)
def
main
(
input_fasta
,
sketch_only
,
generate_from_fasta
,
baselength
,
number_of_iterations
,
filter_string
,
number_of_elements
):
number_of_errors
=
0
start_time
=
datetime
.
now
()
setup
()
sketcher
=
Sketcher
()
if
input_fasta
:
sequences
=
list
(
SeqIO
.
parse
(
open
(
input_fasta
),
'
fasta
'
))
for
sequence
in
sequences
:
sequence
.
id
=
sequence
.
id
.
replace
(
'
/
'
,
'
--
'
)
seq_start_time
=
datetime
.
now
()
print
(
'
Processing {}...
'
.
format
(
sequence
.
id
),
end
=
'
\r
'
)
try
:
if
not
sketch_only
:
nester
=
Nester
(
sequence
)
sketcher
.
create_gff
(
nester
.
nested_element
)
sketcher
.
sketch
(
sequence
.
id
)
seq_end_time
=
datetime
.
now
()
print
(
'
Processing {}: done [{}]
'
.
format
(
sequence
.
id
,
seq_end_time
-
seq_start_time
))
except
KeyboardInterrupt
:
raise
except
CalledProcessError
:
number_of_errors
+=
1
print
(
'
Processing {}: SUBPROCESS ERROR
'
.
format
(
sequence
.
id
))
except
:
number_of_errors
+=
1
print
(
'
Processing {}: UNEXPECTED ERROR:
'
.
format
(
sequence
.
id
),
sys
.
exc_info
()[
0
])
elif
generate_from_fasta
:
generator
=
Generator
(
generate_from_fasta
)
params
=
{}
if
baselength
:
params
[
'
baselength
'
]
=
baselength
if
number_of_iterations
:
params
[
'
number_of_iterations
'
]
=
number_of_iterations
if
filter_string
:
params
[
'
filter_string
'
]
=
filter_string
if
number_of_elements
:
params
[
'
number_of_elements
'
]
=
number_of_elements
generator
.
generate_random_nested_elements
(
**
params
)
generator
.
save_elements_to_fasta
(
'
generated_data/generated.fa
'
)
for
element
in
generator
.
elements
:
sketcher
.
create_gff
(
element
,
'
generated_data
'
)
sketcher
.
sketch
(
element
.
id
,
'
generated_data
'
)
cleanup
()
endTime
=
datetime
.
now
()
print
(
'
Total time: {}
'
.
format
(
endTime
-
start_time
))
print
(
'
Number of errors: {}
'
.
format
(
number_of_errors
))
if
__name__
==
'
__main__
'
:
main
()
This diff is collapsed.
Click to expand it.
nested/cli/nester.py
+
1
−
1
View file @
ccd3edb1
...
@@ -15,7 +15,7 @@ from nested.output.sketcher import Sketcher
...
@@ -15,7 +15,7 @@ from nested.output.sketcher import Sketcher
@click.option
(
'
--sketch_only
'
,
'
-s
'
,
is_flag
=
True
,
help
=
'
If true, nesting is not computed. Genes are sketched only from existing gff files.
'
)
@click.option
(
'
--sketch_only
'
,
'
-s
'
,
is_flag
=
True
,
help
=
'
If true, nesting is not computed. Genes are sketched only from existing gff files.
'
)
@click.option
(
'
--data_folder
'
,
'
-d
'
,
type
=
str
,
help
=
'
Output data folder.
'
)
@click.option
(
'
--data_folder
'
,
'
-d
'
,
type
=
str
,
help
=
'
Output data folder.
'
)
#TODO DATA_FOLDER
#TODO DATA_FOLDER
def
main
(
input_fasta
,
sketch_only
):
def
main
(
input_fasta
,
sketch_only
,
data_folder
):
number_of_errors
=
0
number_of_errors
=
0
start_time
=
datetime
.
now
()
start_time
=
datetime
.
now
()
sequences
=
list
(
SeqIO
.
parse
(
open
(
input_fasta
),
'
fasta
'
))
sequences
=
list
(
SeqIO
.
parse
(
open
(
input_fasta
),
'
fasta
'
))
...
...
This diff is collapsed.
Click to expand it.
nested/config/config.py
+
1
−
1
View file @
ccd3edb1
...
@@ -16,7 +16,7 @@ ltr_finder_args += ['-s', ltr_finder_tRNAdb_path]
...
@@ -16,7 +16,7 @@ ltr_finder_args += ['-s', ltr_finder_tRNAdb_path]
gt_sketch_path
=
'
gt
'
gt_sketch_path
=
'
gt
'
gt_sketch_args
=
[
'
sketch
'
]
gt_sketch_args
=
[
'
sketch
'
]
gt_sketch_args
+=
[
'
-width
'
,
'
1400
'
]
gt_sketch_args
+=
[
'
-width
'
,
'
1400
'
]
gt_sketch_args
+=
[
'
-style
'
,
'
/home/radovan/git/nested/gt.style
'
]
gt_sketch_args
+=
[
'
-style
'
,
'
/home/radovan/git/nested/
nested/config/
gt.style
'
]
blastx_args
=
{
blastx_args
=
{
'
db
'
:
'
/home/radovan/lexa/blastDB/data/gydb_proteins.fa
'
,
'
db
'
:
'
/home/radovan/lexa/blastDB/data/gydb_proteins.fa
'
,
...
...
This diff is collapsed.
Click to expand it.
gt.style
→
nested/config/
gt.style
+
0
−
0
View file @
ccd3edb1
File moved
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