Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BiG-SCAPE
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
Container registry
Model registry
Operate
Environments
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
Gebretsadkan, Samuel
BiG-SCAPE
Commits
ef8b4451
Commit
ef8b4451
authored
7 years ago
by
Kautsar, Satria
Browse files
Options
Downloads
Patches
Plain Diff
Added placeholder (+dummy data) for bgc-family alignment information
parent
c7f60b2d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bigscape.py
+40
-0
40 additions, 0 deletions
bigscape.py
with
40 additions
and
0 deletions
bigscape.py
+
40
−
0
View file @
ef8b4451
...
...
@@ -1314,6 +1314,45 @@ def clusterJsonBatch(bgcs, outputFileBase,matrix,cutoffs=[1.0],damping=0.8,clust
bs_families
=
[{
"
id
"
:
"
FAM_{:03d}
"
.
format
(
family
),
'
members
'
:
members
,
}
for
family
,
members
in
familiesDictReIdxd
.
items
()]
## BGC Family alignment information
bs_families_alignment
=
[]
from
random
import
randint
# TODO: remove this when real data is implemented
def
make_random_tree
(
bgc_ids
):
# TODO: remove this when real data is implemented
if
len
(
bgc_ids
)
==
1
:
return
"
()
"
else
:
randtree
=
"
({}:0.5,{}:0.5)
"
.
format
(
bgc_ids
.
pop
(),
bgc_ids
.
pop
())
for
bgc_id
in
bgc_ids
:
if
(
randint
(
0
,
9
)
>
7
):
randtree
=
"
({}:0.5,
"
+
randtree
+
"
:0.5)
"
.
format
(
bgc_id
)
return
randtree
def
make_random_alignment
(
bgc_genes
,
ref_gene
):
aln
=
[]
selected_idx
=
bgc_genes
[
randint
(
0
,
len
(
bgc_genes
)
-
1
)]
for
bgc_gene
in
bgc_genes
:
if
bgc_gene
==
selected_idx
:
aln
.
append
([
ref_gene
,
100.00
])
else
:
aln
.
append
([
-
1
,
0.00
])
return
aln
for
fam_idx
,
bs_fam
in
enumerate
(
bs_families
):
assert
(
len
(
bs_fam
[
"
members
"
])
>
0
),
"
Error: bs_families[{}] have no members, something went wrong?
"
.
format
(
fam_idx
)
## TODO: please fill this with the real values
ref_bgc
=
bs_fam
[
"
members
"
][
randint
(
0
,
len
(
bs_fam
[
"
members
"
])
-
1
)]
newick_tree
=
make_random_tree
(
bs_fam
[
"
members
"
])
ref_genes
=
[
randint
(
0
,
len
(
bs_data
[
ref_bgc
][
"
orfs
"
])
-
1
)]
aln
=
make_random_alignment
([
gidx
for
gidx
in
xrange
(
0
,
len
(
bs_data
[
ref_bgc
][
"
orfs
"
]))],
ref_genes
[
0
])
### TODO: remove (TODO) comments when done
fam_alignment
=
{
"
id
"
:
bs_fam
[
"
id
"
],
"
ref
"
:
ref_bgc
,
"
newick
"
:
newick_tree
,
"
ref_genes
"
:
ref_genes
,
"
aln
"
:
aln
}
bs_families_alignment
.
append
(
fam_alignment
)
## End of BGC Family alignment information
# column1: BGC, column2: clustering pseudo family
if
verbose
:
print
(
"
Writing clustering file
"
)
...
...
@@ -1339,6 +1378,7 @@ def clusterJsonBatch(bgcs, outputFileBase,matrix,cutoffs=[1.0],damping=0.8,clust
with
open
(
os
.
path
.
join
(
result_html_path
,
"
bs_networks.js
"
),
"
w
"
)
as
bs_networks_js
:
bs_networks_js
.
write
(
"
var bs_similarity={};
\n
"
.
format
(
json
.
dumps
(
bs_distances
,
indent
=
4
,
separators
=
(
'
,
'
,
'
:
'
),
sort_keys
=
True
)))
bs_networks_js
.
write
(
"
var bs_families={};
\n
"
.
format
(
json
.
dumps
(
bs_families
,
indent
=
4
,
separators
=
(
'
,
'
,
'
:
'
),
sort_keys
=
True
)))
bs_networks_js
.
write
(
"
var bs_families_alignment={};
\n
"
.
format
(
json
.
dumps
(
bs_families_alignment
,
indent
=
4
,
separators
=
(
'
,
'
,
'
:
'
),
sort_keys
=
True
)))
if
len
(
clanLabels
)
>
0
:
bs_networks_js
.
write
(
"
var bs_clans={};
\n
"
.
format
(
json
.
dumps
(
bs_clans
,
indent
=
4
,
separators
=
(
'
,
'
,
'
:
'
),
sort_keys
=
True
)))
...
...
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