Skip to content

Commit

Permalink
Showing 5 significant figures for floats in Vaxrank reports.
Browse files Browse the repository at this point in the history
  • Loading branch information
julia326 committed Sep 24, 2018
1 parent b29bb57 commit 4225b7d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ vaccine-peptides-report.html
vaccine-peptides-report.pdf
vaccine-peptides-report.xlsx
vaccine-peptides-report.json
vaccine-peptides-all-passing.csv
vaccine-peptides.csv
neoepitope-report.xlsx
all_variants.csv
4 changes: 2 additions & 2 deletions run-vaxrank-b16-test-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ vaxrank \
--mhc-alleles H2-Kb,H2-Db \
--mhc-epitope-lengths 8 \
--padding-around-mutation 0 \
--min-epitope-score 0.0 \
--min-epitope-score 10e-100 \
--num-epitopes-per-peptide 5 \
--output-ascii-report vaccine-peptides-report.txt \
--output-html-report vaccine-peptides-report.html \
Expand All @@ -15,7 +15,7 @@ vaxrank \
--output-neoepitope-report neoepitope-report.xlsx \
--output-json-file vaccine-peptides-report.json \
--output-csv vaccine-peptides.csv \
--output-passing-variants-csv all_variants.csv \
--output-passing-variants-csv vaccine-peptides-all-passing.csv \
--output-reviewed-by "John Doe,Jane Doe" \
--output-final-review "All the Does" \
--output-patient-id "Test Patient"
2 changes: 1 addition & 1 deletion vaxrank/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.7"
__version__ = "0.8.8"
12 changes: 7 additions & 5 deletions vaxrank/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ def make_pdf_report(
f.flush()

options = {
'zoom': 0.6,
'zoom': 0.55,
'margin-top': '20mm'
}

Expand Down Expand Up @@ -449,15 +449,17 @@ def new_columns():
columns[field] = []
return columns

def _str_sig_figs(input, n_sig_figs):
return '{:g}'.format(float('{:.{p}g}'.format(input, p=n_sig_figs)))

def _sanitize(val):
"""
Converts values into display-friendly
"""
if type(val) == bool:
val = int(val)
elif type(val) == float:
val = round(val, 10)
return val
return int(val)
else:
return _str_sig_figs(val, 5)

def resize_columns(worksheet, amino_acids_col, pos_col):
"""
Expand Down

0 comments on commit 4225b7d

Please sign in to comment.