# 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_HUVEC_profile.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: profile 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_slice" + str(score_center_size) + ".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_slice" + str(score_center_size) + ".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:15<00:00, 1.52it/s] Loading Peaks: 25445it [00:45, 556.49it/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)
9901 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
4479 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
3971 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2831 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2460 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2191 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2095 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2093 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
2028 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
1227 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
1211 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
1113 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
918 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
689 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
433 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
401 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
375 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
367 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
360 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
335 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
333 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
314 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
309 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
241 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
198 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
125 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
96 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
86 seqlets
Sequence (PFM) | |
Hypothetical contributions (hCWM) | |
Actual contributions (CWM) |
69 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 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.973965 Processing query 2 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.989277 Processing query 3 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.972661 Processing query 4 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 5 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.985243 Processing query 6 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.964915 Processing query 7 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.985243 Processing query 8 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.960784 Processing query 9 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.958011 Processing query 10 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.977567 Processing query 11 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 12 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.999116 Processing query 13 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 14 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.989611 Processing query 15 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.975501 Processing query 16 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.980407 Processing query 17 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 18 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.956318 Processing query 19 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.960009 Processing query 20 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.970592 Processing query 21 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=1 Processing query 22 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.971892 Processing query 23 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.978896 Processing query 24 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.947774 Processing query 25 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.98139 Processing query 26 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.970343 Processing query 27 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.997575 Processing query 28 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.969506 Processing query 29 out of 29 Estimating pi_0 from all 3912 observed p-values. Estimating pi_0. Estimated pi_0=0.955411 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 |
---|---|---|
MA0079.5-SP1 | 0.0179999 | |
MA1511.2-KLF10 | 0.0179999 | |
MA0516.3-SP2 | 0.0179999 | |
MA0742.2-KLF12 | 0.0179999 | |
MA1818.1-Zm00001d052229 | 0.0210718 |
Motif ID | q-val | PWM |
---|---|---|
MA1713.1-ZNF610 | 0.165887 | |
MA0597.2-THAP1 | 0.209282 | |
MA1723.1-PRDM9 | 0.209282 | |
MA1845.1-Atoh7 | 0.209282 | |
MA0499.2-MYOD1 | 0.209282 |
Motif ID | q-val | PWM |
---|---|---|
MA1513.1-KLF15 | 5.504e-05 | |
MA0742.2-KLF12 | 9.66045e-05 | |
MA1511.2-KLF10 | 9.66045e-05 | |
MA0079.5-SP1 | 0.000103169 | |
MA0516.3-SP2 | 0.000103169 |
Motif ID | q-val | PWM |
---|---|---|
MA0316.1-HAP5 | 5.03169e-05 | |
MA0060.3-NFYA | 5.03169e-05 | |
MA1644.1-NFYC | 5.88697e-05 | |
MA0314.2-HAP3 | 0.00014079 | |
MA0502.2-NFYB | 0.0223246 |
Motif ID | q-val | PWM |
---|---|---|
MA1935.1-ERF::FOXI1 | 1.93011e-05 | |
MA0098.3-ETS1 | 1.93011e-05 | |
MA0760.1-ERF | 1.93011e-05 | |
MA0764.3-ETV4 | 1.93011e-05 | |
MA0026.1-Eip74EF | 2.59503e-05 |
Motif ID | q-val | PWM |
---|---|---|
MA1817.1-Zm00001d020267 | 4.60988e-08 | |
MA1257.1-ERF9 | 4.60988e-08 | |
MA1833.1-Zm00001d049364 | 5.88087e-08 | |
MA2022.1-LOB | 1.0499e-07 | |
MA1246.1-LEP | 1.58746e-07 |
Motif ID | q-val | PWM |
---|---|---|
MA1988.1-Atf3 | 3.14455e-05 | |
MA1928.1-BNC2 | 0.000141686 | |
MA0489.2-Jun | 0.000141686 | |
MA0099.3-FOS::JUN | 0.000316703 | |
MA1130.1-FOSL2::JUN | 0.000316703 |
Motif ID | q-val | PWM |
---|---|---|
MA1833.1-Zm00001d049364 | 3.88998e-09 | |
MA1817.1-Zm00001d020267 | 2.28587e-08 | |
MA2022.1-LOB | 6.67141e-08 | |
MA1239.1-ERF104 | 6.81281e-08 | |
MA1832.1-Zm00001d002364 | 9.00925e-08 |
Motif ID | q-val | PWM |
---|---|---|
MA1475.1-CREB3L4 | 0.000971961 | |
MA1438.1-atf-7 | 0.00133897 | |
MA0609.2-CREM | 0.00133897 | |
MA1346.1-TGA10 | 0.00249747 | |
MA1133.1-JUN::JUNB | 0.00249747 |
Motif ID | q-val | PWM |
---|---|---|
MA1513.1-KLF15 | 0.00624402 | |
MA1818.1-Zm00001d052229 | 0.0109094 | |
MA0742.2-KLF12 | 0.0120087 | |
MA0079.5-SP1 | 0.0120087 | |
MA1511.2-KLF10 | 0.0120087 |
Motif ID | q-val | PWM |
---|---|---|
MA0506.2-Nrf1 | 0.00103333 |
No TOMTOM matches passing threshold
No TOMTOM matches passing threshold
Motif ID | q-val | PWM |
---|---|---|
MA1933.1-ELK1::SREBF2 | 0.00459049 | |
MA0598.3-EHF | 0.00459049 | |
MA1992.1-Ikzf3 | 0.00459049 | |
MA0474.3-Erg | 0.00872299 | |
MA0473.3-ELF1 | 0.00872299 |
Motif ID | q-val | PWM |
---|---|---|
MA1653.1-ZNF148 | 0.00179359 | |
MA1961.1-PATZ1 | 0.00183855 | |
MA1513.1-KLF15 | 0.00256296 | |
MA1522.1-MAZ | 0.00256296 | |
MA1239.1-ERF104 | 0.00278492 |
Motif ID | q-val | PWM |
---|---|---|
MA1890.1-Klf15 | 8.73517e-08 | |
MA1892.1-Klf5-like | 5.32269e-06 | |
MA1893.1-Klf6-7-like | 5.32269e-06 | |
MA1713.1-ZNF610 | 0.00036614 | |
MA1833.1-Zm00001d049364 | 0.000554715 |
Motif ID | q-val | PWM |
---|---|---|
MA0527.1-ZBTB33 | 0.000121674 |
Motif ID | q-val | PWM |
---|---|---|
MA1820.1-Zm00001d024324 | 0.000234695 | |
MA0076.2-ELK4 | 0.000234695 | |
MA0098.3-ETS1 | 0.000234695 | |
MA0475.2-FLI1 | 0.000234695 | |
MA0760.1-ERF | 0.000234695 |
Motif ID | q-val | PWM |
---|---|---|
MA1892.1-Klf5-like | 0.00186518 | |
MA1890.1-Klf15 | 0.00186518 | |
MA1893.1-Klf6-7-like | 0.00186518 | |
MA1961.1-PATZ1 | 0.00186518 | |
MA1513.1-KLF15 | 0.00186518 |
Motif ID | q-val | PWM |
---|---|---|
MA1818.1-Zm00001d052229 | 2.57449e-05 | |
MA1817.1-Zm00001d020267 | 0.000134501 | |
MA1245.2-ERF112 | 0.000134501 | |
MA1832.1-Zm00001d002364 | 0.000134501 | |
MA1821.1-Zm00001d020595 | 0.000134501 |
Motif ID | q-val | PWM |
---|---|---|
MA1573.2-Thap11 | 1.17082e-07 | |
MA0088.2-ZNF143 | 0.0393721 | |
MA1716.1-ZNF76 | 0.0456636 | |
MA1625.1-Stat5b | 0.275256 | |
MA0525.2-TP63 | 0.385228 |
Motif ID | q-val | PWM |
---|---|---|
MA1053.1-ERF109 | 0.000152033 | |
MA0748.2-YY2 | 0.000202618 | |
MA0997.1-ERF069 | 0.000229399 | |
MA1754.1-ERF073 | 0.000247371 | |
MA1264.1-ERF095 | 0.000247371 |
Motif ID | q-val | PWM |
---|---|---|
MA1880.1-Hey | 0.000179673 | |
MA0506.2-Nrf1 | 0.000276918 | |
MA1826.1-bHLH145 | 0.000469291 | |
MA0375.1-RSC30 | 0.00064048 | |
MA1650.1-ZBTB14 | 0.00259778 |
Motif ID | q-val | PWM |
---|---|---|
MA1102.2-CTCFL | 0.000209235 | |
MA1513.1-KLF15 | 0.000209235 | |
MA0742.2-KLF12 | 0.00108533 | |
MA0746.2-SP3 | 0.00108533 | |
MA0747.1-SP8 | 0.00108533 |
Motif ID | q-val | PWM |
---|---|---|
MA1069.2-TGA6 | 0.000227323 | |
MA0492.1-JUND | 0.000227323 | |
MA0018.4-CREB1 | 0.000227323 | |
MA1632.1-ATF2 | 0.000227323 | |
MA0605.2-ATF3 | 0.000227323 |
Motif ID | q-val | PWM |
---|---|---|
MA1821.1-Zm00001d020595 | 0.000242533 | |
MA1832.1-Zm00001d002364 | 0.000242533 | |
MA1890.1-Klf15 | 0.000313621 | |
MA1818.1-Zm00001d052229 | 0.00105092 | |
MA1257.1-ERF9 | 0.00120743 |
Motif ID | q-val | PWM |
---|---|---|
MA1929.1-CTCF | 0.275864 | |
MA1815.1-GRF4 | 0.275864 | |
MA1713.1-ZNF610 | 0.275864 | |
MA1257.1-ERF9 | 0.420726 |
Motif ID | q-val | PWM |
---|---|---|
MA1880.1-Hey | 0.0245307 | |
MA0814.2-TFAP2C | 0.0245307 | |
MA1892.1-Klf5-like | 0.0245307 | |
MA1833.1-Zm00001d049364 | 0.0245307 | |
MA1893.1-Klf6-7-like | 0.0245307 |
Motif ID | q-val | PWM |
---|---|---|
MA0139.1-CTCF | 1.24114e-07 | |
MA1102.2-CTCFL | 5.88328e-06 | |
MA0531.1-CTCF | 0.000170905 | |
MA1929.1-CTCF | 0.00530384 | |
MA1930.1-CTCF | 0.0138183 |