Skip to content

Commit

Permalink
change keep_demographic_info to remove_demographic_info because less …
Browse files Browse the repository at this point in the history
…confusing
  • Loading branch information
Jessica Rowell authored and Jessica Rowell committed Jan 14, 2025
1 parent c54beb3 commit d524a00
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
13 changes: 6 additions & 7 deletions bin/validate_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def metadata_validation_main():
parameters_class.get_parameters()
parameters = parameters_class.parameters
try:
assert len([x for x in parameters.keys() if x in ['fasta_path', 'meta_path', 'output_dir', 'condaEnv', 'keep_demographic_info',
assert len([x for x in parameters.keys() if x in ['fasta_path', 'meta_path', 'output_dir', 'condaEnv', 'remove_demographic_info',
'date_format_flag', 'file_name', 'restricted_terms',
'illumina_instrument_restrictions', 'nanopore_instrument_restrictions',
'fasta_names', 'overwrite_output_files',
Expand Down Expand Up @@ -122,9 +122,8 @@ def get_args():
parser.add_argument("-o", "--output_dir", type=str, default='validation_outputs',
help="Output Directory for final Files, default is current directory")
parser.add_argument("--overwrite_output_files", type=bool, default=True, help='whether to overwrite the output dir')
parser.add_argument("-k", "--keep_demographic_info", action="store_true", default=False,
help="Flag to keep potentially identifying demographic info if provided otherwise it will return an " +
"error if personal information is provided." +
parser.add_argument("-k", "--remove_demographic_info", action="store_true", default=False,
help="Flag to remove potentially identifying demographic info if provided otherwise no change will be made " +
"Applies to host_sex, host_age, race, ethnicity.")
parser.add_argument("-d", "--date_format_flag", type=str, default="s", choices=['s', 'o', 'v'],
help="Flag to differ date output, s = default (YYYY-MM), " +
Expand Down Expand Up @@ -320,13 +319,13 @@ def validate_main(self):
self.author_valid = False
self.sample_error_msg = "\n\t Invalid Author Name, please list as full names separated by ;"

# run the check on the PI meta information if the keep_demographic_info flag is true
# run the check on the PI meta information if the remove_demographic_info flag is true
try:
assert self.meta_case_grade is True
except AssertionError:
raise AssertionError(f'meta_case_grade was not reset to True')
if self.parameters['keep_demographic_info'] is False:
self.sample_error_msg += (f"\n\t\t'keep_demographic_info' flag is False. Sample demographic data will be removed if present.")
if self.parameters['remove_demographic_info'] is True:
self.sample_error_msg += (f"\n\t\t'remove_demographic_info' flag is True. Sample demographic data will be removed if present.")
self.metadata_df = self.check_meta_case(sample_info)

# check if the SRA submission is triggered, if it is, then run the class of functions for handling sra submission
Expand Down
2 changes: 1 addition & 1 deletion conf/test_params.config
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ params {
*/
val_output_dir = 'validation_outputs'
date_format_flag = 's' // s = default (YYYY-MM), v = verbose(YYYY-MM-DD), o = original (leaves format unchanged)
keep_demographic_info = false // if false, values in host_sex, host_age, race, ethnicity are set to 'Not Provided'
remove_demographic_info = false // if true, values in host_sex, host_age, race, ethnicity are set to 'Not Provided'
validate_custom_fields = false
custom_fields_file = "${projectDir}/assets/custom_meta_fields/example_custom_fields.json"

Expand Down
4 changes: 2 additions & 2 deletions modules/local/metadata_validation/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ process METADATA_VALIDATION {
input:
path meta_path

def keep_demographic_info = params.keep_demographic_info == true ? '--keep_demographic_info' : ''
def remove_demographic_info = params.remove_demographic_info == true ? '--remove_demographic_info' : ''
def validate_custom_fields = params.validate_custom_fields == true ? '--validate_custom_fields' : ''

script:
Expand All @@ -27,7 +27,7 @@ process METADATA_VALIDATION {
--output_dir . \
--custom_fields_file $params.custom_fields_file \
--date_format_flag $params.date_format_flag \
$keep_demographic_info $validate_custom_fields
$remove_demographic_info $validate_custom_fields
"""

output:
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params {

// validation subworkflow
date_format_flag = 's' // s = default (YYYY-MM), v = verbose(YYYY-MM-DD), o = original (leaves format unchanged)
keep_demographic_info = false // if false, values in host_sex, host_age, race, ethnicity are set to 'Not Provided'
remove_demographic_info = false // if true, values in host_sex, host_age, race, ethnicity are set to 'Not Provided'
validate_custom_fields = false
custom_fields_file = "${projectDir}/assets/custom_meta_fields/example_custom_fields.json"

Expand Down

0 comments on commit d524a00

Please sign in to comment.