Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Read sequencer
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
Show more breadcrumbs
zavolan_group
tools
Read sequencer
Commits
f4f2c586
Commit
f4f2c586
authored
2 years ago
by
Christoph Harmel
Browse files
Options
Downloads
Patches
Plain Diff
fix: updated cli.py for rewritten class
parent
e4c0da92
No related branches found
No related tags found
1 merge request
!26
feat: ReadSequencer class rewritten, updated CLI
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
read_sequencer_package/cli.py
+16
-14
16 additions, 14 deletions
read_sequencer_package/cli.py
read_sequencer_package/read_sequencer.py
+0
-3
0 additions, 3 deletions
read_sequencer_package/read_sequencer.py
with
16 additions
and
17 deletions
read_sequencer_package/cli.py
+
16
−
14
View file @
f4f2c586
...
@@ -4,32 +4,34 @@ import logging
...
@@ -4,32 +4,34 @@ import logging
parser
=
argparse
.
ArgumentParser
(
prog
=
'
read_sequencer
'
,
parser
=
argparse
.
ArgumentParser
(
prog
=
'
read_sequencer
'
,
description
=
'
Simulates sequencing of DNA sequences specified by an FASTA file.
'
)
description
=
'
Simulates sequencing of DNA sequences specified by an FASTA file.
'
)
parser
.
add_argument
(
'
--input_file_path
'
,
parser
.
add_argument
(
'
output
'
,
help
=
'
path to FASTA file
'
)
help
=
'
path to FASTA file
'
)
parser
.
add_argument
(
'
-
-output_file_path
'
,
parser
.
add_argument
(
'
-
i
'
,
'
--input
'
,
default
=
None
,
help
=
'
path to FASTA file
'
)
help
=
'
path to FASTA file
'
)
parser
.
add_argument
(
'
--read
_
length
'
,
parser
.
add_argument
(
'
-
r
'
,
'
-
-read
-
length
'
,
default
=
100
,
help
=
'
read length for sequencing
'
,
help
=
'
read length for sequencing
'
,
type
=
int
)
type
=
int
)
parser
.
add_argument
(
'
--random
'
,
action
=
'
store_true
'
,
default
=
False
,
parser
.
add_argument
(
'
-n
'
,
'
--n_random
'
,
default
=
100
,
type
=
int
,
help
=
'
generate random sequences
'
)
help
=
'
n random sequences. Just used if input fasta file is not specified.
'
)
parser
.
add_argument
(
'
--n_random
'
,
default
=
100
,
type
=
int
,
help
=
'
n random sequences
'
)
parser
.
add_argument
(
'
-s
'
,
'
--chunk-size
'
,
default
=
10000
,
type
=
int
,
help
=
'
chunk_size for batch processing
'
)
parser
.
add_argument
(
'
--mean_random
'
,
default
=
50
,
type
=
int
,
help
=
'
mean random sequences
'
)
parser
.
add_argument
(
'
--sd_random
'
,
default
=
25
,
type
=
int
,
help
=
'
standard deviation random sequences
'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
def
main
():
def
main
():
LOG
.
info
(
"
Read sequencer started.
"
)
LOG
.
info
(
"
Read sequencer started.
"
)
read_sequencer
=
ReadSequencer
()
if
args
.
input
is
not
None
:
if
args
.
random
:
read_sequencer
=
ReadSequencer
(
fasta
=
args
.
input
,
output
=
args
.
output
,
read_length
=
args
.
read_length
,
chunk_size
=
args
.
chunk_size
)
read_sequencer
.
add_random
_sequences
(
n
=
args
.
n_random
,
mean
=
args
.
mean_random
,
sd
=
args
.
sd_random
)
read_sequencer
.
get_n
_sequences
()
else
:
else
:
read_sequencer
.
read_fasta
(
args
.
input_file_path
)
read_sequencer
=
ReadSequencer
(
fasta
=
args
.
input
,
output
=
args
.
output
,
read_length
=
args
.
read_length
,
chunk_size
=
args
.
chunk_size
)
read_sequencer
.
run_sequencing
(
args
.
read_length
)
read_sequencer
.
define_random_sequences
(
n
=
args
.
n_random
)
read_sequencer
.
write_fasta
(
args
.
output_file_path
)
read_sequencer
.
run_sequencing
()
LOG
.
info
(
"
Read sequencer finished.
"
)
LOG
.
info
(
"
Read sequencer finished.
"
)
if
__name__
==
'
__main__
'
:
if
__name__
==
'
__main__
'
:
logging
.
basicConfig
(
logging
.
basicConfig
(
format
=
'
[%(asctime)s: %(levelname)s] %(message)s (module
"
%(module)s
"
)
'
,
format
=
'
[%(asctime)s: %(levelname)s] %(message)s (module
"
%(module)s
"
)
'
,
...
...
This diff is collapsed.
Click to expand it.
read_sequencer_package/read_sequencer.py
+
0
−
3
View file @
f4f2c586
...
@@ -36,7 +36,6 @@ class ReadSequencer:
...
@@ -36,7 +36,6 @@ class ReadSequencer:
None
None
"""
"""
self
.
n_sequences
=
len
(
list
(
SeqIO
.
parse
(
self
.
fasta
,
'
fasta
'
)))
self
.
n_sequences
=
len
(
list
(
SeqIO
.
parse
(
self
.
fasta
,
'
fasta
'
)))
LOG
.
info
(
self
.
n_sequences
,
'
sequences found in
'
,
self
.
fasta
)
def
define_random_sequences
(
self
,
n
:
int
)
->
None
:
def
define_random_sequences
(
self
,
n
:
int
)
->
None
:
"""
"""
...
@@ -48,8 +47,6 @@ class ReadSequencer:
...
@@ -48,8 +47,6 @@ class ReadSequencer:
Returns:
Returns:
None
None
"""
"""
LOG
.
info
(
'
Set mode to: generate random sequences
'
)
LOG
.
info
(
'
N random sequences:
'
,
n
)
self
.
random
=
True
self
.
random
=
True
self
.
n_sequences
=
n
self
.
n_sequences
=
n
...
...
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