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
!8
feat: function to generate poly(A) tail sequence
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
feat: function to generate poly(A) tail sequence
polyAtail
into
main
Overview
0
Commits
9
Pipelines
4
Changes
2
Merged
MihaelaZavolan
requested to merge
polyAtail
into
main
3 years ago
Overview
0
Commits
9
Pipelines
4
Changes
2
Expand
0
0
Merge request reports
Viewing commit
5fe33163
Prev
Next
Show latest version
2 files
+
17
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
5fe33163
refactor: readd lost type checks & tests
· 5fe33163
Alex Kanitz
authored
3 years ago
src/poly_a.py
+
15
−
5
Options
@@ -33,6 +33,10 @@ def generate_poly_a(
bases
:
Tuple
[
str
,
str
,
str
,
str
]
=
(
'
A
'
,
'
C
'
,
'
G
'
,
'
U
'
)
# check parameters
if
not
isinstance
(
length
,
int
):
raise
ValueError
(
f
"
The provided length is not an integer:
{
length
}
"
)
if
not
1
<=
int
(
length
)
<=
max_len
:
raise
ValueError
(
"
The provided length is outside of the accepted range
"
@@ -43,15 +47,21 @@ def generate_poly_a(
"
There is not a weight provided for each of the bases
'
{bases}
'
:
"
"
{weights}
"
)
if
any
(
freq
<
0
for
freq
in
weights
):
try
:
sum
(
weights
)
except
TypeError
:
raise
ValueError
(
"
At least one of the provided weights is not a number: {weights}
"
)
if
any
(
w
<
0
for
w
in
weights
):
raise
ValueError
(
"
At least one of the provided
'
weights
'
is negative: {weights}
"
"
At least one of the provided weights is negative: {weights}
"
)
if
all
(
n
==
0
for
n
in
weights
):
raise
ValueError
(
f
"
All
'
weights
'
are zero:
{
weights
}
"
)
if
all
(
w
==
0
for
w
in
weights
):
raise
ValueError
(
f
"
All weights are zero:
{
weights
}
"
)
# ensure that the values are normalized
s
:
float
=
sum
(
weights
)
s
:
float
=
float
(
sum
(
weights
)
)
norm_weights
:
List
[
float
]
=
[
freq
/
s
for
freq
in
weights
]
tail_bases
:
List
[
str
]
=
choices
(
bases
,
weights
=
norm_weights
,
k
=
length
)
return
""
.
join
(
tail_bases
)
Loading