Skip to content

Commit

Permalink
updated python API to include set_cat_color
Browse files Browse the repository at this point in the history
  • Loading branch information
cornhundred committed Jun 13, 2017
1 parent 73641b0 commit 2567330
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 8 deletions.
11 changes: 7 additions & 4 deletions clustergrammer_py/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class Network(object):
'''
version 1.13.3
version 1.13.5
Clustergrammer.py takes a matrix as input (either from a file of a Pandas DataFrame), normalizes/filters, hierarchically clusters, and produces the :ref:`visualization_json` for :ref:`clustergrammer_js`.
Expand Down Expand Up @@ -146,6 +146,9 @@ def df_to_dat(self, df, define_cat_colors=False):
data_formats.df_to_dat(self, df, define_cat_colors)

def set_cat_color(self, axis, cat_index, cat_name, inst_color):
'''
Set row/column category colors using index, name and specified color.
'''

if axis == 0:
axis = 'row'
Expand Down Expand Up @@ -302,12 +305,12 @@ def normalize(self, df=None, norm_type='zscore', axis='row', keep_orig=False):
'''
normalize_fun.run_norm(self, df, norm_type, axis, keep_orig)

def downsample(self, df=None, ds_type='kmeans', axis='row', num_samples=100):
def downsample(self, df=None, ds_type='kmeans', axis='row', num_samples=100, random_state=1000):
'''
Downsample the matrix rows or columns (currently supporting kmeans only). Users can optionally pass in a DataFrame to be downsampled (and this will be incorporated into the network object).
'''

return downsample_fun.main(self, df, ds_type, axis, num_samples)
return downsample_fun.main(self, df, ds_type, axis, num_samples, random_state)

def random_sample(self, num_samples, df=None, replace=False, weights=None, random_state=100, axis='row'):
'''
Expand Down Expand Up @@ -376,7 +379,7 @@ def Iframe_web_app(self, filename=None, width=1000, height=800):
def enrichrgram(self, lib, axis='row'):
'''
Add Enrichr gene enrichment results to your visualization (where your rows
are genes). Run enrichrgram before clustering to include enrichment results
are genes). Run enrichrgram before clustering to incldue enrichment results
as row categories. Enrichrgram can also be run on the front-end using the
Enrichr logo at the top left.
Expand Down
Binary file modified clustergrammer_py/__init__.pyc
Binary file not shown.
Binary file modified docs/_build_html/.doctrees/clustergrammer_py.doctree
Binary file not shown.
Binary file modified docs/_build_html/.doctrees/environment.pickle
Binary file not shown.
12 changes: 9 additions & 3 deletions docs/_build_html/clustergrammer_py.html
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t
<span class="target" id="module-clustergrammer_py"></span><dl class="class">
<dt id="clustergrammer_py.Network">
<em class="property">class </em><code class="descclassname">clustergrammer_py.</code><code class="descname">Network</code><span class="sig-paren">(</span><em>widget=None</em><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network" title="Permalink to this definition"></a></dt>
<dd><p>version 1.13.3</p>
<dd><p>version 1.13.5</p>
<p>Clustergrammer.py takes a matrix as input (either from a file of a Pandas DataFrame), normalizes/filters, hierarchically clusters, and produces the <a class="reference internal" href="clustergrammer_js.html#visualization-json"><span class="std std-ref">Visualization-JSON</span></a> for <a class="reference internal" href="clustergrammer_js.html#clustergrammer-js"><span class="std std-ref">Clustergrammer-JS</span></a>.</p>
<p>Networks have two states:</p>
<blockquote>
Expand Down Expand Up @@ -286,15 +286,15 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t

<dl class="method">
<dt id="clustergrammer_py.Network.downsample">
<code class="descname">downsample</code><span class="sig-paren">(</span><em>df=None</em>, <em>ds_type='kmeans'</em>, <em>axis='row'</em>, <em>num_samples=100</em><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network.downsample" title="Permalink to this definition"></a></dt>
<code class="descname">downsample</code><span class="sig-paren">(</span><em>df=None</em>, <em>ds_type='kmeans'</em>, <em>axis='row'</em>, <em>num_samples=100</em>, <em>random_state=1000</em><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network.downsample" title="Permalink to this definition"></a></dt>
<dd><p>Downsample the matrix rows or columns (currently supporting kmeans only). Users can optionally pass in a DataFrame to be downsampled (and this will be incorporated into the network object).</p>
</dd></dl>

<dl class="method">
<dt id="clustergrammer_py.Network.enrichrgram">
<code class="descname">enrichrgram</code><span class="sig-paren">(</span><em>lib</em>, <em>axis='row'</em><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network.enrichrgram" title="Permalink to this definition"></a></dt>
<dd><p>Add Enrichr gene enrichment results to your visualization (where your rows
are genes). Run enrichrgram before clustering to include enrichment results
are genes). Run enrichrgram before clustering to incldue enrichment results
as row categories. Enrichrgram can also be run on the front-end using the
Enrichr logo at the top left.</p>
<p>Set lib to the Enrichr library that you want to use for enrichment analysis.
Expand Down Expand Up @@ -444,6 +444,12 @@ <h2>Installation<a class="headerlink" href="#installation" title="Permalink to t
<dd><p>This re-initializes the Network object.</p>
</dd></dl>

<dl class="method">
<dt id="clustergrammer_py.Network.set_cat_color">
<code class="descname">set_cat_color</code><span class="sig-paren">(</span><em>axis</em>, <em>cat_index</em>, <em>cat_name</em>, <em>inst_color</em><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network.set_cat_color" title="Permalink to this definition"></a></dt>
<dd><p>Set row/column category colors using index, name and specified color.</p>
</dd></dl>

<dl class="method">
<dt id="clustergrammer_py.Network.swap_nan_for_zero">
<code class="descname">swap_nan_for_zero</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#clustergrammer_py.Network.swap_nan_for_zero" title="Permalink to this definition"></a></dt>
Expand Down
6 changes: 6 additions & 0 deletions docs/_build_html/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,12 @@ <h2 id="S">S</h2>
<table style="width: 100%" class="indextable genindextable"><tr>
<td style="width: 33%" valign="top"><dl>

<dt><a href="clustergrammer_py.html#clustergrammer_py.Network.set_cat_color">set_cat_color() (clustergrammer_py.Network method)</a>
</dt>

</dl></td>
<td style="width: 33%" valign="top"><dl>

<dt><a href="clustergrammer_py.html#clustergrammer_py.Network.swap_nan_for_zero">swap_nan_for_zero() (clustergrammer_py.Network method)</a>
</dt>

Expand Down
Binary file modified docs/_build_html/objects.inv
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/_build_html/searchindex.js

Large diffs are not rendered by default.

0 comments on commit 2567330

Please sign in to comment.