forikiniks:# going through the chunk of 10 iks(perturbagens) from input file (see above)
v=inchikey_sigid[ik]# [several sigid]
neses=collections.defaultdict(list)# creates an empty list if the key doesn't exists
forsigidinv:# For every sig_id corresponding TO THIS PERTURBAGEN (ik)
filename=sigid
ifmethod=="predict":
filename=sigid+"---"+ik
withh5py.File("%s/%s.h5"%(connectivitydir,filename),"r")ashf:# recover the corresponding connectivity h5 file
nes=hf["nes"][:]# get the normalized connectivity scores for this sign
foriinrange(len(signatures)):# For all Touchstone signatures (many sign can refer to the same perturbagen)
neses[(sigid,siginfo[signatures[i]])]+=[nes[i]]# create neses dict as {(current sigid, pert_id):[norm_conn_scores of all signatures refering to pert_id]}
# Here neses correspond to all the signatures refering to our perturbagen's ik