Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Terminal fragment selector
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
Terminal fragment selector
Commits
b7bf68a1
Commit
b7bf68a1
authored
2 years ago
by
Hugo Madge Leon
Browse files
Options
Downloads
Patches
Plain Diff
First iteration of terminal fragment selector
parents
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
fragmentation.py
+37
-0
37 additions, 0 deletions
fragmentation.py
with
37 additions
and
0 deletions
fragmentation.py
0 → 100644
+
37
−
0
View file @
b7bf68a1
import
pandas
as
pd
import
random
import
numpy
as
np
dna_seq
=
{
"
ATAACATGTGGATGGCCAGTGGTCGGTTGTTACACGCCTACCGCGATGCTGAATGACCCGGACTAGAGTGGCGAAATTTATGGCGTGTGACCCGTTATGC
"
:
100
,
"
TCCATTTCGGTCAGTGGGTCATTGCTAGTAGTCGATTGCATTGCCATTCTCCGAGTGATTTAGCGTGACAGCCGCAGGGAACCCATAAAATGCAATCGTA
"
:
100
}
mean_length
=
12
std
=
1
term_frags
=
[]
for
seq
,
counts
in
dna_seq
.
items
():
for
_
in
range
(
counts
):
n_cuts
=
int
(
len
(
seq
)
/
mean_length
)
cuts
=
random
.
sample
(
range
(
1
,
len
(
seq
)
-
1
),
n_cuts
)
cuts
.
sort
()
cuts
.
insert
(
0
,
0
)
term_frag
=
""
for
i
,
val
in
enumerate
(
cuts
):
if
i
==
len
(
cuts
)
-
1
:
fragment
=
seq
[
val
:
cuts
[
-
1
]]
else
:
fragment
=
seq
[
val
:
cuts
[
i
+
1
]]
if
mean_length
-
std
<=
len
(
fragment
)
<=
mean_length
+
std
:
term_frag
=
fragment
if
term_frag
==
""
:
continue
else
:
term_frags
.
append
(
term_frag
)
with
open
(
'
terminal_frags.txt
'
,
'
w
'
)
as
f
:
for
line
in
term_frags
:
f
.
write
(
line
)
f
.
write
(
'
\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