Skip to content

Commit

Permalink
Fixed function calls with providing correct parameters 2.
Browse files Browse the repository at this point in the history
  • Loading branch information
tinavisnovska committed Feb 6, 2024
1 parent 2617073 commit e38f205
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions samplesheet_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('')
Expand All @@ -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']
Expand Down Expand Up @@ -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']
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand All @@ -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:
Expand Down

0 comments on commit e38f205

Please sign in to comment.