Skip to content

Commit

Permalink
handle multiple summary files within one folder
Browse files Browse the repository at this point in the history
  • Loading branch information
CuijieLu committed Jul 8, 2024
1 parent 92a4a6e commit 9625de0
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions scripts/ont_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ def write_to_csv(sample_dict):
destination = project_directory + "/" + sample
file = glob.glob(destination + "/*/sequencing_summary_*")
if len(file) != 0:
summary_metrix = pd.read_csv(file[0], delimiter = "\t")
pooled = if_pooled(summary_metrix)
if pooled:
sample_dict_sub = get_read_length_and_summary_pooled(summary_metrix, sample)
sample_dict.update(sample_dict_sub)
else:
sample_dict[sample] = get_read_length_and_summary(summary_metrix)
file_count = 0
for i in file:
file_count += 1
summary_matrix = pd.read_csv(i, delimiter = "\t")
pooled = if_pooled(summary_matrix)
# give different sample name for multi runs on one flow cell
if file_count != 1:
sample = sample + "_" + str(file_count)
if pooled:
sample_dict_sub = get_read_length_and_summary_pooled(summary_matrix, sample)
sample_dict.update(sample_dict_sub)
else:
sample_dict[sample] = get_read_length_and_summary(summary_matrix)

write_to_csv(sample_dict)
print("ONT stats complete for: " + project_directory)

0 comments on commit 9625de0

Please sign in to comment.