Skip to content

Commit

Permalink
Add n mapped and total reads to results.json
Browse files Browse the repository at this point in the history
  • Loading branch information
boydgreenfield committed Apr 1, 2020
1 parent 53f3d15 commit f8ad4af
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions report.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"outputs": [],
"source": [
"samtools_view_output = !samtools view -F 4 $BAM_PATH | wc -l\n",
"n_aligned_reads = int(samtools_view_output[0])"
"n_mapped_reads = int(samtools_view_output[0])"
]
},
{
Expand Down Expand Up @@ -216,7 +216,7 @@
"This report summarizes the detection of SARS-CoV-2, the causative agent of COVID-19, in sample \n",
"<strong>{sample_filename}</strong>. \n",
"This sample contained <strong>{n_reads:,}</strong> reads, with\n",
"<strong>{n_aligned_reads:,}</strong> mapping to the \n",
"<strong>{n_mapped_reads:,}</strong> mapping to the \n",
"<a href='https://www.ncbi.nlm.nih.gov/nuccore/MN908947.3/' target='_blank'>reference</a>. \n",
"Reads cover <strong>{cov:.0%}</strong> of the genome ({cov_10x:.0%} over 10×), with a mean depth of <strong>{depth:.1f}×</strong>.\n",
"A total of <strong>{n_snps}</strong> variant{'s were' if n_snps != 1 else 'was'} detected.\"\"\"\n",
Expand Down Expand Up @@ -345,6 +345,8 @@
"source": [
"# Save a JSON too, including filtered variants <10x\n",
"results = {\n",
" \"n_reads\": n_reads,\n",
" \"n_mapped_reads\": n_mapped_reads,\n",
" \"report_id\": os.environ.get(\"ONE_CODEX_REPORT_UUID\"), \n",
" \"sample_id\": os.environ.get(\"ONE_CODEX_SAMPLE_UUID\"),\n",
" \"variants\": [r.to_dict() for _, r in snp_table.iterrows()]\n",
Expand Down

0 comments on commit f8ad4af

Please sign in to comment.