Goal

  • export clustered table
In [1]:
def modisco_table(modisco_dir, imp_scores, output_dir, report_url=None):
    """Write the pattern table to as .html and .csv
    """
In [8]:
from basepair.imports import *
/users/avsec/bin/anaconda3/envs/chipnexus/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.
In [14]:
model_dir = Path(f"{ddir}/processed/chipnexus/exp/models/oct-sox-nanog-klf/models/n_dil_layers=9/")
modisco_dir = model_dir / f"modisco/valid"
In [16]:
imp_scores = model_dir / 'grad.valid.h5'
In [127]:
from basepair.modisco.motif_clustering import hirearchically_reorder_table
In [17]:
from basepair.modisco.table import ModiscoData, modisco_table, write_modisco_table
print("Loading required data")
data = ModiscoData.load(modisco_dir, imp_scores)
print("Generating the table")
In [121]:
df_orig = modisco_table(data)
100%|██████████| 70/70 [02:47<00:00,  2.40s/it]
In [21]:
tasks = data.tasks
In [27]:
## Specify which features to exclude
# 1. needs to be numeric
In [134]:
dfr = hirearchically_reorder_table(df_orig, tasks)
In [117]:
output_dir = '/srv/www/kundaje/avsec/chipnexus/oct-sox-nanog-klf/models/n_dil_layers=9/modisco/valid'
In [118]:
report_url = 'http://mitra.stanford.edu/kundaje/avsec/chipnexus/oct-sox-nanog-klf/models/n_dil_layers=9/modisco/valid/results.html'
In [135]:
print("Writing the results")
write_modisco_table(dfr, output_dir, report_url, 'pattern_table.sorted')
print("Done!")
Writing the results
Done!
In [136]:
print("Writing the results")
write_modisco_table(df_orig, output_dir, report_url, 'pattern_table')
print("Done!")
Writing the results
Done!