bpnet icon indicating copy to clipboard operation
bpnet copied to clipboard

Viewing the hypothetical impscores

Open evanseitz opened this issue 3 years ago • 2 comments

I'm interested in viewing the hyp_impscores of the BPNet outputs, as seen in line 5, row 2 of this document.

First, I'm able to view the standard contribution scores using the dictionary produced via: viz_dict, seq, imp_scores = interval_predict(bpnet, ds, interval, tasks, smooth_obs_n=0, neg_rev=False, incl_pred=True)

E.g., via viz_dict['Nanog Imp profile'], which I understand to represent the absolute amount of the contribution score for task {task=Nanog} at the motif instance position — i.e., these are the "contribution of each base within the input sequence to the entire predicted ChiP nexus profile of the TF {task=Nanog} output by DeepLIFT"

As I understand, these are derived by taking the dot product of hyp_impscores with the given one-hot encoding. Is it true that imp_scores['Nanog/profile/wn'][0] (for this example) stores the hyp_impscores?

evanseitz avatar Apr 18 '22 21:04 evanseitz

In general, you can generate hypothetical contribution scores for a sequence using contrib_scoremethod on SeqModel as done here: https://github.com/kundajelab/bpnet/blob/master/bpnet/cli/contrib.py#L238-L241.

Throughout the codebase, 'imp' or 'contrib' refer to hyp_contrib * dna_sequence, where dna_sequence is one-hot encoded (as you correctly inferred).

For accessing hypothetical contribution scores of patterns produces by TF-MoDISco you can access the hyp_contrib values of the Pattern class https://github.com/kundajelab/bpnet/blob/master/bpnet/modisco/core.py#L42. You can also use pattern.plot(kind='hyp_contrib')method to visualize the hypothetical contributions of a pattern. A list of patterns from a modisco run can be obtained from ModiscoFile class (.patterns()) https://github.com/kundajelab/bpnet/blob/master/bpnet/modisco/files.py#L74.

Avsecz avatar May 07 '22 12:05 Avsecz

Thank you, this is very helpful information.

evanseitz avatar May 08 '22 16:05 evanseitz