Skip to content

Commit

Permalink
Merge pull request #25 from yamada-lab/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
omixer authored Mar 18, 2021
2 parents bd5f013 + 4b25b38 commit 3c8afc0
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 46 deletions.
47 changes: 23 additions & 24 deletions functree/analysis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,30 +64,29 @@ def calc_abundances(df, nodes, method, results):
df_dict = {}
for node in nodes:
entry_profile = None
# Skip nodes which was already in df_out
if node['entry'] in df_dict:
continue

if 'children' not in node:
try:
# If node in abundace matrix, input as is
entry_profile = df.loc[node['entry']]
except KeyError:
pass
else:
# get leaf ids of the current node
targets = [child_node['entry'] for child_node in tree.get_nodes(node) if 'children' not in child_node]
try:
# loc is row names of data frame
loc = df.loc[targets]
# sample abundance for a biological entry
# Calculated for children of nodes that are not in the input abundance matrix
entry_profile = eval('loc.{}()'.format(method))
except KeyError:
pass
# the entry on the tree is not in the submitted profile
if entry_profile is not None:
df_dict[node['entry']] = entry_profile.to_dict().values()
# Compute value for nodes not in df_out
if node['entry'] not in df_dict:
# if leaf is reached
if 'children' not in node:
try:
# If node in abundance matrix, input as is
entry_profile = df.loc[node['entry']]
except KeyError:
pass
else:
# get leaf ids of the current node
targets = [child_node['entry'] for child_node in tree.get_nodes(node) if 'children' not in child_node]
try:
# loc is row names of data frame
loc = df.loc[targets]
# sample abundance for a biological entry
# Calculated for children of nodes that are not in the input abundance matrix
entry_profile = eval('loc.{}()'.format(method))
except KeyError:
pass
# the entry on the tree is not in the submitted profile
if entry_profile is not None:
df_dict[node['entry']] = entry_profile.to_dict().values()

df_out = pd.DataFrame.from_dict(df_dict, "index")
if not df_out.empty:
Expand Down
Binary file added functree/favicon.ico
Binary file not shown.
28 changes: 17 additions & 11 deletions functree/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<div class="page-header">
<h2>{{title}}</h2>
<p>This is FuncTree 2 - version {{version}}</p>
<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,
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>),
<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,
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>),
and Takuji Yamada.
</p>
<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>
Expand All @@ -18,22 +18,28 @@ <h3>Publications</h3>
<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>
<br />
Darzi Y, Yamate Y, Yamada T.
<br />
<br />
Bioinformatics, btz245. 20 April 2019; <a href="https://doi.org/10.1093/bioinformatics/btz245" target="_blank">https://doi.org/10.1093/bioinformatics/btz245</a>
</p>

<p>
<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>
<br />
Uchiyama T, Irie M, Mori H, Kurokawa K, Yamada T.
<br />
<br />
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>
</p>

</div>
<hr />
<h3>Change log</h3>
<br />
<h5>Version 0.8.4.0 (2021-03-18)</h5>
<ul>
<li>Fix layer mapping of custom tree upload.
<li>Fix potential security vulnerabilities.
<li>Update author info.
</ul>
<h5>Version 0.8.3.0 (2019-05-08)</h5>
<ul>
<li>Update citation.
Expand Down Expand Up @@ -68,7 +74,7 @@ <h5>Version 0.8.0.0 (2019-02-28)</h5>
<li>Streamlining of the controls layout and the UI.
<li>Bug fix: selection of leaf nodes with value > 0 only.
</ul>
<li>Addition of bar plots to "Module undefined" nodes to highlight the amount of pathway KO not assigned to a module.
<li>Addition of bar plots to "Module undefined" nodes to highlight the amount of pathway KO not assigned to a module.
</ul>
<h5>Version 0.7.6.3 (2019-02-25)</h5>
<ul>
Expand All @@ -79,27 +85,27 @@ <h5>Version 0.7.6.2 (2019-02-15)</h5>
<li>Addition of a toggle action to show/hide node labels.
<li>Addition of a description to the database selection.
<li>Upgrade of Flask.
</ul>
</ul>
<h5>Version 0.7.6.1 (2019-01-18)</h5>
<ul>
<li>Addition of a help section on the Functree explorer page, and improvement of the main documentation.
</ul>
<h5>Version 0.7.6 (2019-01-15)</h5>
<ul>
<li>Addition of a zoom control widget.
<li>Replacement of D3 categorical20 color palette by the color blind friendly palette tableau10.
<li>Replacement of D3 categorical20 color palette by the color blind friendly palette tableau10.
</ul>
<h5>Version 0.7.5 (2018-08-10)</h5>
<ul>
<li>Addition of an option to divide ortholog abundance by its incidence on each layer.
</ul>
<h5>Version 0.7.4 (2018-06-20)</h5>
<ul>
<li>Performance improvement: mapping time is reduced to around 15 seconds on dev machine using the example profile.tsv.
<li>Performance improvement: mapping time is reduced to around 15 seconds on dev machine using the example profile.tsv.
</ul>
<h5>Version 0.7.3 (2018-06-19)</h5>
<ul>
<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.
<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.
</ul>
</div>
{% endblock %}
10 changes: 8 additions & 2 deletions functree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def from_tsv(path, name):
'''
root = Node(entry=name, name=name, layer='root')

# process annoatation if available
# process annotation if available
entry_label = {}
line = path.readline()

Expand All @@ -149,8 +149,14 @@ def from_tsv(path, name):
entry, label = line.split('\t')
entry_label[entry] = label
line = path.readline()
# set header to current line
header = line
# if file has annotation
if len(entry_label) > 0 :
# read header from next line
header = path.readline()

levels = path.readline().strip().decode().split('\t')
levels = header.strip().decode().split('\t')
levels.insert(0, 'root')
nodes_layer = {key: {} for key in levels}
nodes_layer['root'] = {'root': root}
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "functree-ng",
"description": "Visualization and analysis tool for omics data based on biological functional tree",
"description": "FuncTree2: an interactive radial tree for functional hierarchies and omics data visualization",
"author": {
"name": "Yuta Yamate",
"email": "yyamate@bio.titech.ac.jp",
"url": "https://yyuuta88.github.io"
"url": "https://github.com/yutayamate"
},
"repository": {
"type": "git",
Expand All @@ -15,7 +14,7 @@
},
"license": "MIT",
"dependencies": {
"axios": "^0.17.1",
"axios": "^0.21.1",
"bootstrap": "^3.3.7",
"bootstrap-menu": "^1.0.14",
"corejs-typeahead": "^1.2.1",
Expand All @@ -24,7 +23,7 @@
"datatables.net-bs": "^1.10.19",
"datatables.net-buttons": "^1.3.1",
"font-awesome": "^4.7.0",
"highcharts": "^8.2.0",
"highcharts": "^9.0.1"
"jquery": "^3.2.1",
"particles.js": "^2.0.0",
"vue": "^2.4.2",
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
blinker==1.4
cairocffi==0.8.0
CairoSVG==2.0.3
CairoSVG==2.5.1
cffi==1.10.0
click==6.7
cssselect==1.0.1
Expand All @@ -12,14 +12,14 @@ flask-mongoengine==0.9.3
Flask-WTF==0.14.2
itsdangerous==0.24
Jinja2==2.10.1
lxml==3.8.0
lxml==4.6.2
MarkupSafe==1.0
mongoengine==0.13.0
networkx==2.1
numpy==1.13.1
olefile==0.44
pandas==0.20.3
Pillow==4.2.1
Pillow==7.1.0
pycparser==2.18
pymongo==3.4.0
python-dateutil==2.6.1
Expand All @@ -30,5 +30,5 @@ setuptools-scm==1.15.6
six==1.10.0
tinycss==0.4
uWSGI==2.0.15
Werkzeug==0.12.2
Werkzeug==0.15.3
WTForms==2.1

0 comments on commit 3c8afc0

Please sign in to comment.