<jupyter_start><jupyter_text>Preparation  Slicing in nodes' names within networks<jupyter_code>import pandas as pd 

# read tables 
df_host = pd.read_table("COV19_hosts_more_0.7.txt", header=None)
df_human = pd.read_table("humanPPI_score_more_0.7.txt", header=None)

# slice strings
for i, row in df_host.iterrows():
    df_host.at[i,0] = row[0][14:20]
    df_host.at[i,1] = row[1][14:20]

for i, row in df_human.iterrows():
    df_human.at[i,0] = row[0][14:20]
    df_human.at[i,1] = row[1][14:20]
    
# set data types
df_host = df_host.astype(np.int)
df_human = df_human.astype(np.int)

import numpy as np

# export txts
np.savetxt(r'COV19_hosts_more_0.7_slice.txt', df_host.values, fmt='%d')
np.savetxt(r'humanPPI_score_more_0.7_slice.txt', df_human.values, fmt='%d')<jupyter_output><empty_output><jupyter_text>Analyse the diffusion result for nCoV19 host proteins vs human PPI(both confidence > 0.7)<jupyter_code>import pandas as pd
import numpy as np

# prepare data
df_DK_score = pd.read_csv('Cytoscape/humanPPI_vs_Host_DKernel_scores.csv', dtype = {'name':object,'SCORES':np.float32})[['name','SCORES']]

# set a list to store nodes in intervals with different scores
l_score = []
num_set = 10

for i in range(0,num_set):
    l_score.append(set())
    
# split max-min into intervals
interval = df_DK_score['SCORES'].max() - df_DK_score['SCORES'].min()
itv_list = [i*interval/num_set for i in range(1,num_set+1)]
import math
# iterate scores and feed the corresponding names into sets 
for (index, data) in df_DK_score.iterrows():
    val = math.floor(data['SCORES']/interval*num_set)
    # max value should be considered individually 
    if(val == num_set): val = num_set - 1
    l_score[val].add(str(data['name']))<jupyter_output><empty_output><jupyter_text>Visualize<jupyter_code># histogram for visualizing l_score
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter

fig, ax = plt.subplots(figsize=(10,4))
total = sum([len(l) for l in l_score])
# formatter
def percent(x, pos):
    return '%1.1f%%' % (x/total*100)
formatter = FuncFormatter(percent)

ax.yaxis.set_major_formatter(formatter)
rect = ax.bar([i*interval for i in range(1, num_set+1)],[len(l) for l in l_score])

def autolabel(rects):
    """Attach a text label above each bar in *rects*, displaying its height."""
    for rect in rects:
        height = rect.get_height()
        ax.annotate('{}'.format(height),
                    xy=(rect.get_x() + rect.get_width() / 2, height),
                    xytext=(0, 0.6),  # 1 points vertical offset
                    textcoords="offset points",
                    ha='center', va='bottom')
autolabel(rect)
      
plt.title('Diffusion result of nCoV19 host proteins on HumanPPI', pad = 20.0)
plt.ylabel('Percentage')
plt.xlabel('Score')
plt.savefig('img/Diffusion result of nCoV19 host proteins on HumanPPI.png',dpi = 200)
plt.show()<jupyter_output><empty_output><jupyter_text>Build the desease module To delimit the target module, there're serveral premises.1. nCoV19 host proteins(should have high scores in the diffusion algorithm as they're treated as the source) => need verification2. a criteria to distinguish possible drug targets from the humanPPI=> a score range   Verify host proteins(the observed module)<jupyter_code># read host proteins
hosts = []
with open('Cytoscape/nCoV_host_info.txt', 'r') as host_file:
    lines = host_file.readlines()

for l in lines:
    list_ = l.split(", ")

for i in list_:
    hosts.append(i)
# 

# iterate scores
for (index, data) in df_DK_score.iterrows():
    interval/num_set<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12843273231622745, 'fraction_numerical': 0.021359223300970873, 'mean_word_length': 4.590697674418605, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '267056', 'license': 'Apache-2.0', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1280, 'n_words': 321, 'path': 'src/test/java/resources/cov19/network_analysis.ipynb', 'repo_name': '164140757/Dynamic-Network-Algorithm', 'size': '3605'}