diff --git a/samplesheet_generator.py b/samplesheet_generator.py index d62e00d..41300d1 100644 --- a/samplesheet_generator.py +++ b/samplesheet_generator.py @@ -163,7 +163,7 @@ def paired_i7_index_id_index(i7_index_id, index, indexes): # TODO: the following function should be rewriten and broken down to smaller functions so that it is easier to read and understand what's going on -def print_data_section_v1(dual_indexes, index_length, indexes, input_info_file): +def print_data_section_v1(run_id, dual_indexes, index_length, indexes, input_info_file): info_df = pd.read_csv(input_info_file, sep='\t', comment='#', header=0) info_df = info_df.fillna('') @@ -176,7 +176,7 @@ def print_data_section_v1(dual_indexes, index_length, indexes, input_info_file): for index, row in info_df.iterrows(): - if (str(row['run_id']) == args.run_id): + if (str(row['run_id']) == run_id): # select only samples from a run with the given run_id sample_id = row['sample_id'] @@ -265,7 +265,7 @@ def print_data_section_v1(dual_indexes, index_length, indexes, input_info_file): for index, row in info_df.iterrows(): - if (str(row['run_id']) == args.run_id): + if (str(row['run_id']) == run_id): # select only samples from a run with the given run_id sample_id = row['sample_id'] @@ -389,6 +389,8 @@ def main(): args=parser.parse_args() + run_id = args.run_id + index_type = args.index_type index_length = args.index_length investigator_name = args.investigator_name experiment_name = args.experiment_name @@ -407,17 +409,17 @@ def main(): # check whether the specified set of indexes is supported # if so then load them into indexes - if (args.index_type.lower() == "dual"): + if (index_type.lower() == "dual"): dual_indexes = True - elif (args.index_type.lower() == "simple"): + elif (index_type.lower() == "simple"): dual_indexes = False else: sys.exit("Unsupported value of index_type=\'"+args.index_type+"\' provided.") - if not (args.index_length == 8) and not (args.index_length == 10): - sys.exit("Unsupported value of index_length=\'"+args.index_length+"\' provided.") - elif not dual_indexes and (args.index_length == 10): - sys.exit("Unsupported value of index_length=\'"+args.index_length+"\' for simple indexes provided.") + if not (index_length == 8) and not (index_length == 10): + sys.exit("Unsupported value of index_length=\'"+index_length+"\' provided.") + elif not dual_indexes and (index_length == 10): + sys.exit("Unsupported value of index_length=\'"+index_length+"\' for simple indexes provided.") indexes=assign_indexes(dual_indexes, index_length) @@ -429,7 +431,7 @@ def main(): print_header_section_v1(investigator_name, experiment_name) print_reads_section_v1(read_length_1, read_length_2) print_settings_section_v1(adapter_read_1, adapter_read_2, adapter_behavior, minimum_trimmed_read_length, mask_short_reads, override_cycles) - print_data_section_v1(dual_indexes, index_length, indexes, input_info_file) + print_data_section_v1(run_id, dual_indexes, index_length, indexes, input_info_file) elif (samplesheet_version == 'v2'): sys.exit("Not implemented yet") else: