Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2024 10 23 bug changes #23

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion moalmanac/annotation-databases.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[databases]
[paths]
root = ../datasources
almanac_handle = ${root}/moalmanac/molecular-oncology-almanac.json
cancerhotspots_handle = ${root}/cancerhotspots/hotspots_v2.txt
Expand Down
4 changes: 3 additions & 1 deletion moalmanac/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ include_model_similarity_in_actionability_report = on
include_preclinical_efficacy_in_actionability_report = on

[logging]
; Possible values for level include "NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", and "CRITICAL". They are described
; within the logging module's document: https://docs.python.org/3/library/logging.html#logging-levels.
level = INFO

[versions]
interpreter = 0.7.1
interpreter = 0.7.2
database = v.2024-04-11

[exac]
Expand Down
2 changes: 2 additions & 0 deletions moalmanac/logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import logging


class Logger:
@staticmethod
def generate_filename(folder, label):
Expand All @@ -16,6 +17,7 @@ def setup(cls, output_folder, file_prefix, config):
level=config['logging']['level']
)


class Messages:
@staticmethod
def dataframe_size(label, dataframe, add_line_break=False):
Expand Down
15 changes: 6 additions & 9 deletions moalmanac/moalmanac.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def somatic_variants(df, dbs, ontology, config, path_validation):
logger.Messages.general(message="No passed validation sequencing variants to annotate with")
else:
logger.Messages.general(message="No somatic variants detected. Skipping annotation and evaluation.")
evaluated= features.Features.create_empty_dataframe()
evaluated = features.Features.create_empty_dataframe()
logger.Messages.general(message="Annotation and evaluation of somatic variants complete", add_line_break=True)
return evaluated

Expand Down Expand Up @@ -706,8 +706,6 @@ def main(patient, inputs, output_folder, config, dbs, dbs_preclinical=None):


if __name__ == "__main__":
start_time = time.time()

arg_parser = argparse.ArgumentParser(
prog='Molecular Oncology Almanac',
description='A clinical interpretation algorithm for cancer genomics.'
Expand Down Expand Up @@ -854,8 +852,11 @@ def main(patient, inputs, output_folder, config, dbs, dbs_preclinical=None):
config_ini = Ini.read(args.config, extended_interpolation=False, convert_to_dictionary=False)

db_paths = Ini.read(args.dbs, extended_interpolation=True, convert_to_dictionary=True)
db_paths = db_paths['paths']

if args.preclinical_dbs:
preclinical_db_paths = Ini.read(args.preclinical_dbs, extended_interpolation=True, convert_to_dictionary=True)
preclinical_db_paths = preclinical_db_paths['paths']
else:
preclinical_db_paths = None

Expand All @@ -865,10 +866,6 @@ def main(patient, inputs, output_folder, config, dbs, dbs_preclinical=None):
inputs=inputs_dict,
output_folder=output_directory,
config=config_ini,
dbs=db_paths['databases'],
dbs_preclinical=preclinical_db_paths['preclinical']
dbs=db_paths,
dbs_preclinical=preclinical_db_paths
)

end_time = time.time()
time_statement = "Molecular Oncology Almanac runtime: %s seconds" % round((end_time - start_time), 4)
print(time_statement)
2 changes: 1 addition & 1 deletion moalmanac/preclinical-databases.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[preclinical]
[paths]
root = ../datasources
almanac_gdsc_mappings = ${root}/preclinical/formatted/almanac-gdsc-mappings.json
summary = ${root}/preclinical/formatted/cell-lines.summary.txt
Expand Down
13 changes: 8 additions & 5 deletions moalmanac/run_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,15 @@
}

config_ini_path = "config.ini"
dbs_ini_path = "annotation-databases.ini"
dbs_preclinical_ini_path = "preclinical-databases.ini"

config_ini = Ini.read(config_ini_path, extended_interpolation=False, convert_to_dictionary=False)

dbs_ini_path = "annotation-databases.ini"
db_paths = Ini.read(dbs_ini_path, extended_interpolation=True, convert_to_dictionary=True)
db_paths = db_paths['paths']

dbs_preclinical_ini_path = "preclinical-databases.ini"
preclinical_db_paths = Ini.read(dbs_preclinical_ini_path, extended_interpolation=True, convert_to_dictionary=True)
preclinical_db_paths = preclinical_db_paths['paths']


def execute_cmd(command):
Expand All @@ -71,8 +74,8 @@ def execute_cmd(command):
inputs=input_dictionary,
output_folder=output_directory,
config=config_ini,
dbs=db_paths['databases'],
dbs_preclinical=preclinical_db_paths['preclinical']
dbs=db_paths,
dbs_preclinical=preclinical_db_paths
)
end_time = time.time()

Expand Down
4 changes: 2 additions & 2 deletions moalmanac/simplified_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ def main(patient, input_file, output_folder, config, dbs, dbs_preclinical=None):
input_file=args.input,
output_folder=output_directory,
config=config_ini,
dbs=db_paths,
dbs_preclinical=preclinical_db_paths
dbs=db_paths['databases'],
dbs_preclinical=preclinical_db_paths['preclinical'] if preclinical_db_paths else None
)

end_time = time.time()
Expand Down