aboutsummaryrefslogtreecommitdiff
path: root/wqflask/maintenance/quantile_normalize.py
diff options
context:
space:
mode:
authorBonfaceKilz2021-04-30 12:26:19 +0300
committerBonfaceKilz2021-04-30 13:45:15 +0300
commit406eb27859cca232a562c722cbbd37aca2e3be84 (patch)
treeba3fba783e33cc56c535b68bd64d757bc6cde608 /wqflask/maintenance/quantile_normalize.py
parentc7e661b8ff9f70955418fbc4527378904beb0cf4 (diff)
downloadgenenetwork2-406eb27859cca232a562c722cbbd37aca2e3be84.tar.gz
autopep8: Fix E301,E302,E303,E304,E305,E306
Diffstat (limited to 'wqflask/maintenance/quantile_normalize.py')
-rw-r--r--wqflask/maintenance/quantile_normalize.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/wqflask/maintenance/quantile_normalize.py b/wqflask/maintenance/quantile_normalize.py
index 6751a8e5..1896bc52 100644
--- a/wqflask/maintenance/quantile_normalize.py
+++ b/wqflask/maintenance/quantile_normalize.py
@@ -14,6 +14,7 @@ from wqflask import app
from utility.elasticsearch_tools import get_elasticsearch_connection
from utility.tools import ELASTICSEARCH_HOST, ELASTICSEARCH_PORT, SQL_URI
+
def parse_db_uri():
"""Converts a database URI to the db name, host name, user name, and password"""
@@ -28,6 +29,7 @@ def parse_db_uri():
print(db_conn_info)
return db_conn_info
+
def create_dataframe(input_file):
with open(input_file) as f:
ncols = len(f.readline().split("\t"))
@@ -36,6 +38,8 @@ def create_dataframe(input_file):
return pd.DataFrame(input_array)
# This function taken from https://github.com/ShawnLYU/Quantile_Normalize
+
+
def quantileNormalize(df_input):
df = df_input.copy()
# compute rank
@@ -50,6 +54,7 @@ def quantileNormalize(df_input):
df[col] = [rank[i] for i in t]
return df
+
def set_data(dataset_name):
orig_file = "/home/zas1024/cfw_data/" + dataset_name + ".txt"
@@ -95,6 +100,7 @@ def set_data(dataset_name):
}
}
+
if __name__ == '__main__':
Conn = MySQLdb.Connect(**parse_db_uri())
Cursor = Conn.cursor()