Skip to content

Commit

Permalink
Renamed the tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Avani7 committed Jun 26, 2024
1 parent a448441 commit 3516165
Showing 1 changed file with 27 additions and 20 deletions.
47 changes: 27 additions & 20 deletions bin/cmi → bin/crgem
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,43 @@ import logging
import sys
import os

from cmi.stages.functional_analysis import functional_analysis
from cmi.stages.mechanistic_insights import mechanistic_insights
from cmi.stages.grn_inference import grn_inference
from cmi.stages.trrust_analysis import trrust_analysis
from cmi.stages.create_network import create_network
from cmi.stages.generate_hypothesis import generate_hypothesis
from crgem.stages.functional_analysis import functional_analysis
from crgem.stages.mechanistic_insights import mechanistic_insights
from crgem.stages.grn_inference import grn_inference
from crgem.stages.trrust_analysis import trrust_analysis
from crgem.stages.create_network import create_network
from crgem.stages.generate_hypothesis import generate_hypothesis

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
file_handler = logging.FileHandler('logs.log')
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
formatter = logging.Formatter(
'%(asctime)s - %(name)s - %(levelname)s - %(message)s')
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)


abs_path = os.path.dirname(__file__)
DEPS_PATH = f"{abs_path}/dependencies"


def run_all(artefacts_path, *args):
TERDATA = args[5]
TRRUST_DB_FILE = args[6] or "./data/trrust_rawdata_human.tsv"


mechanistic_insights(artefacts_path, *args)
grn_inference(artefacts_path=artefacts_path, ter_data=TERDATA)
trrust_analysis(TRRUST_DB_FILE, artefacts_path)
create_network(artefacts_path, artefacts_path + "/Trrust_Analysis/trrust_analysis.csv")
functional_analysis(artefacts_path,"/Trrust_Analysis/transsynw_genes.csv","/Trrust_Analysis/signet_genes.csv")

create_network(artefacts_path, artefacts_path +
"/Trrust_Analysis/trrust_analysis.csv")
functional_analysis(artefacts_path, "/Trrust_Analysis/transsynw_genes.csv",
"/Trrust_Analysis/signet_genes.csv")



def main():
stage_name = sys.argv[2]
artefacts_path = os.path.abspath(sys.argv[4])

if stage_name == "generate_hypothesis":
params = sys.argv[6:]
generate_hypothesis(artefacts_path, *params)
Expand All @@ -47,7 +49,8 @@ def main():
mechanistic_insights(artefacts_path, *params)
elif stage_name == "grn_inference":
TERDATA = sys.argv[6]
grn_inference(deps_root=DEPS_PATH, artefacts_path=artefacts_path, ter_data=TERDATA)
grn_inference(deps_root=DEPS_PATH,
artefacts_path=artefacts_path, ter_data=TERDATA)
elif stage_name == "trrust_analysis":
trrust_db_file = sys.argv[6]
trrust_analysis(trrust_db_file, artefacts_path)
Expand All @@ -57,13 +60,17 @@ def main():
elif stage_name == "functional_analysis":
transsynw_genes_file = sys.argv[5]
signet_genes_file = sys.argv[6]
functional_analysis(artefacts_path, transsynw_genes_file, signet_genes_file)

functional_analysis(
artefacts_path, transsynw_genes_file, signet_genes_file)

elif stage_name == "all":
run_all(artefacts_path, *sys.argv[6:])
else:
logger.warning("usage: run stage-name --artefacts <artefacts_path> --params [...params]")
logger.warning("available stages: transsynw, mechanistic_insights, grn_inference, trrust_analysis, generate_network, functional_analysis")
logger.warning(
"usage: run stage-name --artefacts <artefacts_path> --params [...params]")
logger.warning(
"available stages: transsynw, mechanistic_insights, grn_inference, trrust_analysis, generate_network, functional_analysis")
sys.exit(1)

main()

main()

0 comments on commit 3516165

Please sign in to comment.