Skip to content

Commit

Permalink
Use CV of 0.0 when there is only one barcode
Browse files Browse the repository at this point in the history
  • Loading branch information
tbooth committed Dec 23, 2024
1 parent ea267fb commit eeffda3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion compile_cell_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,14 @@ def summarize_lima_counts(lima_counts):
"""
unassigned = lima_counts['unassigned']
assigned = [v for k, v in lima_counts.items() if k != 'unassigned']
if len(assigned) > 1:
cov = stdev(assigned) / mean(assigned)
else:
cov = 0.0

return { 'Number of samples': len(assigned),
'Assigned Reads (%)': "{:.2f}".format(sum(assigned) * 100 / (sum(assigned) + unassigned)),
'CV': "{:.2f}".format(stdev(assigned) / mean(assigned)) }
'CV': "{:.2f}".format(cov) }

def calculate_cv(counts_list, qual_list):
"""Calculate the CV of counts_list. If qual_list is provided I'll use it to spot the non-barcoded
Expand Down

0 comments on commit eeffda3

Please sign in to comment.