-
Notifications
You must be signed in to change notification settings - Fork 1
/
albasummary.py
29 lines (25 loc) · 1017 Bytes
/
albasummary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
import pandas as pd
import sys
import numpy as np
# **** Import file ****
if len(sys.argv) != 2:
sys.exit("Usage: python albasummary.py sequencing_summary.txt")
summary_file = sys.argv[1]
summary = pd.read_csv(summary_file, sep = '\t')
# **** Calculate some statistics ****
nr_reads = summary.shape[0]
mean_read_length = np.mean(summary['sequence_length_template'])
throughput_gb = sum(summary['sequence_length_template'])/float(1000000000)
throughput = sum(summary['sequence_length_template'])
max_read_length = np.max(summary['sequence_length_template'])
# **** Print to screen ****
print("==== Albacore statistics =====")
print("Number of reads: %d" % (nr_reads))
print("Avg. read length: %.2fbp" % (mean_read_length))
print("Max read length: %dbp" % (max_read_length))
print("Throughput: %.2fGb" % (throughput_gb))
if summary.shape[1] == 25:
barcodes = summary['barcode_arrangement'].astype('category')
print("\n===== Barcodes ======")
print(barcodes.value_counts())