Skip to content

Commit

Permalink
FDR improves results
Browse files Browse the repository at this point in the history
  • Loading branch information
banskt committed Jan 7, 2019
1 parent 11106e5 commit 2e5d774
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 26 deletions.
103 changes: 79 additions & 24 deletions analysis/jupyter/crosstissue_validation.ipynb

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions analysis/utils/load_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ def jpa(filepath):


def matrixeqtl(filepath):
res = dict()
with open(filepath, 'r') as mfile:
next(mfile)
for line in mfile:
arr = line.strip().split("\t")
rsid = arr[0]
pval = float(arr[4])
if rsid not in res:
res[rsid] = -np.log10(pval)
return res

def matrixeqtl_fdr(filepath):
res = dict()
with open(filepath, 'r') as mfile:
next(mfile)
Expand Down
4 changes: 2 additions & 2 deletions analysis/utils/precision_recall_scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ def confusion_matrix(result):

#tpr = np.array([x / pos if pos > 0 else 0 for x in tplist]) # TPR = Recall = TP / Positives
#fpr = np.array([x / neg if neg > 0 else 0 for x in fplist]) # FPR = FP / Negatives
#ppv = np.array([x[0] / sum(x) if sum(x) > 0 else 1 for x in zip(tplist, fplist)]) # PPV = Precision = TP / (TP + FP)
ppv = np.array([x[0] / sum(x) if sum(x) > 0 else 1 for x in zip(tplist, fplist)]) # PPV = Precision = TP / (TP + FP)
#fdr = np.array([x[1] / sum(x) if sum(x) > 0 else 0 for x in zip(tplist, fplist)]) # FDR = FP / (TP + FP)
tparr = np.array(tplist) # Number of true positives
nsel = np.array([sum(x) for x in zip(tplist, fplist)]) # Number of y selected at each threshold

#return fpr, tpr, ppv, nsel, fdr
return tparr, nsel
return tparr, nsel, ppv

0 comments on commit 2e5d774

Please sign in to comment.