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
3
Merged
MihaelaZavolan
requested to merge
polyAtail
into
main
3 years ago
Overview
0
Commits
9
Pipelines
4
Changes
3
Expand
0
0
Merge request reports
Compare
main
version 3
5fe33163
3 years ago
version 2
f8873896
3 years ago
version 1
9f2d55a3
3 years ago
main (base)
and
version 1
latest version
b5b2471f
9 commits,
3 years ago
version 3
5fe33163
8 commits,
3 years ago
version 2
f8873896
7 commits,
3 years ago
version 1
9f2d55a3
6 commits,
3 years ago
3 files
+
94
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/mk_polyAtail.py
0 → 100644
+
62
−
0
Options
"""
Generate a poly(A) tail.
"""
import
random
as
rn
def
mk_polyA
(
length
=
100
,
a
=
0.914
,
c
=
0.028
,
g
=
0.025
,
u
=
0.033
):
"""
Generate a poly(A) tail of specified length and composition.
This function generates a nucleotide sequence
that has compositional statistics resembling
those of poly(A) tails.
Parameters
----------
length : int
Length of the desired tail
a : float
Frequency of
'
A
'
nucleotides in the tail
c : float
Frequency of
'
C
'
nucleotides in the tail
g : float
Frequency of
'
G
'
nucleotides in the tail
u : float
Frequency of
'
U
'
nucleotides in the tail
Returns
-------
string
The generated polyA tail
Raises
-------
ValueError
Provided length is not a positive int
ValueError
Provided length is too large (max allowed = 200)
ValueError
Provided proportions are not positive numbers
"""
max_len
=
200
# check parameters
length
=
int
(
length
)
a
=
float
(
a
)
c
=
float
(
c
)
g
=
float
(
g
)
u
=
float
(
u
)
if
length
<
0
:
raise
ValueError
(
f
'
{
length
}
is not a positive integer
'
)
if
length
>
200
:
raise
ValueError
(
f
'
{
length
}
is larger than the maximum
{
max_len
}
'
)
if
a
<
0
or
c
<
0
or
g
<
0
or
u
<
0
:
raise
ValueError
(
f
'
One of the base frequencies is negative
{
a
}
,
{
c
}
,
{
g
}
,
{
u
}
'
)
bases
=
[
'
A
'
,
'
C
'
,
'
G
'
,
'
U
'
]
weights
=
[
a
,
c
,
g
,
u
]
# ensure that the values are normalized
s
=
sum
(
weights
)
weights
=
[
w
/
s
for
w
in
weights
]
tail_bases
=
rn
.
choices
(
bases
,
weights
=
weights
,
k
=
length
)
return
""
.
join
(
tail_bases
)
Loading