Skip to content

Commit

Permalink
Initial wip for pepkit/looper#82
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldcampbelljr committed Jan 11, 2024
1 parent b53976f commit fbf20a2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pipestat/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,17 @@ def create_index_html(self, navbar, footer):
)

project_objects = self.create_project_objects()

if self.looper_samples:
try:
sources = self.looper_samples[0]._mapped_attr["_project"].config["sample_modifiers"]['derive']['sources']
derived_table = self.create_derived_table(derived_attributes=sources)
except KeyError:
# No sample modifers or sources, so just pass
derived_table = None
else:
derived_table = None

columns = ["Record Identifiers"] + list(sorted_sample_stat_results.keys())
template_vars = dict(
navbar=navbar,
Expand All @@ -668,6 +679,16 @@ def create_index_html(self, navbar, footer):
render_jinja_template("index.html", self.jinja_env, template_vars),
)

def create_derived_table(self, derived_attributes):
print("Placeholder")
if derived_attributes:
for k,v in derived_attributes.items():
print(f"{k} {v}")


return None


def create_project_objects(self):
"""
Render available project level outputs defined in the
Expand Down
33 changes: 33 additions & 0 deletions tests/test_pipestat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2132,3 +2132,36 @@ def test_multi_results_summarize(
psm.summarize()
data = YAMLConfigManager(filepath=os.path.join(temp_dir, "aggregate_results.yaml"))
assert r_id in data[psm.pipeline_name][psm.pipeline_type].keys()

@pytest.mark.parametrize("backend", ["file"])
def test_temp(
self,
config_file_path,
results_file_path,
recursive_schema_file_path,
backend,
range_values,
):
# This is for temporary PEATAC testing for determining summarize function
with TemporaryDirectory() as d, ContextManagerDBTesting(DB_URL):
temp_dir = d
# single_results_file_path = "{record_identifier}/results.yaml"
# results_file_path = os.path.join(temp_dir, single_results_file_path)
# args = dict(schema_path=recursive_schema_file_path, database_only=False)
# n = 3
config_file_path = "/home/drc/pepatac_tutorial/processed/looper_pipestat_config.yaml"

# for i in range_values[:n]:
# r_id = i[0]
# val = i[1]
# backend_data = {"record_identifier": r_id, "results_file_path": results_file_path}
# args.update(backend_data)
# psm = SamplePipestatManager(**args)
# psm.report(record_identifier=r_id, values=val, force_overwrite=True)
psm = PipestatManager(config_file=config_file_path)
reportlink = psm.summarize()
print(reportlink)
statstsv = psm.table()
print(statstsv)
# data = YAMLConfigManager(filepath=os.path.join(temp_dir, "aggregate_results.yaml"))
# assert r_id in data[psm.pipeline_name][psm.pipeline_type].keys()

0 comments on commit fbf20a2

Please sign in to comment.