172e1c71ff73c351b195c47ea6a89a24cc83e259,dragonn/interpret/ism.py,,in_silico_mutagenesis,#,10

Before Change


    mutants_expanded=np.zeros(output_dim)
    empty_onehot=np.zeros(output_dim[3])
    if start_pos is None:
        start_pos=0
    if end_pos is None:
        end_pos=output_dim[2] 

    /Ǚ. Iterate through all tasks, positions
    for sample_index in range(output_dim[0]):
        print("ISM: task:"+str(task_index)+" sample:"+str(sample_index))
        //fill in wild type logit values into an array of dim (task,sequence_length,num_bases)
        wt_logit_for_task_sample=wild_type_logits[sample_index]
        wt_expanded[sample_index]=np.tile(wt_logit_for_task_sample,(output_dim[2],output_dim[3]))
        //mutagenize each position
        temp_batch = []
        tempbatch_baseposandletter = []
        for base_pos in range(start_pos,end_pos):
            //for each position, iterate through the 4 bases
            for base_letter in range(output_dim[3]):
                cur_base=np.array(empty_onehot)
                cur_base[base_letter]=1
                Xtmp=np.array(X[sample_index])
                Xtmp[0][base_pos]=cur_base
                temp_batch.append(Xtmp)
                tempbatch_baseposandletter.append((base_pos, base_letter))
        //get the logits of the batch
        batch_logits = preact_function([temp_batch]) 
        for logit,(base_pos, base_letter) in zip(batch_logits, tempbatch_baseposandletter):
            mutants_expanded[sample_index][0][base_pos][base_letter]=logit

After Change


            for base_letter in range(output_dim[3]):
                cur_base=np.array(empty_onehot)
                cur_base[base_letter]=1
                Xtmp=np.array(np.expand_dims(X[sample_index],axis=0))
                Xtmp[0][0][base_pos]=cur_base
                //get the logit of Xtmp
                Xtmp_logit=np.squeeze(preact_function(Xtmp),axis=0)
                mutants_expanded[sample_index][0][base_pos][base_letter]=Xtmp_logit[task_index]
    //subtract wt_expanded from mutants_expanded
    ism_vals=mutants_expanded-wt_expanded
    //For each position subtract the mean ISM score for that position from each of the 4 values
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: kundajelab/dragonn
Commit Name: 172e1c71ff73c351b195c47ea6a89a24cc83e259
Time: 2019-07-10
Author: annashcherbina@gmail.com
File Name: dragonn/interpret/ism.py
Class Name:
Method Name: in_silico_mutagenesis


Project Name: scikit-learn-contrib/DESlib
Commit Name: f7a04171e58eb43dfe5b18d06c76481cdf1c5da9
Time: 2018-03-29
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/lca.py
Class Name: LCA
Method Name: estimate_competence


Project Name: scikit-learn-contrib/DESlib
Commit Name: f0c15f219b0761b14329ddd416cda82fa4bae841
Time: 2018-03-28
Author: rafaelmenelau@gmail.com
File Name: deslib/dcs/mcb.py
Class Name: MCB
Method Name: estimate_competence