-
Notifications
You must be signed in to change notification settings - Fork 1
/
4-filterTFsByZScore.py
23 lines (18 loc) · 991 Bytes
/
4-filterTFsByZScore.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
zScoreOfTFxTissuePath = "../results/zScoreOfTFxTissue.tsv"
zScoreOfTFxTissueTopPath = "../results/zScoreOfTFxTissue-Top.tsv"
zScoreOfTFxTissueBottomPath = "../results/zScoreOfTFxTissue-Bottom.tsv"
tissueNames = ["adipose_tissue", "adrenal_gland", "brain", "breast", "colon",
"heart", "kidney", "leukocyte", "liver", "lung", "lymph_node", "ovary",
"prostate", "skeletal_muscle", "testis", "thyriod"]
zScoreDf = pd.read_csv(zScoreOfTFxTissuePath, sep='\t')
#top and bottom percentage to be taken:
percent = 0.05
zScoreTopQuantile = zScoreDf['zScore'].quantile(1.0-percent)
zScoreBottomQuantile = zScoreDf['zScore'].quantile(percent)
zScoreTop = zScoreDf[zScoreDf.zScore >= zScoreTopQuantile]
zScoreTop.to_csv(zScoreOfTFxTissueTopPath, sep="\t", index=False)
zScoreBottom = zScoreDf[zScoreDf.zScore <= zScoreBottomQuantile]
zScoreBottom.to_csv(zScoreOfTFxTissueBottomPath, sep="\t", index=False)