Skip to content

Commit

Permalink
fixed stupid name issue report keys not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheww95 committed Nov 12, 2024
1 parent 70d0291 commit 6ba57b0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 2 additions & 3 deletions bin/report_summaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,11 +264,10 @@ def output_indv_json(self, flattened_data):
"""
updated_items = dict()
for k, v in flattened_data.items():
#out_path = os.path.join(self.output_dir, k + self.flat_sample_string)
out_key = k
sample_dir = k
if v.get(self.__inx_irida_key) != k:
sample_dir = v[self.__inx_irida_key]
if dir_name := v.get(self.__inx_irida_key) != k:
sample_dir = dir_name
#! this field affects the identification of the irida next id being passed out of the pipeline
out_key = sample_dir # this field must be overwritten for iridanext to identify the correct metdata field

Expand Down
14 changes: 6 additions & 8 deletions modules/local/report.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,38 @@ process REPORT{
def report_tag = test_in[i+1]
def report_value = test_in[i+2]

println meta_data
if(!sample_data.containsKey(meta_data.sample)){
// Todo issue grabbing correct tag is here
sample_data[meta_data.sample] = [:]
sample_data[meta_data.sample]["meta"] = [:]
}

update_map_values(sample_data, meta_data, "metagenomic")
//update_map_values(sample_data, meta_data, "sample")
//update_map_values(sample_data, meta_data, "external_id")
//update_map_values(sample_data, meta_data, "id")
update_map_values(sample_data, meta_data, "sample")
update_map_values(sample_data, meta_data, "external_id")
update_map_values(sample_data, meta_data, "assembly")
update_map_values(sample_data, meta_data, "hybrid")
update_map_values(sample_data, meta_data, "single_end")
update_map_values(sample_data, meta_data, "merge")
update_map_values(sample_data, meta_data, "downsampled")


if(!sample_data[meta_data.sample].containsKey(meta_data.id)){
sample_data[meta_data.sample][meta_data.id] = [:]
if(!sample_data[meta_data.sample].containsKey(meta_data.external_id)){
sample_data[meta_data.sample][meta_data.external_id] = [:]
}

if(report_value instanceof Path){
def extension = report_value.getExtension()
if(!check_file_params(report_tag, extension)){
continue
}
// TODO pass in report metadata
def output_data = parse_data(report_value, extension, report_tag, headers_list)
if(output_data){
report_value = output_data
}
}

sample_data[meta_data.sample][meta_data.id][report_tag.report_tag] = report_value
sample_data[meta_data.sample][meta_data.external_id][report_tag.report_tag] = report_value
}


Expand Down
3 changes: 1 addition & 2 deletions subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ workflow INPUT_CHECK {
meta[0].id = "${meta[0].id}_${meta[0].external_id}"
}
}
println "${meta[0].id} ${meta[0]}"
processedIDs << meta[0].id
tuple(meta[0].id, meta[0])
}
Expand Down Expand Up @@ -135,7 +134,7 @@ def format_reads(ArrayList sheet_data){
def error_occured = false
meta.id = sheet_data[0] // id is first value
meta.sample = sheet_data[1].external_id
meta.external_id = sheet_data[0]
meta.external_id = sheet_data[1].external_id

meta.hybrid = false
meta.assembly = false
Expand Down

0 comments on commit 6ba57b0

Please sign in to comment.