Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scRNA-seq-simulation
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
pipelines
scRNA-seq-simulation
Merge requests
!19
Feature
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Feature
feature
into
main
Overview
0
Commits
4
Pipelines
1
Changes
5
Closed
Michele Garioni
requested to merge
feature
into
main
3 years ago
Overview
0
Commits
4
Pipelines
1
Changes
5
Expand
0
0
Merge request reports
Compare
main
main (base)
and
latest version
latest version
9de5ef24
4 commits,
3 years ago
5 files
+
153
−
2
Side-by-side
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
src/parameter_parser.py
0 → 100644
+
72
−
0
Options
"""
Module containing functionalities to store run parameters.
Class:
ParamParse: Take as input a file containing the parameters
and stores them in its attributes.
"""
import
logging
from
pathlib
import
Path
LOG
=
logging
.
getLogger
(
__name__
)
class
ParamParse
:
"""
Class holding the parameters of the run.
Args:
param_file: Path to file with parameter values.
Attributes:
param_file: File with parameter values.
transcripts_file: File with transcript abundances.
genome_ref_file: Reference genome file.
annotations_file: Transcripts annotations.
output_path: Output folder.
n_reads: Number of reads to be simulated.
n_cells: Number of cells to be simulated.
rna_avg_length: average RNA fragment length.
rna_sd_length: RNA fragment length standard deviation.
read_length: Read length.
intron_rate: Constant probability of retaining an intron.
add_poly_a: Boolean option to add a poly A tail.
poly_a_func: Function to add a poly_a tail.
primer_seq: Sequence of the primer.
priming_func: Function that evaluates internal priming.
"""
def
__init__
(
self
,
param_file
:
Path
)
->
None
:
"""
Class constructor.
"""
self
.
param_file
:
Path
=
Path
(
param_file
)
with
open
(
param_file
)
as
f
:
LOG
.
info
(
"
Loading parameters...
"
)
for
line
in
f
:
s
=
line
.
split
(
'
:
'
)
if
s
[
0
]
==
'
Csv transcripts file
'
:
self
.
transcripts_file
:
Path
=
Path
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Reference genome file
'
:
self
.
genome_ref_file
:
Path
=
Path
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Transcripts annotation file
'
:
self
.
annotations_file
:
Path
=
Path
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Output folder
'
:
self
.
output_path
:
Path
=
Path
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Number of reads
'
:
self
.
n_reads
:
int
=
int
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Number of cells
'
:
self
.
n_cells
:
int
=
int
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Average RNA fragments length
'
:
self
.
rna_avg
:
float
=
float
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
RNA fragment length standard deviation
'
:
self
.
rna_sd_length
:
float
=
float
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Reads length
'
:
self
.
read_length
:
int
=
int
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Intron retaining probability
'
:
self
.
intron_rate
:
float
=
float
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Add poly A tail
'
:
self
.
add_poly_a
:
bool
=
bool
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Function to add poly A tail
'
:
self
.
poly_a_func
:
str
=
str
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Primer sequence
'
:
self
.
primer_seq
:
str
=
str
(
s
[
1
].
strip
())
elif
s
[
0
]
==
'
Function to evaluate internal priming
'
:
self
.
priming_func
:
str
=
str
(
s
[
1
].
strip
())
LOG
.
info
(
"
Parameters loaded.
"
)
Loading