diff vsnp_statistics.py @ 23:b34843f09f9f draft

Uploaded
author greg
date Fri, 27 Aug 2021 19:56:20 +0000
parents 377c1a96aae9
children b908bb18008a
line wrap: on
line diff
--- a/vsnp_statistics.py	Tue Aug 24 12:44:52 2021 +0000
+++ b/vsnp_statistics.py	Fri Aug 27 19:56:20 2021 +0000
@@ -100,23 +100,22 @@
 def output_statistics(read1_stats, read2_stats, idxstats_file, metrics_file, output_file):
     paired_reads = read2_stats is not None
     if paired_reads:
-        columns = ['Reference', 'Read1 FASTQ', 'File Size', 'Reads', 'Mean Read Length', 'Mean Read Quality',
+        columns = ['Read1 FASTQ', 'File Size', 'Reads', 'Mean Read Length', 'Mean Read Quality',
                    'Reads Passing Q30', 'Read2 FASTQ', 'File Size', 'Reads', 'Mean Read Length', 'Mean Read Quality',
                    'Reads Passing Q30', 'Total Reads', 'All Mapped Reads', 'Unmapped Reads',
                    'Unmapped Reads Percentage of Total', 'Reference with Coverage', 'Average Depth of Coverage',
-                   'Good SNP Count']
+                   'Good SNP Count', 'Reference']
     else:
-        columns = ['Reference', 'FASTQ', 'File Size', 'Mean Read Length', 'Mean Read Quality', 'Reads Passing Q30',
+        columns = ['FASTQ', 'File Size', 'Mean Read Length', 'Mean Read Quality', 'Reads Passing Q30',
                    'Total Reads', 'All Mapped Reads', 'Unmapped Reads', 'Unmapped Reads Percentage of Total',
-                   'Reference with Coverage', 'Average Depth of Coverage', 'Good SNP Count']
+                   'Reference with Coverage', 'Average Depth of Coverage', 'Good SNP Count', 'Reference']
     with open(output_file, "w") as outfh:
         # Make sure the header starts with a # so
         # MultiQC can properly handle the output.
-        outfh.write("# %s\n" % "\t".join(columns))
+        outfh.write("%s\n" % "\t".join(columns))
         line_items = []
         # Get the current stats and associated files.
         # Get and output the statistics.
-        line_items.append(read1_stats.reference)
         line_items.append(read1_stats.fastq_file)
         line_items.append(read1_stats.file_size)
         if paired_reads:
@@ -152,6 +151,7 @@
         line_items.append(ref_with_coverage)
         line_items.append(avg_depth_of_coverage)
         line_items.append(good_snp_count)
+        line_items.append(read1_stats.reference)
         outfh.write('%s\n' % '\t'.join(str(x) for x in line_items))