cell2net.interpretation.seq_attr#
- cell2net.interpretation.seq_attr(model, peaks=None, idx=None, batch_size=4, num_workers=1, shuffle_n=50, rna_mod='rna', atac_mod='atac', multiply_by_inputs=True)#
Computes sequence attribution scores using the DeepLift algorithm for a given model
This function takes a trained Cell2Net model and computes attribution scores for input sequences using the DeepLift method. It generates shuffled baselines for comparison and averages the attributions over multiple shuffles.
- Parameters:
model (
Cell2Net) – The trained model containing the sequence and other input features.peaks (
int|str|Sequence[int] |Sequence[str] |None(default:None)) – Peaks used to compute attribution. This can be a single peak index, a list of peak indices, a single peak name, or a list of peak names. If None, all peaks are used.idx (
Sequence[int] |Sequence[str] |None(default:None)) – Indices of the samples to compute attribution for. If None, all samples are used.batch_size (
int(default:4)) – The number of samples per batch in the DataLoader.num_workers (
int(default:1)) – The number of worker threads for data loading.shuffle_n (
int(default:50)) – The number of times to shuffle the dinucleotide sequences for baseline attribution.
- Return type:
- Returns:
A NumPy array of shape (n_cells, num_peaks, 4, peak_length), representing the attribution scores for each base in the input sequences.