Skip to content

Commit

Permalink
added timing to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kataikko committed Sep 12, 2023
1 parent 701c91b commit d3b6656
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 54 deletions.
12 changes: 9 additions & 3 deletions db/scripts/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import reader as rd
from uploader import catlas_extention, base_setup, bulk_extention
from utils import print_update
from utils import print_update, time_function
from querier import run_queries
import os
import pandas as pd
Expand All @@ -12,19 +12,21 @@
os.environ["_DEFAULT_CREDENTIALS_PATH"] = "../../config.yml"
os.environ["_DEV_MAX_REL"] = str(10000)
os.environ["_NEO4J_IMPORT_PATH"] = "/usr/local/bin/neo4j/import/"
os.environ["_FUNCTION_TIME_PATH"] = "../source/misc/function_times.tsv"
os.environ["_FUNCTION_TIME_PATH"] = "../source/timing/function_times.tsv"

os.environ["_TIME_FUNCTIONS"] = str(False)
os.environ["_TIME_FUNCTIONS"] = str(True)
os.environ["_SILENT"] = str(False)
os.environ["_PRODUCTION"] = str(True)
os.environ["_UPDATE_NEO4J"] = str(True)


@time_function
def read_experiment_files(genes_annotated_mouse):
data = rd.read(reformat=True, genes_annotated_mouse=genes_annotated_mouse, mode=0)
return data


@time_function
def read_string_files(
complete_mouse: pd.DataFrame,
proteins_mouse: pd.DataFrame,
Expand All @@ -41,21 +43,25 @@ def read_string_files(
return data


@time_function
def read_ensembl_files():
data = rd.read(mode=2)
return data


@time_function
def read_functional_files():
data = rd.read(mode=3)
return data


@time_function
def read_catlas_files(or_nodes: pd.DataFrame, distance: pd.DataFrame):
data = rd.read(or_nodes=or_nodes, distance=distance, mode=4)
return data


@time_function
def upload_workflow():
(
complete_mouse,
Expand Down
2 changes: 0 additions & 2 deletions db/scripts/read/read_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ def _reformat_ft_overlap_human(df: pd.DataFrame):


def _reformat_terms_mouse(df: pd.DataFrame):
df = df.drop(columns=["Unnamed: 0"])
return df


def _reformat_terms_human(df: pd.DataFrame):
df = df.drop(columns=["Unnamed: 0"])
return df
1 change: 0 additions & 1 deletion db/scripts/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from read.read_catlas import parse_catlas


@time_function
def read(
dir_path: str = None,
reformat: bool = True,
Expand Down
3 changes: 2 additions & 1 deletion db/scripts/upload/upload_catlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
import numpy as np
from neo4j import Driver
from upload.upload_experiment import create_correlation, create_context, create_motif
from utils import execute_query, print_update
from utils import execute_query, print_update, time_function

__CATLAS__STUDY = {"name": "Catlas, Whole Mouse Brain", "source": "catlas.org/wholemousebrain/"}


@time_function
def create_source(cell_info: pd.DataFrame, species: str, driver: Driver):
print_update(update_type="Node Creation", text="Study, (Sub-/Subsub-)Celltype and Source", color="blue")
_, nuclei_counts, celltype, subtype, subsubtype = (
Expand Down
47 changes: 0 additions & 47 deletions queries.txt

This file was deleted.

0 comments on commit d3b6656

Please sign in to comment.