diff --git a/micall/core/aln2counts.py b/micall/core/aln2counts.py index e82ac72bd..90dcfdda0 100755 --- a/micall/core/aln2counts.py +++ b/micall/core/aln2counts.py @@ -411,7 +411,8 @@ def _create_amino_writer(amino_file): 'query.nuc.pos', 'refseq.aa.pos'] columns.extend(AMINO_ALPHABET) - columns.extend(('X', 'partial', 'del', 'ins', 'clip', 'g2p_overlap')) + columns.extend( + ('X', 'partial', 'del', 'ins', 'clip', 'g2p_overlap', 'coverage')) return csv.DictWriter(amino_file, columns, lineterminator=os.linesep) @@ -446,11 +447,13 @@ def write_amino_counts(self, amino_writer=None, coverage_summary=None): 'del': seed_amino.deletions, 'ins': report_amino.insertion_count, 'clip': report_amino.max_clip_count, - 'g2p_overlap': seed_amino.g2p_overlap} + 'g2p_overlap': seed_amino.g2p_overlap, + 'coverage': seed_amino.deletions} for letter in AMINO_ALPHABET: letter_count = seed_amino.counts[letter] row[letter] = letter_count coverage_sum += letter_count + row['coverage'] += letter_count amino_writer.writerow(row) pos_count += 1 if coverage_summary is not None and pos_count > 0: @@ -477,7 +480,8 @@ def _create_nuc_writer(nuc_file): 'del', 'ins', 'clip', - 'g2p_overlap'], + 'g2p_overlap', + 'coverage'], lineterminator=os.linesep) def write_nuc_header(self, nuc_file): @@ -521,9 +525,13 @@ def write_counts(self, region, seed_amino, report_amino, nuc_writer): 'del': seed_nuc.counts['-'], 'ins': insertion_count, 'clip': clip_count, - 'g2p_overlap': seed_nuc.g2p_overlap} + 'g2p_overlap': seed_nuc.g2p_overlap, + 'coverage': seed_nuc.counts['-']} for base in 'ACTGN': - row[base] = seed_nuc.counts[base] + nuc_count = seed_nuc.counts[base] + row[base] = nuc_count + if base != 'N': + row['coverage'] += nuc_count nuc_writer.writerow(row) if report_amino is not None: report_amino.max_clip_count = max_clip_count diff --git a/micall/hivdb/genreport.py b/micall/hivdb/genreport.py index efcc32747..1b04624aa 100755 --- a/micall/hivdb/genreport.py +++ b/micall/hivdb/genreport.py @@ -6,6 +6,8 @@ from argparse import ArgumentParser, FileType import csv +from collections import defaultdict + import yaml try: @@ -142,7 +144,7 @@ def read_mutations(cfg_dct, csv_file): Returns a list of dictionaries. """ err_string = "Error in mutations file '{}'".format(csv_file.name) - exp_set = frozenset("drug_class,mutation".split(",")) + exp_set = frozenset("drug_class,mutation,prevalence".split(",")) try: data_lst = list(csv.DictReader(csv_file, restkey="dummy")) except csv.Error: @@ -154,7 +156,7 @@ def read_mutations(cfg_dct, csv_file): # simple sanity check of the fields # generate a dict of drug_class -> string of mutations # also set the strings to 'NONE' if appropriate - tmp_dct = {} + tmp_dct = defaultdict(list) known_drug_class_set = cfg_dct['known_drug_classes'] glob_err = False for od_num, od in enumerate(data_lst): @@ -167,7 +169,9 @@ def read_mutations(cfg_dct, csv_file): print("{}: dataset {}: error with {}\n\n".format( err_string, od_num + 1, od)) glob_err = True - tmp_dct.setdefault(d_class, []).append(mut_str) + tmp_dct[d_class].append('{}({:.0f}%)'.format( + mut_str, + 100*float(od['prevalence']))) if glob_err: raise RuntimeError( "{}: fatal error(s) detected: giving up...".format(err_string)) diff --git a/micall/hivdb/hivdb.py b/micall/hivdb/hivdb.py index 356175921..0f9c4b635 100644 --- a/micall/hivdb/hivdb.py +++ b/micall/hivdb/hivdb.py @@ -70,14 +70,14 @@ def read_aminos(amino_csv, min_fraction, reported_regions=None): aminos = [] for row in rows: counts = list(map(int, (row[f] for f in coverage_columns))) - coverage = sum(counts) + coverage = int(row['coverage']) min_count = max(1, coverage * min_fraction) # needs at least 1 - pos_aminos = [report_names[i] + pos_aminos = {report_names[i]: count/coverage for i, count in enumerate(counts) - if count >= min_count and report_names[i] != '*'] + if count >= min_count and report_names[i] != '*'} ins_count = int(row['ins']) if ins_count >= min_count: - pos_aminos.append('i') + pos_aminos['i'] = ins_count / coverage aminos.append(pos_aminos) yield translated_region, aminos for region in missing_regions: @@ -109,7 +109,7 @@ def write_resistance(aminos, resistance_csv, mutations_csv): lineterminator=os.linesep) resistance_writer.writeheader() mutations_writer = DictWriter(mutations_csv, - ['drug_class', 'mutation'], + ['drug_class', 'mutation', 'prevalence'], lineterminator=os.linesep) mutations_writer.writeheader() asi = AsiAlgorithm(RULES_PATH) @@ -128,8 +128,13 @@ def write_resistance(aminos, resistance_csv, mutations_csv): score=drug_result.score)) for drug_class, class_mutations in result.mutations.items(): for mutation in class_mutations: + amino = mutation[-1] + pos = int(mutation[1:-1]) + pos_aminos = amino_seq[pos-1] + prevalence = pos_aminos[amino] mutations_writer.writerow(dict(drug_class=drug_class, - mutation=mutation)) + mutation=mutation, + prevalence=prevalence)) def hivdb(amino_csv, diff --git a/micall/tests/aln2counts_test.py b/micall/tests/aln2counts_test.py index eb5d724ae..c9fd0e838 100644 --- a/micall/tests/aln2counts_test.py +++ b/micall/tests/aln2counts_test.py @@ -396,10 +396,10 @@ def testSingleReadAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -421,16 +421,16 @@ def testSingleReadNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.write_nuc_header(self.report_file) @@ -457,15 +457,15 @@ def testSecondSourceAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 +R2-seed,R2,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 +R2-seed,R2,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -487,10 +487,10 @@ def testAminoReportWithG2pOverlap(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -512,10 +512,10 @@ def testAminoReportWithoutG2pOverlap(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -537,10 +537,10 @@ def testAminoReportWithIndirectG2pOverlap(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R6a-seed,R6,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R6a-seed,R6,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R6a-seed,R6,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0 """ self.report.write_amino_header(self.report_file) @@ -614,12 +614,12 @@ def testAminoReportWithDifferingConsensus(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -HIV1-C-BR-JX140663-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6 -HIV1-C-BR-JX140663-seed,R1,15,8,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +HIV1-C-BR-JX140663-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +HIV1-C-BR-JX140663-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,9 +HIV1-C-BR-JX140663-seed,R1,15,8,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +HIV1-C-BR-JX140663-seed,R1,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0 +HIV1-C-BR-JX140663-seed,R1,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -677,12 +677,12 @@ def testAminoReportOverlapWithDifferentSeed(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -HIV1-C-BR-JX140663-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,8,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8 -HIV1-C-BR-JX140663-seed,R1,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +HIV1-C-BR-JX140663-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +HIV1-C-BR-JX140663-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +HIV1-C-BR-JX140663-seed,R1,15,8,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,9 +HIV1-C-BR-JX140663-seed,R1,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0 +HIV1-C-BR-JX140663-seed,R1,15,,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.write_amino_header(self.report_file) @@ -706,31 +706,31 @@ def testSecondSourceNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,8,0,0,0,0,0,0,0,0 -R2-seed,R2,15,2,2,8,0,0,0,0,0,0,0,0 -R2-seed,R2,15,3,3,8,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,4,0,0,0,8,0,0,0,0,0 -R2-seed,R2,15,5,5,0,0,0,8,0,0,0,0,0 -R2-seed,R2,15,6,6,0,0,0,8,0,0,0,0,0 -R2-seed,R2,15,,7,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,8,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,9,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,10,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,11,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,12,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,13,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,14,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,15,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,8,0,0,0,0,0,0,0,0,8 +R2-seed,R2,15,2,2,8,0,0,0,0,0,0,0,0,8 +R2-seed,R2,15,3,3,8,0,0,0,0,0,0,0,0,8 +R2-seed,R2,15,4,4,0,0,0,8,0,0,0,0,0,8 +R2-seed,R2,15,5,5,0,0,0,8,0,0,0,0,0,8 +R2-seed,R2,15,6,6,0,0,0,8,0,0,0,0,0,8 +R2-seed,R2,15,,7,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,8,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,9,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,10,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,11,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,12,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,13,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,14,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,,15,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.write_nuc_header(self.report_file) @@ -749,16 +749,16 @@ def testNucleotideReportWithG2pOverlap(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,8 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,8 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,8 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,8 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,8 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,8 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,8,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,8,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,8,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,8,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,8,9 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,8,9 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.write_nuc_header(self.report_file) @@ -781,16 +781,16 @@ def testSoftClippingNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,9,0 -R1-seed,R1,15,2,2,0,0,0,0,0,0,0,9,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,7,7,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,8,8,0,0,0,0,0,0,0,9,0 -R1-seed,R1,15,9,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,9,0,0 +R1-seed,R1,15,2,2,0,0,0,0,0,0,0,9,0,0 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,7,7,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,8,8,0,0,0,0,0,0,0,9,0,0 +R1-seed,R1,15,9,9,0,0,0,0,0,0,0,0,0,0 """ self.report.read_clipping(clipping) @@ -816,10 +816,10 @@ def testSoftClippingAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0 """ self.report.read_clipping(clipping) @@ -847,16 +847,16 @@ def testInsertionBetweenReadAndConsensusNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,2,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,2,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.read_insertions(conseq_ins_csv) @@ -881,10 +881,10 @@ def testInsertionBetweenReadAndConsensusAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.read_insertions(conseq_ins_csv) @@ -915,10 +915,10 @@ def testSubstitutionAtBoundary(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R4-seed,R4,15,10,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0 -R4-seed,R4,15,13,2,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R4-seed,R4,15,16,3,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R4-seed,R4,15,10,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,9 +R4-seed,R4,15,13,2,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R4-seed,R4,15,16,3,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """ self.report.write_amino_header(self.report_file) @@ -990,16 +990,16 @@ def testOffsetNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,1,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,1,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,7,7,0,8,0,0,0,0,0,0,0 -R1-seed,R1,15,8,8,0,0,8,0,0,0,0,0,0 -R1-seed,R1,15,9,9,8,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,2,2,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,3,3,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,4,4,0,0,0,1,0,0,0,0,0,1 +R1-seed,R1,15,5,5,0,0,0,1,0,0,0,0,0,1 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,7,7,0,8,0,0,0,0,0,0,0,8 +R1-seed,R1,15,8,8,0,0,8,0,0,0,0,0,0,8 +R1-seed,R1,15,9,9,8,0,0,0,0,0,0,0,0,8 """ self.report.read(aligned_reads) @@ -1015,16 +1015,16 @@ def testPartialCodonNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) @@ -1040,16 +1040,16 @@ def testLowQualityNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,5,5,0,0,0,0,9,0,0,0,0 -R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,0,9,0,0,0,0,0 +R1-seed,R1,15,6,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,,7,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,8,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1,15,,9,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) @@ -1066,10 +1066,10 @@ def testLowQualityAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) @@ -1086,10 +1086,10 @@ def testPartialDeletionAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) @@ -1112,10 +1112,10 @@ def testShiftedReadingFrameAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,8,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,2,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,5,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,8,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1137,16 +1137,16 @@ def testShiftedReadingFrameNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,2,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,5,4,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,6,5,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,7,6,0,0,0,9,0,0,0,0,0 -R1-seed,R1,15,8,7,0,9,0,0,0,0,0,0,0 -R1-seed,R1,15,9,8,0,0,9,0,0,0,0,0,0 -R1-seed,R1,15,10,9,9,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,2,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,5,4,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,6,5,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,7,6,0,0,0,9,0,0,0,0,0,9 +R1-seed,R1,15,8,7,0,9,0,0,0,0,0,0,0,9 +R1-seed,R1,15,9,8,0,0,9,0,0,0,0,0,0,9 +R1-seed,R1,15,10,9,9,0,0,0,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1167,16 +1167,16 @@ def testDeletionNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,4,0,0,0,0,0,9,0,0,0 -R1-seed,R1,15,5,5,0,0,0,0,0,9,0,0,0 -R1-seed,R1,15,6,6,0,0,0,0,0,9,0,0,0 -R1-seed,R1,15,7,7,9,0,0,0,0,0,0,0,0 -R1-seed,R1,15,8,8,0,0,9,0,0,0,0,0,0 -R1-seed,R1,15,9,9,0,0,9,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,2,2,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,3,3,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,4,0,0,0,0,0,9,0,0,0,9 +R1-seed,R1,15,5,5,0,0,0,0,0,9,0,0,0,9 +R1-seed,R1,15,6,6,0,0,0,0,0,9,0,0,0,9 +R1-seed,R1,15,7,7,9,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,8,8,0,0,9,0,0,0,0,0,0,9 +R1-seed,R1,15,9,9,0,0,9,0,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1197,22 +1197,22 @@ def testDeletionBetweenSeedAndCoordinateNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,9,0,0,0,0,0,0,0,0 -R2-seed,R2,15,2,2,9,0,0,0,0,0,0,0,0 -R2-seed,R2,15,3,3,9,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,4,0,0,0,9,0,0,0,0,0 -R2-seed,R2,15,5,5,0,0,0,9,0,0,0,0,0 -R2-seed,R2,15,6,6,0,0,0,9,0,0,0,0,0 -R2-seed,R2,15,,7,0,0,0,0,0,9,0,0,0 -R2-seed,R2,15,,8,0,0,0,0,0,9,0,0,0 -R2-seed,R2,15,,9,0,0,0,0,0,9,0,0,0 -R2-seed,R2,15,7,10,0,9,0,0,0,0,0,0,0 -R2-seed,R2,15,8,11,0,9,0,0,0,0,0,0,0 -R2-seed,R2,15,9,12,0,9,0,0,0,0,0,0,0 -R2-seed,R2,15,10,13,0,9,0,0,0,0,0,0,0 -R2-seed,R2,15,11,14,0,0,9,0,0,0,0,0,0 -R2-seed,R2,15,12,15,9,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,9,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,2,2,9,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,3,3,9,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,4,4,0,0,0,9,0,0,0,0,0,9 +R2-seed,R2,15,5,5,0,0,0,9,0,0,0,0,0,9 +R2-seed,R2,15,6,6,0,0,0,9,0,0,0,0,0,9 +R2-seed,R2,15,,7,0,0,0,0,0,9,0,0,0,9 +R2-seed,R2,15,,8,0,0,0,0,0,9,0,0,0,9 +R2-seed,R2,15,,9,0,0,0,0,0,9,0,0,0,9 +R2-seed,R2,15,7,10,0,9,0,0,0,0,0,0,0,9 +R2-seed,R2,15,8,11,0,9,0,0,0,0,0,0,0,9 +R2-seed,R2,15,9,12,0,9,0,0,0,0,0,0,0,9 +R2-seed,R2,15,10,13,0,9,0,0,0,0,0,0,0,9 +R2-seed,R2,15,11,14,0,0,9,0,0,0,0,0,0,9 +R2-seed,R2,15,12,15,9,0,0,0,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1234,12 +1234,12 @@ def testDeletionBetweenSeedAndCoordinateAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0 -R2-seed,R2,15,7,4,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,9 +R2-seed,R2,15,7,4,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1260,12 +1260,12 @@ def testDeletionBetweenSeedAndConsensusAminoReport(self): # A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R5-seed,R5,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R5-seed,R5,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R5-seed,R5,15,7,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R5-seed,R5,15,10,4,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R5-seed,R5,15,13,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R5-seed,R5,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R5-seed,R5,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R5-seed,R5,15,7,3,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R5-seed,R5,15,10,4,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R5-seed,R5,15,13,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9 """ self.report.write_amino_header(self.report_file) @@ -1288,10 +1288,10 @@ def testDeletionWithMinorityVariant(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0 -R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7 +R1-seed,R1,15,4,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,7 +R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,7 """ self.report.read(aligned_reads) @@ -1308,10 +1308,10 @@ def testDeletionNotAlignedToCodons(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0 -R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 +R1-seed,R1,15,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,5 +R1-seed,R1,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,5 """ self.report.remap_conseqs = {'R1-seed': 'AAATTTAGG'} @@ -1334,15 +1334,15 @@ def testInsertionBetweenSeedAndCoordinateAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R3-seed,R3,15,10,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,13,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,16,3,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,19,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,9,0,0 -R3-seed,R3,15,25,5,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,28,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,31,7,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,34,8,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R3-seed,R3,15,10,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,13,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,16,3,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,19,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,9,0,0,9 +R3-seed,R3,15,25,5,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,28,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,31,7,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,34,8,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """ expected_insertions = """\ seed,region,qcut,left,insert,count,before @@ -1371,31 +1371,31 @@ def testInsertionBetweenSeedAndCoordinateNucleotideReport(self): R3-seed,15,0,9,0,CATGAGCGAAAATTTCAGACTGGGCCCCGAGAGCATCAGTTTAAA """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R3-seed,R3,15,10,1,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,11,2,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,12,3,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,13,4,0,0,0,9,0,0,0,0,0 -R3-seed,R3,15,14,5,0,0,0,9,0,0,0,0,0 -R3-seed,R3,15,15,6,0,0,0,9,0,0,0,0,0 -R3-seed,R3,15,16,7,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,17,8,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,18,9,0,0,9,0,0,0,0,0,0 -R3-seed,R3,15,19,10,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,20,11,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,21,12,0,0,0,9,0,0,9,0,0 -R3-seed,R3,15,25,13,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,26,14,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,27,15,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,28,16,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,29,17,0,0,9,0,0,0,0,0,0 -R3-seed,R3,15,30,18,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,31,19,0,0,9,0,0,0,0,0,0 -R3-seed,R3,15,32,20,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,33,21,0,0,9,0,0,0,0,0,0 -R3-seed,R3,15,34,22,0,9,0,0,0,0,0,0,0 -R3-seed,R3,15,35,23,9,0,0,0,0,0,0,0,0 -R3-seed,R3,15,36,24,0,0,0,9,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R3-seed,R3,15,10,1,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,11,2,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,12,3,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,13,4,0,0,0,9,0,0,0,0,0,9 +R3-seed,R3,15,14,5,0,0,0,9,0,0,0,0,0,9 +R3-seed,R3,15,15,6,0,0,0,9,0,0,0,0,0,9 +R3-seed,R3,15,16,7,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,17,8,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,18,9,0,0,9,0,0,0,0,0,0,9 +R3-seed,R3,15,19,10,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,20,11,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,21,12,0,0,0,9,0,0,9,0,0,9 +R3-seed,R3,15,25,13,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,26,14,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,27,15,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,28,16,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,29,17,0,0,9,0,0,0,0,0,0,9 +R3-seed,R3,15,30,18,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,31,19,0,0,9,0,0,0,0,0,0,9 +R3-seed,R3,15,32,20,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,33,21,0,0,9,0,0,0,0,0,0,9 +R3-seed,R3,15,34,22,0,9,0,0,0,0,0,0,0,9 +R3-seed,R3,15,35,23,9,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,36,24,0,0,0,9,0,0,0,0,0,9 """ self.report.read(aligned_reads) @@ -1557,12 +1557,12 @@ def testGapBetweenForwardAndReverse(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,10,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,13,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 +R2-seed,R2,15,4,2,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5 +R2-seed,R2,15,7,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,10,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,13,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,5 """ self.report.read(aligned_reads) @@ -1765,16 +1765,16 @@ def testRegionWithoutCoordinateReferenceNucleotideReport(self): """) expected_text = """\ -seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap -R-NO-COORD,R-NO-COORD,15,1,,9,0,0,0,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,2,,9,0,0,0,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,3,,9,0,0,0,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,4,,0,0,0,9,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,5,,0,0,0,9,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,6,,0,0,0,9,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,7,,0,0,0,0,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,8,,0,0,0,0,0,0,0,0,0 -R-NO-COORD,R-NO-COORD,15,9,,0,0,0,0,0,0,0,0,0 +seed,region,q-cutoff,query.nuc.pos,refseq.nuc.pos,A,C,G,T,N,del,ins,clip,g2p_overlap,coverage +R-NO-COORD,R-NO-COORD,15,1,,9,0,0,0,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,2,,9,0,0,0,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,3,,9,0,0,0,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,4,,0,0,0,9,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,5,,0,0,0,9,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,6,,0,0,0,9,0,0,0,0,0,9 +R-NO-COORD,R-NO-COORD,15,7,,0,0,0,0,0,0,0,0,0,0 +R-NO-COORD,R-NO-COORD,15,8,,0,0,0,0,0,0,0,0,0,0 +R-NO-COORD,R-NO-COORD,15,9,,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) @@ -1848,14 +1848,14 @@ def testMultipleCoordinateAminoReport(self): expected_text = """\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1a,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1a,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1a,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1b,15,,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1b,15,1,2,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1b,15,4,3,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1b,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1a,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1a,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1a,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1b,15,,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R1-seed,R1b,15,1,2,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1b,15,4,3,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1b,15,,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """ self.report.read(aligned_reads) diff --git a/micall/tests/hivdb_test.py b/micall/tests/hivdb_test.py index 457e9382a..c4cfeee4d 100644 --- a/micall/tests/hivdb_test.py +++ b/micall/tests/hivdb_test.py @@ -138,13 +138,13 @@ class ReadAminosTest(TestCase): def test_simple(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,7,3,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,7,3,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F'], ['A']])] + expected_aminos = [('R1', [{'K': 1.0}, {'F': 1.0}, {'A': 1.0}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -153,13 +153,13 @@ def test_simple(self): def test_mixtures(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,1,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,2,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,1,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 +R1-seed,R1,15,4,2,2,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['A', 'F'], []])] + expected_aminos = [('R1', [{'K': 0.9}, {'F': 0.8, 'A': 0.2}, {}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -168,13 +168,13 @@ def test_mixtures(self): def test_no_coverage(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F'], []])] + expected_aminos = [('R1', [{'K': 1.0}, {'F': 1.0}, {}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -183,17 +183,17 @@ def test_no_coverage(self): def test_multiple_regions(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F'], []]), - ('R2', [['K'], ['F'], ['C']])] + expected_aminos = [('R1', [{'K': 1.0}, {'F': 1.0}, {}]), + ('R2', [{'K': 1.0}, {'F': 1.0}, {'C': 1.0}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -202,22 +202,22 @@ def test_multiple_regions(self): def test_reported_regions(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R3-seed,R3,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R3-seed,R3,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """) min_fraction = 0.2 reported_regions = {'R1': ['Region1', False], # No data 'R2': ['Region2', True]} # Others are skipped expected_aminos = [('Region1', None), - ('Region2', [['K'], ['F'], ['C']])] + ('Region2', [{'K': 1.0}, {'F': 1.0}, {'C': 1.0}])] aminos = list(read_aminos(amino_csv, min_fraction, @@ -228,15 +228,15 @@ def test_reported_regions(self): def test_missing_region(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R2-seed,R2,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,4,2,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 +R2-seed,R2,15,7,3,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9 """) min_fraction = 0.2 reported_regions = {'R1': ['Region1', False], # No data 'R2': ['Region2', True]} # Others are skipped - expected_aminos = [('Region2', [['K'], ['F'], ['C']]), + expected_aminos = [('Region2', [{'K': 1.0}, {'F': 1.0}, {'C': 1.0}]), ('Region1', None)] aminos = list(read_aminos(amino_csv, @@ -248,13 +248,13 @@ def test_missing_region(self): def test_deletions(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,10 +R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,10 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F', 'd'], []])] + expected_aminos = [('R1', [{'K': 0.9}, {'F': 0.8, 'd': 0.2}, {}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -263,13 +263,13 @@ def test_deletions(self): def test_insertions(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0 -R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,9 +R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,8 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F', 'i'], []])] + expected_aminos = [('R1', [{'K': 1.0}, {'F': 1.0, 'i': 0.25}, {}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -278,13 +278,13 @@ def test_insertions(self): def test_stop_codons(self): amino_csv = StringIO("""\ seed,region,q-cutoff,query.nuc.pos,refseq.aa.pos,\ -A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap -R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0 -R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0 -R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 +A,C,D,E,F,G,H,I,K,L,M,N,P,Q,R,S,T,V,W,Y,*,X,partial,del,ins,clip,g2p_overlap,coverage +R1-seed,R1,15,1,1,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,10 +R1-seed,R1,15,4,2,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,10 +R1-seed,R1,15,,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 """) min_fraction = 0.2 - expected_aminos = [('R1', [['K'], ['F'], []])] + expected_aminos = [('R1', [{'K': 0.9}, {'F': 0.8}, {}])] aminos = list(read_aminos(amino_csv, min_fraction)) @@ -294,7 +294,7 @@ def test_stop_codons(self): class WriteResistanceTest(TestCase): def test_simple(self): self.maxDiff = None - aminos = [('RT', [['A']] * 40 + [['L']])] + aminos = [('RT', [{'A': 1.0}] * 40 + [{'L': 1.0}])] resistance_csv = StringIO() mutations_csv = StringIO() expected_resistance = """\ @@ -312,8 +312,8 @@ def test_simple(self): RT,NNRTI,RPV,rilpivirine,1,Susceptible,0.0 """ expected_mutations = """\ -drug_class,mutation -NRTI,M41L +drug_class,mutation,prevalence +NRTI,M41L,1.0 """ write_resistance(aminos, resistance_csv, mutations_csv) @@ -323,7 +323,7 @@ def test_simple(self): def test_low_coverage(self): aminos = [('PR', None), - ('RT', [['A']] * 40 + [['L']])] + ('RT', [{'A': 1.0}] * 40 + [{'L': 1.0}])] resistance_csv = StringIO() mutations_csv = StringIO() expected_resistance = """\ @@ -349,8 +349,37 @@ def test_low_coverage(self): RT,NNRTI,RPV,rilpivirine,1,Susceptible,0.0 """ expected_mutations = """\ -drug_class,mutation -NRTI,M41L +drug_class,mutation,prevalence +NRTI,M41L,1.0 +""" + + write_resistance(aminos, resistance_csv, mutations_csv) + + self.assertEqual(expected_resistance, resistance_csv.getvalue()) + self.assertEqual(expected_mutations, mutations_csv.getvalue()) + + def test_mixture(self): + self.maxDiff = None + aminos = [('RT', [{'A': 1.0}] * 40 + [{'L': 0.3}])] + resistance_csv = StringIO() + mutations_csv = StringIO() + expected_resistance = """\ +region,drug_class,drug,drug_name,level,level_name,score +RT,NRTI,3TC,lamivudine,1,Susceptible,0.0 +RT,NRTI,ABC,abacavir,1,Susceptible,5.0 +RT,NRTI,AZT,zidovudine,3,Low-Level Resistance,15.0 +RT,NRTI,D4T,stavudine,3,Low-Level Resistance,15.0 +RT,NRTI,DDI,didanosine,2,Potential Low-Level Resistance,10.0 +RT,NRTI,FTC,emtricitabine,1,Susceptible,0.0 +RT,NRTI,TDF,tenofovir,1,Susceptible,5.0 +RT,NNRTI,EFV,efavirenz,1,Susceptible,0.0 +RT,NNRTI,ETR,etravirine,1,Susceptible,0.0 +RT,NNRTI,NVP,nevirapine,1,Susceptible,0.0 +RT,NNRTI,RPV,rilpivirine,1,Susceptible,0.0 +""" + expected_mutations = """\ +drug_class,mutation,prevalence +NRTI,M41L,0.3 """ write_resistance(aminos, resistance_csv, mutations_csv)