encoding="utf-8", delay=0) my_handler.setFormatter( logging.Formatter('%(asctime)s %(levelname)s %(message)s')) my_handler.setLevel(logging.INFO) logger = logging.getLogger("OKP") logger.setLevel(logging.INFO) logger.addHandler(my_handler) logger.info( "===================== Started a new session =====================") # Load the config file and start the connection config = configparser.ConfigParser() config.read('EKP/config.ini') # Set up the connection c = connection(config) #TODO: Filter implementeren voor indirect verbonden eiwitten # Load the drug targets by UNIPROT ID and RXNORM ID, keep only the ones which have more than 5 targets nature = open("EKP/Roche/Input/Nature_Targets.csv", "r") csv_reader = csv.reader(nature) next(csv_reader) target_dict = {} for l in csv_reader: if l[10] is not '' and l[4] is not '': try: protID = c.getID(l[4], "Amino Acid, Peptide, or Protein", knowledgebase="uniprot")['content'] if len(protID) == 1: if l[10] not in target_dict.keys():
# Load the connection from EKP.EKP2 import connection import os import csv import configparser import logging os.chdir('/Users/Wytze/git/ODEX4all-UseCases/EKP') logging.basicConfig(filename='logs/Roche.log',level=logging.DEBUG) logging.info("===================== Started a new session =====================") config = configparser.ConfigParser() config.read('config.ini') # Set up the connection c = connection(config) # Read in the targets of the drugs target_dict = {} input = open("Roche/drug_target_uniprot_links.csv", "r") reader = csv.reader(input, delimiter = ",") for line in reader: if line[0] not in target_dict.keys(): target_dict[line[0]] = [line[3]] else: target_dict[line[0]].append(line[3]) input.close() # Load the data input = open("Roche/DiseaseTarget_referenceSet.csv", "r") reader = csv.reader(input, delimiter = ";") reader.__next__()