{% macro format_aa_frequency(freq, percent=True) %}{%
if freq is none %}?{% else %}{{
'{:.0f}'.format(freq*100) if freq >= 0.01 else ('{:.1f}'.format(freq*100) if freq >= 0.001 else '<0.1') }}{{ '%' if percent else '' }}{% endif
%}{% endmacro %}
{% macro format_aa_frequency_tooltip(v_germline_family, aa, freqs) %}
{% if freqs %}
Frequency in {{ v_germline_family }}: {{ aa }}={{ format_aa_frequency(freqs.get(aa, 0) if freqs else none) }}
({%
for aa in sorted(freqs or {}, key=freqs.get, reverse=True)[:3]
%}{% if loop.index != 1 %}, {% endif %}{{aa}}={{ format_aa_frequency(freqs[aa]) }}{%
endfor %})
{% else %}
Frequency for {{ v_germline_family }} not available
{% endif %}
{% endmacro %}
{% macro format_percent_subjects(freq) %}{%
if freq is none %}?{%
elif freq == 0 %}0{%
elif freq >= 0.01 %}{{ '{:.0%}'.format(freq | round(2, 'floor')) }}{%
else %}{{ '{:.1%}'.format(freq | round(3, 'floor')) }}{%
endif %}{%
endmacro %}
{% macro chain_humanness_header(chain_humanness, min_subj) %}
{{ '{:.0%}'.format(chain_humanness.get_oasis_identity(min_subj)) }} OASis identity
|
{{ '{:.0%}'.format(chain_humanness.get_oasis_percentile(min_subj)) }}
OASis percentile
| {{ '{:.0%}'.format(chain_humanness.get_germline_content()) }} germline content
{% endmacro %}
{% macro format_sequence_tooltip(v_germline_family, pos, aa, freqs, non_human_peptides, peptide) %}
{% if freqs %}
{% if freqs.get(aa, 0) < RARE_FAMILY_FREQUENCY %}
{{ aa_name(aa) }} is a rare residue at {{ pos.scheme.title() }} {{ pos }}
({{ format_aa_frequency(freqs.get(aa, 0)) }} frequency in repertoires of {{ v_germline_family }})
{% endif %}
{% else %}
Frequency for {{ v_germline_family }} not available
{% endif %}
{% if non_human_peptides %}
Non-human peptides:
{% for peptide in non_human_peptides %}
{{ peptide.seq }} ({%
if peptide.fraction_oas_subjects is none %}?{%
elif peptide.fraction_oas_subjects == 0 %}NOT PRESENT{%
elif peptide.fraction_oas_subjects >= 0.01 %}{{ '{:.0%} of human subjects'.format(peptide.fraction_oas_subjects | round(2, 'floor')) }}{%
else %}{{ '{:.1%} of human subjects'.format(peptide.fraction_oas_subjects | round(3, 'floor')) }}{%
endif %})
{% endfor %}
{% endif %}
{{ pos.scheme.title() }} {{ pos }} {% if pos.is_in_cdr() %}({{ pos.get_region() }}){% elif is_vernier %}(Vernier zone){% endif %}
{% endmacro %}
{% macro annot_num(num, suffix_many, suffix_one)
%}{{big_number_format(num, precision=0)}}{% if suffix_one and num == 1 %} {{suffix_one}}{% elif suffix_many %} {{suffix_many}}{% endif %}{%
endmacro %}
{% macro oasis_sequence_pair(parental_humanness, humanized_humanness, min_subj, url='', num_germlines=5) %}