Skip to content

Commit

Permalink
small update: only include 'empty' report when no other reports are s…
Browse files Browse the repository at this point in the history
…pecified
  • Loading branch information
LonnekeScheffer committed Nov 8, 2023
1 parent 6e90ce1 commit ab27ec5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
8 changes: 4 additions & 4 deletions immuneML/api/galaxy/build_dataset_overview_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ def build_specs(args):
"instructions": {
"my_dataset_generation_instruction": {
"type": "ExploratoryAnalysis",
"analyses":{
"dataset_overview":{
"dataset": args.dataset_name,
"report": None}}
"analyses": dict()
}
}
}
Expand All @@ -53,6 +50,9 @@ def build_specs(args):
if args.amino_acid_report == "True":
add_report_with_label(specs, args, report_name="AminoAcidFrequencyDistribution", report_key="amino_acid")

if len(specs["instructions"]["my_dataset_generation_instruction"]["analyses"]) == 0:
specs["instructions"]["my_dataset_generation_instruction"]["analyses"] = {"dataset_overview":{"dataset": args.dataset_name, "report": None}}

return specs


Expand Down
11 changes: 5 additions & 6 deletions test/api/galaxy/test_build_dataset_overview_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ def test_sequencedataset(self):
self.assertDictEqual(loaded_specs["instructions"], {"my_dataset_generation_instruction": {
"type":"ExploratoryAnalysis",
"analyses":{
"dataset_overview":
{"dataset": "dataset",
"report": None},
"sequence_length_analysis":
{"dataset": "dataset",
"report": "sequence_length_report"},
Expand Down Expand Up @@ -126,7 +123,7 @@ def test_repertoiredataset(self):

os.chdir(path)

yamlbuilder_main(["-r", "VDJdb", "-o", str(path), "-f", "repertoire.yaml", "-m", "metadata.csv", "-i", "True"])
yamlbuilder_main(["-r", "VDJdb", "-o", str(path), "-f", "repertoire.yaml", "-m", "metadata.csv", "-i", "True", "-q", "True"])

with open(path / "repertoire.yaml", "r") as file:
loaded_specs = yaml.load(file, Loader=yaml.FullLoader)
Expand All @@ -135,12 +132,14 @@ def test_repertoiredataset(self):
{"path": "./", "metadata_file": "metadata.csv", "is_repertoire": True, "region_type": RegionType.IMGT_CDR3.name,
"result_path": "./"}}})

self.assertDictEqual(loaded_specs["definitions"]["reports"], {"amino_acid_report": "AminoAcidFrequencyDistribution"})

self.assertDictEqual(loaded_specs["instructions"], {"my_dataset_generation_instruction":
{"type": "ExploratoryAnalysis",
"analyses":
{"dataset_overview":
{"amino_acid_analysis":
{"dataset": "dataset",
"report": None}}}})
"report": "amino_acid_report"}}}})

ImmuneMLParser.parse_yaml_file(path / "repertoire.yaml")

Expand Down

0 comments on commit ab27ec5

Please sign in to comment.