# Filepaths and Hard-coded Defaults
proj_root = "/users/kcochran/projects/procap_models/"
sequence_path = proj_root + "genomes/GRCh38_no_alt_analysis_set_GCA_000001405.15.fasta"
chrom_sizes = proj_root + "genomes/hg38.chrom.sizes.withrRNA"
in_window = 2114
out_window = 1000
# stuff to get from config file
with open("2022-07-04_22-37-17_run1_modisco_config.txt") as config_f:
config_dict = {line.split()[0] : line.strip().split()[1] for line in config_f}
modisco_out_path = config_dict["modisco_out_path"]
scoring_type = config_dict["scoring_type"]
score_center_size = int(config_dict["score_center_size"])
profile_display_center_size = int(config_dict["profile_display_center_size"])
# digest what's in config file
assay_type, model_type, cell, accession, modisco_dir_base = modisco_out_path.split("/")[-5:]
ts_part1, ts_part2, run_str, _ = modisco_dir_base.split("_")
timestamp = ts_part1 + "_" + ts_part2
run = int(run_str.replace("run", ""))
print(modisco_out_path)
print("cell_type:", cell, accession)
print("timestamp:", timestamp)
print("run:", run)
print("scoring_type:", scoring_type)
print("score_center_size:", score_center_size)
print("profile_display_center_size:", profile_display_center_size)
/users/kcochran//projects/procap_models/modisco_out/procap/bpnetlite_basic_v2/HUVEC/ENCSR098LLB/2022-07-04_22-37-17_run1_modisco cell_type: HUVEC ENCSR098LLB timestamp: 2022-07-04_22-37-17 run: 1 scoring_type: counts score_center_size: 1000 profile_display_center_size: 400
data_dir = proj_root + "/data/procap/processed/" + cell + "/" + accession + "/"
plus_bw_path = data_dir + "final.5prime.pos.bigWig"
minus_bw_path = data_dir + "final.5prime.neg.bigWig"
val_peak_path = data_dir + "peaks_uni_and_bi_train_and_val.bed.gz"
val_save_dir = proj_root + "model_out/" + assay_type + "/" + model_type + "/" + cell + "/" + accession + "/"
val_save_path = val_save_dir + timestamp + "_run" + str(run) + "_train_and_val"
attr_save_path = val_save_dir.replace("model_out", "deepshap_out") + timestamp + "_run" + str(run) + "_deepshap"
if not modisco_out_path.endswith("/"):
modisco_out_path = modisco_out_path + "/"
# task-specific filepaths
import os
assert scoring_type in ["profile", "counts"], scoring_type
if scoring_type == "profile":
scores_path = attr_save_path + "_prof.npy"
onehot_scores_path = attr_save_path + "_prof_onehot.npy"
modisco_obj_path = modisco_out_path + "results_allChroms_prof_slice500.hdf5"
seqlet_path = modisco_out_path + "seqlets_prof.txt"
else:
scores_path = attr_save_path + "_count.npy"
onehot_scores_path = attr_save_path + "_count_onehot.npy"
modisco_obj_path = modisco_out_path + "results_allChroms_count_slice500.hdf5"
seqlet_path = modisco_out_path + "seqlets_count.txt"
assert(os.path.exists(scores_path)), scores_path
assert(os.path.exists(onehot_scores_path)), onehot_scores_path
# Imports, Plotting Defaults
import matplotlib.pyplot as plt
import matplotlib.font_manager as font_manager
plot_params = {
"figure.titlesize": 22,
"axes.titlesize": 22,
"axes.labelsize": 20,
"legend.fontsize": 18,
"xtick.labelsize": 16,
"ytick.labelsize": 16,
"font.weight": "bold"
}
plt.rcParams.update(plot_params)
from IPython.display import display
import tqdm
tqdm.tqdm_notebook()
import numpy as np
from view_modisco_results_utils import *
/users/kcochran/miniconda3/envs/procap/lib/python3.7/site-packages/ipykernel_launcher.py:19: TqdmDeprecationWarning: This function will be removed in tqdm==5.0.0 Please use `tqdm.notebook.tqdm` instead of `tqdm.tqdm_notebook`
# Load in True Profiles and Sequences
import sys
sys.path.append('../1_train_models')
from data_loading import extract_peaks
one_hot_seqs, true_profs = extract_peaks(sequence_path,
plus_bw_path, minus_bw_path, val_peak_path, in_window, out_window,
max_jitter=0, verbose=True)
one_hot_seqs = one_hot_seqs.swapaxes(1,2)
one_hot_seqs = one_hot_seqs[:, (in_window // 2 - score_center_size // 2):(in_window // 2 + score_center_size // 2), :]
Reading FASTA: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 24/24 [00:17<00:00, 1.40it/s] Loading Peaks: 25445it [00:43, 579.71it/s]
# Load in Coordinates of Examples
coords = load_coords(val_peak_path, in_window)
# Import SHAP scores, predicted profiles
hyp_scores = np.load(scores_path).swapaxes(1,2)
hyp_scores = hyp_scores[:, (in_window // 2 - score_center_size // 2):(in_window // 2 + score_center_size // 2), :]
pred_profs = np.exp(np.load(val_save_path + ".profs.npy"))
# Load modisco results object
tfm_obj = import_tfmodisco_results(modisco_obj_path, hyp_scores, one_hot_seqs)
motif_pfms, motif_hcwms, motif_cwms, \
motif_pfms_short, num_seqlets, \
motif_seqlets, num_metaclusters = plot_all_metaclusters(tfm_obj, one_hot_seqs, hyp_scores,
true_profs, pred_profs, coords,
in_window, out_window,
score_center_size,
profile_display_center_size)
11184 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
7775 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
4902 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
4560 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
3609 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2878 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2132 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
991 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
937 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
820 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
601 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
555 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
446 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
353 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
257 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
233 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
82 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
54 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
20 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
349 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
231 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
90 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
84 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
77 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
59 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
run_and_plot_tomtom(modisco_out_path, motif_pfms, motif_hcwms, motif_pfms_short, num_metaclusters)
The output directory '/users/kcochran//projects/procap_models/modisco_out/procap/bpnetlite_basic_v2/HUVEC/ENCSR098LLB/2022-07-04_22-37-17_run1_modisco/tomtom' already exists. Its contents will be overwritten. Processing query 1 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.984986 Processing query 2 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.969554 Processing query 3 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 4 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.957943 Processing query 5 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.99435 Processing query 6 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.985243 Processing query 7 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.979675 Processing query 8 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 9 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.955115 Processing query 10 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 11 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.950134 Processing query 12 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.966045 Processing query 13 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.988412 Processing query 14 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.981903 Processing query 15 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.950868 Processing query 16 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 17 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.945418 Processing query 18 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.955021 Processing query 19 out of 19 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.959405 Can't locate HtmlMonolithWr.pm: /root/lib/perl/HtmlMonolithWr.pm: Permission denied at /software/meme/4.11.2/bin/tomtom_xml_to_html line 48. Warning: tomtom_xml_to_html exited abnormally and may have failed to create HTML output.
Motif ID | q-val | PWM |
---|---|---|
MA0076.2-ELK4 | 1.7857e-07 | |
MA0750.2-ZBTB7A | 1.01936e-05 | |
MA0475.2-FLI1 | 1.13071e-05 | |
MA0916.1-Ets21C | 1.13071e-05 | |
MA0156.3-FEV | 1.68943e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA1513.1-KLF15 | 5.65064e-05 | |
MA0742.2-KLF12 | 8.64053e-05 | |
MA0516.3-SP2 | 0.000122849 | |
MA0685.2-SP4 | 0.000142343 | |
MA1892.1-Klf5-like | 0.000142343 |
Motif ID | q-val | PWM |
---|---|---|
MA0316.1-HAP5 | 5.86726e-05 | |
MA0060.3-NFYA | 7.64291e-05 | |
MA1644.1-NFYC | 7.64291e-05 | |
MA0314.2-HAP3 | 8.83181e-05 | |
MA0502.2-NFYB | 0.0178259 |
Motif ID | q-val | PWM |
---|---|---|
MA1475.1-CREB3L4 | 0.000888715 | |
MA1438.1-atf-7 | 0.00286329 | |
MA0609.2-CREM | 0.00295286 | |
MA1133.1-JUN::JUNB | 0.0033405 | |
MA0656.1-JDP2 | 0.0033405 |
Motif ID | q-val | PWM |
---|---|---|
MA0506.2-Nrf1 | 0.000251211 | |
MA1412.1-TSAR2 | 0.299908 | |
MA1560.1-SOHLH2 | 0.325827 | |
MA1826.1-bHLH145 | 0.325827 |
Motif ID | q-val | PWM |
---|---|---|
MA1988.1-Atf3 | 1.21457e-05 | |
MA0478.1-FOSL2 | 4.04053e-05 | |
MA0099.3-FOS::JUN | 4.95373e-05 | |
MA1141.1-FOS::JUND | 4.95373e-05 | |
MA1928.1-BNC2 | 4.95373e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA0748.2-YY2 | 6.7482e-05 | |
MA1818.1-Zm00001d052229 | 0.000118835 | |
MA0998.1-ERF096 | 0.000157267 | |
MA0975.1-CRF2 | 0.000736098 | |
MA0997.1-ERF069 | 0.00083562 |
Motif ID | q-val | PWM |
---|---|---|
MA0527.1-ZBTB33 | 3.74447e-07 |
Motif ID | q-val | PWM |
---|---|---|
MA1832.1-Zm00001d002364 | 1.32166e-07 | |
MA1821.1-Zm00001d020595 | 1.63262e-07 | |
MA1819.1-Zm00001d005892 | 1.63262e-07 | |
MA1820.1-Zm00001d024324 | 1.8367e-07 | |
MA1818.1-Zm00001d052229 | 5.28361e-07 |
Motif ID | q-val | PWM |
---|---|---|
MA1573.2-Thap11 | 1.04522e-07 | |
MA0088.2-ZNF143 | 0.0130015 | |
MA1716.1-ZNF76 | 0.0208681 | |
MA1625.1-Stat5b | 0.154017 | |
MA0519.1-Stat5a::Stat5b | 0.166683 |
Motif ID | q-val | PWM |
---|---|---|
MA1817.1-Zm00001d020267 | 4.17114e-05 | |
MA1820.1-Zm00001d024324 | 6.38324e-05 | |
MA1833.1-Zm00001d049364 | 0.000106007 | |
MA1819.1-Zm00001d005892 | 0.000112988 | |
MA2022.1-LOB | 0.000112988 |
Motif ID | q-val | PWM |
---|---|---|
MA0139.1-CTCF | 1.47799e-07 | |
MA1929.1-CTCF | 6.32899e-06 | |
MA1930.1-CTCF | 4.1091e-05 | |
MA1102.2-CTCFL | 4.7175e-05 | |
MA0531.1-CTCF | 5.11583e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA0375.1-RSC30 | 0.020898 | |
MA0506.2-Nrf1 | 0.127474 | |
MA0374.1-RSC3 | 0.127474 | |
MA1650.1-ZBTB14 | 0.127474 | |
MA0541.1-efl-1 | 0.127474 |
Motif ID | q-val | PWM |
---|---|---|
MA1069.2-TGA6 | 0.000352613 | |
MA1951.1-FOS | 0.000352613 | |
MA1070.2-TGA7 | 0.000352613 | |
MA1047.2-TGA5 | 0.000352613 | |
MA1632.1-ATF2 | 0.000352613 |
Motif ID | q-val | PWM |
---|---|---|
MA1819.1-Zm00001d005892 | 1.30155e-05 | |
MA1833.1-Zm00001d049364 | 1.30155e-05 | |
MA1820.1-Zm00001d024324 | 1.30155e-05 | |
MA1817.1-Zm00001d020267 | 1.47764e-05 | |
MA1832.1-Zm00001d002364 | 2.79525e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA1573.2-Thap11 | 6.16665e-05 | |
MA1687.1-ARF14 | 0.19124 |
Motif ID | q-val | PWM |
---|---|---|
MA1833.1-Zm00001d049364 | 0.000335276 | |
MA1818.1-Zm00001d052229 | 0.000335276 | |
MA1819.1-Zm00001d005892 | 0.000335276 | |
MA1820.1-Zm00001d024324 | 0.000506475 | |
MA0975.1-CRF2 | 0.000506475 |
Motif ID | q-val | PWM |
---|---|---|
MA1833.1-Zm00001d049364 | 4.16942e-07 | |
MA1819.1-Zm00001d005892 | 2.18877e-06 | |
MA2022.1-LOB | 3.08322e-06 | |
MA1817.1-Zm00001d020267 | 3.08322e-06 | |
MA1820.1-Zm00001d024324 | 3.73654e-06 |
Motif ID | q-val | PWM |
---|---|---|
MA0139.1-CTCF | 1.82298e-05 | |
MA1930.1-CTCF | 0.000925322 | |
MA1929.1-CTCF | 0.00280574 | |
MA1102.2-CTCFL | 0.00903296 | |
MA0123.1-abi4 | 0.0323935 |
The output directory '/users/kcochran//projects/procap_models/modisco_out/procap/bpnetlite_basic_v2/HUVEC/ENCSR098LLB/2022-07-04_22-37-17_run1_modisco/tomtom' already exists. Its contents will be overwritten. Processing query 1 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.954416 Processing query 2 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.944628 Processing query 3 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.935635 Processing query 4 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.940069 Processing query 5 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.937549 Processing query 6 out of 6 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.944628 Can't locate HtmlMonolithWr.pm: /root/lib/perl/HtmlMonolithWr.pm: Permission denied at /software/meme/4.11.2/bin/tomtom_xml_to_html line 48. Warning: tomtom_xml_to_html exited abnormally and may have failed to create HTML output.
Motif ID | q-val | PWM |
---|---|---|
MA1713.1-ZNF610 | 0.00156149 | |
MA1820.1-Zm00001d024324 | 0.00254291 | |
MA1817.1-Zm00001d020267 | 0.00254291 | |
MA1890.1-Klf15 | 0.00254291 | |
MA1880.1-Hey | 0.00254291 |
Motif ID | q-val | PWM |
---|---|---|
MA1820.1-Zm00001d024324 | 0.00149834 | |
MA1832.1-Zm00001d002364 | 0.00149834 | |
MA1821.1-Zm00001d020595 | 0.00149834 | |
MA1817.1-Zm00001d020267 | 0.00175702 | |
MA1818.1-Zm00001d052229 | 0.00190899 |
Motif ID | q-val | PWM |
---|---|---|
MA1819.1-Zm00001d005892 | 9.00232e-06 | |
MA1820.1-Zm00001d024324 | 1.17346e-05 | |
MA1817.1-Zm00001d020267 | 6.79602e-05 | |
MA1833.1-Zm00001d049364 | 6.79602e-05 | |
MA1410.1-StBRC1 | 8.52427e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA1713.1-ZNF610 | 0.00158906 | |
MA1833.1-Zm00001d049364 | 0.00158906 | |
MA1976.1-ZNF320 | 0.00171698 | |
MA1817.1-Zm00001d020267 | 0.00171698 | |
MA1820.1-Zm00001d024324 | 0.00171698 |
Motif ID | q-val | PWM |
---|---|---|
MA1833.1-Zm00001d049364 | 0.000866506 | |
MA1880.1-Hey | 0.000866506 | |
MA1819.1-Zm00001d005892 | 0.000866506 | |
MA1410.1-StBRC1 | 0.000866506 | |
MA1820.1-Zm00001d024324 | 0.000866506 |
Motif ID | q-val | PWM |
---|---|---|
MA1833.1-Zm00001d049364 | 0.0021638 | |
MA1820.1-Zm00001d024324 | 0.00534931 | |
MA1817.1-Zm00001d020267 | 0.00534931 | |
MA1832.1-Zm00001d002364 | 0.00534931 | |
MA1713.1-ZNF610 | 0.00534931 |