bernardo-de-almeida commited on
Commit
75576cf
·
1 Parent(s): 8ade038

add interpretation pipeline in home

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. assets/saliency_example.png +3 -0
  3. tabs/home.html +36 -1
.gitattributes CHANGED
@@ -44,3 +44,4 @@ notebooks_pipelines/bigwig_outputs/HepG2_DNAse.bw filter=lfs diff=lfs merge=lfs
44
  notebooks_pipelines/bigwig_outputs/HepG2_H3k4me3.bw filter=lfs diff=lfs merge=lfs -text
45
  notebooks_pipelines/bigwig_outputs/HepG2_RNA_seq.bw filter=lfs diff=lfs merge=lfs -text
46
  notebooks_pipelines/bigwig_outputs/K562_CTCF.bw filter=lfs diff=lfs merge=lfs -text
 
 
44
  notebooks_pipelines/bigwig_outputs/HepG2_H3k4me3.bw filter=lfs diff=lfs merge=lfs -text
45
  notebooks_pipelines/bigwig_outputs/HepG2_RNA_seq.bw filter=lfs diff=lfs merge=lfs -text
46
  notebooks_pipelines/bigwig_outputs/K562_CTCF.bw filter=lfs diff=lfs merge=lfs -text
47
+ assets/saliency_example.png filter=lfs diff=lfs merge=lfs -text
assets/saliency_example.png ADDED

Git LFS Details

  • SHA256: a94fb832ce06230e837f5692fcbca03604fbe79843fd140b212f96e223ae56e9
  • Pointer size: 130 Bytes
  • Size of remote file: 43.3 kB
tabs/home.html CHANGED
@@ -132,7 +132,42 @@ print(out.logits.shape) # (B, L, V = 11)
132
  </code></pre></div>
133
  <p>Model embeddings can be used for fine-tuning on downstream tasks.</p>
134
 
135
- <p style="margin-top: 40px;">TO DO: add pipeline for fine-tuning on functional tracks or genome annotation.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  </div>
137
 
138
  <div class="card">
 
132
  </code></pre></div>
133
  <p>Model embeddings can be used for fine-tuning on downstream tasks.</p>
134
 
135
+ <h2 style="margin-top: 40px;">🔍 Model interpretation</h2>
136
+ <p>Here is an example of how to use the interpretation pipeline for multi-scale analysis of DNA sequences:</p>
137
+ <div class="code"><pre><code class="language-python">from transformers import pipeline
138
+ import torch
139
+ import matplotlib.pyplot as plt
140
+
141
+ model_name = "InstaDeepAI/NTv3_650M_post"
142
+
143
+ # Build interpretation pipeline
144
+ ntv3_interpret = pipeline(
145
+ "ntv3-interpret",
146
+ model=model_name,
147
+ trust_remote_code=True,
148
+ device=0 if torch.cuda.is_available() else -1,
149
+ )
150
+
151
+ # Run interpretation on a given genomic region with tracks, annotations, attention, and saliency
152
+ result = ntv3_interpret(
153
+ {"chrom": "chr11", "start": 5_253_561, "end": 5_286_329, "species": "human"},
154
+ output_attention=True,
155
+ output_saliency=True,
156
+ saliency_track_id="ENCSR000EFT", # K562 GATA1 ChIP-seq
157
+ plot=True, # plot predictons on tracks and annotations
158
+ tracks_to_plot={"K562 RNA-seq": "ENCSR056HPM", "K562 GATA1": "ENCSR000EFT"},
159
+ elements_to_plot=["exon", "promoter_Tissue_specific"],
160
+ )
161
+
162
+ # Access attention map results
163
+ result.plot_attention() # attention map (last layer)
164
+ plt.show()
165
+
166
+ # Access saliency scores results
167
+ result.plot_saliency(window_size=128)
168
+ plt.show()
169
+ </code></pre></div>
170
+ <img src="assets/saliency_example.png" alt="Output tracks visualization" style="max-width: 100%; margin-top: 20px;" />
171
  </div>
172
 
173
  <div class="card">