Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Carlos GO
RNAmigos_GCN
Commits
433ea597
Commit
433ea597
authored
Jan 21, 2020
by
Carlos GO
Browse files
annotation scramble
parent
7ae793bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
data_processor/annot_scramble.py
0 → 100644
View file @
433ea597
"""
Swap the fingerprints around from an annotated folder.
"""
import
os
,
pickle
def
scramble_fingerprints
(
anot_dir
,
dump_dir
):
"""
Assign a fingerprint to each graph chosen at random from all other
fingerprints in annot_dir.
"""
datas
=
os
.
listdir
(
annot_dir
)
indices
=
range
(
len
(
datas
))
fps
=
[]
for
i
,
g
in
datas
:
g
,
tree
,
ring
,
fp
=
pickle
.
load
(
open
(
os
.
path
.
join
(
annot_dir
,
g
)))
fps
.
append
(
fp
)
for
i
,
g
in
datas
:
pickle
.
dump
((
g
,
tree
,
ring
,
fps
[
random
.
choice
(
indices
)]),
os
.
path
.
join
(
dump_dir
,
g
))
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment