Exemplo n.º 1
0
import random
import sys, os

from torch import rand

sys.path.append(os.path.realpath('.'))

from src.generate_edgelist import read_interaction_dataset, write_interaction_database_reduced

if __name__ == "__main__":
    interaction_dataset_path = 'data/source_database_data/NPInter2.xlsx'
    interaction_list, negative_interaction_list,lncRNA_list, protein_list, lncRNA_name_index_dict, protein_name_index_dict, set_interactionKey, \
        set_negativeInteractionKey = read_interaction_dataset(dataset_path=interaction_dataset_path, dataset_name='NPInter2')

    list_interaction_NPInter2_20persent_pureRandom = random.sample(
        interaction_list, int(len(interaction_list) * 0.2))

    write_interaction_database_reduced(
        r'data\source_database_data\NPInter2_pureRandom_0.20',
        list_interaction_NPInter2_20persent_pureRandom, [])
Exemplo n.º 2
0
    if TP == 1 and FN == 0:
        return True
    elif FN == 1 and TP == 0:
        return False
    else:
        raise Exception('there should be only one data')



if __name__ == "__main__":
    time_start = time.time()
    args = parse_args()

    interaction_dataset_path = 'data/source_database_data/'+ args.interactionDatasetName + '.xlsx'
    interaction_list, negative_interaction_list,lncRNA_list, protein_list, lncRNA_name_index_dict, protein_name_index_dict, set_interactionKey, \
        set_negativeInteractionKey = read_interaction_dataset(dataset_path=interaction_dataset_path, dataset_name=args.interactionDatasetName)
    
    # 读入mutual interaction的键集合
    if args.interactionDatasetName == 'NPInter2':
        path_set_interactionKey_mutual = r'data\NPInter2_RPI2241_mutual_interaction\interactionKey_NPInter2_mutual'
    elif args.interactionDatasetName == 'RPI2241':
        path_set_interactionKey_mutual = r'data\NPInter2_RPI2241_mutual_interaction\interactionKey_RPI2241_mutual'
    else:
        raise Exception('必须是RPI2241或者NPInter2其中之一')
    set_interactionKey_mutual = read_set_interactionKey(path_set_interactionKey_mutual)

    # 从set_interactionKey里面删去读入的NPInter2和RPI2241共有的相互作用
    for interactionKey in set_interactionKey_mutual:
        set_interactionKey.remove(interactionKey)