Skip to content

Commit

Permalink
Give error message when one read doesn't exist for paired reads.
Browse files Browse the repository at this point in the history
  • Loading branch information
harmonbhasin committed Jan 22, 2025
1 parent f28a9d0 commit 92f22e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bin/generate_samplesheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,13 @@ def build_samples_dict(listing, dir_path, single_end, forward_suffix, reverse_su
for sample, fr_dict in samples_dict.items():
if fr_dict["fwd"] and fr_dict["rev"]:
final_dict[sample] = [fr_dict["fwd"], fr_dict["rev"]]
else:
# New error message for incomplete pairs
if fr_dict["fwd"] and not fr_dict["rev"]:
print(f"Error: Sample '{sample}' is missing its reverse read (found forward: {fr_dict['fwd']})", file=sys.stderr)
elif fr_dict["rev"] and not fr_dict["fwd"]:
print(f"Error: Sample '{sample}' is missing its forward read (found reverse: {fr_dict['rev']})", file=sys.stderr)
sys.exit(1)
return final_dict

else:
Expand Down Expand Up @@ -245,4 +252,4 @@ def write_samplesheet(samples_dict, groups_dict, output_path, single_end):


if __name__ == "__main__":
main()
main()

0 comments on commit 92f22e2

Please sign in to comment.