<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 I2D network
Step1:  9900 genes in the network. 4181 of those are always expressed.
<ASSISTANT_TASK:>
Python Code:
print aces_gene_names[:10]
alist = list(aces_gene_names[:10])
gn1 = 'Entrez_5982'
gn2 = 'Entrez_76'
print alist.index(gn1)
print alist.index(gn2)
aces_gene_names = list(aces_gene_names)
edges_set = set([]) # (gene_idx_1, gene_idx_2)
# gene_idx_1 < gene_idx_2
# idx in aces_gene_names, starting at 0
with open('ACES/experiments/data/I2D_edges_0411.sif') as f:
    for line in f:
        ls = line.split()
        gene_name_1 = 'Entrez_%s' % ls[0]
        gene_name_2 = 'Entrez_%s' % ls[2]
        # Exclude self edges
        if gene_name_1 == gene_name_2:
            continue 
        try:
            gene_idx_1 = aces_gene_names.index(gene_name_1)  
            gene_idx_2 = aces_gene_names.index(gene_name_2)
        except ValueError:
            continue
        if gene_idx_1 < gene_idx_2:
            e = (gene_idx_1, gene_idx_2)
        else:
            e = (gene_idx_2, gene_idx_1)
        edges_set.add(e)
    f.close()  
np.savetxt('I2D_edges.txt', np.array([list(x) for x in list(edges_set)]), fmt='%d')
len(edges_set)
edges_list = np.array(edges_list)
genes_in_network = set(np.array([list(x) for x in list(edges_set)]).flatten())
print len(genes_in_network)
len(set(np.where(np.sum(X_zeroed, axis=0)==0)[0]).intersection(genes_in_network))
Explanation: I2D network: 12 643 nodes, of which 10 018 are present in the data, and 142309 edges.
End of explanation
X_binary = np.where(X<-1, 0, 1)
float(np.count_nonzero(X_binary))/(X.shape[1]*X.shape[1])
np.count_nonzero(X_binary)
Explanation: 9900 genes in the network. 4181 of those are always expressed.
End of explanation
<END_TASK>