Skip to content

Commit 3c8afc0

Browse files
authored
Merge pull request #25 from yamada-lab/develop
Develop
2 parents bd5f013 + 4b25b38 commit 3c8afc0

File tree

6 files changed

+56
-46
lines changed

6 files changed

+56
-46
lines changed

functree/analysis/__init__.py

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,30 +64,29 @@ def calc_abundances(df, nodes, method, results):
6464
df_dict = {}
6565
for node in nodes:
6666
entry_profile = None
67-
# Skip nodes which was already in df_out
68-
if node['entry'] in df_dict:
69-
continue
70-
71-
if 'children' not in node:
72-
try:
73-
# If node in abundace matrix, input as is
74-
entry_profile = df.loc[node['entry']]
75-
except KeyError:
76-
pass
77-
else:
78-
# get leaf ids of the current node
79-
targets = [child_node['entry'] for child_node in tree.get_nodes(node) if 'children' not in child_node]
80-
try:
81-
# loc is row names of data frame
82-
loc = df.loc[targets]
83-
# sample abundance for a biological entry
84-
# Calculated for children of nodes that are not in the input abundance matrix
85-
entry_profile = eval('loc.{}()'.format(method))
86-
except KeyError:
87-
pass
88-
# the entry on the tree is not in the submitted profile
89-
if entry_profile is not None:
90-
df_dict[node['entry']] = entry_profile.to_dict().values()
67+
# Compute value for nodes not in df_out
68+
if node['entry'] not in df_dict:
69+
# if leaf is reached
70+
if 'children' not in node:
71+
try:
72+
# If node in abundance matrix, input as is
73+
entry_profile = df.loc[node['entry']]
74+
except KeyError:
75+
pass
76+
else:
77+
# get leaf ids of the current node
78+
targets = [child_node['entry'] for child_node in tree.get_nodes(node) if 'children' not in child_node]
79+
try:
80+
# loc is row names of data frame
81+
loc = df.loc[targets]
82+
# sample abundance for a biological entry
83+
# Calculated for children of nodes that are not in the input abundance matrix
84+
entry_profile = eval('loc.{}()'.format(method))
85+
except KeyError:
86+
pass
87+
# the entry on the tree is not in the submitted profile
88+
if entry_profile is not None:
89+
df_dict[node['entry']] = entry_profile.to_dict().values()
9190

9291
df_out = pd.DataFrame.from_dict(df_dict, "index")
9392
if not df_out.empty:

functree/favicon.ico

1.12 KB
Binary file not shown.

functree/templates/about.html

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<div class="page-header">
77
<h2>{{title}}</h2>
88
<p>This is FuncTree 2 - version {{version}}</p>
9-
<p>FuncTree 2 is actively developed at the <a href="http://comp.bio.titech.ac.jp" target="_blank">Yamada Lab</a>, Tokyo Institute of Technology,
10-
by Youssef Darzi (<a href="https://github.com/omixer" target="_blank">@omixer</a>), Yuta Yamate (<a href="https://github.com/yyuuta88" target="_blank">@yyuuta88</a>),
9+
<p>FuncTree 2 is actively developed at the <a href="http://comp.bio.titech.ac.jp" target="_blank">Yamada Lab</a>, Tokyo Institute of Technology,
10+
by Youssef Darzi (<a href="https://github.com/omixer" target="_blank">@omixer</a>), Yuta Yamate (<a href="https://github.com/yutayamate" target="_blank">@yutayamate</a>),
1111
and Takuji Yamada.
1212
</p>
1313
<p>Source code is available on <a href="https://github.com/yamada-lab/functree-ng" target="_blank">github.com/yamada-lab/functree-ng</a></p>
@@ -18,22 +18,28 @@ <h3>Publications</h3>
1818
<i><a href="https://doi.org/10.1093/bioinformatics/btz245" target="_blank">FuncTree2: an interactive radial tree for functional hierarchies and omics data visualization</a></i>
1919
<br />
2020
Darzi Y, Yamate Y, Yamada T.
21-
<br />
21+
<br />
2222
Bioinformatics, btz245. 20 April 2019; <a href="https://doi.org/10.1093/bioinformatics/btz245" target="_blank">https://doi.org/10.1093/bioinformatics/btz245</a>
2323
</p>
24-
24+
2525
<p>
2626
<i><a href="http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0126967" target="_blank">FuncTree: Functional Analysis and Visualization for Large-Scale Omics Data</a></i>
2727
<br />
2828
Uchiyama T, Irie M, Mori H, Kurokawa K, Yamada T.
29-
<br />
29+
<br />
3030
PLoS ONE 10(5): e0126967. 2015 May 14; <a href="https://doi.org/10.1371/journal.pone.0126967" target="_blank">https://doi.org/10.1371/journal.pone.0126967</a>
3131
</p>
32-
32+
3333
</div>
3434
<hr />
3535
<h3>Change log</h3>
3636
<br />
37+
<h5>Version 0.8.4.0 (2021-03-18)</h5>
38+
<ul>
39+
<li>Fix layer mapping of custom tree upload.
40+
<li>Fix potential security vulnerabilities.
41+
<li>Update author info.
42+
</ul>
3743
<h5>Version 0.8.3.0 (2019-05-08)</h5>
3844
<ul>
3945
<li>Update citation.
@@ -68,7 +74,7 @@ <h5>Version 0.8.0.0 (2019-02-28)</h5>
6874
<li>Streamlining of the controls layout and the UI.
6975
<li>Bug fix: selection of leaf nodes with value > 0 only.
7076
</ul>
71-
<li>Addition of bar plots to "Module undefined" nodes to highlight the amount of pathway KO not assigned to a module.
77+
<li>Addition of bar plots to "Module undefined" nodes to highlight the amount of pathway KO not assigned to a module.
7278
</ul>
7379
<h5>Version 0.7.6.3 (2019-02-25)</h5>
7480
<ul>
@@ -79,27 +85,27 @@ <h5>Version 0.7.6.2 (2019-02-15)</h5>
7985
<li>Addition of a toggle action to show/hide node labels.
8086
<li>Addition of a description to the database selection.
8187
<li>Upgrade of Flask.
82-
</ul>
88+
</ul>
8389
<h5>Version 0.7.6.1 (2019-01-18)</h5>
8490
<ul>
8591
<li>Addition of a help section on the Functree explorer page, and improvement of the main documentation.
8692
</ul>
8793
<h5>Version 0.7.6 (2019-01-15)</h5>
8894
<ul>
8995
<li>Addition of a zoom control widget.
90-
<li>Replacement of D3 categorical20 color palette by the color blind friendly palette tableau10.
96+
<li>Replacement of D3 categorical20 color palette by the color blind friendly palette tableau10.
9197
</ul>
9298
<h5>Version 0.7.5 (2018-08-10)</h5>
9399
<ul>
94100
<li>Addition of an option to divide ortholog abundance by its incidence on each layer.
95101
</ul>
96102
<h5>Version 0.7.4 (2018-06-20)</h5>
97103
<ul>
98-
<li>Performance improvement: mapping time is reduced to around 15 seconds on dev machine using the example profile.tsv.
104+
<li>Performance improvement: mapping time is reduced to around 15 seconds on dev machine using the example profile.tsv.
99105
</ul>
100106
<h5>Version 0.7.3 (2018-06-19)</h5>
101107
<ul>
102-
<li>Performance improvement: mapping time is reduced from 3 minutes to 1 minute and 20 seconds. Module coverage computation time is lowered from 80 seconds to 5 seconds.
108+
<li>Performance improvement: mapping time is reduced from 3 minutes to 1 minute and 20 seconds. Module coverage computation time is lowered from 80 seconds to 5 seconds.
103109
</ul>
104110
</div>
105111
{% endblock %}

functree/tree.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def from_tsv(path, name):
136136
'''
137137
root = Node(entry=name, name=name, layer='root')
138138

139-
# process annoatation if available
139+
# process annotation if available
140140
entry_label = {}
141141
line = path.readline()
142142

@@ -149,8 +149,14 @@ def from_tsv(path, name):
149149
entry, label = line.split('\t')
150150
entry_label[entry] = label
151151
line = path.readline()
152+
# set header to current line
153+
header = line
154+
# if file has annotation
155+
if len(entry_label) > 0 :
156+
# read header from next line
157+
header = path.readline()
152158

153-
levels = path.readline().strip().decode().split('\t')
159+
levels = header.strip().decode().split('\t')
154160
levels.insert(0, 'root')
155161
nodes_layer = {key: {} for key in levels}
156162
nodes_layer['root'] = {'root': root}

package.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"name": "functree-ng",
3-
"description": "Visualization and analysis tool for omics data based on biological functional tree",
3+
"description": "FuncTree2: an interactive radial tree for functional hierarchies and omics data visualization",
44
"author": {
55
"name": "Yuta Yamate",
6-
"email": "yyamate@bio.titech.ac.jp",
7-
"url": "https://yyuuta88.github.io"
6+
"url": "https://github.com/yutayamate"
87
},
98
"repository": {
109
"type": "git",
@@ -15,7 +14,7 @@
1514
},
1615
"license": "MIT",
1716
"dependencies": {
18-
"axios": "^0.17.1",
17+
"axios": "^0.21.1",
1918
"bootstrap": "^3.3.7",
2019
"bootstrap-menu": "^1.0.14",
2120
"corejs-typeahead": "^1.2.1",
@@ -24,7 +23,7 @@
2423
"datatables.net-bs": "^1.10.19",
2524
"datatables.net-buttons": "^1.3.1",
2625
"font-awesome": "^4.7.0",
27-
"highcharts": "^8.2.0",
26+
"highcharts": "^9.0.1"
2827
"jquery": "^3.2.1",
2928
"particles.js": "^2.0.0",
3029
"vue": "^2.4.2",

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
blinker==1.4
22
cairocffi==0.8.0
3-
CairoSVG==2.0.3
3+
CairoSVG==2.5.1
44
cffi==1.10.0
55
click==6.7
66
cssselect==1.0.1
@@ -12,14 +12,14 @@ flask-mongoengine==0.9.3
1212
Flask-WTF==0.14.2
1313
itsdangerous==0.24
1414
Jinja2==2.10.1
15-
lxml==3.8.0
15+
lxml==4.6.2
1616
MarkupSafe==1.0
1717
mongoengine==0.13.0
1818
networkx==2.1
1919
numpy==1.13.1
2020
olefile==0.44
2121
pandas==0.20.3
22-
Pillow==4.2.1
22+
Pillow==7.1.0
2323
pycparser==2.18
2424
pymongo==3.4.0
2525
python-dateutil==2.6.1
@@ -30,5 +30,5 @@ setuptools-scm==1.15.6
3030
six==1.10.0
3131
tinycss==0.4
3232
uWSGI==2.0.15
33-
Werkzeug==0.12.2
33+
Werkzeug==0.15.3
3434
WTForms==2.1

0 commit comments

Comments
 (0)