Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# calc_CSP_metrics.py
# calculate Fmeasure, Precision, Recall for each apo/holo pair with CSP data
# determine binding residues using UCBShift predictions for holo form, spectra aligned to holo shifts
import sys
from os.path import basename
from util import *
from paths import *
from os.path import exists, isfile, isdir, join
from os import listdir
from tqdm import tqdm
data_source_file = './CSPRANK.csv'
method = "MONTE"
z_value = 0
def align_shifts_to_seq(aligned_sequence, sequence, shifts):
new_shifts = []
seq_index = 0
for i in range(len(aligned_sequence)):
if seq_index < len(sequence) and aligned_sequence[i] == sequence[seq_index]:
new_shifts.append(shifts[seq_index])
seq_index += 1
else:
new_shifts.append(-1)
return new_shifts
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python calc_CSP_RANK_for_directory.py <bound>")
sys.exit(1)
bound = sys.argv[1].lower()
directory = NMR_holo_structure_dir
if isdir(directory) == False or len(listdir(directory)) == 0:
print("Invalid directory")
sys.exit(1)
data = parse_csv(data_source_file)
apos = [str(data['apo_bmrb']) for data in data]
bounds = [data['holo_pdb'] for data in data]
if bound not in bounds:
print("Invalid bound")
sys.exit(1)
apo = apos[bounds.index(bound)]
holo = bound
pdb_files = [f for f in listdir(directory) if isfile(join(directory, f)) and f.endswith('.pdb') and f.find(holo) != -1]
# medoid = find_medoid_structure(pdb_files)
# medoid = medoid[medoid.rfind('/')+1:medoid.rfind('.')]
# basenames = [f[f.rfind('/')+1:f.rfind('.')] for f in listdir(directory)]
TP, FP, FN, TN = get_confusion(apo, holo, "MONTE", "UCBShift", "", "", structure_source = "NMR", basename=pdb_files)
F, MCC, consensus = get_F_MCC_cons(TP, FP, FN, TN)
print("F: ", F)
print("MCC: ", MCC)
print("consensus: ", consensus)