Mercurial > repos > sanbi-uwc > qc
comparison qc.py @ 6:878f18249f76 draft
"planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/tools/qc commit 21d348651ca466563cc507b9e3a3fbd6c2b0a016"
author | sanbi-uwc |
---|---|
date | Mon, 12 Apr 2021 12:28:41 +0000 |
parents | 2aa014ad54bc |
children | 6bdec8c62aec |
comparison
equal
deleted
inserted
replaced
5:499b71c93c5d | 6:878f18249f76 |
---|---|
4 import csv | 4 import csv |
5 import subprocess | 5 import subprocess |
6 import pandas as pd | 6 import pandas as pd |
7 import matplotlib.pyplot as plt | 7 import matplotlib.pyplot as plt |
8 import shlex | 8 import shlex |
9 import json | |
9 | 10 |
10 """ | 11 """ |
11 This script can incorporate as many QC checks as required | 12 This script can incorporate as many QC checks as required |
12 as long as it outputs a csv file containing a final column | 13 as long as it outputs a csv file containing a final column |
13 headed with 'qc_pass' and rows for each sample indcating | 14 headed with 'qc_pass' and rows for each sample indcating |
154 with open(args.outfile, 'w') as csvfile: | 155 with open(args.outfile, 'w') as csvfile: |
155 header = qc_line.keys() | 156 header = qc_line.keys() |
156 writer = csv.DictWriter(csvfile, fieldnames=header) | 157 writer = csv.DictWriter(csvfile, fieldnames=header) |
157 writer.writeheader() | 158 writer.writeheader() |
158 writer.writerow(qc_line) | 159 writer.writerow(qc_line) |
159 | 160 |
161 # write a json file from the dict | |
162 json_file = args.outfile + '.json' | |
163 with open(args.outfile, 'w') as jsonfile: | |
164 json.dump(qc_line, json_file) | |
165 | |
160 N_density = sliding_window_N_density(fasta) | 166 N_density = sliding_window_N_density(fasta) |
161 make_qc_plot(depth_pos, N_density, args.sample) | 167 make_qc_plot(depth_pos, N_density, args.sample) |
162 | 168 |
163 def main(): | 169 def main(): |
164 import argparse | 170 import argparse |