Skip to content

Commit

Permalink
Merge pull request #65 from martinghunt/contig_depths_key_error
Browse files Browse the repository at this point in the history
Catch when no coverage from samtools
  • Loading branch information
martinghunt committed Apr 27, 2016
2 parents 1919d33 + 3526173 commit 9ea4ef2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ariba/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,14 @@ def _report_lines_for_one_contig(cluster, contig_name, ref_cov_per_contig, pymum
str(cluster.assembly_compare.percent_identities[contig_name]) if contig_name in cluster.assembly_compare.percent_identities else '0',
contig_name,
str(contig_length), # 9 length of scaffold matching reference
str(round(cluster.total_contig_depths[contig_name] / contig_length, 1)), # 10 mean mapped read depth
]

# it's possible that there is no read depth on an assembled contig
if contig_name in cluster.total_contig_depths:
common_first_columns.append(str(round(cluster.total_contig_depths[contig_name] / contig_length, 1)))
else:
common_first_columns.append('0')

if cluster.ref_sequence.id in cluster.refdata.metadata and len(cluster.refdata.metadata[cluster.ref_sequence.id]['.']) > 0:
free_text_column = ';'.join([x.free_text for x in cluster.refdata.metadata[cluster.ref_sequence.id]['.']])
else:
Expand Down

0 comments on commit 9ea4ef2

Please sign in to comment.