Skip to content

Commit

Permalink
fix: handling of <output_dir> input argument (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
sellth authored Apr 28, 2023
1 parent ae8bb92 commit bdf0e21
Show file tree
Hide file tree
Showing 48 changed files with 54 additions and 50 deletions.
4 changes: 2 additions & 2 deletions cubi_tk/isa_tpl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ def run_cookiecutter(tpl, args, _parser=None, _subparser=None, no_input=False):
logger.info(args)

output_dir = os.path.realpath(args.output_dir)
output_base = os.path.dirname(args.output_dir)
extra_context["i_dir_name"] = os.path.basename(output_dir)
output_base = os.path.dirname(output_dir)
extra_context["__output_dir"] = os.path.basename(output_dir)

# FIXME: better solution? (added because args.var_is_triplet is None)
if "is_triplet" in tpl.configuration:
Expand Down
8 changes: 4 additions & 4 deletions cubi_tk/isa_tpl/isatab-bulk_rnaseq/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"center_contact": "",

"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "nucleotide sequencing",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}"
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
8 changes: 4 additions & 4 deletions cubi_tk/isa_tpl/isatab-generic/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@
"center_contact": "",

"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_measurement_abbreviation": "{% if cookiecutter.a_measurement_type == 'transcription profiling' %}mRNA_seq{% else %}UNKNOWN{% endif %}",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
"sample_type": "x-charite-medgen-blood-book-id",
"lib_strategy": "{% if cookiecutter.a_measurement_abbreviation == 'mRNA_seq' %}RNA-seq{% else %}UNKNOWN{% endif %}",
"lib_selection": "{% if cookiecutter.a_measurement_abbreviation == 'mRNA_seq' %}PolyA{% else %}UNKNOWN{% endif %}",
"lib_layout": [ "PAIRED", "SINGLE" ]
"lib_layout": [ "PAIRED", "SINGLE" ],
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
8 changes: 4 additions & 4 deletions cubi_tk/isa_tpl/isatab-germline/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@
"center_contact": "",

"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "nucleotide sequencing",
"a_measurement_abbreviation": "{% if cookiecutter.a_measurement_type == 'exome sequencing' %}WES{% else %}WGS{% endif %}",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
"sample_type": "x-charite-medgen-blood-book-id",
"lib_strategy": "{% if cookiecutter.a_measurement_abbreviation == 'WES' %}WXS{% else %}WGS{% endif %}",
"lib_selection": "{% if cookiecutter.a_measurement_abbreviation == 'WES' %}Hybrid Selection{% else %}RANDOM{% endif %}",
"lib_layout": "PAIRED"
"lib_layout": "PAIRED",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
8 changes: 4 additions & 4 deletions cubi_tk/isa_tpl/isatab-microarray/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
"array_design_ref": "",

"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "microarray",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",

Expand All @@ -37,5 +36,6 @@
"accession_number": "http://purl.obolibrary.org/obo/OBI_0400148",
"source_ref": "OBI"
}
}
},
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
4 changes: 2 additions & 2 deletions cubi_tk/isa_tpl/isatab-ms_meta_biocrates/cookiecutter.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"investigation_title": "Investigation Title",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",

"study_title": "{{cookiecutter.investigation_title}}",
"study_id": "{{cookiecutter.study_title|lower|replace(' ', '_')}}",
Expand Down Expand Up @@ -77,5 +76,6 @@
"chromatography_instrument": [
"Agilent UHPLC 1290",
"Agilent 1290 Infinity II LC System"
]
],
"__output_dir": "Required variable. Do not remove."
}
10 changes: 5 additions & 5 deletions cubi_tk/isa_tpl/isatab-single_cell_rnaseq/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
"sample_multiplexing": ["No", "CellPlex", "TotalSeq", "Other"],
"genotype_multiplexing": ["no", "yes"],
"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "nucleotide sequencing",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}"
}
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
8 changes: 4 additions & 4 deletions cubi_tk/isa_tpl/isatab-stem_cell_core/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
"library_construction_meta": "{{'Sequencing kit,RNA amount,QC cell load recovery,QC tape fragment size' if cookiecutter.library_type == 'Single-Cell' else 'Sequencing kit,RNA amount,QC tape fragment size'}}",
"sequencing_meta": "Platform,Instrument model,No. targeted reads,QC-notes",
"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "nucleotide sequencing",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}"
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
4 changes: 2 additions & 2 deletions cubi_tk/isa_tpl/isatab-stem_cell_core_bulk/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"library_kit": "mRNA",
"library_construction_meta": "Library selection,Target insert size",
"sequencing_meta": "Platform,Instrument model,No. targeted reads,Paired-End",
"i_dir_name": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"s_file_name": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"assay_prefix": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"assay_name": "GEX_{{cookiecutter.a_measurement_type|replace(' ', '_')}}"
"assay_name": "GEX_{{cookiecutter.a_measurement_type|replace(' ', '_')}}",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
4 changes: 2 additions & 2 deletions cubi_tk/isa_tpl/isatab-stem_cell_core_sc/cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"library_type": ["GEX", "GEX+antibody", "GEX+VDJ", "GEX+other", "GEX+antibody+VDJ", "GEX+other+another"],
"sample_multiplexing": ["No", "CellPlex", "TotalSeq", "Other"],
"genotype_multiplexing": ["no", "yes"],
"i_dir_name": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"s_file_name": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"assay_prefix": "{{cookiecutter.study_title|replace(' ', '_')|replace('/', '-')}}",
"assay_name": "{{cookiecutter.library_type}}_{{cookiecutter.a_measurement_type|replace(' ', '_')}}"
"assay_name": "{{cookiecutter.library_type}}_{{cookiecutter.a_measurement_type|replace(' ', '_')}}",
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@
"center_contact": "",

"study_title": "{{cookiecutter.investigation_title}}",
"i_dir_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"is_triplet": null,
"s_file_name": "{{cookiecutter.i_dir_name}}",
"assay_prefix": "{{cookiecutter.i_dir_name|lower}}",
"s_file_name": "{{cookiecutter.investigation_title|replace(' ', '_')}}",
"assay_prefix": "{{cookiecutter.s_file_name|lower}}",
"a_technology_type": "nucleotide sequencing",
"a_measurement_abbreviation": "{% if cookiecutter.a_measurement_type == 'exome sequencing' %}WES{% else %}WGS{% endif %}",
"assay_name": "{{cookiecutter.a_measurement_type|replace(' ', '_')}}_{{cookiecutter.a_technology_type|replace(' ', '_')}}",
Expand All @@ -68,5 +67,6 @@
"lib_layout": [
"PAIRED",
"SINGLE"
]
],
"__output_dir": "Required variable. Do not remove."
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Investigation Person Roles
Investigation Person Roles Term Accession Number
Investigation Person Roles Term Source REF
STUDY
Study Identifier {{cookiecutter.i_dir_name}}
Study Identifier {{cookiecutter.s_file_name}}
Study Title {{cookiecutter.investigation_title}}
Study Description ""
Comment[Study Grant Number] ""
Expand Down
12 changes: 8 additions & 4 deletions tests/test_isa_tpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ def test_run_cookiecutter_isatab_generic(tmp_path):

assert output_path.exists()
assert (output_path / "i_Investigation.txt").exists()
assert (output_path / "a_output_dir_transcription_profiling_nucleotide_sequencing.txt").exists()
assert (output_path / "s_output_dir.txt").exists()
assert (
output_path / "a_investigation_title_transcription_profiling_nucleotide_sequencing.txt"
).exists()
assert (output_path / "s_Investigation_Title.txt").exists()


def test_run_cookiecutter_isatab_germline(tmp_path):
Expand All @@ -36,8 +38,10 @@ def test_run_cookiecutter_isatab_germline(tmp_path):

assert output_path.exists()
assert (output_path / "i_Investigation.txt").exists()
assert (output_path / "a_output_dir_exome_sequencing_nucleotide_sequencing.txt").exists()
assert (output_path / "s_output_dir.txt").exists()
assert (
output_path / "a_investigation_title_exome_sequencing_nucleotide_sequencing.txt"
).exists()
assert (output_path / "s_Investigation_Title.txt").exists()


def test_run_cookiecutter_isatab_ms_meta_biocrates(tmp_path):
Expand Down

0 comments on commit bdf0e21

Please sign in to comment.