annotate vsnp_statistics.py @ 23:b34843f09f9f draft

Uploaded
author greg
date Fri, 27 Aug 2021 19:56:20 +0000
parents 377c1a96aae9
children b908bb18008a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
1 #!/usr/bin/env python
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
2
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
3 import argparse
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
4 import gzip
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
5 import os
5
d0fbdeaaa488 "planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_statistics commit 770e89322a15829580ed9577a853660f63233f32"
greg
parents: 4
diff changeset
6 from functools import partial
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
7
4
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
8 import numpy
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
9 import pandas
5
d0fbdeaaa488 "planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_statistics commit 770e89322a15829580ed9577a853660f63233f32"
greg
parents: 4
diff changeset
10 from Bio import SeqIO
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
11
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
12
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
13 class Statistics:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
14
1becb6606626 Uploaded
greg
parents: 5
diff changeset
15 def __init__(self, reference, fastq_file, file_size, total_reads, mean_read_length, mean_read_quality, reads_passing_q30):
1becb6606626 Uploaded
greg
parents: 5
diff changeset
16 self.reference = reference
1becb6606626 Uploaded
greg
parents: 5
diff changeset
17 self.fastq_file = fastq_file
1becb6606626 Uploaded
greg
parents: 5
diff changeset
18 self.file_size = file_size
1becb6606626 Uploaded
greg
parents: 5
diff changeset
19 self.total_reads = total_reads
1becb6606626 Uploaded
greg
parents: 5
diff changeset
20 self.mean_read_length = mean_read_length
1becb6606626 Uploaded
greg
parents: 5
diff changeset
21 self.mean_read_quality = mean_read_quality
1becb6606626 Uploaded
greg
parents: 5
diff changeset
22 self.reads_passing_q30 = reads_passing_q30
1becb6606626 Uploaded
greg
parents: 5
diff changeset
23
1becb6606626 Uploaded
greg
parents: 5
diff changeset
24
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
25 def nice_size(size):
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
26 # Returns a readably formatted string with the size
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
27 words = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB']
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
28 prefix = ''
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
29 try:
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
30 size = float(size)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
31 if size < 0:
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
32 size = abs(size)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
33 prefix = '-'
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
34 except Exception:
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
35 return '??? bytes'
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
36 for ind, word in enumerate(words):
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
37 step = 1024 ** (ind + 1)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
38 if step > size:
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
39 size = size / float(1024 ** ind)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
40 if word == 'bytes': # No decimals for bytes
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
41 return "%s%d bytes" % (prefix, size)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
42 return "%s%.1f %s" % (prefix, size, word)
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
43 return '??? bytes'
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
44
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
45
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
46 def get_statistics(dbkey, fastq_file, gzipped):
1becb6606626 Uploaded
greg
parents: 5
diff changeset
47 sampling_size = 10000
1becb6606626 Uploaded
greg
parents: 5
diff changeset
48 # Read fastq_file into a data fram to
1becb6606626 Uploaded
greg
parents: 5
diff changeset
49 # get the phred quality scores.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
50 _open = partial(gzip.open, mode='rt') if gzipped else open
1becb6606626 Uploaded
greg
parents: 5
diff changeset
51 with _open(fastq_file) as fh:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
52 identifiers = []
1becb6606626 Uploaded
greg
parents: 5
diff changeset
53 seqs = []
1becb6606626 Uploaded
greg
parents: 5
diff changeset
54 letter_annotations = []
1becb6606626 Uploaded
greg
parents: 5
diff changeset
55 for seq_record in SeqIO.parse(fh, "fastq"):
1becb6606626 Uploaded
greg
parents: 5
diff changeset
56 identifiers.append(seq_record.id)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
57 seqs.append(seq_record.seq)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
58 letter_annotations.append(seq_record.letter_annotations["phred_quality"])
1becb6606626 Uploaded
greg
parents: 5
diff changeset
59 # Convert lists to Pandas series.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
60 s1 = pandas.Series(identifiers, name='id')
1becb6606626 Uploaded
greg
parents: 5
diff changeset
61 s2 = pandas.Series(seqs, name='seq')
1becb6606626 Uploaded
greg
parents: 5
diff changeset
62 # Gather Series into a data frame.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
63 fastq_df = pandas.DataFrame(dict(id=s1, seq=s2)).set_index(['id'])
1becb6606626 Uploaded
greg
parents: 5
diff changeset
64 # Starting at row 3, keep every 4 row
1becb6606626 Uploaded
greg
parents: 5
diff changeset
65 # random sample specified number of rows.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
66 file_size = nice_size(os.path.getsize(fastq_file))
1becb6606626 Uploaded
greg
parents: 5
diff changeset
67 total_reads = int(len(fastq_df.index) / 4)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
68 # Mean Read Length
1becb6606626 Uploaded
greg
parents: 5
diff changeset
69 if sampling_size > total_reads:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
70 sampling_size = total_reads
1becb6606626 Uploaded
greg
parents: 5
diff changeset
71 fastq_df = fastq_df.iloc[3::4].sample(sampling_size)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
72 dict_mean = {}
1becb6606626 Uploaded
greg
parents: 5
diff changeset
73 list_length = []
1becb6606626 Uploaded
greg
parents: 5
diff changeset
74 i = 0
1becb6606626 Uploaded
greg
parents: 5
diff changeset
75 for id, seq, in fastq_df.iterrows():
1becb6606626 Uploaded
greg
parents: 5
diff changeset
76 dict_mean[id] = numpy.mean(letter_annotations[i])
1becb6606626 Uploaded
greg
parents: 5
diff changeset
77 list_length.append(len(seq.array[0]))
1becb6606626 Uploaded
greg
parents: 5
diff changeset
78 i += 1
1becb6606626 Uploaded
greg
parents: 5
diff changeset
79 mean_read_length = '%.1f' % numpy.mean(list_length)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
80 # Mean Read Quality
1becb6606626 Uploaded
greg
parents: 5
diff changeset
81 df_mean = pandas.DataFrame.from_dict(dict_mean, orient='index', columns=['ave'])
1becb6606626 Uploaded
greg
parents: 5
diff changeset
82 mean_read_quality = '%.1f' % df_mean['ave'].mean()
1becb6606626 Uploaded
greg
parents: 5
diff changeset
83 # Reads Passing Q30
1becb6606626 Uploaded
greg
parents: 5
diff changeset
84 reads_gt_q30 = len(df_mean[df_mean['ave'] >= 30])
1becb6606626 Uploaded
greg
parents: 5
diff changeset
85 reads_passing_q30 = '{:10.2f}'.format(reads_gt_q30 / sampling_size)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
86 stats = Statistics(dbkey, os.path.basename(fastq_file), file_size, total_reads, mean_read_length,
1becb6606626 Uploaded
greg
parents: 5
diff changeset
87 mean_read_quality, reads_passing_q30)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
88 return stats
1becb6606626 Uploaded
greg
parents: 5
diff changeset
89
1becb6606626 Uploaded
greg
parents: 5
diff changeset
90
1becb6606626 Uploaded
greg
parents: 5
diff changeset
91 def accrue_statistics(dbkey, read1, read2, gzipped):
1becb6606626 Uploaded
greg
parents: 5
diff changeset
92 read1_stats = get_statistics(dbkey, read1, gzipped)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
93 if read2 is None:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
94 read2_stats = None
1becb6606626 Uploaded
greg
parents: 5
diff changeset
95 else:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
96 read2_stats = get_statistics(dbkey, read2, gzipped)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
97 return read1_stats, read2_stats
1becb6606626 Uploaded
greg
parents: 5
diff changeset
98
1becb6606626 Uploaded
greg
parents: 5
diff changeset
99
1becb6606626 Uploaded
greg
parents: 5
diff changeset
100 def output_statistics(read1_stats, read2_stats, idxstats_file, metrics_file, output_file):
1becb6606626 Uploaded
greg
parents: 5
diff changeset
101 paired_reads = read2_stats is not None
1becb6606626 Uploaded
greg
parents: 5
diff changeset
102 if paired_reads:
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
103 columns = ['Read1 FASTQ', 'File Size', 'Reads', 'Mean Read Length', 'Mean Read Quality',
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
104 'Reads Passing Q30', 'Read2 FASTQ', 'File Size', 'Reads', 'Mean Read Length', 'Mean Read Quality',
1becb6606626 Uploaded
greg
parents: 5
diff changeset
105 'Reads Passing Q30', 'Total Reads', 'All Mapped Reads', 'Unmapped Reads',
1becb6606626 Uploaded
greg
parents: 5
diff changeset
106 'Unmapped Reads Percentage of Total', 'Reference with Coverage', 'Average Depth of Coverage',
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
107 'Good SNP Count', 'Reference']
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
108 else:
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
109 columns = ['FASTQ', 'File Size', 'Mean Read Length', 'Mean Read Quality', 'Reads Passing Q30',
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
110 'Total Reads', 'All Mapped Reads', 'Unmapped Reads', 'Unmapped Reads Percentage of Total',
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
111 'Reference with Coverage', 'Average Depth of Coverage', 'Good SNP Count', 'Reference']
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
112 with open(output_file, "w") as outfh:
21
377c1a96aae9 Uploaded
greg
parents: 8
diff changeset
113 # Make sure the header starts with a # so
377c1a96aae9 Uploaded
greg
parents: 8
diff changeset
114 # MultiQC can properly handle the output.
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
115 outfh.write("%s\n" % "\t".join(columns))
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
116 line_items = []
1becb6606626 Uploaded
greg
parents: 5
diff changeset
117 # Get the current stats and associated files.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
118 # Get and output the statistics.
1becb6606626 Uploaded
greg
parents: 5
diff changeset
119 line_items.append(read1_stats.fastq_file)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
120 line_items.append(read1_stats.file_size)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
121 if paired_reads:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
122 line_items.append(read1_stats.total_reads)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
123 line_items.append(read1_stats.mean_read_length)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
124 line_items.append(read1_stats.mean_read_quality)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
125 line_items.append(read1_stats.reads_passing_q30)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
126 if paired_reads:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
127 line_items.append(read2_stats.fastq_file)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
128 line_items.append(read2_stats.file_size)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
129 line_items.append(read2_stats.total_reads)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
130 line_items.append(read2_stats.mean_read_length)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
131 line_items.append(read2_stats.mean_read_quality)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
132 line_items.append(read2_stats.reads_passing_q30)
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
133 # Total Reads
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
134 if paired_reads:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
135 total_reads = read1_stats.total_reads + read2_stats.total_reads
1becb6606626 Uploaded
greg
parents: 5
diff changeset
136 else:
1becb6606626 Uploaded
greg
parents: 5
diff changeset
137 total_reads = read1_stats.total_reads
1becb6606626 Uploaded
greg
parents: 5
diff changeset
138 line_items.append(total_reads)
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
139 # All Mapped Reads
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
140 all_mapped_reads, unmapped_reads = process_idxstats_file(idxstats_file)
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
141 line_items.append(all_mapped_reads)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
142 line_items.append(unmapped_reads)
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
143 # Unmapped Reads Percentage of Total
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
144 if unmapped_reads > 0:
5
d0fbdeaaa488 "planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_statistics commit 770e89322a15829580ed9577a853660f63233f32"
greg
parents: 4
diff changeset
145 unmapped_reads_percentage = '{:10.2f}'.format(unmapped_reads / total_reads)
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
146 else:
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
147 unmapped_reads_percentage = 0
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
148 line_items.append(unmapped_reads_percentage)
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
149 # Reference with Coverage
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
150 ref_with_coverage, avg_depth_of_coverage, good_snp_count = process_metrics_file(metrics_file)
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
151 line_items.append(ref_with_coverage)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
152 line_items.append(avg_depth_of_coverage)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
153 line_items.append(good_snp_count)
23
b34843f09f9f Uploaded
greg
parents: 21
diff changeset
154 line_items.append(read1_stats.reference)
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
155 outfh.write('%s\n' % '\t'.join(str(x) for x in line_items))
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
156
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
157
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
158 def process_idxstats_file(idxstats_file):
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
159 all_mapped_reads = 0
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
160 unmapped_reads = 0
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
161 with open(idxstats_file, "r") as fh:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
162 for i, line in enumerate(fh):
5
d0fbdeaaa488 "planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_statistics commit 770e89322a15829580ed9577a853660f63233f32"
greg
parents: 4
diff changeset
163 line = line.rstrip('\r\n')
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
164 items = line.split("\t")
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
165 if i == 0:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
166 # NC_002945.4 4349904 213570 4047
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
167 all_mapped_reads = int(items[2])
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
168 elif i == 1:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
169 # * 0 0 82774
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
170 unmapped_reads = int(items[3])
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
171 return all_mapped_reads, unmapped_reads
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
172
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
173
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
174 def process_metrics_file(metrics_file):
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
175 ref_with_coverage = '0%'
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
176 avg_depth_of_coverage = 0
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
177 good_snp_count = 0
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
178 with open(metrics_file, "r") as ifh:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
179 for i, line in enumerate(ifh):
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
180 if i == 0:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
181 # Skip comments.
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
182 continue
5
d0fbdeaaa488 "planemo upload for repository https://github.com/gregvonkuster/galaxy_tools/tree/master/tools/sequence_analysis/vsnp/vsnp_statistics commit 770e89322a15829580ed9577a853660f63233f32"
greg
parents: 4
diff changeset
183 line = line.rstrip('\r\n')
1
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
184 items = line.split("\t")
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
185 if i == 1:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
186 # MarkDuplicates 10.338671 98.74%
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
187 ref_with_coverage = items[3]
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
188 avg_depth_of_coverage = items[2]
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
189 elif i == 2:
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
190 # VCFfilter 611
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
191 good_snp_count = items[1]
14e29f7d59ca Uploaded
greg
parents: 0
diff changeset
192 return ref_with_coverage, avg_depth_of_coverage, good_snp_count
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
193
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
194
4
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
195 parser = argparse.ArgumentParser()
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
196
4
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
197 parser.add_argument('--dbkey', action='store', dest='dbkey', help='Reference dbkey')
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
198 parser.add_argument('--gzipped', action='store_true', dest='gzipped', required=False, default=False, help='Input files are gzipped')
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
199 parser.add_argument('--output', action='store', dest='output', help='Output Excel statistics file')
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
200 parser.add_argument('--read1', action='store', dest='read1', help='Required: single read')
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
201 parser.add_argument('--read2', action='store', dest='read2', required=False, default=None, help='Optional: paired read')
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
202 parser.add_argument('--samtools_idxstats', action='store', dest='samtools_idxstats', help='Output of samtools_idxstats')
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
203 parser.add_argument('--vsnp_azc_metrics', action='store', dest='vsnp_azc_metrics', help='Output of vsnp_add_zero_coverage')
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
204
4
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
205 args = parser.parse_args()
0
c21d338dbdc4 Uploaded
greg
parents:
diff changeset
206
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
207 stats_list = []
4
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
208 idxstats_files = []
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
209 metrics_files = []
2d6c6b01319e Uploaded
greg
parents: 3
diff changeset
210 # Accumulate inputs.
8
1becb6606626 Uploaded
greg
parents: 5
diff changeset
211 read1_stats, read2_stats = accrue_statistics(args.dbkey, args.read1, args.read2, args.gzipped)
1becb6606626 Uploaded
greg
parents: 5
diff changeset
212 output_statistics(read1_stats, read2_stats, args.samtools_idxstats, args.vsnp_azc_metrics, args.output)