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
Roman Sarrazin-Gendron
RNABayesPairing
Commits
1716aa69
Commit
1716aa69
authored
Jun 23, 2019
by
Roman Sarrazin-Gendron
Browse files
finished update with textbook chapter release
parent
b06ef6f4
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
bayespairing/src/Rfam_to_module.py
View file @
1716aa69
...
...
@@ -24,7 +24,7 @@ def get_consensus(module_seqs):
consensus
.
append
([
x
/
tot
for
x
in
scores
])
return
consensus
def
rfam_to_module
(
positions
,
family_file
,
output_name
,
as_list
=
False
,
seqs
=
[]):
def
rfam_to_module
(
positions
=
[]
,
family_file
=
""
,
output_name
=
"module_seqs.fasta"
,
as_list
=
False
,
seqs
=
[]):
alph
=
[
"A"
,
"C"
,
"G"
,
"U"
]
...
...
@@ -43,6 +43,7 @@ def rfam_to_module(positions, family_file,output_name, as_list=False, seqs=[]):
if
str
(
s
[
col
])
!=
"-"
:
this_mod
=
this_mod
+
str
(
s
[
col
])
else
:
#print("CONSENSUS:", cons, "CURRENT COLUMN", col)
this_mod
=
this_mod
+
alph
[
choice
(
np
.
array
([
0
,
1
,
2
,
3
]),
p
=
cons
[
col
])]
fmodule_seqs
.
append
(
this_mod
)
...
...
bayespairing/src/find_rna3dmotif_modules.py
View file @
1716aa69
...
...
@@ -29,14 +29,39 @@ def number_of_strands(nodelist):
return
(
n_breaks
+
1
)
def
match_pos
(
input_pos
,
module_pos
):
if
len
(
input_pos
)
==
0
:
return
True
if
len
(
input_pos
)
==
0
:
return
True
for
i
in
input_pos
:
if
i
in
module_pos
:
return
True
return
False
def
get_carnaval_graph
(
file
):
n
=
[]
e
=
[]
with
open
(
file
)
as
f
:
g
=
nx
.
DiGraph
()
lines
=
f
.
readlines
()
for
line
in
lines
:
if
"+++"
in
line
:
continue
else
:
n1
,
nuc1
,
bp
,
n2
,
nuc2
=
line
.
replace
(
"
\n
"
,
""
).
split
(
" "
)
if
(
int
(
n1
),{
"nuc"
:
nuc1
})
not
in
n
:
n
.
append
((
int
(
n1
),{
"nuc"
:
nuc1
}))
if
(
int
(
n2
),{
"nuc"
:
nuc2
})
not
in
n
:
n
.
append
((
int
(
n2
),{
"nuc"
:
nuc2
}))
if
(
int
(
n1
),
int
(
n2
),{
"label"
:
bp
})
not
in
e
:
e
.
append
((
int
(
n1
),
int
(
n2
),{
"label"
:
bp
}))
n
=
sorted
(
n
)
e
=
sorted
(
e
)
g
.
add_nodes_from
(
n
)
g
.
add_edges_from
(
e
)
return
g
for
i
in
input_pos
:
if
i
in
module_pos
:
return
True
return
False
def
parse_dataset_for_modules
(
dataset
,
source_PDBs
,
n_strands
=-
1
,
bp
=
[
"None"
],
input_positions
=
[]):
modules_in_PDB
=
[]
full_ids
=
[]
...
...
bayespairing/test/Textbook_final.ipynb
0 → 100644
View file @
1716aa69
This diff is collapsed.
Click to expand it.
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