Skip to content

Commit

Permalink
Set logging to calculate coverage stats prior to saving the file
Browse files Browse the repository at this point in the history
  • Loading branch information
Orpowell committed Apr 5, 2023
1 parent 1766d79 commit d44895f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions commands/query_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ def query_coverage(blast_path, contig_path):

data_matrix = [contig_dict[k].get_data() for k in contig_dict.keys()]
summary = pd.DataFrame(data_matrix)
logging.info("Saving query coverage data to query_coverage.txt ...")
summary.to_csv("query_coverage.txt", sep="\t")
logging.info(
f"Percentage contigs covering 60 Kb or less: {len(summary[summary[5] < 60000][5]) / len(summary) * 100:.4}% ({len(summary[summary[5] < 60000][5])} of {len(summary)})")
logging.info(
f"Percentage contigs covering 1 Mb or less: {len(summary[summary[5] < 100000][5]) / len(summary) * 100:.4}% ({len(summary[summary[5] < 100000][5])} of {len(summary)})")

logging.info("Saving query coverage data to query_coverage.txt ...")
summary.to_csv("query_coverage.txt", sep="\t")

0 comments on commit d44895f

Please sign in to comment.