<jupyter_start><jupyter_text>Load HumanNet Raw Data Source: http://www.functionalnet.org/humannet/HumanNet.v1.benchmark.txtDownloaded: August 12, 2016  No latest version date posted (last updated likely around 2011).  Citation: <NAME>, <NAME>, <NAME>, <NAME>, and <NAME>. MarcotteGenome Research 21(7):1109-21 (2011)<jupyter_code>wd = '/cellar/users/jkhuang/Data/Projects/Network_Analysis/Data/'
HumanNet_Raw = pd.read_csv(wd+'Network_Data_Raw/HumanNet.v1.join.txt',sep='\t',header=-1)
f = open(wd+'Network_Data_Raw/HumanNet.v1.evidence_code.txt')
HumanNet_headers = ['Gene 1', 'Gene 2']+[name.split(' = ')[0] for name in f.read().splitlines()[1:-1]]
HumanNet_Raw.columns = HumanNet_headers
# Extract gene list
HumanNet_Raw_Genes = list(set(HumanNet_Raw['Gene 1']).union(set(HumanNet_Raw['Gene 2'])))
HumanNet_Raw_Genes = [str(gene) for gene in HumanNet_Raw_Genes]
# Get edge list of network
query_edgelist = HumanNet_Raw[['Gene 1','Gene 2']].astype(str)
query_edgelist = pd.concat([query_edgelist, HumanNet_Raw['IntNet']], axis=1).values.tolist()
print len(query_edgelist), "HumanNet Edges"<jupyter_output>476399 HumanNet Edges<jupyter_text>Convert genes from Entrez ID to HUGO Symbol<jupyter_code>query_string, valid_genes, invalid_genes = gct.query_constructor(HumanNet_Raw_Genes)
# Set scopes (gene naming systems to search)
scopes = "entrezgene, retired"

# Set fields (systems from which to return gene names from)
fields = "symbol, entrezgene"

# Query MyGene.Info
match_list = gct.query_batch(query_string, scopes=scopes, fields=fields)
print len(match_list), 'Matched query results'
match_table_trim, query_to_symbol, query_to_entrez = gct.construct_query_map_table(match_list, valid_genes)<jupyter_output>Queries without full matching results found: 10

0 Queries with mutliple matches found

Query mapping table/dictionary construction complete: 19.62 seconds<jupyter_text>Construct Converted Network<jupyter_code>%%time
# Convert weighted edge list
HumanNet_edgelist_symbol = gct.convert_edgelist(query_edgelist, query_to_symbol, weighted=True)
# Filter converted edge list
HumanNet_edgelist_symbol_filt = gct.filter_converted_edgelist(HumanNet_edgelist_symbol, weighted=True)
# Write network to file
gct.write_edgelist(HumanNet_edgelist_symbol_filt, wd+'Network_SIFs_Symbol/HumanNet_Symbol.sif', binary=False)
# Create filtered network
HumanNet90_edgelist = dit.filter_weighted_network_sif(wd+'Network_SIFs_Symbol/HumanNet_Symbol.sif', nodeA_col=0, nodeB_col=1, score_col=2, 
                                                      q=0.9, delimiter='\t', verbose=True, save_path=wd+'Network_SIFs_Symbol/HumanNet90_Symbol.sif')<jupyter_output>90.0% score: 2.17047289928
47595 / 475959 edges retained
{'fraction_non_alphanumeric': 0.11148025101513473, 'fraction_numerical': 0.03137689184200812, 'mean_word_length': 6.970588235294118, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '251487', 'license': 'MIT', 'n_tokens_mistral': 1028, 'n_tokens_neox': 932, 'n_words': 189, 'path': 'Network Processing Notebooks/HumanNet Processing.ipynb', 'repo_name': 'jdtibochab/network_bisb', 'size': '2736'}