diff --git a/.buildinfo b/.buildinfo new file mode 100644 index 0000000..abdc149 --- /dev/null +++ b/.buildinfo @@ -0,0 +1,4 @@ +# Sphinx build info version 1 +# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. +config: 53b96ff69ff94ca92a8cf411fc29606d +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2668354 --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# GitHub Pages Cache + +Nothing to see here. The contents of this branch are essentially a cache that's not intended to be viewed on github.com. + + +If you're looking to update our documentation, check the relevant development branch's 'docs/' dir. + +For more information on how this documentation is built using Sphinx, Read the Docs, and GitHub Actions/Pages, see: + + * https://tech.michaelaltfield.net/2020/07/18/sphinx-rtd-github-pages-1 diff --git a/_images/dagt.svg b/_images/dagt.svg new file mode 100644 index 0000000..d047a79 --- /dev/null +++ b/_images/dagt.svg @@ -0,0 +1,598 @@ + + + + + + +dag + + + +p0 + +Channel.fromPath + + + +p2 + +validate_sample_table + + + +p0->p2 + + +sample_ch + + + +p6 + +splitCsv + + + +p2->p6 + + + + + +p15 + +collect_phip_data + + + +p2->p15 + + +sample_table + + + +p1 + +Channel.fromPath + + + +p3 + +validate_peptide_table + + + +p1->p3 + + +peptide_ch + + + +p4 + +generate_fasta_reference + + + +p3->p4 + + + + + +p3->p15 + + +peptide_table + + + +p7 + +map + + + +p6->p7 + + + + + +p5 + +generate_index + + + +p4->p5 + + + + + +p8 + +cross + + + +p5->p8 + + + + + +p9 + +map + + + +p8->p9 + + + + + +p7->p8 + + +samples_ch + + + +p10 + +short_read_alignment + + + +p9->p10 + + + + + +p11 + +sam_to_counts + + + +p10->p11 + + + + + +p12 + +sam_to_stats + + + +p10->p12 + + + + + +p13 + +toSortedList + + + +p11->p13 + + + + + +p13->p15 + + + + + +p14 + +toSortedList + + + +p12->p14 + + + + + +p14->p15 + + + + + +p16 + +replicate_counts + + + +p15->p16 + + + + + +p17 + +counts_per_million + + + +p16->p17 + + +ds + + + +p18 + +size_factors + + + +p16->p18 + + +ds + + + +p20 + +edgeR_BEER:to_csv + + + +p16->p20 + + +ds + + + +p19 + +mix + + + +p17->p19 + + + + + +p25 + +cpm_fold_enrichment + + + +p17->p25 + + +phip_data + + + +p26 + +fit_predict_zscore + + + +p17->p26 + + +phip_data + + + +p27 + +concat + + + +p19->p27 + + +auto_stats_ch + + + +p18->p19 + + + + + +p28 + +collect + + + +p27->p28 + + + + + +p21 + +edgeR_BEER:run_edgeR + + + +p20->p21 + + + + + +p22 + +edgeR_BEER:to_xarray + + + +p21->p22 + + + + + +p24 + + + + +p21->p24 + + +rds_data + + + +p22->p27 + + + + + +p25->p27 + + + + + +p26->p27 + + + + + +p29 + +merge_binary_datasets + + + +p28->p29 + + + + + +p30 + +dump_binary + + + +p29->p30 + + +dataset + + + +p32 + +dump_wide_csv + + + +p29->p32 + + +dataset + + + +p33 + +dump_tall_csv + + + +p29->p33 + + +dataset + + + +p31 + + + + +p30->p31 + + +dump_binary + + + +p35 + +split_samples + + + +p32->p35 + + +dump_wide_csv + + + +p36 + +toSortedList + + + +p32->p36 + + +dump_wide_csv + + + +p37 + +splitText + + + +p35->p37 + + + + + +p34 + + + + +p33->p34 + + +dump_tall_csv + + + +p38 + +combine + + + +p37->p38 + + + + + +p36->p38 + + + + + +p40 + +aggregate_organisms + + + +p38->p40 + + + + + +p41 + +flatten + + + +p40->p41 + + + + + +p39 + + + + +p39->p40 + + +public_epitopes_csv + + + +p42 + +toSortedList + + + +p41->p42 + + + + + +p43 + +join_organisms + + + +p42->p43 + + + + + +p44 + + + + +p43->p44 + + + + + diff --git a/_images/esc_prof_compare1.png b/_images/esc_prof_compare1.png new file mode 100644 index 0000000..a4d9559 Binary files /dev/null and b/_images/esc_prof_compare1.png differ diff --git a/_images/esc_prof_compare2.png b/_images/esc_prof_compare2.png new file mode 100644 index 0000000..5c0ddb2 Binary files /dev/null and b/_images/esc_prof_compare2.png differ diff --git a/_images/esc_prof_ot_diagram.png b/_images/esc_prof_ot_diagram.png new file mode 100644 index 0000000..c573e84 Binary files /dev/null and b/_images/esc_prof_ot_diagram.png differ diff --git a/_images/example-counts-R.svg b/_images/example-counts-R.svg new file mode 100644 index 0000000..465d681 --- /dev/null +++ b/_images/example-counts-R.svg @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 +25 +50 +75 +100 + + + + + + + + + +0 +400 +800 +1200 +Locus +# peptide alignments + +infection status + + + + +conv outpatient 30d +healthy adult +Sars-CoV-2 Spike Protein Enrichments + + diff --git a/_images/example-heatmap-Py-2.svg b/_images/example-heatmap-Py-2.svg new file mode 100644 index 0000000..03cf4f4 --- /dev/null +++ b/_images/example-heatmap-Py-2.svg @@ -0,0 +1,3564 @@ + + + + + + + + 2022-09-12T11:32:32.324040 + image/svg+xml + + + Matplotlib v3.5.3, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_images/heatmap_viz_app.png b/_images/heatmap_viz_app.png new file mode 100644 index 0000000..e84cc94 Binary files /dev/null and b/_images/heatmap_viz_app.png differ diff --git a/_images/launch_viz_app.png b/_images/launch_viz_app.png new file mode 100644 index 0000000..039cfda Binary files /dev/null and b/_images/launch_viz_app.png differ diff --git a/_images/logo_to_distr.png b/_images/logo_to_distr.png new file mode 100644 index 0000000..eb4f262 Binary files /dev/null and b/_images/logo_to_distr.png differ diff --git a/_images/logoplot_example.png b/_images/logoplot_example.png new file mode 100644 index 0000000..e5aaa56 Binary files /dev/null and b/_images/logoplot_example.png differ diff --git a/_images/phippery-suite-6.svg b/_images/phippery-suite-6.svg new file mode 100644 index 0000000..9728522 --- /dev/null +++ b/_images/phippery-suite-6.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/_images/query_peptides_viz_app.png b/_images/query_peptides_viz_app.png new file mode 100644 index 0000000..ce21556 Binary files /dev/null and b/_images/query_peptides_viz_app.png differ diff --git a/_images/xarray-format.svg b/_images/xarray-format.svg new file mode 100644 index 0000000..4f7c682 --- /dev/null +++ b/_images/xarray-format.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/_modules/index.html b/_modules/index.html new file mode 100644 index 0000000..4ad6a85 --- /dev/null +++ b/_modules/index.html @@ -0,0 +1,145 @@ + + + + + + Overview: module code — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ +

All modules for which code is available

+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/phippery/eigen.html b/_modules/phippery/eigen.html new file mode 100644 index 0000000..56b8fe6 --- /dev/null +++ b/_modules/phippery/eigen.html @@ -0,0 +1,246 @@ + + + + + + phippery.eigen — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for phippery.eigen

+r"""
+=================
+Eigen
+=================
+
+A method for MDS via Singular Value Decomposition 
+on phip-seq datasets.
+"""
+
+import numpy as np
+from numpy.linalg import svd
+import xarray as xr
+import pandas as pd
+import scipy.stats as st
+import itertools
+import copy
+
+
[docs]def eigenassay_projections( + ds, + data_table="counts", + compute_correlations=False, + return_raw_decomposition=False, + n_eigenvectors=None, +): + + r"""Compute the Singular Value Decomposition + of the enrichment data before projecting each + sample into the first n eigenvectors ("eigenassays") + in the dataset. + + Concretely, given a Matrix of, :math:`X` enrichments in the + `phippery` dataset with shape (peptides, samples). We compute + the decomposition :math:`X = USV^{T}` + + The principal axes in feature space are then represented by the columns of + :math:`V` and represent the direction of maximum variance in the data. + The sample projections into this space are then computed and tied to the + sample annotation in the returned dictionary. + + Parameters + ---------- + ds : xarray.DataSet + The dataset you would like to perform eigen-decomposition on. + + data_table : str + The name of the enrichment layer in the phippery dataset to perform + the operation on. + + compute_correlations : bool + If true, compute the correlation of a sample's true binding enrichments to + the n'th principal axes. These will be added in the same fashion as the sample + scores that are appended to the sample table. + + return_raw_decomposition : bool + If true, include the raw :math:`USV^{T}` decomposition of the enrichment + matrix specified + + n_eigenvectors : int + the number of projections "eigenassay dimensions" to include. + + + Returns + ------- + dict : + 1. The eigenassay projects tied with the appended to sample annotations + included in `ds`. + 2. (optional) The raw "economy" SVD decomposition matrices. + + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + n_eigenvectors = len(ds.sample_id) if n_eigenvectors is None else n_eigenvectors + if n_eigenvectors > len(ds.sample_id): + raise ValueError( + f"n_eigenvectors must be less than or equal to the number of samples in the dataset" + ) + + a = ds[f"{data_table}"].values + U, S, V = svd(a, full_matrices=False) + sam_meta = ds.sample_table.to_pandas() + + z_jk = np.zeros([n_eigenvectors, n_eigenvectors]) + if compute_correlations: + p_jk = np.zeros([n_eigenvectors, n_eigenvectors]) + for j in range(n_eigenvectors): + for k in range(n_eigenvectors): + z_jk[j, k] = np.dot(a[:, j], U[:, k]) + if compute_correlations: + p_jk[j, k] = st.pearsonr(a[:, j], U[:, k])[0] + + for k in range(n_eigenvectors): + sam_meta[f"Eigenassay-{k}-projection"] = z_jk[:, k] + if compute_correlations: + sam_meta[f"Eigenassay-{k}-correlation"] = p_jk[:, k] + + ret = {"sample_eigenassay_projections": sam_meta} + if return_raw_decomposition: + ret["raw_decomposition"] = (U, S, V) + + return ret
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/phippery/escprof.html b/_modules/phippery/escprof.html new file mode 100644 index 0000000..9dd1ab1 --- /dev/null +++ b/_modules/phippery/escprof.html @@ -0,0 +1,448 @@ + + + + + + phippery.escprof — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for phippery.escprof

+r"""
+=================
+Escape Profile
+=================
+
+Use 
+`optimal transport method <https://en.wikipedia.org/wiki/Transportation_theory_(mathematics)>`_
+to compare 
+`phage-dms <https://www.sciencedirect.com/science/article/pii/S2589004220308142>`_
+escape profiles.
+See the escape profile :ref:`description and examples <sec_escape_profile_comparisons>`.
+"""
+
+# dependencies
+import pandas as pd
+import numpy as np
+import xarray as xr
+import ot
+from phippery.utils import id_query
+from Bio.Align import substitution_matrices
+
+
+def _get_aa_ordered_list():
+    """
+    return the ordered list of amino acid.
+    This convention is based on the BLOSUM
+    matrix in biopython and assumed for the
+    binned distribution presenting amino
+    acid contribution to differential
+    selection at a site
+    """
+    return list("ARNDCQEGHILKMFPSTWYV")
+
+
+
[docs]def get_cost_matrix(): + """ + Returns the default 40x40 cost matrix based on BLOSUM62 + and assigns maximum cost to transport between + opposite signed differential selection contributions. + + Returns + ------- + list : + 40x40 matrix (as a list of lists) + """ + + substitution_matrix = substitution_matrices.load("BLOSUM62") + alphabet_list = _get_aa_ordered_list() + Naa = len(alphabet_list) + + # chosen so that range of costs in the + # matrix is within an order of magnitude + nthroot = 7.0 + + # maximum cost assigned by the cost matrix + maxMij = np.exp(np.max(-substitution_matrix) / nthroot) + + cost_matrix = [] + + # first 20 rows + for aa in alphabet_list: + row = [-x / nthroot for x in substitution_matrix[aa, :][:Naa]] + cost_row = (np.exp(row)).tolist() + [maxMij for i in range(Naa)] + cost_matrix.append(cost_row) + + # last 20 rows + for aa in alphabet_list: + row = [-x / nthroot for x in substitution_matrix[aa, :][:Naa]] + cost_row = [maxMij for i in range(Naa)] + (np.exp(row)).tolist() + cost_matrix.append(cost_row) + + return cost_matrix
+ + +
[docs]def get_loc_esc_distr(ds, metric, sample_factor, sfact_val, loc): + """ + Returns the normalized distribution represented as a list + for the amino acid pattern of scaled differential + selection for a specified individual and amino acid site. + + Parameters + ---------- + ds : xarray.DataSet + The dataset containing the sample of interest. + + metric : str + The name of the scaled differential selection data in ds. + + sample_factor : str + The sample annotation label to identify the individual sample (e.g. 'sample_ID'). + + sfact_val : str + The sample_factor value to identify the sample of interest. + + loc : int + The location number for the amino acid site of interest. + + Returns + ------- + list : + The relative contributions to the total absolute scaled differential selection at the site. + The first 20 entries are contributions to negative selection (binding loss). + The last 20 entries are contributions to positive selection (binding gain). + """ + + # Code assumes peptide annotation for location is called 'Loc', + # and for amino acid substitution is called 'aa_sub' + my_ds = ds.loc[ + dict( + peptide_id=id_query(ds, f"Loc == '{loc}'", "peptide"), + sample_id=id_query(ds, f"{sample_factor} == '{sfact_val}'") + ) + ] + + diff_sel = my_ds[metric].to_pandas().to_numpy().flatten() + + my_df = my_ds.peptide_table.loc[:, ["aa_sub"]].to_pandas() + my_df["diff_sel"] = diff_sel + + esc_data_neg = [] + esc_data_pos = [] + for aa in _get_aa_ordered_list(): + val = my_df[my_df["aa_sub"] == aa]["diff_sel"].item() + if val > 0: + esc_data_neg.append(0) + esc_data_pos.append(val) + else: + esc_data_neg.append(-val) + esc_data_pos.append(0) + + esc_data = esc_data_neg + esc_data_pos + + if np.sum(esc_data) == 0: + return esc_data + else: + return esc_data / np.sum(esc_data)
+ + +def _get_weights(ds, metric, sample_factor, sfact_val1, sfact_val2, loc_start, loc_end): + """ + return the list of weights for computing the + weighted sum of similarity scores in region + [loc_start, loc_end] + """ + + # Code assumes peptide annotation for location is called 'Loc' + + loc_sums1 = [] + loc_sums2 = [] + for loc in range(loc_start, loc_end + 1): + ds1 = ds.loc[ + dict( + peptide_id=id_query(ds, f"Loc == '{loc}'", "peptide"), + sample_id=id_query(ds, f"{sample_factor} == '{sfact_val1}'") + ) + ] + + diff_sel1 = ds1[metric].to_pandas().to_numpy().flatten() + loc_sums1.append(0) + for val in diff_sel1: + loc_sums1[-1] = loc_sums1[-1] + abs(val) + + ds2 = ds.loc[ + dict( + peptide_id=id_query(ds, f"Loc == '{loc}'", "peptide"), + sample_id=id_query(ds, f"{sample_factor} == '{sfact_val2}'") + ) + ] + + diff_sel2 = ds2[metric].to_pandas().to_numpy().flatten() + loc_sums2.append(0) + for val in diff_sel2: + loc_sums2[-1] = loc_sums2[-1] + abs(val) + + loc_sums1 = loc_sums1 / np.sum(loc_sums1) + loc_sums2 = loc_sums2 / np.sum(loc_sums2) + + weights = {} + total = 0 + for i, loc in zip(range(loc_end - loc_start + 1), range(loc_start, loc_end + 1)): + val = min(loc_sums1[i], loc_sums2[i]) + total = total + val + weights[loc] = val + + weights = {k: v / total for k, v in weights.items()} + + return weights + + +
[docs]def compute_sim_score(a, b, cost_matrix): + """ + Returns the similarity score given + two distributions and the cost matrix. + + Parameters + ---------- + a : list + A distribution of relative contribution for each amino acid to scaled differential selection. + + b : list + Another distribution of relative contribution for each amino acid to scaled differential selection. + + cost_matrix : list + The cost matrix to evaluate optimal transport from a to b. + + Returns + ------- + float : + The similarity score (reciprocal of the optimal transport cost). + """ + + if np.sum(a) == 0 or np.sum(b) == 0: + return 0 + + cost = ot.emd2(a, b, cost_matrix) + return 1.0 / cost
+ + +
[docs]def loc_sim_score(ds, metric, cost_matrix, sample_factor, sfact_val1, sfact_val2, loc): + """ + Returns the similarity score for comparison at a site between two samples. + + Parameters + ---------- + ds : xarray.DataSet + The dataset containing the sample of interest. + + metric : str + The name of the scaled differential selection data in ds. + + cost_matrix : list + The cost matrix to evaluate optimal transport between two distributions. + + sample_factor : str + The sample annotation label to identify the samples (e.g. 'sample_ID'). + + sfact_val1 : str + The sample_factor value to identify sample 1. + + sfact_val2 : str + The sample_factor value to identify sample 2. + + loc : int + The location number for the amino acid site of interest. + + Returns + ------- + float : + The similarity score at the amino acid site. + """ + + a = get_loc_esc_distr(ds, metric, sample_factor, sfact_val1, loc) + b = get_loc_esc_distr(ds, metric, sample_factor, sfact_val2, loc) + + return compute_sim_score(a, b, cost_matrix)
+ + +
[docs]def region_sim_score( + ds, metric, cost_matrix, sample_factor, sfact_val1, sfact_val2, loc_start, loc_end +): + """ + Returns the similarity score for comparison in the + region [loc_start, loc_end]. + + Parameters + ---------- + ds : xarray.DataSet + The dataset containing the sample of interest + + metric : str + The name of the scaled differential selection data in ds. + + cost_matrix : list + The cost matrix to evaluate optimal transport between two distributions. + + sample_factor : str + The sample annotation label to identify the samples (e.g. 'sample_ID'). + + sfact_val1 : str + The sample_factor value to identify sample 1. + + sfact_val2 : str + The sample_factor value to identify sample 2. + + loc_start : int + The location number for the first amino acid site in the region of interest. + + loc_end : int + The location number for the last amino acid site in the region of interest. + + Returns + ------- + float : + The similarity score for the region. + """ + + weights = _get_weights( + ds, metric, sample_factor, sfact_val1, sfact_val2, loc_start, loc_end + ) + region_sim = 0 + for loc in range(loc_start, loc_end + 1): + sim = weights[loc] * loc_sim_score( + ds, metric, cost_matrix, sample_factor, sfact_val1, sfact_val2, loc + ) + region_sim = region_sim + sim + + return region_sim
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/phippery/modeling.html b/_modules/phippery/modeling.html new file mode 100644 index 0000000..b77ece2 --- /dev/null +++ b/_modules/phippery/modeling.html @@ -0,0 +1,343 @@ + + + + + + phippery.modeling — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for phippery.modeling

+r"""
+=================
+Modeling
+=================
+
+A collection of interfaces for modeling binding enrichments,
+and estimating significance.
+"""
+
+import numpy as np
+import xarray as xr
+import copy
+import scipy.stats as st
+from phippery.gampois import fit_gamma
+from phippery.gampois import gamma_poisson_posterior_rates
+from phippery.gampois import mlxp_gamma_poisson
+from phippery.zscore import zscore_pids_binning
+from phippery.zscore import compute_zscore
+
+
+
[docs]def gamma_poisson_model( + ds, + starting_alpha=0.8, + starting_beta=0.1, + trim_percentile=99.9, + data_table="size_factors", + inplace=True, + new_table_name="gamma_poisson_mlxp", +): + r"""Fit a Gamma distribution to determine Poisson rates + per peptide for the non-specific binding background and estimate the + :math:`-\log_{10}(p)` value, or *mlxp*, + for each sample-peptide enrichment in the dataset provided. + We use the following parameterization of the Gamma distribution: + + .. math:: + f(x) = \frac{\beta^\alpha}{\Gamma(\alpha)}x^{\alpha-1}e^{-\beta x} + + The fit is performed on the distribution of peptide average counts to + obtain :math:`\alpha` and :math:`\beta`. If there are :math:`n` + samples involved in the fit, and for a given peptide with counts + :math:`x_1, x_2, \ldots, x_n`, the background Poisson distribution + is determined by the rate, + + .. math:: + \lambda = \frac{\alpha + \sum^n_{k=1} x_k}{\beta + n} + + Note + ---- + much of this source code is derived from + https://github.com/lasersonlab/phip-stat + and written by Uri Laserson. + + + Parameters + ---------- + ds : xarray.DataSet + The dataset you would like to fit to. + + starting_alpha : float + Initial value for the shape parameter of the Gamma distribution. + + starting_beta : float + Initial value for the rate parameter of the Gamma distribution. + + trim_percentile : float + The percentile cutoff for removing peptides with very high counts. + (e.g. a value of 98 means peptides in the highest 2% in counts + would be removed from the fit) + This parameter is used to remove potential signal peptides that + would bias the fit. + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + Returns + ------- + tuple : + the alpha, and beta values of the fit. If inplace is false, a copy of the new dataset + is returned first. + """ + + print( + f"Running new modeling with starting alpha = {starting_alpha}, beta = {starting_beta}" + ) + + if data_table not in ds: + raise KeyError(f"{data_table} is not included in dataset.") + + counts = copy.deepcopy(ds[f"{data_table}"].to_pandas()) + counts = counts.round(2) + + upper_bound = st.scoreatpercentile(counts.values, trim_percentile) + trimmed_means = np.ma.mean( + np.ma.masked_greater(counts.values, upper_bound), axis=1 + ).data + alpha, beta = fit_gamma( + trimmed_means, starting_alpha=starting_alpha, starting_beta=starting_beta + ) + background_rates = gamma_poisson_posterior_rates(counts, alpha, beta, upper_bound) + counts.loc[:, :] = mlxp_gamma_poisson(counts, background_rates) + + if inplace: + ds[new_table_name] = xr.DataArray(counts, dims=ds[data_table].dims) + return (alpha, beta) + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = xr.DataArray(counts, dims=ds[data_table].dims) + return (alpha, beta), ds_copy
+ + +
[docs]def zscore( + ds, + beads_ds, + data_table="cpm", + min_Npeptides_per_bin=300, + lower_quantile_limit=0.05, + upper_quantile_limit=0.95, + inplace=True, + new_table_name="zscore", +): + r"""Calculate a Z-score of empirical enrichment relative to + expected background mean CPM (:math:`\mu`) and stddev CPM (:math:`\sigma`) + from beads-only samples, + for each sample-peptide enrichment in the dataset provided. + For a peptide with CPM :math:`n`, the Z-score is, + + .. math:: + z = \frac{n - \mu}{\sigma} + + Note + ---- + This implementation follows the method described in the + supplement to DOI:10.1126/science.aay6485. + + Parameters + ---------- + ds : xarray.DataSet + The dataset containing samples to estimate significance on. + + beads_ds : xarray.DataSet + The dataset containing beads only control samples to estimate + background means and stddevs. + + min_Npeptides_per_bin : int + Minimum number of peptides per bin. + + lower_quantile_limit : float + Counts below this quantile are ignored for computing background mean and stddev. + + upper_quantile_limit : float + Counts above this quantile are ignored for computing background mean and stddev. + + data_table : str + The name of the enrichment layer from which you would like to compute Z-scores. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + Returns + ------- + None, xarray.DataSet : + If inplace is false, a copy of the new dataset is returned. + """ + # This is a wrapper function for our xarray dataset. + + # for each sample in the dataset provided, compute Z-score following the method described + # in the supplement to DOI:10.1126/science.aay6485 + + # If 'inplace' parameter is True, then this function + # appends a dataArray to ds which is indexed with the same coordinate dimensions as + #'data_table'. If False, a copy of ds is returned with the appended dataArray + # """ + + binning = zscore_pids_binning(beads_ds, data_table, min_Npeptides_per_bin) + + zscore_table = copy.deepcopy(ds[f"{data_table}"].to_pandas()) + zs_df, mu_df, sigma_df = compute_zscore( + ds, data_table, binning, lower_quantile_limit, upper_quantile_limit + ) + zscore_table.loc[:, :] = zs_df + + if inplace: + ds[new_table_name] = xr.DataArray(zscore_table, dims=ds[data_table].dims) + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = xr.DataArray(zscore_table, dims=ds[data_table].dims) + return ds_copy
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/phippery/normalize.html b/_modules/phippery/normalize.html new file mode 100644 index 0000000..51af127 --- /dev/null +++ b/_modules/phippery/normalize.html @@ -0,0 +1,1160 @@ + + + + + + phippery.normalize — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for phippery.normalize

+"""
+=================
+Normalize
+=================
+
+A set of useful functions for normalizing enrichments
+in a phippery dataset.
+"""
+
+import numpy as np
+from numpy.linalg import svd
+import xarray as xr
+import pandas as pd
+import copy
+
+from phippery.utils import iter_groups
+from phippery.utils import id_query
+from phippery.utils import to_tall
+
+
+
[docs]def standardized_enrichment( + ds, + lib_ds, + beads_ds, + data_table="counts", + inplace=True, + new_table_name="std_enrichment", +): + """Compute standardized enrichment of sample counts. + This is the *fold enrichment* of each sample's frequency + compared to the library average frequency, minus the mock IP + (beads only control) frequency. + + Note + ---- + Psuedo counts and exact calculation are + derived from the Bloom Lab's formulated normalization + heuristic for differential selection. See + https://jbloomlab.github.io/dms_tools2/diffsel.html#id5 + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + lib_ds : xarray.DataSet + The dataset of phage library control samples used in normalization + + beads_ds : xarray.DataSet + The dataset of beads only control samples used in normalization + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + + Example + ------- + Given a dataset, ``ds``, with the following samples and + counts across 10 peptides: + + >>> phippery.get_annotation_table(ds, "sample") + sample_metadata fastq_filename reference seq_dir sample_type + sample_id + 0 sample_0.fastq refa expa beads_only + 1 sample_1.fastq refa expa beads_only + 2 sample_2.fastq refa expa library + 3 sample_3.fastq refa expa library + 4 sample_4.fastq refa expa IP + 5 sample_5.fastq refa expa IP + 6 sample_6.fastq refa expa IP + 7 sample_7.fastq refa expa IP + 8 sample_8.fastq refa expa IP + 9 sample_9.fastq refa expa IP + >>> ds.counts + <xarray.DataArray 'counts' (peptide_id: 5, sample_id: 10)> + array([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], + [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]]) + Coordinates: + * sample_id (sample_id) int64 0 1 2 3 4 5 6 7 8 9 + * peptide_id (peptide_id) int64 0 1 2 3 4 + + First, separate the dataset into it's various samples types using + :func:`phippery.utils.ds_query` + + >>> ip_ds = ds_query(ds, "sample_type == 'IP'") + >>> lib_ds = ds_query(ds, "sample_type == 'library'") + >>> mockip_ds = ds_query(ds, "sample_type == 'beads_only'") + + We can then compute standardized fold enrichment like so: + + >>> phippery.normalize.standardized_enrichment(ip_ds, lib_ds, mockip_ds) + + which will modify the ``ip_ds`` dataset inplace to include a new table + + >>> ip_ds.std_enrichment + <xarray.DataArray 'std_enrichment' (peptide_id: 5, sample_id: 6)> + array([[0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0.], + [0., 0., 0., 0., 0., 0.]]) + Coordinates: + * sample_id (sample_id) int64 4 5 6 7 8 9 + * peptide_id (peptide_id) int64 0 1 2 3 4 + + Note that we expect the result to be all zeros because + a 1-to-1 fold enrichment for ip's to library samples minus + 1-to-1 beads to library + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + for control in [lib_ds, beads_ds]: + if not isinstance(control, xr.Dataset): + raise ValueError( + "ds_lib_control_indices must be of type list, even if there is only a single value" + ) + + std_enrichments = xr.DataArray( + _comp_std_enr( + counts=ds[data_table].to_pandas(), + lib_counts=lib_ds[data_table].to_pandas(), + mock_ip_counts=beads_ds[data_table].to_pandas(), + ), + dims=ds[data_table].dims, + ) + + if inplace: + ds[new_table_name] = std_enrichments + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = std_enrichments + return ds_copy
+ + +def _comp_std_enr(counts, lib_counts, mock_ip_counts): + """Computes standardized enrichment.""" + + normalized_ds_counts = copy.deepcopy(counts) + + # find controls and average all + ds_lib_counts_mean = lib_counts.mean(axis=1) + ds_bead_counts_mean = mock_ip_counts.mean(axis=1) + ds_lib_counts_mean_sum = sum(ds_lib_counts_mean) + + # compute beads control std enrichment + pseudo_sample = ds_bead_counts_mean + max( + 1, sum(ds_bead_counts_mean) / ds_lib_counts_mean_sum + ) + pseudo_lib_counts = ds_lib_counts_mean + max( + 1, ds_lib_counts_mean_sum / sum(ds_bead_counts_mean) + ) + pseudo_sample_freq = pseudo_sample / sum(pseudo_sample) + pseudo_lib_counts_freq = pseudo_lib_counts / sum(pseudo_lib_counts) + pseudo_bead_enrichment = pseudo_sample_freq / pseudo_lib_counts_freq + + # compute all sample standardized enrichment + for sample_id, sample in counts.items(): + pseudo_sample = sample + max(1, sum(sample) / ds_lib_counts_mean_sum) + pseudo_lib_counts = ds_lib_counts_mean + max( + 1, ds_lib_counts_mean_sum / sum(sample) + ) + pseudo_sample_freq = pseudo_sample / sum(pseudo_sample) + pseudo_lib_counts_freq = pseudo_lib_counts / sum(pseudo_lib_counts) + sample_enrichment = pseudo_sample_freq / pseudo_lib_counts_freq + normalized_ds_counts.loc[:, sample_id] = ( + sample_enrichment - pseudo_bead_enrichment + ) + + return normalized_ds_counts + + +
[docs]def enrichment( + ds, + lib_ds, + data_table="counts", + inplace=True, + new_table_name="enrichment", +): + """This function computes fold enrichment in the same fashion as + the **standardized_enrichment**, but does *not* subtract beads only controls + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + lib_ds : xarray.DataSet + The dataset of phage library control samples used in normalization + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + if not isinstance(lib_ds, xr.Dataset): + raise ValueError( + "ds_lib_control_indices must be of type list, even if there is only a single value" + ) + + enrichments = xr.DataArray( + _comp_enr( + counts=ds[data_table].to_pandas(), lib_counts=lib_ds[data_table].to_pandas() + ), + dims=ds[data_table].dims, + ) + + if inplace: + ds[new_table_name] = enrichments + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = enrichments + return ds_copy
+ + +def _comp_enr(counts, lib_counts): + """Compute enrichment values.""" + + # we are going to add an augmented counts matrix + enrichments = copy.deepcopy(counts) + + # find controls and average all + lib_counts_mean = lib_counts.mean(axis=1) + lib_counts_mean_sum = sum(lib_counts_mean) + + # compute all sample standardized enrichment + for sample_id, sample in enrichments.items(): + + pseudo_sample = sample + max(1, sum(sample) / lib_counts_mean_sum) + pseudo_lib_control = lib_counts_mean + max(1, lib_counts_mean_sum / sum(sample)) + pseudo_sample_freq = pseudo_sample / sum(pseudo_sample) + pseudo_lib_control_freq = pseudo_lib_control / sum(pseudo_lib_control) + sample_enrichment = pseudo_sample_freq / pseudo_lib_control_freq + enrichments.loc[:, sample_id] = sample_enrichment + + return enrichments + + +
[docs]def svd_rank_reduction( + ds, + rank=1, + data_table="enrichment", + inplace=True, + new_table_name="svd_rr", +): + r""" + This function computes the singular value decomposition, + then recomputes the enrichment matrix up to the rank specified. + + Concretely, given a Matrix of, :math:`X` enrichments in the + `phippery` dataset with shape (peptides, samples). We compute + the decomposition :math:`X = USV^{T}`, then return the + recomposition using the first + ``rank`` eigenvectors and eigenvalues. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + rank : int + The number of ranks to include in the reconstruction. + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + low_rank_dt = copy.deepcopy(ds[data_table].to_pandas()) + + # compute rank reduction decomposition matrices + U, S, V = svd(low_rank_dt.values) + + # Grab the first X outer products in the finite summation of rank layers. + low_rank = U[:, :rank] @ np.diag(S[:rank]) @ V[:rank, :] + low_rank_dt.loc[:, :] = low_rank + svd_rr_approx = xr.DataArray(low_rank_dt, dims=ds[data_table].dims) + + if inplace: + ds[new_table_name] = svd_rr_approx + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = svd_rr_approx + return ds_copy
+ + +
[docs]def svd_aa_loc( + ds, + rank=1, + data_table="enrichment", + protein_name_column="Protein", + location_col="Loc", + aa_sub_col="aa_sub", + inplace=True, + new_table_name="svd_rr", +): + """ + Compute singular value decomposition rank reduction + on the aa / loc matrix by pivoting before computing decomposition + and re-shaping to add to the dataset. + + Note + ---- + + This function is meant to be used specifically with phage-dms data + where the peptide table includes a "loc" column, and an "aa_sub_col" + which specifies the amino acid at that location. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + protein_name_column : str + The peptide table feature which specifies which protein a specific peptide + derives from. + + location_col : str + The peptide table feature which specifies the site that a particular peptide + is centered at. + + aa_sub_col : str + The peptide table feature which specifies the amino acid at a given site. + + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + low_rank_dt = copy.deepcopy(ds[data_table].to_pandas()) + + for prot, prot_ds in iter_groups(ds, protein_name_column, "peptide"): + + for sid in prot_ds.sample_id.values: + + # grab the single sample ds + rep_ds = prot_ds.loc[ + dict( + sample_id=[sid], + sample_metadata=["sample_ID"], + peptide_metadata=[aa_sub_col, location_col], + ) + ] + + # melt + tall = to_tall(rep_ds) + + # Pivot so that we get the (aa X Loc) + piv = tall.pivot(index=aa_sub_col, columns=location_col, values=data_table) + + # Preserve the indices for population of new enrichment table + piv_index = tall.pivot( + index=aa_sub_col, columns=location_col, values="peptide_id" + ) + + # compute rank reduction decomposition matrices + U, S, V = svd(piv) + + # Grab the first X outer products in the finite summation of rank layers. + low_rank = U[:, :rank] @ np.diag(S[:rank]) @ V[:rank, :] + + low_rank_piv = pd.DataFrame(low_rank, index=piv.index, columns=piv.columns) + melted_values = pd.melt(low_rank_piv.reset_index(), id_vars=[aa_sub_col]) + melted_index = pd.melt(piv_index.reset_index(), id_vars=[aa_sub_col]) + melted_values["peptide_id"] = melted_index["value"] + low_rank_dt.loc[melted_values["peptide_id"], sid] = melted_values[ + "value" + ].values + + svd_rr_approx = xr.DataArray(low_rank_dt, dims=ds[data_table].dims) + + if inplace: + ds[new_table_name] = svd_rr_approx + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = svd_rr_approx + return ds_copy
+ + +
[docs]def differential_selection_wt_mut( + ds, + data_table="enrichment", + scaled_by_wt=False, + smoothing_flank_size=0, + groupby=["Protein"], + loc_column="Loc", + is_wt_column="is_wt", + inplace=True, + new_table_name="wt_mutant_differential_selection", + relu_bias=None, + skip_samples=set(), +): + r"""A generalized function to compute differential selection + of amino acid variants in relation to the wildtype sequence. + The function computed log fold change between enrichments + of a wildtype and mutation at any given site. + + Concretely, given some site, :math:`s` (defined by `loc_column` + feature in the peptide table) in the enrichment + matrix, :math:`X`, + the differential selection of any mutation with enrichment, :math:`m`, + at a site with wildtype enrichment, :math:`wt`, is :math:`\log_{2}(m/wt)`. + + Note + ---- + + This function is meant to be used specifically with phage-dms data + where the peptide table includes a "loc" column, and an "aa_sub_col" + which specifies the amino acid at that location. + + Note + ---- + This calculation of differential selection + is derived from the Bloom Lab's formulated from + https://jbloomlab.github.io/dms_tools2/diffsel.html#id5 + + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + scaled_by_wt : bool + A boolean flag indicating whether or not you would like to multiply the + differential selection value by the wildtype enrichment + + smoothing_flank_size : int + This parameter should only be used if **scaled_by_wt** is true. + By specifying an integer greater than 0, you are scaling the differential + selection value by enrichment values of the wildtype peptides surrounding + , in both directions, a given site. The integer specified here then + determines how many peptides are used for the scaling in both directions. + + groupby: list[str] + This will specify which peptide feature groups such that site-mutation + combinations are unique. + + loc_column : str + The peptide table feature which specifies the site that a particular peptide + is centered at. + + is_wt_column : str + The column specifying which peptides are wildtype. + + relu_bias : int + If an integer is specified, then enrichment values less than + 1 are replaced by the specified value before computing differential + selection. + + skip_samples : set + sample id's which you do not want to calculate the differential selection on, + such as controls. This function has many nested loops, so avoid computing + on unnecessary samples. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + diff_sel = copy.deepcopy(ds[data_table]) + sw = smoothing_flank_size + + for group, group_ds in iter_groups(ds, groupby, "peptide"): + + wt_pep_id = id_query(group_ds, f"{is_wt_column} == True", "peptide") + + group_loc = group_ds.peptide_table.loc[wt_pep_id, loc_column].values + for i, loc in enumerate(group_loc): + + loc_pid = id_query(group_ds, f"{loc_column} == {loc}", "peptide") + loc_ds = group_ds.loc[dict(peptide_id=loc_pid)] + + # check that skip samples is of type list + sams = set(loc_ds.sample_id.values) - set(skip_samples) + for sam_id in sams: + + wt_seq_enr = group_ds[data_table].loc[wt_pep_id, sam_id].values + wt_enrichment = float(wt_seq_enr[i]) + scalar = ( + _wt_window_scalar(list(wt_seq_enr), i, sw) if scaled_by_wt else 1 + ) + values = loc_ds[data_table].loc[:, sam_id].values + + if relu_bias is not None: + values[values < 1] = relu_bias + dsel = _comp_diff_sel(wt_enrichment, values, scalar) + + diff_sel.loc[list(loc_ds.peptide_id.values), sam_id] = dsel + assert diff_sel.loc[wt_pep_id[0], sam_id] == 0.0 + + if inplace: + ds[new_table_name] = diff_sel + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = diff_sel + return ds_copy
+ + +def _wt_window_scalar(wt_enr, i, flank_size): + """ + Get a scalar from a wt sequence with a certain flank size. + """ + + if flank_size == 0: + return wt_enr[i] + + lcase = i - flank_size < 0 + rcase = i + flank_size + 1 > len(wt_enr) + lflank = wt_enr[i - flank_size : i] if not lcase else wt_enr[:i] + rflank = wt_enr[i : i + flank_size + 1] if not rcase else wt_enr[i:] + window_enr = lflank + rflank + return sum(window_enr) / len(window_enr) + + +
[docs]def differential_selection_sample_groups( + ds, + sample_feature="library_batch", + is_equal_to="batch_a", + data_table="counts", + aggregate_function=np.mean, + inplace=True, + new_table_name="sample_group_differential_selection", +): + """This function computes differential selection + between groups of samples. + + Note + ---- + This function is still experimental. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + + + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + diff_sel = copy.deepcopy(ds[data_table]) + group_id = id_query(ds, f"{sample_feature} == '{is_equal_to}'") + group_enrichments = ds[data_table].loc[:, group_id].values + group_agg = np.apply_along_axis(aggregate_function, 1, group_enrichments) + for agg_enrich, peptide_id in zip(group_agg, ds.peptide_id.values): + all_other_sample_values = ds[data_table].loc[peptide_id, :].values + peptide_diff_sel = _comp_diff_sel(agg_enrich, all_other_sample_values) + diff_sel.loc[peptide_id, :] = peptide_diff_sel + + if inplace: + ds[new_table_name] = diff_sel + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = diff_sel + return ds_copy
+ + +def _comp_diff_sel(base, all_other_values, scalar=1): + """ + a private function to compute differential selection of one values to a list of other values. + Optionally, you can scale each of the differential selection values by the base if desired. + """ + + if np.any(np.array(all_other_values) == 0): + raise ZeroDivisionError( + "All values for which we are computing differential selection must be non-zero" + ) + diff_sel = np.array([np.log2(v / base) for v in all_other_values]) + return diff_sel * scalar + + +
[docs]def size_factors(ds, inplace=True, data_table="counts", new_table_name="size_factors"): + r""" + Warning + ------- + This method is deprecated. It is currently maintained only for reproducibility of previous results. + + + Compute size factors from + `Anders and Huber 2010 + <https://genomebiology.biomedcentral.com/articles/10.1186/gb-2010-11-10-r106>`_. + + Concretely, given a Matrix of enrichments, :math:`X_{i,j}`, in the + `phippery` dataset with shape (peptides, samples). Consider a *pseudo-reference sample* + where the count of each peptide is the geometric mean of counts for that peptide across + the samples in the dataset. For a sample to be normalized, calculate for each peptide + the ratio of peptide count in the sample to the peptide count in the pseudo-reference + sample. The median of this ratio, :math:`\hat S_{j}`, is the size factor to normalize + all counts in sample :math:`j`, + + .. math:: + \hat S_{j} = {median \atop i} \frac{X_{i,j}}{(\prod_{v=1}^{m}{X_{i,v}})^{1/m}} + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + size_factors = _comp_size_factors(ds[data_table].to_pandas().values) + sf_da = xr.DataArray(size_factors, dims=ds[data_table].dims) + + if inplace: + ds[new_table_name] = sf_da + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = sf_da + return ds_copy
+ + +def _comp_size_factors(counts): + + size_factors = copy.deepcopy(counts) + masked = np.ma.masked_equal(counts, 0) + + if not isinstance(masked.mask, np.ndarray): + bool_mask = np.full(counts.shape, False, dtype=bool) + else: + bool_mask = ~masked.mask + + geom_means = ( + np.ma.exp(np.ma.log(masked).sum(axis=1) / (bool_mask).sum(axis=1)) + .data[np.newaxis] + .T + ) + + size_factors = ( + size_factors / np.ma.median(masked / geom_means, axis=0).data + ).round(2) + + return size_factors + + +
[docs]def counts_per_million( + ds, inplace=True, new_table_name="cpm", per_sample=True, data_table="counts" +): + r"""Compute counts per million. + + Concretely, given a Matrix of enrichments, :math:`X`, in the + `phippery` dataset with shape P peptides and S samples, + we compute the :math:`i^{th}` peptide and :math:`j^{th}` sample position like so: + + .. math:: + + \text{cpm}(X,i,j) = \left\{ + \begin{array}{@{}ll@{}} + X_{i,j}/\sum_{p\in P} X_{p,j} \times 10^6, & \text{if per_sample is True} \\[10pt] + X_{i,j}/\sum_{p\in P}\sum_{s\in S} X_{p,s} \times 10^6, & \text{if per_sample is False} + \end{array} + \right. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + per_sample : bool + If True, compute counts per million separately for each sample. + Otherwise, frequencies are computed as a ratio of each count to the sum of + all counts in the dataset. + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + + Example + ------- + + >>> ds.counts.values + array([[8, 8, 3, 1], + [1, 3, 7, 4], + [9, 0, 5, 1], + [5, 2, 4, 4], + [1, 4, 1, 3], + [3, 4, 4, 0], + [4, 8, 2, 7], + [4, 3, 6, 5], + [0, 2, 9, 1], + [0, 5, 6, 5]]) + >>> from phippery.normalize import counts_per_million + >>> counts_per_million(ds, new_table_name="cpm", inplace=True) + >>> ds.cpm.values + array([[228571.43, 205128.21, 63829.79, 32258.06], + [ 28571.43, 76923.08, 148936.17, 129032.26], + [257142.86, 0. , 106382.98, 32258.06], + [142857.14, 51282.05, 85106.38, 129032.26], + [ 28571.43, 102564.1 , 21276.6 , 96774.19], + [ 85714.29, 102564.1 , 85106.38, 0. ], + [114285.71, 205128.21, 42553.19, 225806.45], + [114285.71, 76923.08, 127659.57, 161290.32], + [ 0. , 51282.05, 191489.36, 32258.06], + [ 0. , 128205.13, 127659.57, 161290.32]]) + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + counts = ds[data_table].to_pandas().values + cpm = _comp_cpm_per_sample(counts) if per_sample else _comp_cpm(counts) + cpm_da = xr.DataArray(cpm, dims=ds[data_table].dims) + + if inplace: + ds[new_table_name] = cpm_da + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = cpm_da + return ds_copy
+ + +def _comp_cpm(counts): + + ret = copy.deepcopy(counts) + return (ret / (ret.sum() / 1e6)).round(2) + + +def _comp_cpm_per_sample(counts): + + ret = copy.deepcopy(counts) + return (ret / (ret.sum(axis=0) / 1e6)).round(2) + + +
[docs]def rank_data( + ds, + data_table="counts", + inplace=True, + per_sample=False, + new_table_name="rank", +): + """Compute the rank of specified enrichment layer. + The rank is descending + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to fit to + + per_sample : bool + If True, compute rank separately for each sample. + Otherwise, frequencies are computed as a ratio of each count to the sum of + all counts in the dataset. + + data_table : str + The name of the enrichment layer you would like to fit mlxp to. + + new_table_name : str + The name of the new layer you would like to append to the dataset. + + inplace : bool + If True, then this function + appends a dataArray to ds which is indexed with the same coordinate dimensions as + 'data_table'. If False, a copy of ds is returned with the appended dataArray + + + Returns + ------- + + xarray.DataSet : + If inplace is False, return a new DataSet object which has + the enrichment values appended + + Example + ------- + + >>> ds["counts"].values + array([[533, 734, 399, 588], + [563, 947, 814, 156], + [ 47, 705, 750, 685], + [675, 118, 897, 290], + [405, 880, 772, 570], + [629, 961, 530, 63], + [633, 931, 268, 115], + [833, 290, 164, 184], + [ 18, 704, 359, 33], + [143, 486, 371, 415]]) + >>> rank_data(ds, data_table="counts", per_sample=True) + >>> ds["rank"].values + array([[4, 5, 4, 8], + [5, 8, 8, 3], + [1, 4, 6, 9], + [8, 0, 9, 5], + [3, 6, 7, 7], + [6, 9, 5, 1], + [7, 7, 1, 2], + [9, 1, 0, 4], + [0, 3, 2, 0], + [2, 2, 3, 6]]) + """ + + if data_table not in ds: + avail = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + raise KeyError( + f"{data_table} is not included in dataset. \n available datasets: {avail}" + ) + + counts = ds[data_table].to_pandas().values + cpm = _comp_rank_per_sample(counts) if per_sample else _comp_rank(counts) + cpm_da = xr.DataArray(cpm, dims=ds[data_table].dims) + + if inplace: + ds[new_table_name] = cpm_da + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = cpm_da + return ds_copy
+ + +def _comp_rank(enrichment): + + ret = np.ones(enrichment.shape) + sample_data_sh = enrichment.shape + sample_data = enrichment.flatten() + temp = sample_data.argsort() + ranks = np.empty_like(temp) + ranks[temp] = np.arange(len(sample_data)) + ret[:, :] = ranks.reshape(sample_data_sh) + + return ret.astype(int) + + +def _comp_rank_per_sample(enrichment): + + ret = np.ones(enrichment.shape) + for sid in range(enrichment.shape[1]): + sample_data = enrichment[:, sid] + temp = sample_data.argsort() + ranks = np.empty_like(temp) + ranks[temp] = np.arange(len(sample_data)) + ret[:, sid] = ranks.flatten() + + return ret.astype(int) +
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/phippery/utils.html b/_modules/phippery/utils.html new file mode 100644 index 0000000..99a39a2 --- /dev/null +++ b/_modules/phippery/utils.html @@ -0,0 +1,1123 @@ + + + + + + phippery.utils — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +

Source code for phippery.utils

+r"""
+=================
+Utils
+=================
+
+Utilities for building, indexing, and manipulating
+and xarray dataset topology 
+specific to most **phippery** functions provided in this package
+"""
+
+# dependencies
+import pandas as pd
+import numpy as np
+import xarray as xr
+import scipy.stats as st
+
+# built-in python3
+import os
+import copy
+import itertools
+import pickle
+from functools import reduce
+from collections import defaultdict
+
+
+
[docs]def iter_groups(ds, by, dim="sample"): + """This function returns an iterator + yielding subsets of the provided dataset, + grouped by items in the metadata of either of the + dimensions specified. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset to iterate over. + + Returns + ------- + + generator : + Returns subsets of the original dataset sliced by + either sample or peptide table groups. + + Example + ------- + + >>> phippery.get_annotation_table(ds, "sample") + sample_metadata fastq_filename reference seq_dir sample_type + sample_id + 0 sample_0.fastq refa expa beads_only + 1 sample_1.fastq refa expa beads_only + 2 sample_2.fastq refa expa library + 3 sample_3.fastq refa expa library + >>> ds["counts"].values + array([[458, 204, 897, 419], + [599, 292, 436, 186], + [ 75, 90, 978, 471], + [872, 33, 108, 505], + [206, 107, 981, 208]]) + >>> sample_groups = iter_groups(ds, by="sample_type") + >>> for group, phip_dataset in sample_groups: + ... print(group) + ... print(phip_dataset["counts"].values) + ... + beads_only + [[458 204] + [599 292] + [ 75 90] + [872 33] + [206 107]] + library + [[897 419] + [436 186] + [978 471] + [108 505] + [981 208]] + """ + + table = get_annotation_table(ds, dim=dim) + for group, group_df in table.groupby(by): + group_ds = ds.loc[{f"{dim}_id": list(group_df.index.values)}] + yield group, group_ds
+ + +
[docs]def get_annotation_table(ds, dim="sample"): + """ + return a copy of the peptide table after converting all + the data types applying the pandas NaN heuristic + + Parameters + ---------- + + ds : xarray.DataSet + The dataset to extract an annotation from. + + dim : str + The annotation table to grab: "sample" or "peptide". + + Returns + ------- + + pd.DataFrame : + The annotation table. + + """ + + st = ds[f"{dim}_table"].to_pandas().convert_dtypes() + st.index.name = f"{dim}_id" + return st
+ + +
[docs]def stitch_dataset( + counts, + peptide_table, + sample_table, +): + """Build an phippery xarray dataset from individual + tables. + + Note + ---- + If the counts matrix that you're passing has the shape + (M x N) for M peptides, and N samples, the + sample table should have a len of N, + and peptide table should have len M + + Parameters + ---------- + + counts : numpy.ndarray + The counts matrix for sample peptide enrichments. + + sample_table : pd.DataFrame + The sample annotations corresponding to the columns of + the counts matrix. + + peptide_table : pd.DataFrame + The peptide annotations corresponding to the rows of + the counts matrix. + + Returns + ------- + + xarray.DataSet : + The formatted phippery xarray dataset used by most of the phippery functionality. + + """ + + # make sure the coordinated match up. + assert np.all(counts.columns == sample_table.index) + assert np.all(counts.index == peptide_table.index) + + # we are returning the xarray dataset organized by four coordinates seen below. + pds = xr.Dataset( + { + "counts": (["peptide_id", "sample_id"], counts), + "sample_table": (["sample_id", "sample_metadata"], sample_table), + "peptide_table": (["peptide_id", "peptide_metadata"], peptide_table), + }, + coords={ + "sample_id": counts.columns.values, + "peptide_id": counts.index.values, + "sample_metadata": sample_table.columns.values, + "peptide_metadata": peptide_table.columns.values, + }, + ) + return pds
+ + +
[docs]def collect_counts(counts): + r"""merge individual tsv files from individual samples alignments + into a counts matrix. + + Parameters + ---------- + + counts : list[str] + A list a filepaths relative to current working directory to read in. + The filepaths should point to tab-separated files for each sample + which contains two columns (without headers): + + 1. peptide ids - the integer peptide identifiers + 2. enrichments - the respective enrichments for any peptide id + + Returns + ------- + + pd.DataFrame : + The merged enrichments with peptides as the index, and filenames as column names. + + """ + + load = lambda path, sample: pd.read_csv( # noqa + path, index_col=0, sep="\t", names=["peptide_id", sample] + ) + + sample_dataframes = [ + load(path, int(os.path.basename(path).split(".")[0])) for path in counts + ] + + merged_counts_df = reduce( + lambda l, r: pd.merge( + l, r, how="outer", left_index=True, right_index=True + ), # noqa: E741 + sample_dataframes, + ).fillna(0) + + merged_counts_df.columns = merged_counts_df.columns.astype(int) + merged_counts_df.index = merged_counts_df.index.astype(int) + merged_counts_df.sort_index(inplace=True) + merged_counts_df.sort_index(axis=1, inplace=True) + + return merged_counts_df
+ + +
[docs]def to_tall(ds: xr.Dataset): + """Melt a phippery xarray dataset into a single long-formatted + dataframe that has a unique sample peptide interaction on each + row. Ideal for ggplotting. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset to extract an annotation from. + + Returns + ------- + + pd.DataFrame : + The tall formatted dataset. + + Example + ------- + >>> ds["counts"].to_pandas() + sample_id 0 1 + peptide_id + 0 453 393 + 1 456 532 + 2 609 145 + >>> to_tall(ds)[["sample_id", "peptide_id", "counts"]] + sample_id peptide_id counts + 0 0 0 453 + 1 0 1 456 + 2 0 2 609 + 3 1 0 393 + 4 1 1 532 + 5 1 2 145 + """ + + return pd.concat([sample_df for sample_df in yield_tall(ds)])
+ + +
[docs]def yield_tall(ds: xr.Dataset): + """For each sample, yield a tall DataFrame.""" + + # Get the table of samples + sample_table = ds.sample_table.to_pandas().reset_index().infer_objects() + + # Keep track of the order of columns in all emitted items + cnames = None + + # For each sample + for sample_id in sample_table["sample_id"].values: + + # Make sure that values for this sample are present in all data tables + for dt in set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]): + assert ( + sample_id in ds[f"{dt}"].to_pandas().columns.values + ), f"Could not find sample '{sample_id}' in table for {dt}" + + # Make a wide table + sample_df = pd.DataFrame( + { + f"{dt}": ds[f"{dt}"].to_pandas()[sample_id] + for dt in set(list(ds.data_vars)) + - set(["sample_table", "peptide_table"]) + } + ).assign(sample_id=sample_id) + + # Get the table of peptides + peptide_table = ds.peptide_table.to_pandas().reset_index().infer_objects() + + # merge the metadata into the melted datatables + sample_df = sample_df.merge(peptide_table, on="peptide_id") + + # Merge the sample table + sample_df = sample_df.merge(sample_table, on="sample_id") + + # If the column names have not yet been set + if cnames is None: + + # Set them based on the first table + cnames = sample_df.columns.values + + # If the column names were set in a previous iteration + else: + + # Make sure that this table conforms to the same column order + sample_df = sample_df.reindex(columns=cnames) + + yield sample_df
+ + +
[docs]def to_wide(ds): + """Take a phippery dataset and split it into + its separate components in a dictionary. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset to separate. + + Returns + ------- + dict : + The dictionary of annotation tables and enrichment matrices. + + """ + + ret = {} + enr_layers = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + for dt in enr_layers: + layer = copy.deepcopy(ds[f"{dt}"].to_pandas()) + layer.index.name = "" + ret[dt] = layer + + for at in ["sample", "peptide"]: + ret[at] = get_annotation_table(ds, dim=at) + + return ret
+ + +
[docs]def to_wide_csv(ds, file_prefix): + """Take a phippery dataset and split it into + its separate components at writes each into a + comma separated file. + + Note + ---- + This is the inverse operation of the + `dataset_from_csv()` utility function. + Generally speaking these functions are used for + long term storage in common formats when pickle + dumped binaries are not ideal. + + + Parameters + ---------- + + ds : xarray.DataSet + The dataset to extract an annotation from. + + file_prefix : str + The file prefix relative to the current working directory + where the files should be written. + + Returns + ------- + None + """ + + enr_layers = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + for dt in enr_layers: + layer = ds[f"{dt}"].to_pandas() + layer.index.name = "" + layer.to_csv(f"{file_prefix}_{dt}.csv", na_rep="NA", index_label=None) + + for at in ["sample", "peptide"]: + get_annotation_table(ds, dim=at).to_csv( + f"{file_prefix}_{at}_annotation_table.csv" + )
+ + +
[docs]def id_coordinate_from_query_df(ds, query_df): + """Given a dataframe with pandas query statements + for both samples and peptides, return the relevant sample + and peptide id's after applying the logical AND of all queries. + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to query. + + query_df : pd.DataFrame + A dataframe with must have two columns (including headers): + + 1. "dimension" - either "sample" or "peptide" to specify expression dimension + 2. "expression" - The pandas query expression to apply. + + Returns + ------- + tuple : list, list + Return a tuple of sample id's and peptide id's + + """ + + sq = list(query_df.loc[query_df["dimension"] == "sample", "expression"].values) + sid = id_query(ds, "sample", " & ".join(sq)) + + pq = list(query_df.loc[query_df["dimension"] == "peptide", "expression"].values) + pid = id_query(ds, "peptide", " & ".join(pq)) + + return sid, pid
+ + +
[docs]def ds_query(ds, query, dim="sample"): + """ + Apply a sample or peptide query statement to the + entire dataset. + + Note + ---- + For more on pandas queries, see + `the pandas documentation <https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html>`_ + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to query. + + query : str + pandas query expression + + dim : str + The dimension to to apply the expression + + Returns + ------- + xarray.DataSet : + reference to the dataset slice from the given expression. + + Example + ------- + + >>> phippery.get_annotation_table(ds, "peptide") + peptide_metadata Oligo virus + peptide_id + 0 ATCG zika + 1 ATCG zika + 2 ATCG zika + 3 ATCG zika + 4 ATCG dengue + 5 ATCG dengue + 6 ATCG dengue + 7 ATCG dengue + >>> zka_ds = ds_query(ds, "virus == 'zika'", dim="peptide") + >>> zka_ds["counts"].to_pandas() + sample_id 0 1 2 3 4 5 6 7 8 9 + peptide_id + 0 110 829 872 475 716 815 308 647 216 791 + 1 604 987 776 923 858 985 396 539 32 600 + 2 865 161 413 760 422 297 639 786 857 878 + 3 992 354 825 535 440 416 572 988 763 841 + """ + + idx = id_query(ds, query, dim) + return ds.loc[{f"{dim}_id": idx}]
+ + +
[docs]def id_query(ds, query, dim="sample"): + """ + Apply a sample or peptide query statement to the + entire dataset and retrieve the respective indices. + + Note + ---- + For more on pandas queries, see + https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.query.html + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to query. + + query : str + pandas query expression + + dim : str + + + Return + ------ + list[int] : + The list of integer identifiers that apply to a given expression + for the respective dimension. + """ + + return get_annotation_table(ds, dim).query(query).index.values
+ + +
[docs]def load(path): + """simple wrapper for loading + xarray datasets from pickle binary + + Parameters + ---------- + + path : str + Relative path of binary phippery dataset + + Returns + ------- + + xarray.DataSet : + phippery dataset + """ + + return pickle.load(open(path, "rb"))
+ + +
[docs]def dump(ds, path): + """ + simple wrapper for dumping xarray datasets to pickle binary + + Parameters + ---------- + + ds : xarray.DataSet + The dataset you would like to write to disk. + + path : str + The relative path you would like to write to. + + Returns + ------- + None + """ + + pickle.dump(ds, open(path, "wb"))
+ + +
[docs]def dataset_from_csv( + peptide_table_filename, sample_table_filename, counts_table_filename +): + r"""Load a dataset from individual comma separated + files containing the counts matrix, as well as + sample and peptide annotation tables. + + Note + ---- + This is the inverse operation of the + `to_wide_csv()` utility function. + Generally speaking these functions are used for + long term storage in common formats when pickle + dumped binaries are not ideal. + For now, this function only supports + a single enrichment table to be added with the + variable name "counts" to the dataset. + If you would like to add other transformation of the + enrichment table (i.e. cpm, mlxp, etc), you can + load the csv's via pandas and add to the dataset + using the `add_enrichment_layer_from_array` function + + + Parameters + ---------- + counts_table_filename : str + The glob filepath to csv file(s) containing the enrichments. + All files should have the first column be indices which match the + given peptide table index column. + The first row then should have column headers that match the + index of the sample table. + + peptide_table_filename : str + The relative filepath to the peptide annotation table. + + sample_table_filename : str + The relative filepath to the sample annotation table. + + Returns + ------- + xarray.DataSet : + The combined tables in a phippery dataset. + """ + + counts_df = _collect_counts_matrix(counts_table_filename) + peptide_df = _collect_peptide_table(peptide_table_filename) + sample_df = _collect_sample_table(sample_table_filename) + + return stitch_dataset( + counts=counts_df, + peptide_table=peptide_df, + sample_table=sample_df, + )
+ + +def _collect_sample_table(sample_table_filename: str): + """Read and verify a sample table.""" + + sample_table = pd.read_csv(sample_table_filename, sep=",", index_col=0, header=0) + + if sample_table.index.name != "sample_id": + raise ValueError("The name of the index must be 'sample_id'") + + if sample_table.index.dtype != "int64": + raise ValueError("The index values for sample_id must be inferred as integers") + + sample_table.sort_index(inplace=True) + return sample_table + + +def _collect_peptide_table(peptide_table_filename: str): + """Read and verify a peptide table.""" + + peptide_table = pd.read_csv(peptide_table_filename, sep=",", index_col=0, header=0) + + if peptide_table.index.name != "peptide_id": + raise ValueError + + if peptide_table.index.dtype != "int64": + raise ValueError("The index values for peptide_id must be inferred as integers") + + peptide_table.sort_index(inplace=True) + return peptide_table + + +def _collect_counts_matrix(counts_matrix_filename: str): + """Read and verify a counts matrix file.""" + + counts_matrix = pd.read_csv(counts_matrix_filename, sep=",", index_col=0, header=0) + + try: + counts_matrix.columns = counts_matrix.columns.astype(int) + except ValueError: + raise ValueError( + "column header values much be able to cast to type 'int' to match peptide table index" + ) + + try: + counts_matrix.index = counts_matrix.index.astype(int) + except ValueError: + raise ValueError( + "row index values much be able to cast to type 'int' to match peptide table index" + ) + + counts_matrix.sort_index(inplace=True) + counts_matrix.sort_index(axis=1, inplace=True) + + return counts_matrix + + +
[docs]def add_enrichment_layer_from_array(ds, enrichment, new_table_name=None, inplace=True): + """Append an enrichment layer to the dataset. + + Parameters + ---------- + + ds : xarray.DataSet + The phippery dataset to append to. + + enrichment : np.array + The enrichment matrix to append to the phippery dataset. + The number of rows should be the same length as ds.peptide_id + and the number of columns should be the same length as ds.sample_id + + new_table_name : str + What you would like to name the enrichment layer. + + inplace : bool + Determines whether to modify the passed dataset, or return an augmented + copy + + Returns + ------- + None | xarray.DataSet + The augmented phippery dataset copy is returned if inplace is ``True`` + """ + + if enrichment.shape != ds.counts.shape: + ins = enrichment.shape + cur = ds.counts.shape + pri = f"provided enrichment layer shape: {ins}," + pri += f"current working dataset counts shape: {cur}" + raise ValueError( + f"Enrichments must have the same shape as enrichments in dataset. {pri}" + ) + enr_layers = set(list(ds.data_vars)) - set(["sample_table", "peptide_table"]) + if new_table_name is None: + new_table_name = f"enrichment_layer_{len(enr_layers)+1}" + enrichment = xr.DataArray(enrichment, dims=ds.counts.dims) + if inplace: + ds[new_table_name] = enrichment + return None + else: + ds_copy = copy.deepcopy(ds) + ds_copy[new_table_name] = enrichment + return ds_copy
+ + +def _throw_mismatched_features(df, by): + """ + When you collapse by some set of columns in the dataframe, + keep only features which homogeneous within groups. + + This is similar to 'DataFrameGroupby.first()' method, + but instead of keeping the first factor level appearing for each group + category, we only throw any features which are note homogeneous within groups. + You could achieve the same functionality by listing features you know to be + homogeneous in the 'by' parameter. + """ + + # Find out which collapse features are shared within groups + collapsed_sample_metadata = defaultdict(list) + for i, (group, group_df) in enumerate(df.groupby(by)): + for column, value in group_df.items(): + v = value.values + if np.all(v == v[0]) or np.all([n != n for n in v]): + collapsed_sample_metadata[column].append(v[0]) + + # Throw out features that are not shared between groups + to_throw = [ + key for key, value in collapsed_sample_metadata.items() if len(value) < i + 1 + ] + [collapsed_sample_metadata.pop(key) for key in to_throw] + return pd.DataFrame(collapsed_sample_metadata) + + +def _mean_pw_cc_by_multiple_tables(ds, by, dim="sample", data_tables="all"): + """ + A wrapper for computing pw cc within groups defined + with the 'by' parameter. Merges the correlations into a + single table + """ + + # Compute mean pw cc on all possible data tables + if data_tables == "all": + data_tables = list(set(ds.data_vars) - set(["sample_table", "peptide_table"])) + + # Some error handling + if dim not in ["sample", "peptide"]: + raise ValueError("parameter 'dim' must be either 'sample' or 'peptide'") + + groups_avail = ds[f"{dim}_metadata"].values + for data_table in data_tables: + if data_table not in ds: + raise KeyError(f"{data_table} is not included in dataset.") + + for group in by: + if group not in groups_avail: + raise KeyError( + f"{group} is not included as a column in the {dim} table. The available groups are {groups_avail}" + ) + + # Compute mean pw cc on all data layers - resulting in a df for each + corr_dfs = [ + _mean_pw_cc_by(ds, by, data_table=data_table, dim=dim) + for data_table in data_tables + ] + + # return a single merged df containing info for all data layer pw cc + return reduce( + lambda l, r: pd.merge( + l, r, how="outer", left_index=True, right_index=True + ), # noqa: E741 + corr_dfs, + ) + + +def _mean_pw_cc_by(ds, by, data_table="counts", dim="sample"): + """ + Computes pairwise cc for all + dim in a group specified by 'group' column. + + returns a dataframe with each group, it's + respective pw_cc, and the number of dims + in the group. + """ + + data = ds[f"{data_table}"].to_pandas() + + groups, pw_cc, n = [], [], [] + + for s_group, group_ds in iter_groups(ds, by, dim): + groups.append(s_group) + n.append(len(group_ds[f"{dim}_id"].values)) + + if len(group_ds[f"{dim}_id"].values) < 2: + pw_cc.append(1.0) + continue + + correlations = [] + for dim_ids in itertools.combinations(group_ds[f"{dim}_id"].values, 2): + dim_0_enrichment = data.loc[:, dim_ids[0]] + dim_1_enrichment = data.loc[:, dim_ids[1]] + correlation = ( + st.pearsonr(dim_0_enrichment, dim_1_enrichment)[0] + if np.any(dim_0_enrichment != dim_1_enrichment) + else 1.0 + ) + correlations.append(correlation) + pw_cc.append(round(sum(correlations) / len(correlations), 5)) + + name = "_".join(by) + column_prefix = f"{name}_{data_table}" + + ret = pd.DataFrame( + { + f"{name}": groups, + f"{column_prefix}_pw_cc": np.array(pw_cc).astype(np.float64), + f"{column_prefix}_n_reps": np.array(n).astype(int), + } + ).set_index(name) + + return ret + + +
[docs]def collapse_sample_groups(*args, **kwargs): + """wrap for sample collapse""" + return collapse_groups(*args, **kwargs, collapse_dim="sample")
+ + +
[docs]def collapse_peptide_groups(*args, **kwargs): + """wrap for peptide collapse""" + return collapse_groups(*args, **kwargs, collapse_dim="peptide")
+ + +
[docs]def collapse_groups( + ds, by, collapse_dim="sample", agg_func=np.mean, compute_pw_cc=False, **kwargs +): + """Collapse an xarray dataset along one of the annotation axis + by applying the agg_function to annotation groups of 'by'. + + Parameters + ---------- + + ds : xarray.DataSet + The phippery dataset to append to. + + by : list + The name of the annotation feature you would like to collapse. + + collapse_dim : str + The dimension you's like to collapse. "sample" or "peptide" + + compute_pw_cc : bool + Whether or not to compute the mean pairwise correlation + of all values within any feature group that is being + collapsed. + + agg_func : *function* + This function must take a one-dimensional array and aggregate + all values to a single number, agg_func(list[float | int]) -> float | int + + + Returns + ------- + + xarray.DataSet : + The collapsed phippery dataset. + + Example + ------- + >>> get_annotation_table(ds, dim="sample") + sample_metadata fastq_filename reference seq_dir sample_type + sample_id + 0 sample_0.fastq refa expa beads_only + 1 sample_1.fastq refa expa beads_only + 2 sample_2.fastq refa expa library + 3 sample_3.fastq refa expa library + 4 sample_4.fastq refa expa IP + 5 sample_5.fastq refa expa IP + >>> ds["counts"].to_pandas() + sample_id 0 1 2 3 4 5 + peptide_id + 0 7 0 3 2 3 2 + 1 6 3 1 0 7 5 + 2 9 1 7 8 4 7 + >>> mean_sample_type_ds = collapse_groups(ds, by=["sample_type"]) + >>> get_annotation_table(mean_sample_type_ds, dim="sample") + sample_metadata reference seq_dir sample_type + sample_id + 0 refa expa IP + 1 refa expa beads_only + 2 refa expa library + >>> mean_sample_type_ds["counts"].to_pandas() + sample_id 0 1 2 + peptide_id + 0 2.5 3.5 2.5 + 1 6.0 4.5 0.5 + 2 5.5 5.0 7.5 + """ + + # Check to see if the group(s) is/are available + groups_avail = ds[f"{collapse_dim}_metadata"].values + + for group in by: + if group not in groups_avail: + raise KeyError( + f"{group} is not included as a column in the {collapse_dim} table. The available groups are {groups_avail}" + ) + + # define collapse and fixed df + dims = set(["sample", "peptide"]) + fixed_dim = list(dims - set([collapse_dim]))[0] + + # grab relevant annotation tables + collapse_df = ds[f"{collapse_dim}_table"].to_pandas() + fixed_df = ds[f"{fixed_dim}_table"].to_pandas() + + # Create group-able dataset by assigning table columns to a coordinate + if len(by) == 1: + coord = collapse_df[by[0]] + coord_ds = ds.assign_coords({f"{by[0]}": (f"{collapse_dim}_id", coord)}) + else: + print("WARNING: Nothing available, here") + return None + + # if were grouping by multiple things, we need to zip 'em into a tuple coord + # psuedo-code + # else: + # common_dim = f"{collapse_dim}_id" + # coor_arr = np.empty(len(ds[common_dim]), dtype=object) + # coor_arr[:] = list(zip(*(collapse_df[f].values for f in by))) + # coord_ds = ds.assign_coords( + # coord=xr.DataArray(coor_arr, collapse_dims=common_dim) + # ) + + del coord_ds["sample_table"] + del coord_ds["peptide_table"] + del coord_ds["sample_metadata"] + del coord_ds["peptide_metadata"] + + # Perform the reduction on all data tables. + collapsed_enrichments = coord_ds.groupby(f"{by[0]}", squeeze=False).reduce(agg_func) + + if collapse_dim == "sample": + collapsed_enrichments = collapsed_enrichments.transpose() + + # Once the data tables are grouped we have no use for first copy. + del coord_ds + + # Compile each of the collapsed xarray variables. + collapsed_xr_dfs = { + f"{dt}": ( + ["peptide_id", "sample_id"], + collapsed_enrichments[f"{dt}"].to_pandas(), + ) + for dt in set(list(collapsed_enrichments.data_vars)) + } + + cat = _throw_mismatched_features(collapse_df, by) + + # Compute mean pairwise correlation for all groups, + # for all enrichment layers - and add it to the + # resulting collapsed sample table + if compute_pw_cc: + mean_pw_cc = _mean_pw_cc_by(ds, by, **kwargs) + cat = cat.merge(mean_pw_cc, left_index=True, right_index=True) + + # Insert the correct annotation tables to out dictionary of variables + collapsed_xr_dfs[f"{collapse_dim}_table"] = ( + [f"{collapse_dim}_id", f"{collapse_dim}_metadata"], + cat, + ) + + collapsed_xr_dfs[f"{fixed_dim}_table"] = ( + [f"{fixed_dim}_id", f"{fixed_dim}_metadata"], + fixed_df, + ) + + pds = xr.Dataset( + collapsed_xr_dfs, + coords={ + f"{collapse_dim}_id": collapsed_xr_dfs[f"{collapse_dim}_table"][ + 1 + ].index.values, + f"{fixed_dim}_id": collapsed_xr_dfs[f"{fixed_dim}_table"][1].index.values, + f"{collapse_dim}_metadata": collapsed_xr_dfs[f"{collapse_dim}_table"][ + 1 + ].columns.values, + f"{fixed_dim}_metadata": collapsed_xr_dfs[f"{fixed_dim}_table"][ + 1 + ].columns.values, + }, + ) + return pds
+
+ +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/_sources/alignments-pipeline.rst.txt b/_sources/alignments-pipeline.rst.txt new file mode 100644 index 0000000..a9c9b11 --- /dev/null +++ b/_sources/alignments-pipeline.rst.txt @@ -0,0 +1,539 @@ + +.. _sec_pipeline_intro: + +=================== +Alignments Pipeline +=================== + +A flexible `Nextflow automated pipeline `_ +used for producing the +:ref:`enrichment data ` +from PhIP-Seq data when provided the demultiplexed +:ref:`fastq files `, +as well as annotation files for both the experimental +:ref:`samples ` and +:ref:`peptides ` in the phage library being used. + +.. figure:: images/dagt.svg + :class: with-border + :width: 600 + :alt: directed acyclic graph + :align: left + + **Directed Acyclic Graph (DAG)** + defining the execution order and dependencies of each individual + processes. The major steps of the pipeline can be summarized as: + (1) Build a ``Bowtie`` index from the relevant peptide oligos + (2) Align each of the samples to the library reference using + `Bowtie` end-to-end alignment allowing for up to N mismatches (default 2). + The user specifies the size of both the reads and peptide, + the low-quality end of the read are then trimmed to match + the reference length before alignment. + (3) Peptide counts for each sample alignment are obtained + using ``samtools-idxstats`` (`Li et al., 2009 `_) in parallel + to computing the common alignment stats such as + raw total sequences, reads_mapped, error_rate, and average_quality, by default. + (4) The resulting dataset containing the enrichment matrix, + sample metadata, and peptide metadata are organized + using the `xarray `_ + package (`Hamman and Hoyer, 2017 `_). + (5) Optionally, summary statistics such as counts per million, + size factors, fold enrichment, as well as model fits for estimates + of significance are computed. + (6) By default, the pipeline outputs all results + computed above as a pickle dump binary of the xarray object + with all combined results, as well as individual csv's for each statistic computed. + You may also export the results in ``PhIPData`` (Chen et al 2022) format + via RDS file, and even tall CSV formats. + +.. _sec_pipeline_inputs: + +=========== +Input files +=========== + +.. _sec_sam_anno: + +Sample table +++++++++++++ + +A CSV where one of the columns must be ``fastq_filename`` listing +all samples to be run through the pipeline. +By default, the pipeline assumes the reads are relative to +the project directory where the pipeline is being executed. + +.. note:: If there is some other prefix for the filepaths, + you may check out the ``--reads_prefix`` parameter. + +As an example, let's assume there's some directory ``ngs/*`` containing all the +fastq files for a project. To organize these files (excluding barcode files) +into a minimal sample table describing each of their relative paths, we might +use the following command. + +.. code-block:: bash + + (echo "fastq_filepath" && ls ngs/*R1*.gz) > sample_table.csv + +.. seealso:: An example of a simple sample table can be found + `here `_. + +In addition to the file paths provided for each sample, +you may include as many colorful annotations as you would +like so long as the CSV stays tidy. +One caveat is that you should *not* include a column named ``sample_id``, +this feature name is reserved for integer id's +which are added to both the sample and peptide annotation tables +for internal and user organization of the annotations with +enrichment tables. +Many of the ``phippery`` API utilities, +are generalized to help you index, and otherwise +manipulate the data to your liking using any combination +of these annotations, so go wild with annotations! + +Internally, data types are handled through conversion to pandas data types +- so it's best to keep data types consistent +between the columns provided. For :ref:`missing data `, +we recommend empty strings, "", +but "NaN" and "N/A" also work (hopefully) as expected. + +.. note:: Some of the :ref:`optional workflows ` + have additional required annotations, so keep an eye for those. + +.. _sec_input_fasta: + +.. note:: The fastq files pointed to by the sample table described above + are assumed to have uniform (trimmed) read lengths. + During alignment, this is enforced by reads being + trimmed on the 3' end to match the length specified + by the ``--oligo_tile_length`` parameter. + +See :ref:`pipeline parameters ` for more. + +.. _sec_pep_anno: + +Peptide table ++++++++++++++ + +A CSV where one of the columns must be "oligo" which +contains the oligonucleotide sequence encoding a peptide in +the phage library. +Adapters are assumed to be encoded by lower case nucleotides +and are ultimately tossed from the output of the pipeline. +Conversely, the oligonucleotide encoding of the expressed peptide +should be upper case. +Similar to the sample annotation table, you may include any +annotations you like to the peptides (e.g. "Virus", "Strain", "Loci" etc) +*except* an annotation named ``peptide_id`` which is again reserved for +the pipeline execution. + +.. seealso:: An example of a simple peptide table can be found + `here `__. + +.. _sec_pipeline_outputs: + +================ +Pipeline results +================ + +The primary use of this pipeline is to process raw sequencing data, +produce the peptide counts table, apply statistical methods +(such as the :ref:`EdgeR `), then combine and organize +the results from these workflows for the user to analyze however they wish. +By default the pipeline will produce the following outputs + +:: + + results + ├── pickle_data + │   └── data.phip + ├── rds_data + │   └── PhIPData.rds + └── wide_data + ├── data_counts.csv.gz + ├── data_cpm.csv.gz + ├── data_edgeR_hits.csv.gz + ├── data_edgeR_logfc.csv.gz + ├── data_edgeR_logpval.csv.gz + ├── data_peptide_annotation_table.csv.gz + ├── data_sample_annotation_table.csv.gz + └── data_size_factors.csv.gz + + 4 directories, 11 files + +see the :ref:`example page ` +for a more detailed explanation of these outputs. + +.. _sec_pipeline_params: + +========== +Parameters +========== + +Below, we describe each of the possible parameters that may be passed to the pipeline. +Parameters with a "*" next to the name must be provided values +explicitly in the ``nextflow run``, command unless +you wish to be using the default values described below. +Otherwise, the parameter value is only required for relevant the +:ref:`optional workflow `. + + +``--sample_table`` + +- help: Table describing each input sample, minimally containing the column 'fastq_filepath' with the name of each file to be analyzed. Control samples are indicated with a value of 'beads_only' in the column 'control_status'. +- wb_type: file +- required: True + +``--reads_prefix`` + +- help: Folder which contains the files listed in the sample table +- wb_type: folder +- required: True + +``--read_length`` + +- help: Read length for alignment. See :ref:`alignment approach section ` for more. +- wb_type: integer +- default: 125 + +``--fastq_stream_func`` + +- help: Set this as 'cat' if fastq files not g'zipped +- wb_type: string +- default: zcat + +``--peptide_table`` + +- help: Table describing each peptide in the library, minimally containing the column 'oligo' with the sequence used for each peptide +- wb_type: file +- required: True + +``--oligo_tile_length`` + +- help: length of oligonucleotide sequence encoding any given peptide in the library. See :ref:`alignment approach section ` for more. +- wb_type: integer +- default: 117 + +``--dataset_prefix`` + +- help: String which is prepended to all output files +- wb_type: string +- default: data + +``--output_pickle_xarray`` + +- help: Generate output files in xarray pickle format +- wb_type: bool +- default: True + +``--output_tall_csv`` + +- help: Generate output files in tall CSV format +- wb_type: bool +- default: True + +``--output_wide_csv`` + +- help: Generate output files in wide CSV format +- wb_type: bool +- default: True + +``--n_mismatches`` + +- help: Number of mismatches allowed +- wb_type: integer +- default: 2 + +``--bowtie_optional_args`` + +- help: Other bowtie options +- wb_type: string +- default: --tryhard --nomaqround --norc --best --sam --quiet + +``--replicate_sequence_counts`` + +- help: Flag for replicating counts for replicate sequences +- wb_type: bool +- default: True + +.. _sec_optional_workflows: + +=================== +Optional Parameters +=================== + +We provide a popular (at least for us) +selection of the features found in the +:mod:`phippery` python API as optional during pipeline +execution. To run any one of these +optional workflows, you'll set the relevant +boolean flag parameter to true. +Additionally, you may need to provide +certain annotation features +and factor levels in the sample or peptide +table. + +Our `example pan-CoV dataset `__ +includes library enrichment samples that +are appropriately annotated in the +sample table, meaning we could +run the cpm enrichment workflow like so: + +.. code-block:: bash + + (base) ubuntu phippery/phip-flow ‹V1.04*› » nextflow run main.nf -profile docker --run_cpm_enr_workflow true + N E X T F L O W ~ version 21.04.3 + Launching `main.nf` [distracted_banach] - revision: 9ea43df075 + P H I P - F L O W! + Matsen, Overbaugh, and Minot Labs + Fred Hutchinson CRC, Seattle WA + ================================ + sample_table : /home/jared/MatsenGroup/Projects/phippery/phip-flow/data/pan-cov-example/sample_table.csv + peptide_table : /home/jared/MatsenGroup/Projects/phippery/phip-flow/data/pan-cov-example/peptide_table.csv + results : /home/jared/MatsenGroup/Projects/phippery/phip-flow/results/ + + + executor > local (29) + [2c/30601d] process > ALIGN:validate_sample_table (1) [100%] 1 of 1 ✔ + [1d/073399] process > ALIGN:validate_peptide_table (1) [100%] 1 of 1 ✔ + [37/6937e7] process > ALIGN:generate_fasta_reference (1) [100%] 1 of 1 ✔ + [61/a636a9] process > ALIGN:generate_index (1) [100%] 1 of 1 ✔ + [1d/454757] process > ALIGN:short_read_alignment (1) [100%] 6 of 6 ✔ + [0d/320a4d] process > ALIGN:sam_to_counts (6) [100%] 6 of 6 ✔ + [f4/687d71] process > ALIGN:sam_to_stats (6) [100%] 6 of 6 ✔ + [c6/036a15] process > ALIGN:collect_phip_data (1) [100%] 1 of 1 ✔ + [c0/3eb016] process > ALIGN:replicate_counts (1) [100%] 1 of 1 ✔ + [e8/fae63a] process > STATS:counts_per_million (1) [100%] 1 of 1 ✔ + [a9/81d0b7] process > STATS:size_factors (1) [100%] 1 of 1 ✔ + [11/031d9e] process > STATS:cpm_fold_enrichment (1) [100%] 1 of 1 ✔ + [- ] process > STATS:fit_predict_neg_binom - + [- ] process > STATS:fit_predict_zscore - + [7e/df19de] process > STATS:merge_binary_datasets [100%] 1 of 1 ✔ + [c0/5b1faf] process > DSOUT:dump_binary [100%] 1 of 1 ✔ + [- ] process > DSOUT:dump_wide_csv - + [- ] process > DSOUT:dump_tall_csv - + [- ] process > AGG:split_samples - + [- ] process > AGG:aggregate_organisms - + [- ] process > AGG:join_organisms - + +We can then use the :mod:`phippery.utils` to read in the data to take a look at the results. + +.. code-block:: python + + >>> import phippery + >>> ds = phippery.load("results/pickle_data/data.phip") + >>> ds + + Dimensions: (sample_id: 6, peptide_id: 10047, sample_metadata: 9, + peptide_metadata: 7) + Coordinates: + * sample_id (sample_id) int64 0 1 2 3 4 5 + * peptide_id (peptide_id) int64 0 1 2 3 4 ... 10043 10044 10045 10046 + * sample_metadata (sample_metadata) object 'library_batch' ... 'average_q...' + * peptide_metadata (peptide_metadata) object 'Virus' ... 'Prot_Start' + Data variables: + counts (peptide_id, sample_id) int64 0 1 0 3 0 3 ... 0 1 0 0 2 1 + sample_table (sample_id, sample_metadata) object 'MEGSUB' ... 37.3 + peptide_table (peptide_id, peptide_metadata) object 'OC43' ... 4052 + size_factors (peptide_id, sample_id) float64 0.0 1.0 0.0 ... 2.29 1.0 + cpm (peptide_id, sample_id) float64 0.0 94.85 ... 560.2 245.6 + enrichment (peptide_id, sample_id) float64 0.02065 1.979 ... 5.093 + >>> ds.counts.to_pandas() + sample_id 0 1 2 3 4 5 + peptide_id + 0 0 1 0 3 0 3 + 1 7 2 3 0 5 1 + 2 2 1 0 0 0 0 + 3 0 2 0 0 0 0 + 4 0 0 0 0 0 0 + ... .. .. .. .. .. .. + 10042 0 1 0 0 0 0 + 10043 1 2 0 0 0 0 + 10044 0 1 0 0 0 0 + 10045 8 0 0 0 1 0 + 10046 0 1 0 0 2 1 + + [10047 rows x 6 columns] + >>> ds.enrichment.to_pandas() + sample_id 0 1 2 3 4 5 + peptide_id + 0 0.020650 1.979353 0.020651 34.805577 0.020651 15.238485 + 1 1.552418 0.447580 4.091275 0.002347 3.289535 0.578875 + 2 1.328661 0.671337 0.007004 0.007004 0.007004 0.007004 + 3 0.010433 1.989571 0.010433 0.010433 0.010433 0.010433 + 4 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 + ... ... ... ... ... ... ... + 10042 0.020650 1.979353 0.020651 0.020651 0.020651 0.020651 + 10043 0.666665 1.333336 0.006992 0.006992 0.006992 0.006992 + 10044 0.020650 1.979353 0.020651 0.020651 0.020651 0.020651 + 10045 1.997354 0.002643 0.002643 0.002643 0.742907 0.002643 + 10046 0.020650 1.979353 0.020651 0.020651 11.589568 5.093262 + + [10047 rows x 6 columns] + + +BEER +++++ + +.. warning:: + This workflow has not been fully tested and may be very slow. + For errors which may arise from the BEER workflow, we recommend + that you direct questions to the BEER developers. + If you would like to run BEER outside of the pipeline, note that + by default the pipeline runs EdgeR and outputs + those results into the + `PhIPData `__ + object file which can be directly loaded and used with the BEER library. + +``--run_BEER`` + +- help: Flag for running edgeR and BEER using the infrastructure in the + BEER pipeline. See the + `R Vignettes `_ + and `BEER Paper `_ + for more on this method. + Enrichments, EdgeR hits, and Annotations are + tied into a `PhIPData `_ + object and exported to an RDS binary object file. + The object file is then saved in the ``params.results`` directory + below the ``rds_data/`` sub-directory. + Additionally, these results will be tied back into the + xarray object used by the Python phippery API, + as well as any CSV outputs (wide & tall). +- wb_type: bool +- default: False + + +CPM Enrichment +++++++++++++++ + +``--run_cpm_enr_workflow`` + +- help: Flag for running the enrichment workflow using counts + per million as a pre-processing step to fold enrichment + of empricial IP samples over library abundance controls. + If ``True``, we require that the sample annotation table + provides a column "control_status" for which a subset of samples + is labeled as "library" indicating the sample is a control + For a description of how this function works in more detail, + see :meth:`phippery.normalize.enrichment`. +- wb_type: bool +- default: False + + +Z-Score ++++++++ + +``--run_zscore_fit_predict`` + +- help: Flag for running Z-score enrichment analysis. + This model fits to mock ip (bead only controls) + and thus requires the sample annotation column "control_status" + where mock IP\'s are marked "beads_only". + Note that this method uses the + :func:`phippery.normalize.counts_per_million` function + to normalize the data before fitting and estimating significance + using :func:`phippery.modeling.zscore`. + For more on this method, see + :ref:`the background modeling documentation ` +- wb_type: bool +- default: False + + +VirScan Organism Summary +++++++++++++++++++++++++ + +This workflow will summarize the hits to epitopes (peptides) +across the groups across the proteome specified in the peptide annotation +table input to the pipeline. + +Note that this analysis workflow was created with the Virscan +peptide library in mind, but could be used for any peptide assay being +analyzed. For example, you could run this workflow on the example data like so: + +.. code-block:: bash + + nextflow run matsengrp/phip-flow -r V1.12 \ + -profile docker \ + --summarize_by_organism true \ + --peptide_seq_col "Prot" \ + --peptide_org_col "Virus" \ + --results "$(date -I)" + +``--summarize_by_organism`` + +- help: Flag used to control the summary of results by organism + Requires that the peptide table includes information regarding + the source organism for each epitope. It is possible to annotate + an epitope as being contained in multiple organisms by including + multiple lines with the same peptide. + When this flag is enabled, an additional output table will be + produced (``aggregated_data/organism.summary.csv.gz``) which summarizes + the number of epitopes with Z-scores above the threshold + (``--zscore_threshold``, described below) for each organism. + The sequence of each peptide is taken into account to filter out + overlapping peptide hits. + For any pair of peptides which overlap by more than the allowed + number of amino acids (``--max_overlap``), only the higher-scoring + peptide (in terms of Z-score) will be retained. + Overlaps between peptides are determined by exact k-mer matching. + A peptide is marked as a 'hit' when it is above the threshold in + all replicates of that sample. When it is only above the threshold + in a subset of replicates, it is marked as 'discordant'. + The Epitope Binding Score (EBS) is also calculated for each peptide + as the mean Z-score across all replicates from the same sample. + At the organism level, the max and mean EBS is reported. + Finally, all of those results are reported for the subset of + epitopes which are marked as 'public' (using ``--public_epitopes_csv``), + which indicates that there is independent experimental evidence supporting + the presence of binding antibodies in a human population. +- wb_type: bool +- default: False + +``--peptide_org_col`` + +- help: Column in the peptide table indicating the organism for each peptide +- wb_type: string +- default: organism + +``--peptide_seq_col`` + +- help: Column in the peptide table containing the peptide sequence (used to match against public epitopes provided with ``--public_epitopes_csv``) +- wb_type: string +- default: seq + +``--max_overlap`` + +- help: Maximum allowed overlap between detected peptides +- wb_type: integer +- default: 7 + +``--zscore_threshold`` + +- help: Minimum Z-score threshold +- wb_type: float +- default: 2.5 + +``--sample_grouping_col`` + +- help: Column in the sample table used for mapping replicates to samples +- wb_type: string +- default: + +``--public_epitopes_csv`` + +- help: Optional, a CSV containing public epitopes +- wb_type: file + +``--public_epitopes_col`` + +- help: In the public epitopes CSV, the column containing the translated amino acid sequence +- wb_type: string +- default: peptide_translate + +``--nxf_profile`` + +- help: Profile used for resource allocation (options: standard / docker / cluster) +- wb_env: PROFILE +- wb_type: string +- default: standard + diff --git a/_sources/bkg-model.rst.txt b/_sources/bkg-model.rst.txt new file mode 100644 index 0000000..dd63f2a --- /dev/null +++ b/_sources/bkg-model.rst.txt @@ -0,0 +1,67 @@ + + +.. _sec_background_modeling: + +=================== +Background Modeling +=================== + +Introduction +------------ + +In addition to running the alignments and computing the counts, ``phippery`` also provides workflows +to model the background with mock-IP samples and compute non-specific peptide enrichments. +By default the ``phip-flow`` pipeline will run the +`edgeR `_ [#edgeR2010]_ workflow as described in the +`Chen et al. 2022 `_ [#ChenBEER]_ paper. +Optionally, we also provide a simpler Z-score method to evaluate the significance of peptide enrichment relative to +background that was used in `Mina et al. 2019 `_ [#MinaMeasles]_. +Each is described in greater detail below. +Note that these workflows are not mutually exclusive, (i.e. do not overwrite the counts, cpm, or any other default/optional outputs from the pipeline). +You may run none or all of the workflows in tandem, then do with the :ref:`combined results ` as you wish. + +.. _sec_edger: + +edgeR/BEER Method +----------------- +`Chen et al. 2022 `_ adapts the `edgeR `_ tool to compute +fold-change with respect to mock-IP samples and p-values of peptide enrichment. +This is run by default. +Optionally, you may run the +`BEER (Bayesian Estimation Enrichment in R) method `_, +which is statistically more powerful and may be better at identifying significantly enriched peptides with lower fold-changes. +The trade-off for using the BEER method is longer run-time. +By default, the ``phip-flow`` pipeline runs EdgeR, but not BEER. +see :ref:`Optional Parameters in the pipeline documentation ` for more. + +.. _sec_zscore: + +Z-score Method (optional) +------------------------- + +``phippery`` can also optionally run the Z-score method to compute the significance of peptide enrichment relative to background. +This Z-score method used in `Mina et al. 2019 `_ is described in detail in their +`supplementary document `_. The method takes the mock-IP +samples to bin together peptide species of similar abundance under the beads-only condition. Here, abundance can be represented in any form of normalized counts and +CPM is the default in ``phippery``. Note that the mock-IP samples are used only to determine binning. + +To compute the Z-score for a peptide species in an empirical sample, identify the bin it belongs to and compute the mean and standard deviation CPM among the peptide +species in that bin. To reduce the influence of outliers, such as signal from epitope-specific binding, the highest 5% and lowest 5% of CPM values are discarded when +computing the mean :math:`\mu` and standard deviation :math:`\sigma`. Formally, for a peptide species, :math:`p`, with CPM value, :math:`n_p`, belonging to bin :math:`i`, +the Z-score is: + +.. math:: + Z_p = \frac{n_p - \mu_i}{\sigma_i} . + +References +---------- + +.. [#edgeR2010] Robinson, M.D., McCarthy, D.J., and Smyth, G.K. + `edgeR: a Bioconductor package for differential expression analysis of digital gene expression data `_. + Bioinformatics, 2010. **26** (1): p. 139-140. + +.. [#ChenBEER] Chen, A., et al. `Detecting and quantifying antibody reactivity in PhIP-Seq data with BEER `_. + Bioinformatics, **38** (19): p. 4647-4649. + +.. [#MinaMeasles] Mina, M.J., et al. `Measles virus infection diminishes preexisting antibodies that offer protection from other pathogens `_. + Science, 2019. **366** (6465): p. 599-606. diff --git a/_sources/command-line-interface.rst.txt b/_sources/command-line-interface.rst.txt new file mode 100644 index 0000000..8c4eb11 --- /dev/null +++ b/_sources/command-line-interface.rst.txt @@ -0,0 +1,109 @@ +.. _sec_cli_intro: + +====================== +Command Line Interface +====================== + +The CLI is written using the +`Click `_ +library, and thus both ``phippery -h``, and ``phippery COMMAND -h`` will provide +the same information provided below. + +.. _sec_cli_soup_nutz: + +With the binary dataset output (default) +and an installation of +the :ref:`phippery ` CLI tools, +we can run the some useful queries on the dataset to learn a little +about the dataset. + +.. code-block:: + + $ phippery about output/Pan-CoV-example.phip + +The **about** command will print information about +the three primary aspects of a single dataset; Samples, Peptides, and Enrichment +Layers. For more about how the data is structured, +see the :ref:`under the hood ` page. +Primarily, it tells you what information is available in terms of the +`Samples Table`, +`Peptide Table`, +and `Enrichment Layers`. + +:: + + Sample Table: + ------------- + + Int64Index: 6 entries, 124 to 540 + Data columns (total 10 columns): + # Column Non-Null Count Dtype + --- ------ -------------- ----- + 0 seq_dir 6 non-null string + 1 library_batch 6 non-null string + 2 control_status 6 non-null string + 3 participant_ID 4 non-null string + 4 patient_status 4 non-null string + 5 fastq_filename 6 non-null string + 6 raw-total-sequences 6 non-null Int64 + 7 reads-mapped 6 non-null Int64 + 8 error-rate 6 non-null Float64 + 9 average-quality 6 non-null Float64 + dtypes: Float64(2), Int64(2), string(6) + memory usage: 552.0 bytes + +Above we see our example dataset `sample table`. +The information about +annotation feature data types, and missing information (NA) counts +is provided by default. + +As displayed, this dataset contains 6 samples, +each with the annotations we fed to the pipeline +along with some alignment statistics. +While maybe not immediately useful, it's nice to know +which information you have available at any given time -- +especially after we start slicing or grouping datasets. + +Further, you may want to know more detail about one of the annotation columns +at a time. The :program:`about-feature` will give you a useful description +of the feature level distributions (categorical or numeric features), as well +as a few example queries for help indexing the dataset by this annotation feature. +Let's take a look at our +`reads mapped `_ +annotation feature: + +:: + + reads-mapped: Integer Feature: + --------------------------- + + distribution of numerical feature: + + count 6.000000 + mean 359803.000000 + std 283811.764886 + min 122878.000000 + 25% 147733.250000 + 50% 234885.500000 + 75% 597263.000000 + max 729431.000000 + Name: reads-mapped, dtype: float64 + + + Some example query statements: + ------------------------------ + + > "reads-mapped >= 359803" + + > "reads-mapped <= 359803" + + > "(reads-mapped >= 147733) and (reads-mapped <= 234885)" + + +.. Tip:: run ``phippery -h`` for a list of possible commands. Additionally, you can run ``phippery COMMAND -h`` + for option descriptions for a specific command. + +.. click:: phippery.cli:cli + :prog: phippery + :nested: full + diff --git a/_sources/esc-prof.rst.txt b/_sources/esc-prof.rst.txt new file mode 100644 index 0000000..81687fd --- /dev/null +++ b/_sources/esc-prof.rst.txt @@ -0,0 +1,243 @@ + + +.. _sec_escape_profile_comparisons: + +========================= +Comparing Escape Profiles +========================= + +Introduction +------------ + +Phage-DMS [#PhageDMS]_ is an application of PhIP-Seq for deep mutational scanning (DMS). +In Phage-DMS, the peptide library catalogs possible mutations in the viral protein. Of +particular concern are mutations that cause significant loss of antibody binding, +potentially allowing the virus to escape the immune response. When considering only +mutations that cause single amino acid substitutions, the results can be summarized in +an *escape profile* [#PDMS_SCV2]_ showing the impact on binding for every possible +substitution at each site. This can be visualized in a logo plot where the scaled +differential selection [#PhageDMS]_ of each amino acid substitution is reflected by the +height of its one-letter symbol, + +.. image:: images/logoplot_example.png + :width: 500 + :align: center + :alt: logo plot visualization of an escape profile + +There are two aspects of interest at each site: + +- the sum over all substitutions reflecting the total potential for change in binding, +- the pattern of amino acid contributions, i.e. the relative contribution of each substitution to change in binding. + +Naturally, one would like to compare escape profiles of different samples, and a +quantitative approach would allow for systematic analysis of many profiles. This page +describes a scoring method for comparing two escape profiles. The main steps are: + +1. assigning an escape similarity score to each site by comparing the pattern of amino acid contributions, +2. computing a weighted sum of escape similarity scores across the sites of interest to obtain a single score for the region. + + +Escape similarity score at a site +--------------------------------- + +Given two patterns of contributions, we want an approach that accounts for the degree +of similarity between any two amino acids, instead of only comparing contributions +from matching amino acids. For this purpose, we use the BLOSUM62 substitution matrix +[#BLOSUM]_, which assigns an integer score between two amino acids based on how often +their substitution is observed in empirical data. We then map the problem of comparing +amino acid patterns to the problem of comparing distributions in the framework of +optimal transport. + +In brief, an optimal transport problem involves two distributions and a specification of +cost to transport "contents" between them, and the objective is to determine how to +transform one distribution into the other while minimizing the total cost. This minimum +cost reflects the level of similarity between the two distributions; the lower the cost, +the more similar they are. + +Each pattern is represented as a binned distribution. There are 20 amino acids +but a mutation could result in negative or positive differential selection, corresponding to +loss or gain in binding respectively, which are two different effects. Therefore, two bins are +associated with each amino acid, one for negative differential selection and one for +positive differential selection, resulting in a 40-bin distribution. The bin contents +are the relative contribution to the total absolute differential selection at the site. +For any amino acid pattern, at most 19 bins are non-zero because an amino acid substitution +cannot contribute negative and positive differential selection simultaneously, and the +wild type amino acid contributes zero by definition. + +.. image:: images/logo_to_distr.png + :width: 500 + :align: center + :alt: Diagram for conversion of logo pattern to binned distribution + +The cost matrix is based on the BLOSUM62 matrix. Denote the entries of the BLOSUM62 matrix +by :math:`M_{ij}`, which quantifies an overall similarity between amino acids :math:`i` and +:math:`j`. For transport between same-sign differential selection "contents" +(e.g. negative with negative) of :math:`i` and :math:`j`, the cost is given by, + +.. math:: + C_{ij} = \exp\left(-M_{ij}/7\right). + +The exponentiation is applied so that cost values are positive. Higher values in the BLOSUM62 +matrix corresponds to higher similarity between amino acids, and vice versa, so the negative +sign is applied to assign the corresponding cost. The factor of 7 is included so that the +range of cost values lie within a factor of 10, to avoid a single site from overwhelming +the scores of all other sites when we aggregate across a region. + +For transport between opposite-sign differential selection, we disregard similarity between +amino acids and simply assign a fixed cost of :math:`C_{\scriptsize \mbox{max}} = \exp\left(4/7\right)`, +which is the maximum cost possible because the BLOSUM62 matrix has the minimum entry of :math:`-4`. + +Putting this altogether, the complete cost function is a :math:`40\times40` matrix that can +be expressed in blocks of :math:`20\times20` sub-matrices as the following: + +.. math:: + + \begin{bmatrix} + C_{ij} & C_{\scriptsize \mbox{max}} \\ + C_{\scriptsize \mbox{max}} & C_{ij} + \end{bmatrix}, + +where the off-diagonal blocks are sub-matrices with :math:`C_{\scriptsize \mbox{max}}` for all entries. + +To solve the optimal transport problem, we use the +`Python Optimal Transport package `_ [#POT]_. +The obtained minimum cost is inversely related to how similar the two escape profiles +are, so we define the *escape similarity score* to be the reciprocal of this cost value. We do this because +our interest leans more towards identifying escape profiles that are consistent, and working with +similarity score rather than cost makes the interpretation a little easier when we aggregate +scores across sites in a region. We attribute a high regional escape similarity score to +having several sites with high similarity, in contrast to a low regional cost due to lacking +sites with high cost. Of course, the conclusions don't change either way -- cost and similarity +are just two sides of the same coin. + +The diagram below summarizes the procedure for comparing patterns of amino acid contributions at a site. +For brevity, the site in the example contains only negative differential selection in both profiles so +we illustrate the distributions with just 20 bins. + +.. image:: images/esc_prof_ot_diagram.png + :width: 600 + :align: center + :alt: Diagram of similarity score calculation with optimal transport. + + +In ``phippery``, the example illustrated by the diagram above translates to the following, + +.. code:: python + + from phippery.escprof import * + + profile1 = [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + + profile2 = [ + 0, 0, 0, 0.5,0, 0, 0, 0, 0, 0, + 0.2,0, 0, 0, 0, 0, 0.3,0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ] + + cost_matrix = get_cost_matrix() + + compute_sim_score(profile1, profile2, cost_matrix) + + """ + 0.9744633979128656 + """ + +The escape similarity score for the site is approximately 0.97. The ``get_cost_matrix()`` +function provides the cost matrix based on BLOSUM62 as described above. Note that an +ordering of amino acids is assumed, which is ``ARNDCQEGHILKMFPSTWYV``; hence, the first 20 +bins correspond to negative differential selection contributions for amino acids in that order, +and the last 20 bins likewise correspond to positive differential selection contributions. +The ``get_aa_ordered_list()`` function returns a list with this ordering, + +.. code:: python + + from phippery.escprof import * + aa_list = get_aa_ordered_list() + print(aa_list) + + """ + ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'] + """ + + +Escape similarity score for a region +------------------------------------ + +Having defined and computed the escape similarity score for each site, a score for the +comparison across a region is calculated by a weighted sum of site scores. The weights +are assigned so that sites contributing larger scaled differential selection in both +profiles are given higher importance. + +First, compute the relative contribution of each site to the profile. This is the summed +absolute scaled differential selection at a site divided by the sum over all sites in the +region. Denote these relative contributions by :math:`\left\{\alpha_k\right\}` and +:math:`\left\{\beta_k\right\}` for the two profiles, where :math:`k` runs over the sites. +Then for each site, we choose the minimum, + +.. math:: + + \mu_k = \min\left(\alpha_k,\,\beta_k\right). + +The motivation to take the minimum (as oppose to the average) is because we wish to lower +the importance of the score at sites that have very different relative contributions +in the two profiles (i.e. very high in one and very low in the other). Therefore, we are +considering such sites to be rather dissimilar regardless of how concordant their amino acid +patterns may be. + +Finally, we normalize such that the sum of weights is 1, + +.. math:: + + w_k = \frac{\mu_k}{\sum_k \mu_k}. + +Given the set of scores across the sites, :math:`\left\{s_k\right\}`, the escape similarity +score for the region is, + +.. math:: + + S = \sum_k w_k s_k + + +The left and right plots shown below each illustrate a comparison of a pair of escape +profiles. In each plot, the top two panels are the logo plots of the profiles under comparison. +The third panel is the bar plot of the per site weights, :math:`\{w_k\}`. The bottom panel shows +the weighted per site escape similarity scores, :math:`\{w_k s_k\}`. The region escape similarity +scores are shown at the top of the plot, indicating that the pair of profiles on the right are more +concordant than the pair on the left. + + +|esc_comp1| |esc_comp2| + +.. |esc_comp1| image:: images/esc_prof_compare1.png + :width: 48% + +.. |esc_comp2| image:: images/esc_prof_compare2.png + :width: 48% + + +In ``phippery``, the region escape similarity score can be computed with ``region_sim_score()``. + + + +References +---------- + +.. [#PhageDMS] Garrett, M.E., et al., `Phage-DMS: A Comprehensive Method for Fine Mapping of + Antibody Epitopes `_. + iScience, 2020. **23** (10): p. 101622. + +.. [#PDMS_SCV2] Garrett, M.E., et al., `High resolution profiling of pathways of escape for + SARS-CoV-2 spike-binding antibodies `_. + Cell, 2021. **184** (11): p. 2927-2938. + +.. [#BLOSUM] Henikoff, S. and Henikoff, J.G., `Amino Acid Substitution Matrices from Protein Blocks + `_. PNAS, 1992. **89** (22): + p. 10915-10919. + +.. [#POT] Flamary, R., et al., `POT: Python Optimal Transport `_. JMLR, 2021. **22** (78): p. 1-8. diff --git a/_sources/examples.rst.txt b/_sources/examples.rst.txt new file mode 100644 index 0000000..49e4abb --- /dev/null +++ b/_sources/examples.rst.txt @@ -0,0 +1,423 @@ + +.. _sec_quick_start: + +======== +Examples +======== + +There are a few primary steps to PhIP-Seq analysis after the sequencing and +demultiplexing of samples. To address each of these, we provide +a flexible `Nextflow automated pipeline `_ +used for producing the +enrichment data when provided +Next Generation Sequencing (demultiplexed fastq files) data, +as well as coupled sample and peptide library annotation files, as input. +Below, we'll give a brief overview of using the pipeline on some example data, +followed by a typical approach for running on some new data. + +Pan-CoV example dataset +^^^^^^^^^^^^^^^^^^^^^^^ + +The dataset provided with this pipeline +is derived from a pre-COVID-19 healthy adult serum +sample, along with serum from a SARS-CoV-2 infected convalescent individual, +both run in duplicate across two separate batches of the Pan-Human CoV full +proteome library. +Huge thanks to the authors of +`Stoddard et al. 2021 `_ and the wonderful folks at the +`Overbaugh Lab `_ for obtaining this data and allowing us to use it here. + +.. _sec_align_soup_nutz: + +The example data is included and run by default unless specified otherwise. +This input includes the next generation +sequencing files for each of the six samples described +in the `sample table `_: +the replicates of the samples described above, as well as two replicates of the input phage library. +We'll begin by aligning the fastq files to the oligo library described by the +oligonucleotide coding sequences in the +`peptide table `_. + +Running locally ++++++++++++++++ + +.. _sec_clone_template: + +To run the following example, you must first have installed +`docker `_, +and `Nextflow `_. +For our approach to easy installation, see the :ref:`installation page `. + +To run the pipeline, we can use the +`nextflow run `_, +git-aware command. This will run the specified version (``-r V1.12``) of the pipeline in the current working directory. +We recommend using the latest version which can be seen in the `release section `_ of the repository. +Note that no cloning of the repository is necessary if we're simply running the pipeline and +we do not wish to modify the source code. + +Simply: +:: + + $ nextflow run matsengrp/phip-flow -r V1.12 -profile docker --output_tall_csv true + +Here we specified three parameters: two that are native to ``Nextflow`` +(denoted with a single **'-'** prefix) and one that is specific to +``PhIP-Flow`` (double minus **'- -'** symbols). +Here, we did not specify a sample table or peptide table, so the pipeline +will run on the default example data. +Additionally, we did not specify a results directory, so the pipeline will +,by default, write to ``results/``: +(1) a pickled binary +`xarray DataSet object `_ +(as it is the primary data structure for using the :ref:`Python CLI `) +in addition to +(2) an RDS file for the respective `PhIPData Object `_. +The options ``--output_tall_csv`` (default false) and ``--output_wide_csv`` (default true) each specifies one +of two optional output formats: a tall CSV and a collection of wide CSVs. + +.. seealso:: For more on the parameters that specify pipeline behavior, see the + :ref:`alignments pipeline parameters ` section. + +.. note:: For more on these CSV formats see this + `great blog post `_ + on the topic. + +By default, this command ran the pipeline on the example dataset +described above. The files can be viewed in the +`phip-flow git repo `_. +In short, the workflow +(1) used ``bowtie`` to align all the reads described in the +sample annotation table to the reference phage library described in the +peptide table, +(2) computed some useful statistics on raw counts +(such as the edgeR log fold enrichment), and +(3) formatted the data +into a single coherent dataset. +For more detail about the exact steps that were run, +see the :ref:`nextflow pipeline page `. + +Running on HPC (cluster) +++++++++++++++++++++++++ + +Above, we specified ``-profile docker`` as a parameter option, +which will assume you are running +this locally with ``Docker`` and ``Nextflow`` installed. +For high performance computing systems, we can also specify +the ``-profile cluster`` option for running the default configurations +on a `slurm `_ cluster. +This option assumes the cluster has loaded modules or installs for +Singularity and Nextflow. Here's an example script we might execute to run +the pipeline on the Fred Hutch Rhino machines: + +.. code-block:: bash + + #!/bin/bash + + set -e + source /app/lmod/lmod/init/profile + + module load nextflow + module load Singularity + export PATH=$SINGULARITYROOT/bin/:$PATH + + nextflow run matsengrp/phip-flow -r V1.12 \ + --read_length 125 \ + --oligo_tile_length 117 \ + --output_tall_csv true \ + --results "$(date -I)" \ + -profile cluster \ + -resume + +Here, we specified a few more parameters, ``--read_length`` and ``--oligo_tile_length`` that define our input data for alignment purposes. +See the :ref:`Creating and running your own data ` section for more details on these. + + +Example results (tall CSV) +++++++++++++++++++++++++++ + + +Now, let's take a quick +look at the results from the Pan-CoV example dataset that was run. +By default, the pipeline runs the Pan-CoV example data, +and writes the results out to a directory, "*results/*". +The pickled binary +`xarray `_ +object is output by default, and we additionally specified that a tall style data ("data-tall.csv") as well +as a collection of wide style data matrices be output. +Let's take a quick look. + +:: + + results + ├── pickle_data + │   └── data.phip + ├── rds_data + │   └── PhIPData.rds + ├── tall_data + │   └── data-tall.csv.gz + └── wide_data + ├── data_counts.csv.gz + ├── data_cpm.csv.gz + ├── data_edgeR_hits.csv.gz + ├── data_edgeR_logfc.csv.gz + ├── data_edgeR_logpval.csv.gz + ├── data_peptide_annotation_table.csv.gz + ├── data_sample_annotation_table.csv.gz + └── data_size_factors.csv.gz + + 4 directories, 11 files + +Note the csv outputs are ``gzipped``, so we'll need to unzip them before +moving forward. The following command unzip's all the csv files in the +results directory. + +:: + + gunzip results/**/*.csv.gz + +Let's take a look at how you might use **ggplot** +to visualize the data found in the tall formatted CSV. +We'll start by plotting the individual sample enrichments, colored by +infection status. + +.. code-block:: R + + library(ggplot2) + library(dplyr) + library(viridis) + + phip_data <- read.table( + "results/tall_data/data-tall.csv", # gunzip first + header=TRUE, sep= "," + ) %>% + filter(Protein == "spike") %>% + filter(Virus == "SARSCoV2") + + # Plot + p <- phip_data %>% + ggplot(aes( + x=Prot_Start, y=counts, + group=factor(sample_id), + color=factor(patient_status)) + ) + + theme_bw() + + geom_line() + + ggtitle("Sars-CoV-2 Spike Protein Enrichments") + + labs(y="# peptide alignments", x="Locus", color="infection status") + + +.. figure:: images/example-counts-R.svg + :width: 700 + :alt: example results + :align: left + + Example data counts plotted as a function of location on Spike + protein of SARS-CoV-2, and colored by infection status of the + sample. + +Example results (wide CSV) +++++++++++++++++++++++++++ + +Looking at the files in the wide format sub directory, we are given back the +peptide and sample annotation tables, both +with an index (i.e. first) column "peptide_id" and "sample_id". +These indices can simply be mapped back to the rows and columns +of each of the output enrichment matrices. +By default, the phip-flow pipeline outputs the raw counts as well as +counts per million and size factor normalizations +(`Anders and Huber, 2010 `_) +of the matrix. +Let's use matplotlib's ``implot`` to plot the same sample's binding to OC43 as a heatmap. + +.. code-block:: python3 + + import pandas as pd + import seaborn as sns + import matplotlib.pyplot as plt + + cpm = pd.read_csv("results/wide_data/data_cpm.csv", index_col=0, header=0) + cpm.columns = cpm.columns.astype(int) + sample_table = pd.read_csv("results/wide_data/data_sample_annotation_table.csv") + peptide_table = pd.read_csv("results/wide_data/data_peptide_annotation_table.csv") + + OC43_spike = peptide_table.query("Full_name == 'OC43_SC0776_spike'") + non_null_samples = sample_table.query("patient_status.notnull()") + cpm_OC43_spike = cpm.loc[OC43_spike.index, non_null_samples.index] + + fig, ax = plt.subplots(figsize=[7, 3]) + sns.heatmap( + cpm_OC43_spike.transpose(), + yticklabels=non_null_samples["patient_status"], + xticklabels=OC43_spike["Prot_Start"], + cbar_kws={'label': 'binding counts per million'}, + ax=ax, cmap="YlGnBu", + vmax = 2000 + ) + + for label in ax.xaxis.get_ticklabels()[::2]: + label.set_visible(False) + + ax.set_title("OC43 Spike Binding - \n Strain: SC0776") + ax.set_xlabel("Locus") + plt.tight_layout() + +.. figure:: images/example-heatmap-Py-2.svg + :width: 700 + :alt: example heatmap results + :align: left + + A heatmap of peptide alignment counts per million across the OC43 + Spike protein. Each row corresponds to a sample replicate. + +.. _example_own_data: + +Creating and running your own data +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. _alignment_approach: + +Alignment approach +++++++++++++++++++ + +We designed this pipeline to work well with the common protocol for PhIP-Seq +experiments; which is to use a single read, shotgun sequencing of the phage library +after the antibody immunoprecipitation step. +We expect the input reads to be trimmed to a uniform length +(specified with the ``--read_length`` parameter), which should be +longer than, or equal to, the oligonucleotide sequence encoding any given peptide in the provided library +(specified with the ``--oligo_tile_length`` parameter). +Additionally, we assume that your peptide library is comprised of +uniform-length oligonucleotide sequences (tiles), and that sequencing adapters are +designed such that the 5' (high-quality) end of the read is +where alignment should begin. + +Concretely, we perform alignment of reads to the peptide-encoding oligo sequences +via `bowtie (-n mode) `_. +This means alignments may have no more than ``--n_mismatches`` mismatches +(where ``--n_mismatches`` is a number 0-3, with a default of 2) +in the first ``--oligo_tile_length`` bases +(where ``--oligo_tile_length`` is a number 5 or greater, with a default of 117) +on the high-quality (left) end of the read. +Additional parameters for alignment can be specified by the ``--bowtie_optional_args`` parameter, +which by default is ``--tryhard --nomaqround --norc --best --sam --quiet``. +This specifies that the aligner should not be looking at the reverse compliment +of the oligo sequences, and that it should report *only* the best alignment for each read. +This can be modified as you see fit. +It's worth noting that while we only report a single alignment per read, +if there are identical oligo sequences in the peptide table (described below) +then the parameter ``--replicate_sequence_counts`` (default True) will ensure that +that the resulting alignment counts for all replicate sequences are reported as the sum +of alignments across each. + +Ideally, the ``--read_length`` is the same as the length specified by the +``--oligo_tile_length`` parameter. +If the ``read_length`` is greater than the ``oligo_tile_length``, +we use bowtie's ``--trim3`` parameter to trim the reads on the 3' +end to match the ``--oligo_tile_length``. +If for some reason reads are shorter than the ``--oligo_tile_length``, +or variable in length, then we recommend setting the ``--read_length`` to ``0``, +and potentially allowing for more ``--n_mismatches`` +such that reads are *not* trimmed before alignment, and partial reads still have a chance +at being reported. + +If you would like to modify the behavior of the alignment approach +outside the scope of the ``--bowtie_optional_args`` parameters described above +or even the alignment tool itself, +and you have experience with Nextflow, +it should be relatively straightforward to modify the +`alignment template script `_, it's +`respective parameters `_, +and the +`associated process definition `_. + +Input file requirements ++++++++++++++++++++++++ + +Input to the pipeline is dependent upon the following: + +- **NGS files**: Single-read, demultiplexed fastq files for each of the samples. + We do not currently support paired-end reads. + +- **sample annotation table**: a CSV containing a column *fastq_filepath*, + where each row contains a path relative from where the pipeline is run + to where the respective fastq file resides. + +- **peptide annotation table**: a CSV containing a column *oligo*, + where each row contains a single peptide from the complete library + used in the antibody immunoprecipitation step. This will be generated into an index for all samples + to be aligned to. + +As an example, let's assume there's some directory *ngs/* containing all the +fastq files for a project. To organize these files (excluding barcode files) +into a minimal sample table describing each of their relative paths, we might +use the following command. + +.. code-block:: bash + + (echo "fastq_filepath" && ls ngs/*R1*.gz) > sample_table.csv + +Now, we must have a peptide annotation file which will describe the phage library +being used in this particular study. Usually, we expect something of this +nature has been created prior to synthesizing the library during the +phage library design. For the sake of this pipeline, we must have +a column denoting the oligonucleotide sequence. Here's an peek +at what a +`phage-dms `_ +peptide annotation might look like: +:: + + Virus,Protein,Loc,aa_sub,Loc_Rel,is_wt,oligo + BG505,gp120,1,G,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGGTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,E,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGAAGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,D,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGACGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,V,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGTTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,A,30,TRUE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGCTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,R,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTCGTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,S,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTTCTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,K,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTAAAGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + BG505,gp120,1,N,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTAACGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc + +.. warning:: Currently, only *upper case* oligonucleotides will be included as + part of the reference index when aligning the reads. Historically, we have + encoded the barcodes with lower case letters. + +With these, we can simply use the same command as shown above, however, now +we will specify the ``--sample_table`` and ``--peptide_table`` parameters +to the ``run`` command: + +.. code-block:: bash + + #!/bin/bash + + set -e + source /app/lmod/lmod/init/profile + + module load nextflow + module load Singularity + export PATH=$SINGULARITYROOT/bin/:$PATH + + nextflow run matsengrp/phip-flow -r main \ + --sample_table sample_table.csv \ + --peptide_table peptide_table.csv \ + --output_tall_csv true \ + --output_wide_csv true \ + --results "$(date -I)" \ + -profile cluster \ + -resume + +Note that while here we specified nothing but the fastq filepaths +in the sample table, we could have populated the CSV with +any number of useful annotations pertaining to the fastq files in each +of the rows. Any of the annotations added here will be tied in correctly +to all output formats for more organized downstream analysis and plotting. + +If you want to run some of the more advanced analysis available through +this pipeline such as fold enrichment, +differential selection, or model fitting for estimates of significance, +you will need to include special annotations +in either of the annotation tables. +The requirements and descriptions of +these columns can be found in the +:ref:`optional workflows ` section of the documentation. + + diff --git a/_sources/index.rst.txt b/_sources/index.rst.txt new file mode 100644 index 0000000..6da304d --- /dev/null +++ b/_sources/index.rst.txt @@ -0,0 +1,72 @@ +.. phippery documentation master file, created by + sphinx-quickstart on Mon Sep 27 17:42:02 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + + +Welcome to phippery's documentation! +==================================== + +.. toctree:: + :maxdepth: 2 + :caption: Overview: + + introduction + installation + examples + +.. toctree:: + :maxdepth: 1 + :caption: Nextflow Pipeline: + + alignments-pipeline + +.. toctree:: + :maxdepth: 1 + :caption: Python API: + + phippery.utils + phippery.normalize + phippery.modeling + phippery.eigen + phippery.escprof + +.. toctree:: + :maxdepth: 1 + :caption: Command Line Interface: + + command-line-interface + +.. toctree:: + :maxdepth: 2 + :caption: Streamlit Viz App + + streamlit-app + +.. toctree:: + :maxdepth: 2 + :caption: Methods Descriptions + + esc-prof + bkg-model + +.. toctree:: + :maxdepth: 2 + :caption: The Rest of It + + the-rest-of-it + +.. interactive-visualization + annotation-tables + under-the-hood + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + + + +.. todolist:: diff --git a/_sources/installation.rst.txt b/_sources/installation.rst.txt new file mode 100644 index 0000000..2549e5d --- /dev/null +++ b/_sources/installation.rst.txt @@ -0,0 +1,101 @@ + +.. _sec_install_intro: + +============ +Installation +============ + +.. _sec_installation_phippery: + +^^^^^^^^^^ +Python API +^^^^^^^^^^ + +Installation of the ``phippery`` python package is available through + +.. code-block:: + + » pip install phippery + +.. seealso:: for more information about how to contribute + please see the :ref:`Development ` page. + + +.. _sec_installation_phipflow: + +^^^^^^^^^^^^^^^^^^^ +Alignments Pipeline +^^^^^^^^^^^^^^^^^^^ + +For running the ``Nextflow`` alignments pipeline, +we maintain a +`Dockerfile `_, +and host a pre-built +`public image `_ +on quay.io for convenience. + +.. note:: + Note that the quay image is pointed to by default + in the pipeline configuration file -- + meaning if you have both ``Docker`` and ``Nextflow`` + installed, you have everything you need to run the pipeline + with ``--profile docker`` specified after the ``nextflow run`` + command. The other option would be to pull, + or build the image yourself, then run the pipeline + within that container. + +To install +`docker desktop `_ +(Desktop is just fine), +on most unix OS: + +.. code-block:: bash + + » curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh + +To test the Docker install: + +.. code-block:: bash + + » docker -v + Docker version 20.10.1, build 831ebea + » docker run docker/whalesay cowsay boo + +To install +`Nextflow `_ +on most Unix OS: + +.. code-block:: bash + + » curl -s https://get.nextflow.io | bash + +To test the Nextflow install: + +.. code-block:: bash + + » nextflow -v + nextflow version 20.04.1.5335 + + +^^^^^^^^^^^^^ +Streamlit App +^^^^^^^^^^^^^ + +We reccomend running streamlit through the +`quay public image `_ +we maintain. + +Simply navigate to a directory where you have some ``.phip`` +binary datasets and run + +.. code-block:: + + » docker run -p 8501:8501 -v $PWD:/app/data/ quay.io/matsengrp/phip-viz + + +for local installation + +.. code-block:: + + » git clone https://github.com/matsengrp/phip-viz.git + » (cd phip-viz && pip install -r requirements.txt) diff --git a/_sources/introduction.rst.txt b/_sources/introduction.rst.txt new file mode 100644 index 0000000..b4acf11 --- /dev/null +++ b/_sources/introduction.rst.txt @@ -0,0 +1,158 @@ + +.. _sec_introduction: + +============ +Introduction +============ + +Welcome to the documentation for ``phippery``. +We present a software suite of data analysis tools for +`Phage Immunoprecipitation Sequencing (PhIP-Seq) `_ [#PhIPSeq]_, +a high-throughput phage-display sequencing technique. +All the tools presented here are +designed for flexibility and general purpose, suitable for +either *commonly used* (e.g. Virscan) +or *highly customized* phage-display libraries +(e.g. Phage-DMS). + +We encourage bug reporting and all other +helpful feedback -- +the source code for ``phippery`` can be found at +https://github.com/matsengrp/phippery. For more +on contributing, see the +:ref:`contributing ` page. + +If you find these tools useful for your own research studies please cite our manuscript, +`phippery: a software suite for PhIP-Seq data analysis `_. + +=============================================== + +.. figure:: images/phippery-suite-6.svg + :width: 1000 + :alt: phippery suite schematic + :align: left + + **Software tools schematic:** A cartoon flow + chart description of the workflow using + each of the tools of ``phippery``. + (A) Inputs from the experimentalist feed into + the alignment pipeline. The inputs are: the list + of demultiplexed files (fastq) for the samples + under study, along with an annotation table of + relevant sample-specific information; a peptide + table listing all peptides in the phage library + and descriptors of interest (oligo sequence to + align sequencing reads to, virus, protein, + locus, etc) + (B) A python API to perform tasks such as + data wrangling or model fitting. + Most operations result in "layering" + specific transformations onto the primary data + structure. For more details on code structure and the + available CLI, see :ref:`under the hood `. + (C) An interactive browser-based application presents + the layered data, allowing users to aggregate + and visualize data by selecting on sample and peptide + annotation features. The export functionality provides + image files (of the visualization) or the + underlying raw data (in tall or wide formats) for + plotting with any of your favorite packages. + +=============================================== + + ++++++++++++++++ +Getting Started ++++++++++++++++ + +- Head over to the :ref:`Installation ` + page to get installation instructions for each of the three tools described above. + +- To get a feel for running each of the three related tools pictured above, + we suggest following a :ref:`walk through ` of running the + alignments pipeline on some empirical data from `Stoddard et al. 2021 + `_ [#Stoddard]_. + +- Check out the :ref:`running your own data ` section for a bare minimum + approach to getting enrichment values from your own NGS data. + +- Take a look at the :ref:`Nextflow pipeline ` page for a better description + of the pipeline and its features for downstream analysis. + + +++++++++++ +Background +++++++++++ + +The advent of modern oligonucleotide synthesis allows researchers to generate +*highly* multiplexed assays such as PhIP-Seq, which is used to investigate +antibody-antigen interactions with comprehensive phage-display libraries. +The library used in VirScan [#VirScan]_, a general purpose application of PhIP-Seq, +comprises :math:`\mathcal{O}(10^5)` peptides spanning over 1000 individual +strains across 206 species of virus. There are also specialized library designs, +such as in deep mutational scanning, for estimating the impact that mutations to +a viral protein may have on antibody binding [#PhageDMS]_. + +Despite the growing use of the protocol, there is not yet an established set of +software tools for bioinformatics and computational tasks with PhIP-Seq data. +Much of the published code is specific to the authors' experiment, thus new researchers +are either piecing together snippets from others or developing scripts from scratch. +A goal of ``phippery`` is to provide some *efficient* and *unit-tested* general infrastructure +for computing enrichment, data formatting/storing/transforming, and other common analysis +functions. Each of the tools presented here can be used separately or in +conjunction for the rapid exploration of PhIP-Seq data. + +Here we focus most heavily on the ``Nextflow`` pipeline as it provides a framework +for creating, modeling, and computing statistics on a PhIP-Seq dataset. +The :ref:`pipeline inputs ` +are demultiplexed fastq files for each of the sample IP's, +as well as annotation tables +for samples and peptides -- CSV files with only a single column requirement each. +The default workflow then performs all of the major steps in processing the raw data and +obtaining an enrichment dataset (along with some other optional statistical goodies). +The pipeline will output a pickled binary of the +`xarray.DataSet `_ +as described in :ref:`under the hood ` +, and/or optionally two common CSV formats +(`tall & wide `_) +such that the user may query with their own favorite analysis tools. + +++++++++++ +References +++++++++++ + +.. [#PhIPSeq] Mohan, D., et al., + `PhIP-Seq characterization of serum antibodies using oligonucleotide-encoded peptidomes + `_. Nat Protoc, 2018. **13** : p. 1958–1978 (2018). + +.. [#Stoddard] Stoddard, C.I., et al., `Epitope profiling reveals binding signatures of + SARS-CoV-2 immune response in natural infection and cross-reactivity with endemic + human CoVs `_. Cell Reports, 2021. + **35** (8): 109164. + +.. [#VirScan] Xu, G.J., et al., `Comprehensive serological profiling of human populations using a + synthetic human virome `_. + Science, 2015. **348** (6239): aaa0698. + +.. [#PhageDMS] Garrett, M.E., et al., `Phage-DMS: A Comprehensive Method for Fine Mapping of Antibody + Epitopes `_. iScience, 2020. **23** (10): p. 101622. + ++++++++++++++++++++++++++++++ +Licensing and Acknowledgement ++++++++++++++++++++++++++++++ + +This work is provided by members of the +`Matsen `_ and +`Overbaugh `_ groups at the +`Fred Hutchinson Cancer Research Center `_. +The software is publicly available licenced under the +`MIT License `_. +The work presented is funded by the **NIH**, **NSF**, and **HHMI**. + +For questions or concerns about these using tools, +feel free to email jgallowa (at) fredhutch +If you find these tools useful for your own research studies, please cite + +.. note:: + for questions and/or suggestions, please + `open an issue `_ diff --git a/_sources/phippery.eigen.rst.txt b/_sources/phippery.eigen.rst.txt new file mode 100644 index 0000000..de2d1a6 --- /dev/null +++ b/_sources/phippery.eigen.rst.txt @@ -0,0 +1,4 @@ +.. automodule:: phippery.eigen + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/phippery.escprof.rst.txt b/_sources/phippery.escprof.rst.txt new file mode 100644 index 0000000..7538c8e --- /dev/null +++ b/_sources/phippery.escprof.rst.txt @@ -0,0 +1,4 @@ +.. automodule:: phippery.escprof + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/phippery.modeling.rst.txt b/_sources/phippery.modeling.rst.txt new file mode 100644 index 0000000..517e057 --- /dev/null +++ b/_sources/phippery.modeling.rst.txt @@ -0,0 +1,4 @@ +.. automodule:: phippery.modeling + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/phippery.normalize.rst.txt b/_sources/phippery.normalize.rst.txt new file mode 100644 index 0000000..6c89c6b --- /dev/null +++ b/_sources/phippery.normalize.rst.txt @@ -0,0 +1,4 @@ +.. automodule:: phippery.normalize + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/phippery.utils.rst.txt b/_sources/phippery.utils.rst.txt new file mode 100644 index 0000000..2f2bcc1 --- /dev/null +++ b/_sources/phippery.utils.rst.txt @@ -0,0 +1,4 @@ +.. automodule:: phippery.utils + :members: + :undoc-members: + :show-inheritance: diff --git a/_sources/streamlit-app.rst.txt b/_sources/streamlit-app.rst.txt new file mode 100644 index 0000000..b755531 --- /dev/null +++ b/_sources/streamlit-app.rst.txt @@ -0,0 +1,67 @@ + +.. _sec_streamlit_app: + +================= +Streamlit Viz App +================= + +For convenience, we have created a simple +`streamlit `_ application for viewing a ``phippery`` +dataset (i.e. "data.phip") as +`altair heatmaps `_. +The application allows you to subset you data based upon annotations that +were in the sample or peptide tables (see :ref:`pipeline inputs `). + +To use the application on the :ref:`example Pan-CoV dataset `, + +.. code-block:: bash + + » docker run -p 8501:8501 -v $PWD:/app/data/ quay.io/matsengrp/phip-viz + +Your default browser will then open the application and look something like this +at ``http://0.0.0.0:8501`` + +.. figure:: images/launch_viz_app.png + :width: 700 + :alt: example results + :align: left + +As a quick example, click on the expander drop bar on the right side, labeled +"Working Peptides" under ``Peptide table``, +This will show us a brief overview of the peptides in our dataset for reference, or to +add queries that will narrow the scope of our visualizations to a smaller subset. +Notice that the application gives some helpful suggestions based upon the data available. + +We'll start by looking at only peptides from the spike protein of SARS-CoV-2 and 229E +viruses. To do this, type ``(Virus in ['SARS', '229E']) & (Protein == 'spike')`` in the entry box +denoted ``Peptide Query Condition``, and hit the ```` key. You'll +notice the query and it's unique key (denoted starting with "q") +was added to the table. The query was applied to the working +dataset and you can now see the summary of peptides has changes accordingly. + +.. figure:: images/query_peptides_viz_app.png + :width: 700 + :alt: example results + :align: left + +Next, well scroll down to the ``Visualize Enrichment Heatmap`` section to look at our data. +Enter the following options to view the enrichments aggregated by sample type and locus. +The values used to populate the heat map may be conveniently chosen +via a drop-down menu, under "Normalization". +The options available depend on the transformations stored in the input ``xarray`` (.phip) +file. For example, if using the .phip as output by the +:ref:`alignments pipeline `, +then you'll have the option to visualize; +raw counts ("counts"), +counts per million ("cpm"), +significant ``edgeR`` hits ("edgeR_hits), +``edgeR`` lod fold change values ("edgeR_logfc"), +or size factors ("size_factors") normalization. + +.. figure:: images/heatmap_viz_app.png + :width: 700 + :alt: example results + :align: left + +And that's it! For other features such as saving images, uploading query tables, and more, +click on and of the ``?`` boxes to explore the various options. diff --git a/_sources/the-rest-of-it.rst.txt b/_sources/the-rest-of-it.rst.txt new file mode 100644 index 0000000..c6b198f --- /dev/null +++ b/_sources/the-rest-of-it.rst.txt @@ -0,0 +1,150 @@ + +.. _sec_dev_intro: + +======= +Gotchas +======= + +.. _sec_missing_data: + +Missing Annotations (i.e. NaN's) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When dealing with missing values in the annotation tables, we use the +`pd.convert_dtypes `_ +function to best allow for missing annotations, while maintaining the integrity of +the inferred datatype. It is highly recommended you stay consistent with datatype for feature annotations, +i.e. try not to mix values like ``1`` (integer), ``6.7`` (float), and ``hello_world`` (string) in any one of the columns. +For missing data of any type, +The following values will be interpreted as ``NaN``: + +:: + + ‘’, ‘#N/A’, ‘#N/A N/A’, + ‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’, ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘’, + ‘N/A’, ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’. + +.. _sec_contribute: + +============ +Contributing +============ + +We welcome and encourage contributions to the pipeline. +We recommend following the same instructions +as `tskit `_ +for submitting a `pull request `__. + +Phippery Development Install +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +For activate development, and documentation, we recommend using the following +instructions inside of a virtual environment or equivalent. + +:: + + » git clone https://github.com/matsengrp/phippery.git + » (cd phippery && pip install -e ".[dev]") + +Next, run the tests to make sure everything is working properly. + +:: + + » (cd phippery && pytest -vv) + + +PyPI +^^^^ + +This process will most likely be handled by the +maintainers of the project after a PR has been approved +and merged into main. + +Update the version: +:: + + bumpver update --patch + +:: + + For small changes, use ``--patch`` + For minor changes, use ``--minor`` + For major changes, use ``--major`` + +Build the wheel +:: + + python -m build + +Use Twine to check +:: + + twine check dist/* + +Optionally, Use Twine to upload to testpypi +:: + + twine upload -r testpypi --verbose dist/* + + + +Building Documentation +^^^^^^^^^^^^^^^^^^^^^^ + +To edit the documentation seen here, +simply edit the respective ``.rst`` file +(following the git workflow described below) +in the ``docs/`` subdirectory. Once edited, you can check +the edits are rendered correctly by building the docs locally + +:: + + » cd docs/ + » make clean && make html + +Then open the index file built at ``_build/html/index.html`` +with a browser of choice to inspect changes. + +Once the changes have been approved and merged into the main branch +the documentation will automatically build and deploy. + + +.. _sec_under_the_hood: + +The Data Structure +^^^^^^^^^^^^^^^^^^ + +The primary data structure resulting from PhIP-Seq experiments is an *enrichment matrix*, +X, with i rows and j columns. +Commonly, row index represents a peptide that is displayed on a phage, +and each column represents a sample that was mixed with the entire phage library. +After sequencing and demultiplexing each sample, we align the reads to the +oligonucleotide reference library to observe a +count of aligned reads to each peptide. + +Outside of the enrichment matrix, each *sample* in an experiment as well as each *peptide* +in the phage library used have number of important annotations required when +performing analysis tasks like model fitting, normalizing, and differential selection. +Additionally, the comparison across groups of virus proteins and +sample types is crucial in many experiments. For large sample size experiments, +it can be difficult to cross reference each of these groups before and +after analysis. + +Here, we take advantage of the powerful +`xarray `_ +approach to organizing all the Phip-Seq data along four primary coordinate +dimensions which tie all sample/peptide enrichments to the respective annotations. +Doing this allows us to store all the information without the error prone +step of cross-checking separate dataframes, and without the +large storage scaling of using "Tall" dataframes. + + +.. figure:: images/xarray-format.svg + :width: 400 + :alt: phippery xarray format + :align: left + + **Xarray Dataset Format** A cartoon representation + of the format output by the pipeline for + we require for using phippery functions. + Concretely, for a matrix, `\mathcal{M}_{i}{j}` diff --git a/_static/Xarray_function.png b/_static/Xarray_function.png new file mode 100644 index 0000000..e3815be Binary files /dev/null and b/_static/Xarray_function.png differ diff --git a/_static/_sphinx_javascript_frameworks_compat.js b/_static/_sphinx_javascript_frameworks_compat.js new file mode 100644 index 0000000..8549469 --- /dev/null +++ b/_static/_sphinx_javascript_frameworks_compat.js @@ -0,0 +1,134 @@ +/* + * _sphinx_javascript_frameworks_compat.js + * ~~~~~~~~~~ + * + * Compatability shim for jQuery and underscores.js. + * + * WILL BE REMOVED IN Sphinx 6.0 + * xref RemovedInSphinx60Warning + * + */ + +/** + * select a different prefix for underscore + */ +$u = _.noConflict(); + + +/** + * small helper function to urldecode strings + * + * See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURIComponent#Decoding_query_parameters_from_a_URL + */ +jQuery.urldecode = function(x) { + if (!x) { + return x + } + return decodeURIComponent(x.replace(/\+/g, ' ')); +}; + +/** + * small helper function to urlencode strings + */ +jQuery.urlencode = encodeURIComponent; + +/** + * This function returns the parsed url parameters of the + * current request. Multiple values per key are supported, + * it will always return arrays of strings for the value parts. + */ +jQuery.getQueryParameters = function(s) { + if (typeof s === 'undefined') + s = document.location.search; + var parts = s.substr(s.indexOf('?') + 1).split('&'); + var result = {}; + for (var i = 0; i < parts.length; i++) { + var tmp = parts[i].split('=', 2); + var key = jQuery.urldecode(tmp[0]); + var value = jQuery.urldecode(tmp[1]); + if (key in result) + result[key].push(value); + else + result[key] = [value]; + } + return result; +}; + +/** + * highlight a given string on a jquery object by wrapping it in + * span elements with the given class name. + */ +jQuery.fn.highlightText = function(text, className) { + function highlight(node, addItems) { + if (node.nodeType === 3) { + var val = node.nodeValue; + var pos = val.toLowerCase().indexOf(text); + if (pos >= 0 && + !jQuery(node.parentNode).hasClass(className) && + !jQuery(node.parentNode).hasClass("nohighlight")) { + var span; + var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); + if (isInSVG) { + span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + } else { + span = document.createElement("span"); + span.className = className; + } + span.appendChild(document.createTextNode(val.substr(pos, text.length))); + node.parentNode.insertBefore(span, node.parentNode.insertBefore( + document.createTextNode(val.substr(pos + text.length)), + node.nextSibling)); + node.nodeValue = val.substr(0, pos); + if (isInSVG) { + var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); + var bbox = node.parentElement.getBBox(); + rect.x.baseVal.value = bbox.x; + rect.y.baseVal.value = bbox.y; + rect.width.baseVal.value = bbox.width; + rect.height.baseVal.value = bbox.height; + rect.setAttribute('class', className); + addItems.push({ + "parent": node.parentNode, + "target": rect}); + } + } + } + else if (!jQuery(node).is("button, select, textarea")) { + jQuery.each(node.childNodes, function() { + highlight(this, addItems); + }); + } + } + var addItems = []; + var result = this.each(function() { + highlight(this, addItems); + }); + for (var i = 0; i < addItems.length; ++i) { + jQuery(addItems[i].parent).before(addItems[i].target); + } + return result; +}; + +/* + * backward compatibility for jQuery.browser + * This will be supported until firefox bug is fixed. + */ +if (!jQuery.browser) { + jQuery.uaMatch = function(ua) { + ua = ua.toLowerCase(); + + var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || + /(webkit)[ \/]([\w.]+)/.exec(ua) || + /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || + /(msie) ([\w.]+)/.exec(ua) || + ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || + []; + + return { + browser: match[ 1 ] || "", + version: match[ 2 ] || "0" + }; + }; + jQuery.browser = {}; + jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; +} diff --git a/_static/basic.css b/_static/basic.css new file mode 100644 index 0000000..4e9a9f1 --- /dev/null +++ b/_static/basic.css @@ -0,0 +1,900 @@ +/* + * basic.css + * ~~~~~~~~~ + * + * Sphinx stylesheet -- basic theme. + * + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ + +/* -- main layout ----------------------------------------------------------- */ + +div.clearer { + clear: both; +} + +div.section::after { + display: block; + content: ''; + clear: left; +} + +/* -- relbar ---------------------------------------------------------------- */ + +div.related { + width: 100%; + font-size: 90%; +} + +div.related h3 { + display: none; +} + +div.related ul { + margin: 0; + padding: 0 0 0 10px; + list-style: none; +} + +div.related li { + display: inline; +} + +div.related li.right { + float: right; + margin-right: 5px; +} + +/* -- sidebar --------------------------------------------------------------- */ + +div.sphinxsidebarwrapper { + padding: 10px 5px 0 10px; +} + +div.sphinxsidebar { + float: left; + width: 230px; + margin-left: -100%; + font-size: 90%; + word-wrap: break-word; + overflow-wrap : break-word; +} + +div.sphinxsidebar ul { + list-style: none; +} + +div.sphinxsidebar ul ul, +div.sphinxsidebar ul.want-points { + margin-left: 20px; + list-style: square; +} + +div.sphinxsidebar ul ul { + margin-top: 0; + margin-bottom: 0; +} + +div.sphinxsidebar form { + margin-top: 10px; +} + +div.sphinxsidebar input { + border: 1px solid #98dbcc; + font-family: sans-serif; + font-size: 1em; +} + +div.sphinxsidebar #searchbox form.search { + overflow: hidden; +} + +div.sphinxsidebar #searchbox input[type="text"] { + float: left; + width: 80%; + padding: 0.25em; + box-sizing: border-box; +} + +div.sphinxsidebar #searchbox input[type="submit"] { + float: left; + width: 20%; + border-left: none; + padding: 0.25em; + box-sizing: border-box; +} + + +img { + border: 0; + max-width: 100%; +} + +/* -- search page ----------------------------------------------------------- */ + +ul.search { + margin: 10px 0 0 20px; + padding: 0; +} + +ul.search li { + padding: 5px 0 5px 20px; + background-image: url(file.png); + background-repeat: no-repeat; + background-position: 0 7px; +} + +ul.search li a { + font-weight: bold; +} + +ul.search li p.context { + color: #888; + margin: 2px 0 0 30px; + text-align: left; +} + +ul.keywordmatches li.goodmatch a { + font-weight: bold; +} + +/* -- index page ------------------------------------------------------------ */ + +table.contentstable { + width: 90%; + margin-left: auto; + margin-right: auto; +} + +table.contentstable p.biglink { + line-height: 150%; +} + +a.biglink { + font-size: 1.3em; +} + +span.linkdescr { + font-style: italic; + padding-top: 5px; + font-size: 90%; +} + +/* -- general index --------------------------------------------------------- */ + +table.indextable { + width: 100%; +} + +table.indextable td { + text-align: left; + vertical-align: top; +} + +table.indextable ul { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; +} + +table.indextable > tbody > tr > td > ul { + padding-left: 0em; +} + +table.indextable tr.pcap { + height: 10px; +} + +table.indextable tr.cap { + margin-top: 10px; + background-color: #f2f2f2; +} + +img.toggler { + margin-right: 3px; + margin-top: 3px; + cursor: pointer; +} + +div.modindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +div.genindex-jumpbox { + border-top: 1px solid #ddd; + border-bottom: 1px solid #ddd; + margin: 1em 0 1em 0; + padding: 0.4em; +} + +/* -- domain module index --------------------------------------------------- */ + +table.modindextable td { + padding: 2px; + border-collapse: collapse; +} + +/* -- general body styles --------------------------------------------------- */ + +div.body { + min-width: 360px; + max-width: 800px; +} + +div.body p, div.body dd, div.body li, div.body blockquote { + -moz-hyphens: auto; + -ms-hyphens: auto; + -webkit-hyphens: auto; + hyphens: auto; +} + +a.headerlink { + visibility: hidden; +} + +h1:hover > a.headerlink, +h2:hover > a.headerlink, +h3:hover > a.headerlink, +h4:hover > a.headerlink, +h5:hover > a.headerlink, +h6:hover > a.headerlink, +dt:hover > a.headerlink, +caption:hover > a.headerlink, +p.caption:hover > a.headerlink, +div.code-block-caption:hover > a.headerlink { + visibility: visible; +} + +div.body p.caption { + text-align: inherit; +} + +div.body td { + text-align: left; +} + +.first { + margin-top: 0 !important; +} + +p.rubric { + margin-top: 30px; + font-weight: bold; +} + +img.align-left, figure.align-left, .figure.align-left, object.align-left { + clear: left; + float: left; + margin-right: 1em; +} + +img.align-right, figure.align-right, .figure.align-right, object.align-right { + clear: right; + float: right; + margin-left: 1em; +} + +img.align-center, figure.align-center, .figure.align-center, object.align-center { + display: block; + margin-left: auto; + margin-right: auto; +} + +img.align-default, figure.align-default, .figure.align-default { + display: block; + margin-left: auto; + margin-right: auto; +} + +.align-left { + text-align: left; +} + +.align-center { + text-align: center; +} + +.align-default { + text-align: center; +} + +.align-right { + text-align: right; +} + +/* -- sidebars -------------------------------------------------------------- */ + +div.sidebar, +aside.sidebar { + margin: 0 0 0.5em 1em; + border: 1px solid #ddb; + padding: 7px; + background-color: #ffe; + width: 40%; + float: right; + clear: right; + overflow-x: auto; +} + +p.sidebar-title { + font-weight: bold; +} +nav.contents, +aside.topic, +div.admonition, div.topic, blockquote { + clear: left; +} + +/* -- topics ---------------------------------------------------------------- */ +nav.contents, +aside.topic, +div.topic { + border: 1px solid #ccc; + padding: 7px; + margin: 10px 0 10px 0; +} + +p.topic-title { + font-size: 1.1em; + font-weight: bold; + margin-top: 10px; +} + +/* -- admonitions ----------------------------------------------------------- */ + +div.admonition { + margin-top: 10px; + margin-bottom: 10px; + padding: 7px; +} + +div.admonition dt { + font-weight: bold; +} + +p.admonition-title { + margin: 0px 10px 5px 0px; + font-weight: bold; +} + +div.body p.centered { + text-align: center; + margin-top: 25px; +} + +/* -- content of sidebars/topics/admonitions -------------------------------- */ + +div.sidebar > :last-child, +aside.sidebar > :last-child, +nav.contents > :last-child, +aside.topic > :last-child, +div.topic > :last-child, +div.admonition > :last-child { + margin-bottom: 0; +} + +div.sidebar::after, +aside.sidebar::after, +nav.contents::after, +aside.topic::after, +div.topic::after, +div.admonition::after, +blockquote::after { + display: block; + content: ''; + clear: both; +} + +/* -- tables ---------------------------------------------------------------- */ + +table.docutils { + margin-top: 10px; + margin-bottom: 10px; + border: 0; + border-collapse: collapse; +} + +table.align-center { + margin-left: auto; + margin-right: auto; +} + +table.align-default { + margin-left: auto; + margin-right: auto; +} + +table caption span.caption-number { + font-style: italic; +} + +table caption span.caption-text { +} + +table.docutils td, table.docutils th { + padding: 1px 8px 1px 5px; + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #aaa; +} + +th { + text-align: left; + padding-right: 5px; +} + +table.citation { + border-left: solid 1px gray; + margin-left: 1px; +} + +table.citation td { + border-bottom: none; +} + +th > :first-child, +td > :first-child { + margin-top: 0px; +} + +th > :last-child, +td > :last-child { + margin-bottom: 0px; +} + +/* -- figures --------------------------------------------------------------- */ + +div.figure, figure { + margin: 0.5em; + padding: 0.5em; +} + +div.figure p.caption, figcaption { + padding: 0.3em; +} + +div.figure p.caption span.caption-number, +figcaption span.caption-number { + font-style: italic; +} + +div.figure p.caption span.caption-text, +figcaption span.caption-text { +} + +/* -- field list styles ----------------------------------------------------- */ + +table.field-list td, table.field-list th { + border: 0 !important; +} + +.field-list ul { + margin: 0; + padding-left: 1em; +} + +.field-list p { + margin: 0; +} + +.field-name { + -moz-hyphens: manual; + -ms-hyphens: manual; + -webkit-hyphens: manual; + hyphens: manual; +} + +/* -- hlist styles ---------------------------------------------------------- */ + +table.hlist { + margin: 1em 0; +} + +table.hlist td { + vertical-align: top; +} + +/* -- object description styles --------------------------------------------- */ + +.sig { + font-family: 'Consolas', 'Menlo', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; +} + +.sig-name, code.descname { + background-color: transparent; + font-weight: bold; +} + +.sig-name { + font-size: 1.1em; +} + +code.descname { + font-size: 1.2em; +} + +.sig-prename, code.descclassname { + background-color: transparent; +} + +.optional { + font-size: 1.3em; +} + +.sig-paren { + font-size: larger; +} + +.sig-param.n { + font-style: italic; +} + +/* C++ specific styling */ + +.sig-inline.c-texpr, +.sig-inline.cpp-texpr { + font-family: unset; +} + +.sig.c .k, .sig.c .kt, +.sig.cpp .k, .sig.cpp .kt { + color: #0033B3; +} + +.sig.c .m, +.sig.cpp .m { + color: #1750EB; +} + +.sig.c .s, .sig.c .sc, +.sig.cpp .s, .sig.cpp .sc { + color: #067D17; +} + + +/* -- other body styles ----------------------------------------------------- */ + +ol.arabic { + list-style: decimal; +} + +ol.loweralpha { + list-style: lower-alpha; +} + +ol.upperalpha { + list-style: upper-alpha; +} + +ol.lowerroman { + list-style: lower-roman; +} + +ol.upperroman { + list-style: upper-roman; +} + +:not(li) > ol > li:first-child > :first-child, +:not(li) > ul > li:first-child > :first-child { + margin-top: 0px; +} + +:not(li) > ol > li:last-child > :last-child, +:not(li) > ul > li:last-child > :last-child { + margin-bottom: 0px; +} + +ol.simple ol p, +ol.simple ul p, +ul.simple ol p, +ul.simple ul p { + margin-top: 0; +} + +ol.simple > li:not(:first-child) > p, +ul.simple > li:not(:first-child) > p { + margin-top: 0; +} + +ol.simple p, +ul.simple p { + margin-bottom: 0; +} +aside.footnote > span, +div.citation > span { + float: left; +} +aside.footnote > span:last-of-type, +div.citation > span:last-of-type { + padding-right: 0.5em; +} +aside.footnote > p { + margin-left: 2em; +} +div.citation > p { + margin-left: 4em; +} +aside.footnote > p:last-of-type, +div.citation > p:last-of-type { + margin-bottom: 0em; +} +aside.footnote > p:last-of-type:after, +div.citation > p:last-of-type:after { + content: ""; + clear: both; +} + +dl.field-list { + display: grid; + grid-template-columns: fit-content(30%) auto; +} + +dl.field-list > dt { + font-weight: bold; + word-break: break-word; + padding-left: 0.5em; + padding-right: 5px; +} + +dl.field-list > dd { + padding-left: 0.5em; + margin-top: 0em; + margin-left: 0em; + margin-bottom: 0em; +} + +dl { + margin-bottom: 15px; +} + +dd > :first-child { + margin-top: 0px; +} + +dd ul, dd table { + margin-bottom: 10px; +} + +dd { + margin-top: 3px; + margin-bottom: 10px; + margin-left: 30px; +} + +dl > dd:last-child, +dl > dd:last-child > :last-child { + margin-bottom: 0; +} + +dt:target, span.highlighted { + background-color: #fbe54e; +} + +rect.highlighted { + fill: #fbe54e; +} + +dl.glossary dt { + font-weight: bold; + font-size: 1.1em; +} + +.versionmodified { + font-style: italic; +} + +.system-message { + background-color: #fda; + padding: 5px; + border: 3px solid red; +} + +.footnote:target { + background-color: #ffa; +} + +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + +.guilabel, .menuselection { + font-family: sans-serif; +} + +.accelerator { + text-decoration: underline; +} + +.classifier { + font-style: oblique; +} + +.classifier:before { + font-style: normal; + margin: 0 0.5em; + content: ":"; + display: inline-block; +} + +abbr, acronym { + border-bottom: dotted 1px; + cursor: help; +} + +/* -- code displays --------------------------------------------------------- */ + +pre { + overflow: auto; + overflow-y: hidden; /* fixes display issues on Chrome browsers */ +} + +pre, div[class*="highlight-"] { + clear: both; +} + +span.pre { + -moz-hyphens: none; + -ms-hyphens: none; + -webkit-hyphens: none; + hyphens: none; + white-space: nowrap; +} + +div[class*="highlight-"] { + margin: 1em 0; +} + +td.linenos pre { + border: 0; + background-color: transparent; + color: #aaa; +} + +table.highlighttable { + display: block; +} + +table.highlighttable tbody { + display: block; +} + +table.highlighttable tr { + display: flex; +} + +table.highlighttable td { + margin: 0; + padding: 0; +} + +table.highlighttable td.linenos { + padding-right: 0.5em; +} + +table.highlighttable td.code { + flex: 1; + overflow: hidden; +} + +.highlight .hll { + display: block; +} + +div.highlight pre, +table.highlighttable pre { + margin: 0; +} + +div.code-block-caption + div { + margin-top: 0; +} + +div.code-block-caption { + margin-top: 1em; + padding: 2px 5px; + font-size: small; +} + +div.code-block-caption code { + background-color: transparent; +} + +table.highlighttable td.linenos, +span.linenos, +div.highlight span.gp { /* gp: Generic.Prompt */ + user-select: none; + -webkit-user-select: text; /* Safari fallback only */ + -webkit-user-select: none; /* Chrome/Safari */ + -moz-user-select: none; /* Firefox */ + -ms-user-select: none; /* IE10+ */ +} + +div.code-block-caption span.caption-number { + padding: 0.1em 0.3em; + font-style: italic; +} + +div.code-block-caption span.caption-text { +} + +div.literal-block-wrapper { + margin: 1em 0; +} + +code.xref, a code { + background-color: transparent; + font-weight: bold; +} + +h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { + background-color: transparent; +} + +.viewcode-link { + float: right; +} + +.viewcode-back { + float: right; + font-family: sans-serif; +} + +div.viewcode-block:target { + margin: -1px -10px; + padding: 0 10px; +} + +/* -- math display ---------------------------------------------------------- */ + +img.math { + vertical-align: middle; +} + +div.body div.math p { + text-align: center; +} + +span.eqno { + float: right; +} + +span.eqno a.headerlink { + position: absolute; + z-index: 1; +} + +div.math:hover a.headerlink { + visibility: visible; +} + +/* -- printout stylesheet --------------------------------------------------- */ + +@media print { + div.document, + div.documentwrapper, + div.bodywrapper { + margin: 0 !important; + width: 100%; + } + + div.sphinxsidebar, + div.related, + div.footer, + #top-link { + display: none; + } +} \ No newline at end of file diff --git a/_static/css/badge_only.css b/_static/css/badge_only.css new file mode 100644 index 0000000..c718cee --- /dev/null +++ b/_static/css/badge_only.css @@ -0,0 +1 @@ +.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} \ No newline at end of file diff --git a/_static/css/fonts/Roboto-Slab-Bold.woff b/_static/css/fonts/Roboto-Slab-Bold.woff new file mode 100644 index 0000000..6cb6000 Binary files /dev/null and b/_static/css/fonts/Roboto-Slab-Bold.woff differ diff --git a/_static/css/fonts/Roboto-Slab-Bold.woff2 b/_static/css/fonts/Roboto-Slab-Bold.woff2 new file mode 100644 index 0000000..7059e23 Binary files /dev/null and b/_static/css/fonts/Roboto-Slab-Bold.woff2 differ diff --git a/_static/css/fonts/Roboto-Slab-Regular.woff b/_static/css/fonts/Roboto-Slab-Regular.woff new file mode 100644 index 0000000..f815f63 Binary files /dev/null and b/_static/css/fonts/Roboto-Slab-Regular.woff differ diff --git a/_static/css/fonts/Roboto-Slab-Regular.woff2 b/_static/css/fonts/Roboto-Slab-Regular.woff2 new file mode 100644 index 0000000..f2c76e5 Binary files /dev/null and b/_static/css/fonts/Roboto-Slab-Regular.woff2 differ diff --git a/_static/css/fonts/fontawesome-webfont.eot b/_static/css/fonts/fontawesome-webfont.eot new file mode 100644 index 0000000..e9f60ca Binary files /dev/null and b/_static/css/fonts/fontawesome-webfont.eot differ diff --git a/_static/css/fonts/fontawesome-webfont.svg b/_static/css/fonts/fontawesome-webfont.svg new file mode 100644 index 0000000..855c845 --- /dev/null +++ b/_static/css/fonts/fontawesome-webfont.svg @@ -0,0 +1,2671 @@ + + + + +Created by FontForge 20120731 at Mon Oct 24 17:37:40 2016 + By ,,, +Copyright Dave Gandy 2016. All rights reserved. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/_static/css/fonts/fontawesome-webfont.ttf b/_static/css/fonts/fontawesome-webfont.ttf new file mode 100644 index 0000000..35acda2 Binary files /dev/null and b/_static/css/fonts/fontawesome-webfont.ttf differ diff --git a/_static/css/fonts/fontawesome-webfont.woff b/_static/css/fonts/fontawesome-webfont.woff new file mode 100644 index 0000000..400014a Binary files /dev/null and b/_static/css/fonts/fontawesome-webfont.woff differ diff --git a/_static/css/fonts/fontawesome-webfont.woff2 b/_static/css/fonts/fontawesome-webfont.woff2 new file mode 100644 index 0000000..4d13fc6 Binary files /dev/null and b/_static/css/fonts/fontawesome-webfont.woff2 differ diff --git a/_static/css/fonts/lato-bold-italic.woff b/_static/css/fonts/lato-bold-italic.woff new file mode 100644 index 0000000..88ad05b Binary files /dev/null and b/_static/css/fonts/lato-bold-italic.woff differ diff --git a/_static/css/fonts/lato-bold-italic.woff2 b/_static/css/fonts/lato-bold-italic.woff2 new file mode 100644 index 0000000..c4e3d80 Binary files /dev/null and b/_static/css/fonts/lato-bold-italic.woff2 differ diff --git a/_static/css/fonts/lato-bold.woff b/_static/css/fonts/lato-bold.woff new file mode 100644 index 0000000..c6dff51 Binary files /dev/null and b/_static/css/fonts/lato-bold.woff differ diff --git a/_static/css/fonts/lato-bold.woff2 b/_static/css/fonts/lato-bold.woff2 new file mode 100644 index 0000000..bb19504 Binary files /dev/null and b/_static/css/fonts/lato-bold.woff2 differ diff --git a/_static/css/fonts/lato-normal-italic.woff b/_static/css/fonts/lato-normal-italic.woff new file mode 100644 index 0000000..76114bc Binary files /dev/null and b/_static/css/fonts/lato-normal-italic.woff differ diff --git a/_static/css/fonts/lato-normal-italic.woff2 b/_static/css/fonts/lato-normal-italic.woff2 new file mode 100644 index 0000000..3404f37 Binary files /dev/null and b/_static/css/fonts/lato-normal-italic.woff2 differ diff --git a/_static/css/fonts/lato-normal.woff b/_static/css/fonts/lato-normal.woff new file mode 100644 index 0000000..ae1307f Binary files /dev/null and b/_static/css/fonts/lato-normal.woff differ diff --git a/_static/css/fonts/lato-normal.woff2 b/_static/css/fonts/lato-normal.woff2 new file mode 100644 index 0000000..3bf9843 Binary files /dev/null and b/_static/css/fonts/lato-normal.woff2 differ diff --git a/_static/css/theme.css b/_static/css/theme.css new file mode 100644 index 0000000..19a446a --- /dev/null +++ b/_static/css/theme.css @@ -0,0 +1,4 @@ +html{box-sizing:border-box}*,:after,:before{box-sizing:inherit}article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}[hidden],audio:not([controls]){display:none}*{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a:active,a:hover{outline:0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:0}dfn{font-style:italic}ins{background:#ff9;text-decoration:none}ins,mark{color:#000}mark{background:#ff0;font-style:italic;font-weight:700}.rst-content code,.rst-content tt,code,kbd,pre,samp{font-family:monospace,serif;_font-family:courier new,monospace;font-size:1em}pre{white-space:pre}q{quotes:none}q:after,q:before{content:"";content:none}small{font-size:85%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,ol,ul{margin:0;padding:0;list-style:none;list-style-image:none}li{list-style:none}dd{margin:0}img{border:0;-ms-interpolation-mode:bicubic;vertical-align:middle;max-width:100%}svg:not(:root){overflow:hidden}figure,form{margin:0}label{cursor:pointer}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,input[type=button],input[type=reset],input[type=submit]{cursor:pointer;-webkit-appearance:button;*overflow:visible}button[disabled],input[disabled]{cursor:default}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}textarea{resize:vertical}table{border-collapse:collapse;border-spacing:0}td{vertical-align:top}.chromeframe{margin:.2em 0;background:#ccc;color:#000;padding:.2em 0}.ir{display:block;border:0;text-indent:-999em;overflow:hidden;background-color:transparent;background-repeat:no-repeat;text-align:left;direction:ltr;*line-height:0}.ir br{display:none}.hidden{display:none!important;visibility:hidden}.visuallyhidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.visuallyhidden.focusable:active,.visuallyhidden.focusable:focus{clip:auto;height:auto;margin:0;overflow:visible;position:static;width:auto}.invisible{visibility:hidden}.relative{position:relative}big,small{font-size:100%}@media print{body,html,section{background:none!important}*{box-shadow:none!important;text-shadow:none!important;filter:none!important;-ms-filter:none!important}a,a:visited{text-decoration:underline}.ir a:after,a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}.rst-content .toctree-wrapper>p.caption,h2,h3,p{orphans:3;widows:3}.rst-content .toctree-wrapper>p.caption,h2,h3{page-break-after:avoid}}.btn,.fa:before,.icon:before,.rst-content .admonition,.rst-content .admonition-title:before,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .code-block-caption .headerlink:before,.rst-content .danger,.rst-content .eqno .headerlink:before,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-alert,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before,input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week],select,textarea{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:FontAwesome;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713);src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix&v=4.7.0) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#fontawesomeregular) format("svg");font-weight:400;font-style:normal}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14286em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14286em;width:2.14286em;top:.14286em;text-align:center}.fa-li.fa-lg{left:-1.85714em}.fa-border{padding:.2em .25em .15em;border:.08em solid #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa-pull-left.icon,.fa.fa-pull-left,.rst-content .code-block-caption .fa-pull-left.headerlink,.rst-content .eqno .fa-pull-left.headerlink,.rst-content .fa-pull-left.admonition-title,.rst-content code.download span.fa-pull-left:first-child,.rst-content dl dt .fa-pull-left.headerlink,.rst-content h1 .fa-pull-left.headerlink,.rst-content h2 .fa-pull-left.headerlink,.rst-content h3 .fa-pull-left.headerlink,.rst-content h4 .fa-pull-left.headerlink,.rst-content h5 .fa-pull-left.headerlink,.rst-content h6 .fa-pull-left.headerlink,.rst-content p .fa-pull-left.headerlink,.rst-content table>caption .fa-pull-left.headerlink,.rst-content tt.download span.fa-pull-left:first-child,.wy-menu-vertical li.current>a button.fa-pull-left.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-left.toctree-expand,.wy-menu-vertical li button.fa-pull-left.toctree-expand{margin-right:.3em}.fa-pull-right.icon,.fa.fa-pull-right,.rst-content .code-block-caption .fa-pull-right.headerlink,.rst-content .eqno .fa-pull-right.headerlink,.rst-content .fa-pull-right.admonition-title,.rst-content code.download span.fa-pull-right:first-child,.rst-content dl dt .fa-pull-right.headerlink,.rst-content h1 .fa-pull-right.headerlink,.rst-content h2 .fa-pull-right.headerlink,.rst-content h3 .fa-pull-right.headerlink,.rst-content h4 .fa-pull-right.headerlink,.rst-content h5 .fa-pull-right.headerlink,.rst-content h6 .fa-pull-right.headerlink,.rst-content p .fa-pull-right.headerlink,.rst-content table>caption .fa-pull-right.headerlink,.rst-content tt.download span.fa-pull-right:first-child,.wy-menu-vertical li.current>a button.fa-pull-right.toctree-expand,.wy-menu-vertical li.on a button.fa-pull-right.toctree-expand,.wy-menu-vertical li button.fa-pull-right.toctree-expand{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left,.pull-left.icon,.rst-content .code-block-caption .pull-left.headerlink,.rst-content .eqno .pull-left.headerlink,.rst-content .pull-left.admonition-title,.rst-content code.download span.pull-left:first-child,.rst-content dl dt .pull-left.headerlink,.rst-content h1 .pull-left.headerlink,.rst-content h2 .pull-left.headerlink,.rst-content h3 .pull-left.headerlink,.rst-content h4 .pull-left.headerlink,.rst-content h5 .pull-left.headerlink,.rst-content h6 .pull-left.headerlink,.rst-content p .pull-left.headerlink,.rst-content table>caption .pull-left.headerlink,.rst-content tt.download span.pull-left:first-child,.wy-menu-vertical li.current>a button.pull-left.toctree-expand,.wy-menu-vertical li.on a button.pull-left.toctree-expand,.wy-menu-vertical li button.pull-left.toctree-expand{margin-right:.3em}.fa.pull-right,.pull-right.icon,.rst-content .code-block-caption .pull-right.headerlink,.rst-content .eqno .pull-right.headerlink,.rst-content .pull-right.admonition-title,.rst-content code.download span.pull-right:first-child,.rst-content dl dt .pull-right.headerlink,.rst-content h1 .pull-right.headerlink,.rst-content h2 .pull-right.headerlink,.rst-content h3 .pull-right.headerlink,.rst-content h4 .pull-right.headerlink,.rst-content h5 .pull-right.headerlink,.rst-content h6 .pull-right.headerlink,.rst-content p .pull-right.headerlink,.rst-content table>caption .pull-right.headerlink,.rst-content tt.download span.pull-right:first-child,.wy-menu-vertical li.current>a button.pull-right.toctree-expand,.wy-menu-vertical li.on a button.pull-right.toctree-expand,.wy-menu-vertical li button.pull-right.toctree-expand{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s linear infinite;animation:fa-spin 2s linear infinite}.fa-pulse{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scaleX(-1);-ms-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scaleY(-1);-ms-transform:scaleY(-1);transform:scaleY(-1)}:root .fa-flip-horizontal,:root .fa-flip-vertical,:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:""}.fa-music:before{content:""}.fa-search:before,.icon-search:before{content:""}.fa-envelope-o:before{content:""}.fa-heart:before{content:""}.fa-star:before{content:""}.fa-star-o:before{content:""}.fa-user:before{content:""}.fa-film:before{content:""}.fa-th-large:before{content:""}.fa-th:before{content:""}.fa-th-list:before{content:""}.fa-check:before{content:""}.fa-close:before,.fa-remove:before,.fa-times:before{content:""}.fa-search-plus:before{content:""}.fa-search-minus:before{content:""}.fa-power-off:before{content:""}.fa-signal:before{content:""}.fa-cog:before,.fa-gear:before{content:""}.fa-trash-o:before{content:""}.fa-home:before,.icon-home:before{content:""}.fa-file-o:before{content:""}.fa-clock-o:before{content:""}.fa-road:before{content:""}.fa-download:before,.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{content:""}.fa-arrow-circle-o-down:before{content:""}.fa-arrow-circle-o-up:before{content:""}.fa-inbox:before{content:""}.fa-play-circle-o:before{content:""}.fa-repeat:before,.fa-rotate-right:before{content:""}.fa-refresh:before{content:""}.fa-list-alt:before{content:""}.fa-lock:before{content:""}.fa-flag:before{content:""}.fa-headphones:before{content:""}.fa-volume-off:before{content:""}.fa-volume-down:before{content:""}.fa-volume-up:before{content:""}.fa-qrcode:before{content:""}.fa-barcode:before{content:""}.fa-tag:before{content:""}.fa-tags:before{content:""}.fa-book:before,.icon-book:before{content:""}.fa-bookmark:before{content:""}.fa-print:before{content:""}.fa-camera:before{content:""}.fa-font:before{content:""}.fa-bold:before{content:""}.fa-italic:before{content:""}.fa-text-height:before{content:""}.fa-text-width:before{content:""}.fa-align-left:before{content:""}.fa-align-center:before{content:""}.fa-align-right:before{content:""}.fa-align-justify:before{content:""}.fa-list:before{content:""}.fa-dedent:before,.fa-outdent:before{content:""}.fa-indent:before{content:""}.fa-video-camera:before{content:""}.fa-image:before,.fa-photo:before,.fa-picture-o:before{content:""}.fa-pencil:before{content:""}.fa-map-marker:before{content:""}.fa-adjust:before{content:""}.fa-tint:before{content:""}.fa-edit:before,.fa-pencil-square-o:before{content:""}.fa-share-square-o:before{content:""}.fa-check-square-o:before{content:""}.fa-arrows:before{content:""}.fa-step-backward:before{content:""}.fa-fast-backward:before{content:""}.fa-backward:before{content:""}.fa-play:before{content:""}.fa-pause:before{content:""}.fa-stop:before{content:""}.fa-forward:before{content:""}.fa-fast-forward:before{content:""}.fa-step-forward:before{content:""}.fa-eject:before{content:""}.fa-chevron-left:before{content:""}.fa-chevron-right:before{content:""}.fa-plus-circle:before{content:""}.fa-minus-circle:before{content:""}.fa-times-circle:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before{content:""}.fa-check-circle:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before{content:""}.fa-question-circle:before{content:""}.fa-info-circle:before{content:""}.fa-crosshairs:before{content:""}.fa-times-circle-o:before{content:""}.fa-check-circle-o:before{content:""}.fa-ban:before{content:""}.fa-arrow-left:before{content:""}.fa-arrow-right:before{content:""}.fa-arrow-up:before{content:""}.fa-arrow-down:before{content:""}.fa-mail-forward:before,.fa-share:before{content:""}.fa-expand:before{content:""}.fa-compress:before{content:""}.fa-plus:before{content:""}.fa-minus:before{content:""}.fa-asterisk:before{content:""}.fa-exclamation-circle:before,.rst-content .admonition-title:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before{content:""}.fa-gift:before{content:""}.fa-leaf:before{content:""}.fa-fire:before,.icon-fire:before{content:""}.fa-eye:before{content:""}.fa-eye-slash:before{content:""}.fa-exclamation-triangle:before,.fa-warning:before{content:""}.fa-plane:before{content:""}.fa-calendar:before{content:""}.fa-random:before{content:""}.fa-comment:before{content:""}.fa-magnet:before{content:""}.fa-chevron-up:before{content:""}.fa-chevron-down:before{content:""}.fa-retweet:before{content:""}.fa-shopping-cart:before{content:""}.fa-folder:before{content:""}.fa-folder-open:before{content:""}.fa-arrows-v:before{content:""}.fa-arrows-h:before{content:""}.fa-bar-chart-o:before,.fa-bar-chart:before{content:""}.fa-twitter-square:before{content:""}.fa-facebook-square:before{content:""}.fa-camera-retro:before{content:""}.fa-key:before{content:""}.fa-cogs:before,.fa-gears:before{content:""}.fa-comments:before{content:""}.fa-thumbs-o-up:before{content:""}.fa-thumbs-o-down:before{content:""}.fa-star-half:before{content:""}.fa-heart-o:before{content:""}.fa-sign-out:before{content:""}.fa-linkedin-square:before{content:""}.fa-thumb-tack:before{content:""}.fa-external-link:before{content:""}.fa-sign-in:before{content:""}.fa-trophy:before{content:""}.fa-github-square:before{content:""}.fa-upload:before{content:""}.fa-lemon-o:before{content:""}.fa-phone:before{content:""}.fa-square-o:before{content:""}.fa-bookmark-o:before{content:""}.fa-phone-square:before{content:""}.fa-twitter:before{content:""}.fa-facebook-f:before,.fa-facebook:before{content:""}.fa-github:before,.icon-github:before{content:""}.fa-unlock:before{content:""}.fa-credit-card:before{content:""}.fa-feed:before,.fa-rss:before{content:""}.fa-hdd-o:before{content:""}.fa-bullhorn:before{content:""}.fa-bell:before{content:""}.fa-certificate:before{content:""}.fa-hand-o-right:before{content:""}.fa-hand-o-left:before{content:""}.fa-hand-o-up:before{content:""}.fa-hand-o-down:before{content:""}.fa-arrow-circle-left:before,.icon-circle-arrow-left:before{content:""}.fa-arrow-circle-right:before,.icon-circle-arrow-right:before{content:""}.fa-arrow-circle-up:before{content:""}.fa-arrow-circle-down:before{content:""}.fa-globe:before{content:""}.fa-wrench:before{content:""}.fa-tasks:before{content:""}.fa-filter:before{content:""}.fa-briefcase:before{content:""}.fa-arrows-alt:before{content:""}.fa-group:before,.fa-users:before{content:""}.fa-chain:before,.fa-link:before,.icon-link:before{content:""}.fa-cloud:before{content:""}.fa-flask:before{content:""}.fa-cut:before,.fa-scissors:before{content:""}.fa-copy:before,.fa-files-o:before{content:""}.fa-paperclip:before{content:""}.fa-floppy-o:before,.fa-save:before{content:""}.fa-square:before{content:""}.fa-bars:before,.fa-navicon:before,.fa-reorder:before{content:""}.fa-list-ul:before{content:""}.fa-list-ol:before{content:""}.fa-strikethrough:before{content:""}.fa-underline:before{content:""}.fa-table:before{content:""}.fa-magic:before{content:""}.fa-truck:before{content:""}.fa-pinterest:before{content:""}.fa-pinterest-square:before{content:""}.fa-google-plus-square:before{content:""}.fa-google-plus:before{content:""}.fa-money:before{content:""}.fa-caret-down:before,.icon-caret-down:before,.wy-dropdown .caret:before{content:""}.fa-caret-up:before{content:""}.fa-caret-left:before{content:""}.fa-caret-right:before{content:""}.fa-columns:before{content:""}.fa-sort:before,.fa-unsorted:before{content:""}.fa-sort-desc:before,.fa-sort-down:before{content:""}.fa-sort-asc:before,.fa-sort-up:before{content:""}.fa-envelope:before{content:""}.fa-linkedin:before{content:""}.fa-rotate-left:before,.fa-undo:before{content:""}.fa-gavel:before,.fa-legal:before{content:""}.fa-dashboard:before,.fa-tachometer:before{content:""}.fa-comment-o:before{content:""}.fa-comments-o:before{content:""}.fa-bolt:before,.fa-flash:before{content:""}.fa-sitemap:before{content:""}.fa-umbrella:before{content:""}.fa-clipboard:before,.fa-paste:before{content:""}.fa-lightbulb-o:before{content:""}.fa-exchange:before{content:""}.fa-cloud-download:before{content:""}.fa-cloud-upload:before{content:""}.fa-user-md:before{content:""}.fa-stethoscope:before{content:""}.fa-suitcase:before{content:""}.fa-bell-o:before{content:""}.fa-coffee:before{content:""}.fa-cutlery:before{content:""}.fa-file-text-o:before{content:""}.fa-building-o:before{content:""}.fa-hospital-o:before{content:""}.fa-ambulance:before{content:""}.fa-medkit:before{content:""}.fa-fighter-jet:before{content:""}.fa-beer:before{content:""}.fa-h-square:before{content:""}.fa-plus-square:before{content:""}.fa-angle-double-left:before{content:""}.fa-angle-double-right:before{content:""}.fa-angle-double-up:before{content:""}.fa-angle-double-down:before{content:""}.fa-angle-left:before{content:""}.fa-angle-right:before{content:""}.fa-angle-up:before{content:""}.fa-angle-down:before{content:""}.fa-desktop:before{content:""}.fa-laptop:before{content:""}.fa-tablet:before{content:""}.fa-mobile-phone:before,.fa-mobile:before{content:""}.fa-circle-o:before{content:""}.fa-quote-left:before{content:""}.fa-quote-right:before{content:""}.fa-spinner:before{content:""}.fa-circle:before{content:""}.fa-mail-reply:before,.fa-reply:before{content:""}.fa-github-alt:before{content:""}.fa-folder-o:before{content:""}.fa-folder-open-o:before{content:""}.fa-smile-o:before{content:""}.fa-frown-o:before{content:""}.fa-meh-o:before{content:""}.fa-gamepad:before{content:""}.fa-keyboard-o:before{content:""}.fa-flag-o:before{content:""}.fa-flag-checkered:before{content:""}.fa-terminal:before{content:""}.fa-code:before{content:""}.fa-mail-reply-all:before,.fa-reply-all:before{content:""}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:""}.fa-location-arrow:before{content:""}.fa-crop:before{content:""}.fa-code-fork:before{content:""}.fa-chain-broken:before,.fa-unlink:before{content:""}.fa-question:before{content:""}.fa-info:before{content:""}.fa-exclamation:before{content:""}.fa-superscript:before{content:""}.fa-subscript:before{content:""}.fa-eraser:before{content:""}.fa-puzzle-piece:before{content:""}.fa-microphone:before{content:""}.fa-microphone-slash:before{content:""}.fa-shield:before{content:""}.fa-calendar-o:before{content:""}.fa-fire-extinguisher:before{content:""}.fa-rocket:before{content:""}.fa-maxcdn:before{content:""}.fa-chevron-circle-left:before{content:""}.fa-chevron-circle-right:before{content:""}.fa-chevron-circle-up:before{content:""}.fa-chevron-circle-down:before{content:""}.fa-html5:before{content:""}.fa-css3:before{content:""}.fa-anchor:before{content:""}.fa-unlock-alt:before{content:""}.fa-bullseye:before{content:""}.fa-ellipsis-h:before{content:""}.fa-ellipsis-v:before{content:""}.fa-rss-square:before{content:""}.fa-play-circle:before{content:""}.fa-ticket:before{content:""}.fa-minus-square:before{content:""}.fa-minus-square-o:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before{content:""}.fa-level-up:before{content:""}.fa-level-down:before{content:""}.fa-check-square:before{content:""}.fa-pencil-square:before{content:""}.fa-external-link-square:before{content:""}.fa-share-square:before{content:""}.fa-compass:before{content:""}.fa-caret-square-o-down:before,.fa-toggle-down:before{content:""}.fa-caret-square-o-up:before,.fa-toggle-up:before{content:""}.fa-caret-square-o-right:before,.fa-toggle-right:before{content:""}.fa-eur:before,.fa-euro:before{content:""}.fa-gbp:before{content:""}.fa-dollar:before,.fa-usd:before{content:""}.fa-inr:before,.fa-rupee:before{content:""}.fa-cny:before,.fa-jpy:before,.fa-rmb:before,.fa-yen:before{content:""}.fa-rouble:before,.fa-rub:before,.fa-ruble:before{content:""}.fa-krw:before,.fa-won:before{content:""}.fa-bitcoin:before,.fa-btc:before{content:""}.fa-file:before{content:""}.fa-file-text:before{content:""}.fa-sort-alpha-asc:before{content:""}.fa-sort-alpha-desc:before{content:""}.fa-sort-amount-asc:before{content:""}.fa-sort-amount-desc:before{content:""}.fa-sort-numeric-asc:before{content:""}.fa-sort-numeric-desc:before{content:""}.fa-thumbs-up:before{content:""}.fa-thumbs-down:before{content:""}.fa-youtube-square:before{content:""}.fa-youtube:before{content:""}.fa-xing:before{content:""}.fa-xing-square:before{content:""}.fa-youtube-play:before{content:""}.fa-dropbox:before{content:""}.fa-stack-overflow:before{content:""}.fa-instagram:before{content:""}.fa-flickr:before{content:""}.fa-adn:before{content:""}.fa-bitbucket:before,.icon-bitbucket:before{content:""}.fa-bitbucket-square:before{content:""}.fa-tumblr:before{content:""}.fa-tumblr-square:before{content:""}.fa-long-arrow-down:before{content:""}.fa-long-arrow-up:before{content:""}.fa-long-arrow-left:before{content:""}.fa-long-arrow-right:before{content:""}.fa-apple:before{content:""}.fa-windows:before{content:""}.fa-android:before{content:""}.fa-linux:before{content:""}.fa-dribbble:before{content:""}.fa-skype:before{content:""}.fa-foursquare:before{content:""}.fa-trello:before{content:""}.fa-female:before{content:""}.fa-male:before{content:""}.fa-gittip:before,.fa-gratipay:before{content:""}.fa-sun-o:before{content:""}.fa-moon-o:before{content:""}.fa-archive:before{content:""}.fa-bug:before{content:""}.fa-vk:before{content:""}.fa-weibo:before{content:""}.fa-renren:before{content:""}.fa-pagelines:before{content:""}.fa-stack-exchange:before{content:""}.fa-arrow-circle-o-right:before{content:""}.fa-arrow-circle-o-left:before{content:""}.fa-caret-square-o-left:before,.fa-toggle-left:before{content:""}.fa-dot-circle-o:before{content:""}.fa-wheelchair:before{content:""}.fa-vimeo-square:before{content:""}.fa-try:before,.fa-turkish-lira:before{content:""}.fa-plus-square-o:before,.wy-menu-vertical li button.toctree-expand:before{content:""}.fa-space-shuttle:before{content:""}.fa-slack:before{content:""}.fa-envelope-square:before{content:""}.fa-wordpress:before{content:""}.fa-openid:before{content:""}.fa-bank:before,.fa-institution:before,.fa-university:before{content:""}.fa-graduation-cap:before,.fa-mortar-board:before{content:""}.fa-yahoo:before{content:""}.fa-google:before{content:""}.fa-reddit:before{content:""}.fa-reddit-square:before{content:""}.fa-stumbleupon-circle:before{content:""}.fa-stumbleupon:before{content:""}.fa-delicious:before{content:""}.fa-digg:before{content:""}.fa-pied-piper-pp:before{content:""}.fa-pied-piper-alt:before{content:""}.fa-drupal:before{content:""}.fa-joomla:before{content:""}.fa-language:before{content:""}.fa-fax:before{content:""}.fa-building:before{content:""}.fa-child:before{content:""}.fa-paw:before{content:""}.fa-spoon:before{content:""}.fa-cube:before{content:""}.fa-cubes:before{content:""}.fa-behance:before{content:""}.fa-behance-square:before{content:""}.fa-steam:before{content:""}.fa-steam-square:before{content:""}.fa-recycle:before{content:""}.fa-automobile:before,.fa-car:before{content:""}.fa-cab:before,.fa-taxi:before{content:""}.fa-tree:before{content:""}.fa-spotify:before{content:""}.fa-deviantart:before{content:""}.fa-soundcloud:before{content:""}.fa-database:before{content:""}.fa-file-pdf-o:before{content:""}.fa-file-word-o:before{content:""}.fa-file-excel-o:before{content:""}.fa-file-powerpoint-o:before{content:""}.fa-file-image-o:before,.fa-file-photo-o:before,.fa-file-picture-o:before{content:""}.fa-file-archive-o:before,.fa-file-zip-o:before{content:""}.fa-file-audio-o:before,.fa-file-sound-o:before{content:""}.fa-file-movie-o:before,.fa-file-video-o:before{content:""}.fa-file-code-o:before{content:""}.fa-vine:before{content:""}.fa-codepen:before{content:""}.fa-jsfiddle:before{content:""}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-ring:before,.fa-life-saver:before,.fa-support:before{content:""}.fa-circle-o-notch:before{content:""}.fa-ra:before,.fa-rebel:before,.fa-resistance:before{content:""}.fa-empire:before,.fa-ge:before{content:""}.fa-git-square:before{content:""}.fa-git:before{content:""}.fa-hacker-news:before,.fa-y-combinator-square:before,.fa-yc-square:before{content:""}.fa-tencent-weibo:before{content:""}.fa-qq:before{content:""}.fa-wechat:before,.fa-weixin:before{content:""}.fa-paper-plane:before,.fa-send:before{content:""}.fa-paper-plane-o:before,.fa-send-o:before{content:""}.fa-history:before{content:""}.fa-circle-thin:before{content:""}.fa-header:before{content:""}.fa-paragraph:before{content:""}.fa-sliders:before{content:""}.fa-share-alt:before{content:""}.fa-share-alt-square:before{content:""}.fa-bomb:before{content:""}.fa-futbol-o:before,.fa-soccer-ball-o:before{content:""}.fa-tty:before{content:""}.fa-binoculars:before{content:""}.fa-plug:before{content:""}.fa-slideshare:before{content:""}.fa-twitch:before{content:""}.fa-yelp:before{content:""}.fa-newspaper-o:before{content:""}.fa-wifi:before{content:""}.fa-calculator:before{content:""}.fa-paypal:before{content:""}.fa-google-wallet:before{content:""}.fa-cc-visa:before{content:""}.fa-cc-mastercard:before{content:""}.fa-cc-discover:before{content:""}.fa-cc-amex:before{content:""}.fa-cc-paypal:before{content:""}.fa-cc-stripe:before{content:""}.fa-bell-slash:before{content:""}.fa-bell-slash-o:before{content:""}.fa-trash:before{content:""}.fa-copyright:before{content:""}.fa-at:before{content:""}.fa-eyedropper:before{content:""}.fa-paint-brush:before{content:""}.fa-birthday-cake:before{content:""}.fa-area-chart:before{content:""}.fa-pie-chart:before{content:""}.fa-line-chart:before{content:""}.fa-lastfm:before{content:""}.fa-lastfm-square:before{content:""}.fa-toggle-off:before{content:""}.fa-toggle-on:before{content:""}.fa-bicycle:before{content:""}.fa-bus:before{content:""}.fa-ioxhost:before{content:""}.fa-angellist:before{content:""}.fa-cc:before{content:""}.fa-ils:before,.fa-shekel:before,.fa-sheqel:before{content:""}.fa-meanpath:before{content:""}.fa-buysellads:before{content:""}.fa-connectdevelop:before{content:""}.fa-dashcube:before{content:""}.fa-forumbee:before{content:""}.fa-leanpub:before{content:""}.fa-sellsy:before{content:""}.fa-shirtsinbulk:before{content:""}.fa-simplybuilt:before{content:""}.fa-skyatlas:before{content:""}.fa-cart-plus:before{content:""}.fa-cart-arrow-down:before{content:""}.fa-diamond:before{content:""}.fa-ship:before{content:""}.fa-user-secret:before{content:""}.fa-motorcycle:before{content:""}.fa-street-view:before{content:""}.fa-heartbeat:before{content:""}.fa-venus:before{content:""}.fa-mars:before{content:""}.fa-mercury:before{content:""}.fa-intersex:before,.fa-transgender:before{content:""}.fa-transgender-alt:before{content:""}.fa-venus-double:before{content:""}.fa-mars-double:before{content:""}.fa-venus-mars:before{content:""}.fa-mars-stroke:before{content:""}.fa-mars-stroke-v:before{content:""}.fa-mars-stroke-h:before{content:""}.fa-neuter:before{content:""}.fa-genderless:before{content:""}.fa-facebook-official:before{content:""}.fa-pinterest-p:before{content:""}.fa-whatsapp:before{content:""}.fa-server:before{content:""}.fa-user-plus:before{content:""}.fa-user-times:before{content:""}.fa-bed:before,.fa-hotel:before{content:""}.fa-viacoin:before{content:""}.fa-train:before{content:""}.fa-subway:before{content:""}.fa-medium:before{content:""}.fa-y-combinator:before,.fa-yc:before{content:""}.fa-optin-monster:before{content:""}.fa-opencart:before{content:""}.fa-expeditedssl:before{content:""}.fa-battery-4:before,.fa-battery-full:before,.fa-battery:before{content:""}.fa-battery-3:before,.fa-battery-three-quarters:before{content:""}.fa-battery-2:before,.fa-battery-half:before{content:""}.fa-battery-1:before,.fa-battery-quarter:before{content:""}.fa-battery-0:before,.fa-battery-empty:before{content:""}.fa-mouse-pointer:before{content:""}.fa-i-cursor:before{content:""}.fa-object-group:before{content:""}.fa-object-ungroup:before{content:""}.fa-sticky-note:before{content:""}.fa-sticky-note-o:before{content:""}.fa-cc-jcb:before{content:""}.fa-cc-diners-club:before{content:""}.fa-clone:before{content:""}.fa-balance-scale:before{content:""}.fa-hourglass-o:before{content:""}.fa-hourglass-1:before,.fa-hourglass-start:before{content:""}.fa-hourglass-2:before,.fa-hourglass-half:before{content:""}.fa-hourglass-3:before,.fa-hourglass-end:before{content:""}.fa-hourglass:before{content:""}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:""}.fa-hand-paper-o:before,.fa-hand-stop-o:before{content:""}.fa-hand-scissors-o:before{content:""}.fa-hand-lizard-o:before{content:""}.fa-hand-spock-o:before{content:""}.fa-hand-pointer-o:before{content:""}.fa-hand-peace-o:before{content:""}.fa-trademark:before{content:""}.fa-registered:before{content:""}.fa-creative-commons:before{content:""}.fa-gg:before{content:""}.fa-gg-circle:before{content:""}.fa-tripadvisor:before{content:""}.fa-odnoklassniki:before{content:""}.fa-odnoklassniki-square:before{content:""}.fa-get-pocket:before{content:""}.fa-wikipedia-w:before{content:""}.fa-safari:before{content:""}.fa-chrome:before{content:""}.fa-firefox:before{content:""}.fa-opera:before{content:""}.fa-internet-explorer:before{content:""}.fa-television:before,.fa-tv:before{content:""}.fa-contao:before{content:""}.fa-500px:before{content:""}.fa-amazon:before{content:""}.fa-calendar-plus-o:before{content:""}.fa-calendar-minus-o:before{content:""}.fa-calendar-times-o:before{content:""}.fa-calendar-check-o:before{content:""}.fa-industry:before{content:""}.fa-map-pin:before{content:""}.fa-map-signs:before{content:""}.fa-map-o:before{content:""}.fa-map:before{content:""}.fa-commenting:before{content:""}.fa-commenting-o:before{content:""}.fa-houzz:before{content:""}.fa-vimeo:before{content:""}.fa-black-tie:before{content:""}.fa-fonticons:before{content:""}.fa-reddit-alien:before{content:""}.fa-edge:before{content:""}.fa-credit-card-alt:before{content:""}.fa-codiepie:before{content:""}.fa-modx:before{content:""}.fa-fort-awesome:before{content:""}.fa-usb:before{content:""}.fa-product-hunt:before{content:""}.fa-mixcloud:before{content:""}.fa-scribd:before{content:""}.fa-pause-circle:before{content:""}.fa-pause-circle-o:before{content:""}.fa-stop-circle:before{content:""}.fa-stop-circle-o:before{content:""}.fa-shopping-bag:before{content:""}.fa-shopping-basket:before{content:""}.fa-hashtag:before{content:""}.fa-bluetooth:before{content:""}.fa-bluetooth-b:before{content:""}.fa-percent:before{content:""}.fa-gitlab:before,.icon-gitlab:before{content:""}.fa-wpbeginner:before{content:""}.fa-wpforms:before{content:""}.fa-envira:before{content:""}.fa-universal-access:before{content:""}.fa-wheelchair-alt:before{content:""}.fa-question-circle-o:before{content:""}.fa-blind:before{content:""}.fa-audio-description:before{content:""}.fa-volume-control-phone:before{content:""}.fa-braille:before{content:""}.fa-assistive-listening-systems:before{content:""}.fa-american-sign-language-interpreting:before,.fa-asl-interpreting:before{content:""}.fa-deaf:before,.fa-deafness:before,.fa-hard-of-hearing:before{content:""}.fa-glide:before{content:""}.fa-glide-g:before{content:""}.fa-sign-language:before,.fa-signing:before{content:""}.fa-low-vision:before{content:""}.fa-viadeo:before{content:""}.fa-viadeo-square:before{content:""}.fa-snapchat:before{content:""}.fa-snapchat-ghost:before{content:""}.fa-snapchat-square:before{content:""}.fa-pied-piper:before{content:""}.fa-first-order:before{content:""}.fa-yoast:before{content:""}.fa-themeisle:before{content:""}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:""}.fa-fa:before,.fa-font-awesome:before{content:""}.fa-handshake-o:before{content:""}.fa-envelope-open:before{content:""}.fa-envelope-open-o:before{content:""}.fa-linode:before{content:""}.fa-address-book:before{content:""}.fa-address-book-o:before{content:""}.fa-address-card:before,.fa-vcard:before{content:""}.fa-address-card-o:before,.fa-vcard-o:before{content:""}.fa-user-circle:before{content:""}.fa-user-circle-o:before{content:""}.fa-user-o:before{content:""}.fa-id-badge:before{content:""}.fa-drivers-license:before,.fa-id-card:before{content:""}.fa-drivers-license-o:before,.fa-id-card-o:before{content:""}.fa-quora:before{content:""}.fa-free-code-camp:before{content:""}.fa-telegram:before{content:""}.fa-thermometer-4:before,.fa-thermometer-full:before,.fa-thermometer:before{content:""}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:""}.fa-thermometer-2:before,.fa-thermometer-half:before{content:""}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:""}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:""}.fa-shower:before{content:""}.fa-bath:before,.fa-bathtub:before,.fa-s15:before{content:""}.fa-podcast:before{content:""}.fa-window-maximize:before{content:""}.fa-window-minimize:before{content:""}.fa-window-restore:before{content:""}.fa-times-rectangle:before,.fa-window-close:before{content:""}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:""}.fa-bandcamp:before{content:""}.fa-grav:before{content:""}.fa-etsy:before{content:""}.fa-imdb:before{content:""}.fa-ravelry:before{content:""}.fa-eercast:before{content:""}.fa-microchip:before{content:""}.fa-snowflake-o:before{content:""}.fa-superpowers:before{content:""}.fa-wpexplorer:before{content:""}.fa-meetup:before{content:""}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto}.fa,.icon,.rst-content .admonition-title,.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content code.download span:first-child,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink,.rst-content tt.download span:first-child,.wy-dropdown .caret,.wy-inline-validate.wy-inline-validate-danger .wy-input-context,.wy-inline-validate.wy-inline-validate-info .wy-input-context,.wy-inline-validate.wy-inline-validate-success .wy-input-context,.wy-inline-validate.wy-inline-validate-warning .wy-input-context,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li button.toctree-expand{font-family:inherit}.fa:before,.icon:before,.rst-content .admonition-title:before,.rst-content .code-block-caption .headerlink:before,.rst-content .eqno .headerlink:before,.rst-content code.download span:first-child:before,.rst-content dl dt .headerlink:before,.rst-content h1 .headerlink:before,.rst-content h2 .headerlink:before,.rst-content h3 .headerlink:before,.rst-content h4 .headerlink:before,.rst-content h5 .headerlink:before,.rst-content h6 .headerlink:before,.rst-content p.caption .headerlink:before,.rst-content p .headerlink:before,.rst-content table>caption .headerlink:before,.rst-content tt.download span:first-child:before,.wy-dropdown .caret:before,.wy-inline-validate.wy-inline-validate-danger .wy-input-context:before,.wy-inline-validate.wy-inline-validate-info .wy-input-context:before,.wy-inline-validate.wy-inline-validate-success .wy-input-context:before,.wy-inline-validate.wy-inline-validate-warning .wy-input-context:before,.wy-menu-vertical li.current>a button.toctree-expand:before,.wy-menu-vertical li.on a button.toctree-expand:before,.wy-menu-vertical li button.toctree-expand:before{font-family:FontAwesome;display:inline-block;font-style:normal;font-weight:400;line-height:1;text-decoration:inherit}.rst-content .code-block-caption a .headerlink,.rst-content .eqno a .headerlink,.rst-content a .admonition-title,.rst-content code.download a span:first-child,.rst-content dl dt a .headerlink,.rst-content h1 a .headerlink,.rst-content h2 a .headerlink,.rst-content h3 a .headerlink,.rst-content h4 a .headerlink,.rst-content h5 a .headerlink,.rst-content h6 a .headerlink,.rst-content p.caption a .headerlink,.rst-content p a .headerlink,.rst-content table>caption a .headerlink,.rst-content tt.download a span:first-child,.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand,.wy-menu-vertical li a button.toctree-expand,a .fa,a .icon,a .rst-content .admonition-title,a .rst-content .code-block-caption .headerlink,a .rst-content .eqno .headerlink,a .rst-content code.download span:first-child,a .rst-content dl dt .headerlink,a .rst-content h1 .headerlink,a .rst-content h2 .headerlink,a .rst-content h3 .headerlink,a .rst-content h4 .headerlink,a .rst-content h5 .headerlink,a .rst-content h6 .headerlink,a .rst-content p.caption .headerlink,a .rst-content p .headerlink,a .rst-content table>caption .headerlink,a .rst-content tt.download span:first-child,a .wy-menu-vertical li button.toctree-expand{display:inline-block;text-decoration:inherit}.btn .fa,.btn .icon,.btn .rst-content .admonition-title,.btn .rst-content .code-block-caption .headerlink,.btn .rst-content .eqno .headerlink,.btn .rst-content code.download span:first-child,.btn .rst-content dl dt .headerlink,.btn .rst-content h1 .headerlink,.btn .rst-content h2 .headerlink,.btn .rst-content h3 .headerlink,.btn .rst-content h4 .headerlink,.btn .rst-content h5 .headerlink,.btn .rst-content h6 .headerlink,.btn .rst-content p .headerlink,.btn .rst-content table>caption .headerlink,.btn .rst-content tt.download span:first-child,.btn .wy-menu-vertical li.current>a button.toctree-expand,.btn .wy-menu-vertical li.on a button.toctree-expand,.btn .wy-menu-vertical li button.toctree-expand,.nav .fa,.nav .icon,.nav .rst-content .admonition-title,.nav .rst-content .code-block-caption .headerlink,.nav .rst-content .eqno .headerlink,.nav .rst-content code.download span:first-child,.nav .rst-content dl dt .headerlink,.nav .rst-content h1 .headerlink,.nav .rst-content h2 .headerlink,.nav .rst-content h3 .headerlink,.nav .rst-content h4 .headerlink,.nav .rst-content h5 .headerlink,.nav .rst-content h6 .headerlink,.nav .rst-content p .headerlink,.nav .rst-content table>caption .headerlink,.nav .rst-content tt.download span:first-child,.nav .wy-menu-vertical li.current>a button.toctree-expand,.nav .wy-menu-vertical li.on a button.toctree-expand,.nav .wy-menu-vertical li button.toctree-expand,.rst-content .btn .admonition-title,.rst-content .code-block-caption .btn .headerlink,.rst-content .code-block-caption .nav .headerlink,.rst-content .eqno .btn .headerlink,.rst-content .eqno .nav .headerlink,.rst-content .nav .admonition-title,.rst-content code.download .btn span:first-child,.rst-content code.download .nav span:first-child,.rst-content dl dt .btn .headerlink,.rst-content dl dt .nav .headerlink,.rst-content h1 .btn .headerlink,.rst-content h1 .nav .headerlink,.rst-content h2 .btn .headerlink,.rst-content h2 .nav .headerlink,.rst-content h3 .btn .headerlink,.rst-content h3 .nav .headerlink,.rst-content h4 .btn .headerlink,.rst-content h4 .nav .headerlink,.rst-content h5 .btn .headerlink,.rst-content h5 .nav .headerlink,.rst-content h6 .btn .headerlink,.rst-content h6 .nav .headerlink,.rst-content p .btn .headerlink,.rst-content p .nav .headerlink,.rst-content table>caption .btn .headerlink,.rst-content table>caption .nav .headerlink,.rst-content tt.download .btn span:first-child,.rst-content tt.download .nav span:first-child,.wy-menu-vertical li .btn button.toctree-expand,.wy-menu-vertical li.current>a .btn button.toctree-expand,.wy-menu-vertical li.current>a .nav button.toctree-expand,.wy-menu-vertical li .nav button.toctree-expand,.wy-menu-vertical li.on a .btn button.toctree-expand,.wy-menu-vertical li.on a .nav button.toctree-expand{display:inline}.btn .fa-large.icon,.btn .fa.fa-large,.btn .rst-content .code-block-caption .fa-large.headerlink,.btn .rst-content .eqno .fa-large.headerlink,.btn .rst-content .fa-large.admonition-title,.btn .rst-content code.download span.fa-large:first-child,.btn .rst-content dl dt .fa-large.headerlink,.btn .rst-content h1 .fa-large.headerlink,.btn .rst-content h2 .fa-large.headerlink,.btn .rst-content h3 .fa-large.headerlink,.btn .rst-content h4 .fa-large.headerlink,.btn .rst-content h5 .fa-large.headerlink,.btn .rst-content h6 .fa-large.headerlink,.btn .rst-content p .fa-large.headerlink,.btn .rst-content table>caption .fa-large.headerlink,.btn .rst-content tt.download span.fa-large:first-child,.btn .wy-menu-vertical li button.fa-large.toctree-expand,.nav .fa-large.icon,.nav .fa.fa-large,.nav .rst-content .code-block-caption .fa-large.headerlink,.nav .rst-content .eqno .fa-large.headerlink,.nav .rst-content .fa-large.admonition-title,.nav .rst-content code.download span.fa-large:first-child,.nav .rst-content dl dt .fa-large.headerlink,.nav .rst-content h1 .fa-large.headerlink,.nav .rst-content h2 .fa-large.headerlink,.nav .rst-content h3 .fa-large.headerlink,.nav .rst-content h4 .fa-large.headerlink,.nav .rst-content h5 .fa-large.headerlink,.nav .rst-content h6 .fa-large.headerlink,.nav .rst-content p .fa-large.headerlink,.nav .rst-content table>caption .fa-large.headerlink,.nav .rst-content tt.download span.fa-large:first-child,.nav .wy-menu-vertical li button.fa-large.toctree-expand,.rst-content .btn .fa-large.admonition-title,.rst-content .code-block-caption .btn .fa-large.headerlink,.rst-content .code-block-caption .nav .fa-large.headerlink,.rst-content .eqno .btn .fa-large.headerlink,.rst-content .eqno .nav .fa-large.headerlink,.rst-content .nav .fa-large.admonition-title,.rst-content code.download .btn span.fa-large:first-child,.rst-content code.download .nav span.fa-large:first-child,.rst-content dl dt .btn .fa-large.headerlink,.rst-content dl dt .nav .fa-large.headerlink,.rst-content h1 .btn .fa-large.headerlink,.rst-content h1 .nav .fa-large.headerlink,.rst-content h2 .btn .fa-large.headerlink,.rst-content h2 .nav .fa-large.headerlink,.rst-content h3 .btn .fa-large.headerlink,.rst-content h3 .nav .fa-large.headerlink,.rst-content h4 .btn .fa-large.headerlink,.rst-content h4 .nav .fa-large.headerlink,.rst-content h5 .btn .fa-large.headerlink,.rst-content h5 .nav .fa-large.headerlink,.rst-content h6 .btn .fa-large.headerlink,.rst-content h6 .nav .fa-large.headerlink,.rst-content p .btn .fa-large.headerlink,.rst-content p .nav .fa-large.headerlink,.rst-content table>caption .btn .fa-large.headerlink,.rst-content table>caption .nav .fa-large.headerlink,.rst-content tt.download .btn span.fa-large:first-child,.rst-content tt.download .nav span.fa-large:first-child,.wy-menu-vertical li .btn button.fa-large.toctree-expand,.wy-menu-vertical li .nav button.fa-large.toctree-expand{line-height:.9em}.btn .fa-spin.icon,.btn .fa.fa-spin,.btn .rst-content .code-block-caption .fa-spin.headerlink,.btn .rst-content .eqno .fa-spin.headerlink,.btn .rst-content .fa-spin.admonition-title,.btn .rst-content code.download span.fa-spin:first-child,.btn .rst-content dl dt .fa-spin.headerlink,.btn .rst-content h1 .fa-spin.headerlink,.btn .rst-content h2 .fa-spin.headerlink,.btn .rst-content h3 .fa-spin.headerlink,.btn .rst-content h4 .fa-spin.headerlink,.btn .rst-content h5 .fa-spin.headerlink,.btn .rst-content h6 .fa-spin.headerlink,.btn .rst-content p .fa-spin.headerlink,.btn .rst-content table>caption .fa-spin.headerlink,.btn .rst-content tt.download span.fa-spin:first-child,.btn .wy-menu-vertical li button.fa-spin.toctree-expand,.nav .fa-spin.icon,.nav .fa.fa-spin,.nav .rst-content .code-block-caption .fa-spin.headerlink,.nav .rst-content .eqno .fa-spin.headerlink,.nav .rst-content .fa-spin.admonition-title,.nav .rst-content code.download span.fa-spin:first-child,.nav .rst-content dl dt .fa-spin.headerlink,.nav .rst-content h1 .fa-spin.headerlink,.nav .rst-content h2 .fa-spin.headerlink,.nav .rst-content h3 .fa-spin.headerlink,.nav .rst-content h4 .fa-spin.headerlink,.nav .rst-content h5 .fa-spin.headerlink,.nav .rst-content h6 .fa-spin.headerlink,.nav .rst-content p .fa-spin.headerlink,.nav .rst-content table>caption .fa-spin.headerlink,.nav .rst-content tt.download span.fa-spin:first-child,.nav .wy-menu-vertical li button.fa-spin.toctree-expand,.rst-content .btn .fa-spin.admonition-title,.rst-content .code-block-caption .btn .fa-spin.headerlink,.rst-content .code-block-caption .nav .fa-spin.headerlink,.rst-content .eqno .btn .fa-spin.headerlink,.rst-content .eqno .nav .fa-spin.headerlink,.rst-content .nav .fa-spin.admonition-title,.rst-content code.download .btn span.fa-spin:first-child,.rst-content code.download .nav span.fa-spin:first-child,.rst-content dl dt .btn .fa-spin.headerlink,.rst-content dl dt .nav .fa-spin.headerlink,.rst-content h1 .btn .fa-spin.headerlink,.rst-content h1 .nav .fa-spin.headerlink,.rst-content h2 .btn .fa-spin.headerlink,.rst-content h2 .nav .fa-spin.headerlink,.rst-content h3 .btn .fa-spin.headerlink,.rst-content h3 .nav .fa-spin.headerlink,.rst-content h4 .btn .fa-spin.headerlink,.rst-content h4 .nav .fa-spin.headerlink,.rst-content h5 .btn .fa-spin.headerlink,.rst-content h5 .nav .fa-spin.headerlink,.rst-content h6 .btn .fa-spin.headerlink,.rst-content h6 .nav .fa-spin.headerlink,.rst-content p .btn .fa-spin.headerlink,.rst-content p .nav .fa-spin.headerlink,.rst-content table>caption .btn .fa-spin.headerlink,.rst-content table>caption .nav .fa-spin.headerlink,.rst-content tt.download .btn span.fa-spin:first-child,.rst-content tt.download .nav span.fa-spin:first-child,.wy-menu-vertical li .btn button.fa-spin.toctree-expand,.wy-menu-vertical li .nav button.fa-spin.toctree-expand{display:inline-block}.btn.fa:before,.btn.icon:before,.rst-content .btn.admonition-title:before,.rst-content .code-block-caption .btn.headerlink:before,.rst-content .eqno .btn.headerlink:before,.rst-content code.download span.btn:first-child:before,.rst-content dl dt .btn.headerlink:before,.rst-content h1 .btn.headerlink:before,.rst-content h2 .btn.headerlink:before,.rst-content h3 .btn.headerlink:before,.rst-content h4 .btn.headerlink:before,.rst-content h5 .btn.headerlink:before,.rst-content h6 .btn.headerlink:before,.rst-content p .btn.headerlink:before,.rst-content table>caption .btn.headerlink:before,.rst-content tt.download span.btn:first-child:before,.wy-menu-vertical li button.btn.toctree-expand:before{opacity:.5;-webkit-transition:opacity .05s ease-in;-moz-transition:opacity .05s ease-in;transition:opacity .05s ease-in}.btn.fa:hover:before,.btn.icon:hover:before,.rst-content .btn.admonition-title:hover:before,.rst-content .code-block-caption .btn.headerlink:hover:before,.rst-content .eqno .btn.headerlink:hover:before,.rst-content code.download span.btn:first-child:hover:before,.rst-content dl dt .btn.headerlink:hover:before,.rst-content h1 .btn.headerlink:hover:before,.rst-content h2 .btn.headerlink:hover:before,.rst-content h3 .btn.headerlink:hover:before,.rst-content h4 .btn.headerlink:hover:before,.rst-content h5 .btn.headerlink:hover:before,.rst-content h6 .btn.headerlink:hover:before,.rst-content p .btn.headerlink:hover:before,.rst-content table>caption .btn.headerlink:hover:before,.rst-content tt.download span.btn:first-child:hover:before,.wy-menu-vertical li button.btn.toctree-expand:hover:before{opacity:1}.btn-mini .fa:before,.btn-mini .icon:before,.btn-mini .rst-content .admonition-title:before,.btn-mini .rst-content .code-block-caption .headerlink:before,.btn-mini .rst-content .eqno .headerlink:before,.btn-mini .rst-content code.download span:first-child:before,.btn-mini .rst-content dl dt .headerlink:before,.btn-mini .rst-content h1 .headerlink:before,.btn-mini .rst-content h2 .headerlink:before,.btn-mini .rst-content h3 .headerlink:before,.btn-mini .rst-content h4 .headerlink:before,.btn-mini .rst-content h5 .headerlink:before,.btn-mini .rst-content h6 .headerlink:before,.btn-mini .rst-content p .headerlink:before,.btn-mini .rst-content table>caption .headerlink:before,.btn-mini .rst-content tt.download span:first-child:before,.btn-mini .wy-menu-vertical li button.toctree-expand:before,.rst-content .btn-mini .admonition-title:before,.rst-content .code-block-caption .btn-mini .headerlink:before,.rst-content .eqno .btn-mini .headerlink:before,.rst-content code.download .btn-mini span:first-child:before,.rst-content dl dt .btn-mini .headerlink:before,.rst-content h1 .btn-mini .headerlink:before,.rst-content h2 .btn-mini .headerlink:before,.rst-content h3 .btn-mini .headerlink:before,.rst-content h4 .btn-mini .headerlink:before,.rst-content h5 .btn-mini .headerlink:before,.rst-content h6 .btn-mini .headerlink:before,.rst-content p .btn-mini .headerlink:before,.rst-content table>caption .btn-mini .headerlink:before,.rst-content tt.download .btn-mini span:first-child:before,.wy-menu-vertical li .btn-mini button.toctree-expand:before{font-size:14px;vertical-align:-15%}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning,.wy-alert{padding:12px;line-height:24px;margin-bottom:24px;background:#e7f2fa}.rst-content .admonition-title,.wy-alert-title{font-weight:700;display:block;color:#fff;background:#6ab0de;padding:6px 12px;margin:-12px -12px 12px}.rst-content .danger,.rst-content .error,.rst-content .wy-alert-danger.admonition,.rst-content .wy-alert-danger.admonition-todo,.rst-content .wy-alert-danger.attention,.rst-content .wy-alert-danger.caution,.rst-content .wy-alert-danger.hint,.rst-content .wy-alert-danger.important,.rst-content .wy-alert-danger.note,.rst-content .wy-alert-danger.seealso,.rst-content .wy-alert-danger.tip,.rst-content .wy-alert-danger.warning,.wy-alert.wy-alert-danger{background:#fdf3f2}.rst-content .danger .admonition-title,.rst-content .danger .wy-alert-title,.rst-content .error .admonition-title,.rst-content .error .wy-alert-title,.rst-content .wy-alert-danger.admonition-todo .admonition-title,.rst-content .wy-alert-danger.admonition-todo .wy-alert-title,.rst-content .wy-alert-danger.admonition .admonition-title,.rst-content .wy-alert-danger.admonition .wy-alert-title,.rst-content .wy-alert-danger.attention .admonition-title,.rst-content .wy-alert-danger.attention .wy-alert-title,.rst-content .wy-alert-danger.caution .admonition-title,.rst-content .wy-alert-danger.caution .wy-alert-title,.rst-content .wy-alert-danger.hint .admonition-title,.rst-content .wy-alert-danger.hint .wy-alert-title,.rst-content .wy-alert-danger.important .admonition-title,.rst-content .wy-alert-danger.important .wy-alert-title,.rst-content .wy-alert-danger.note .admonition-title,.rst-content .wy-alert-danger.note .wy-alert-title,.rst-content .wy-alert-danger.seealso .admonition-title,.rst-content .wy-alert-danger.seealso .wy-alert-title,.rst-content .wy-alert-danger.tip .admonition-title,.rst-content .wy-alert-danger.tip .wy-alert-title,.rst-content .wy-alert-danger.warning .admonition-title,.rst-content .wy-alert-danger.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-danger .admonition-title,.wy-alert.wy-alert-danger .rst-content .admonition-title,.wy-alert.wy-alert-danger .wy-alert-title{background:#f29f97}.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .warning,.rst-content .wy-alert-warning.admonition,.rst-content .wy-alert-warning.danger,.rst-content .wy-alert-warning.error,.rst-content .wy-alert-warning.hint,.rst-content .wy-alert-warning.important,.rst-content .wy-alert-warning.note,.rst-content .wy-alert-warning.seealso,.rst-content .wy-alert-warning.tip,.wy-alert.wy-alert-warning{background:#ffedcc}.rst-content .admonition-todo .admonition-title,.rst-content .admonition-todo .wy-alert-title,.rst-content .attention .admonition-title,.rst-content .attention .wy-alert-title,.rst-content .caution .admonition-title,.rst-content .caution .wy-alert-title,.rst-content .warning .admonition-title,.rst-content .warning .wy-alert-title,.rst-content .wy-alert-warning.admonition .admonition-title,.rst-content .wy-alert-warning.admonition .wy-alert-title,.rst-content .wy-alert-warning.danger .admonition-title,.rst-content .wy-alert-warning.danger .wy-alert-title,.rst-content .wy-alert-warning.error .admonition-title,.rst-content .wy-alert-warning.error .wy-alert-title,.rst-content .wy-alert-warning.hint .admonition-title,.rst-content .wy-alert-warning.hint .wy-alert-title,.rst-content .wy-alert-warning.important .admonition-title,.rst-content .wy-alert-warning.important .wy-alert-title,.rst-content .wy-alert-warning.note .admonition-title,.rst-content .wy-alert-warning.note .wy-alert-title,.rst-content .wy-alert-warning.seealso .admonition-title,.rst-content .wy-alert-warning.seealso .wy-alert-title,.rst-content .wy-alert-warning.tip .admonition-title,.rst-content .wy-alert-warning.tip .wy-alert-title,.rst-content .wy-alert.wy-alert-warning .admonition-title,.wy-alert.wy-alert-warning .rst-content .admonition-title,.wy-alert.wy-alert-warning .wy-alert-title{background:#f0b37e}.rst-content .note,.rst-content .seealso,.rst-content .wy-alert-info.admonition,.rst-content .wy-alert-info.admonition-todo,.rst-content .wy-alert-info.attention,.rst-content .wy-alert-info.caution,.rst-content .wy-alert-info.danger,.rst-content .wy-alert-info.error,.rst-content .wy-alert-info.hint,.rst-content .wy-alert-info.important,.rst-content .wy-alert-info.tip,.rst-content .wy-alert-info.warning,.wy-alert.wy-alert-info{background:#e7f2fa}.rst-content .note .admonition-title,.rst-content .note .wy-alert-title,.rst-content .seealso .admonition-title,.rst-content .seealso .wy-alert-title,.rst-content .wy-alert-info.admonition-todo .admonition-title,.rst-content .wy-alert-info.admonition-todo .wy-alert-title,.rst-content .wy-alert-info.admonition .admonition-title,.rst-content .wy-alert-info.admonition .wy-alert-title,.rst-content .wy-alert-info.attention .admonition-title,.rst-content .wy-alert-info.attention .wy-alert-title,.rst-content .wy-alert-info.caution .admonition-title,.rst-content .wy-alert-info.caution .wy-alert-title,.rst-content .wy-alert-info.danger .admonition-title,.rst-content .wy-alert-info.danger .wy-alert-title,.rst-content .wy-alert-info.error .admonition-title,.rst-content .wy-alert-info.error .wy-alert-title,.rst-content .wy-alert-info.hint .admonition-title,.rst-content .wy-alert-info.hint .wy-alert-title,.rst-content .wy-alert-info.important .admonition-title,.rst-content .wy-alert-info.important .wy-alert-title,.rst-content .wy-alert-info.tip .admonition-title,.rst-content .wy-alert-info.tip .wy-alert-title,.rst-content .wy-alert-info.warning .admonition-title,.rst-content .wy-alert-info.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-info .admonition-title,.wy-alert.wy-alert-info .rst-content .admonition-title,.wy-alert.wy-alert-info .wy-alert-title{background:#6ab0de}.rst-content .hint,.rst-content .important,.rst-content .tip,.rst-content .wy-alert-success.admonition,.rst-content .wy-alert-success.admonition-todo,.rst-content .wy-alert-success.attention,.rst-content .wy-alert-success.caution,.rst-content .wy-alert-success.danger,.rst-content .wy-alert-success.error,.rst-content .wy-alert-success.note,.rst-content .wy-alert-success.seealso,.rst-content .wy-alert-success.warning,.wy-alert.wy-alert-success{background:#dbfaf4}.rst-content .hint .admonition-title,.rst-content .hint .wy-alert-title,.rst-content .important .admonition-title,.rst-content .important .wy-alert-title,.rst-content .tip .admonition-title,.rst-content .tip .wy-alert-title,.rst-content .wy-alert-success.admonition-todo .admonition-title,.rst-content .wy-alert-success.admonition-todo .wy-alert-title,.rst-content .wy-alert-success.admonition .admonition-title,.rst-content .wy-alert-success.admonition .wy-alert-title,.rst-content .wy-alert-success.attention .admonition-title,.rst-content .wy-alert-success.attention .wy-alert-title,.rst-content .wy-alert-success.caution .admonition-title,.rst-content .wy-alert-success.caution .wy-alert-title,.rst-content .wy-alert-success.danger .admonition-title,.rst-content .wy-alert-success.danger .wy-alert-title,.rst-content .wy-alert-success.error .admonition-title,.rst-content .wy-alert-success.error .wy-alert-title,.rst-content .wy-alert-success.note .admonition-title,.rst-content .wy-alert-success.note .wy-alert-title,.rst-content .wy-alert-success.seealso .admonition-title,.rst-content .wy-alert-success.seealso .wy-alert-title,.rst-content .wy-alert-success.warning .admonition-title,.rst-content .wy-alert-success.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-success .admonition-title,.wy-alert.wy-alert-success .rst-content .admonition-title,.wy-alert.wy-alert-success .wy-alert-title{background:#1abc9c}.rst-content .wy-alert-neutral.admonition,.rst-content .wy-alert-neutral.admonition-todo,.rst-content .wy-alert-neutral.attention,.rst-content .wy-alert-neutral.caution,.rst-content .wy-alert-neutral.danger,.rst-content .wy-alert-neutral.error,.rst-content .wy-alert-neutral.hint,.rst-content .wy-alert-neutral.important,.rst-content .wy-alert-neutral.note,.rst-content .wy-alert-neutral.seealso,.rst-content .wy-alert-neutral.tip,.rst-content .wy-alert-neutral.warning,.wy-alert.wy-alert-neutral{background:#f3f6f6}.rst-content .wy-alert-neutral.admonition-todo .admonition-title,.rst-content .wy-alert-neutral.admonition-todo .wy-alert-title,.rst-content .wy-alert-neutral.admonition .admonition-title,.rst-content .wy-alert-neutral.admonition .wy-alert-title,.rst-content .wy-alert-neutral.attention .admonition-title,.rst-content .wy-alert-neutral.attention .wy-alert-title,.rst-content .wy-alert-neutral.caution .admonition-title,.rst-content .wy-alert-neutral.caution .wy-alert-title,.rst-content .wy-alert-neutral.danger .admonition-title,.rst-content .wy-alert-neutral.danger .wy-alert-title,.rst-content .wy-alert-neutral.error .admonition-title,.rst-content .wy-alert-neutral.error .wy-alert-title,.rst-content .wy-alert-neutral.hint .admonition-title,.rst-content .wy-alert-neutral.hint .wy-alert-title,.rst-content .wy-alert-neutral.important .admonition-title,.rst-content .wy-alert-neutral.important .wy-alert-title,.rst-content .wy-alert-neutral.note .admonition-title,.rst-content .wy-alert-neutral.note .wy-alert-title,.rst-content .wy-alert-neutral.seealso .admonition-title,.rst-content .wy-alert-neutral.seealso .wy-alert-title,.rst-content .wy-alert-neutral.tip .admonition-title,.rst-content .wy-alert-neutral.tip .wy-alert-title,.rst-content .wy-alert-neutral.warning .admonition-title,.rst-content .wy-alert-neutral.warning .wy-alert-title,.rst-content .wy-alert.wy-alert-neutral .admonition-title,.wy-alert.wy-alert-neutral .rst-content .admonition-title,.wy-alert.wy-alert-neutral .wy-alert-title{color:#404040;background:#e1e4e5}.rst-content .wy-alert-neutral.admonition-todo a,.rst-content .wy-alert-neutral.admonition a,.rst-content .wy-alert-neutral.attention a,.rst-content .wy-alert-neutral.caution a,.rst-content .wy-alert-neutral.danger a,.rst-content .wy-alert-neutral.error a,.rst-content .wy-alert-neutral.hint a,.rst-content .wy-alert-neutral.important a,.rst-content .wy-alert-neutral.note a,.rst-content .wy-alert-neutral.seealso a,.rst-content .wy-alert-neutral.tip a,.rst-content .wy-alert-neutral.warning a,.wy-alert.wy-alert-neutral a{color:#2980b9}.rst-content .admonition-todo p:last-child,.rst-content .admonition p:last-child,.rst-content .attention p:last-child,.rst-content .caution p:last-child,.rst-content .danger p:last-child,.rst-content .error p:last-child,.rst-content .hint p:last-child,.rst-content .important p:last-child,.rst-content .note p:last-child,.rst-content .seealso p:last-child,.rst-content .tip p:last-child,.rst-content .warning p:last-child,.wy-alert p:last-child{margin-bottom:0}.wy-tray-container{position:fixed;bottom:0;left:0;z-index:600}.wy-tray-container li{display:block;width:300px;background:transparent;color:#fff;text-align:center;box-shadow:0 5px 5px 0 rgba(0,0,0,.1);padding:0 24px;min-width:20%;opacity:0;height:0;line-height:56px;overflow:hidden;-webkit-transition:all .3s ease-in;-moz-transition:all .3s ease-in;transition:all .3s ease-in}.wy-tray-container li.wy-tray-item-success{background:#27ae60}.wy-tray-container li.wy-tray-item-info{background:#2980b9}.wy-tray-container li.wy-tray-item-warning{background:#e67e22}.wy-tray-container li.wy-tray-item-danger{background:#e74c3c}.wy-tray-container li.on{opacity:1;height:56px}@media screen and (max-width:768px){.wy-tray-container{bottom:auto;top:0;width:100%}.wy-tray-container li{width:100%}}button{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle;cursor:pointer;line-height:normal;-webkit-appearance:button;*overflow:visible}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}button[disabled]{cursor:default}.btn{display:inline-block;border-radius:2px;line-height:normal;white-space:nowrap;text-align:center;cursor:pointer;font-size:100%;padding:6px 12px 8px;color:#fff;border:1px solid rgba(0,0,0,.1);background-color:#27ae60;text-decoration:none;font-weight:400;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 2px -1px hsla(0,0%,100%,.5),inset 0 -2px 0 0 rgba(0,0,0,.1);outline-none:false;vertical-align:middle;*display:inline;zoom:1;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-transition:all .1s linear;-moz-transition:all .1s linear;transition:all .1s linear}.btn-hover{background:#2e8ece;color:#fff}.btn:hover{background:#2cc36b;color:#fff}.btn:focus{background:#2cc36b;outline:0}.btn:active{box-shadow:inset 0 -1px 0 0 rgba(0,0,0,.05),inset 0 2px 0 0 rgba(0,0,0,.1);padding:8px 12px 6px}.btn:visited{color:#fff}.btn-disabled,.btn-disabled:active,.btn-disabled:focus,.btn-disabled:hover,.btn:disabled{background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled = false);filter:alpha(opacity=40);opacity:.4;cursor:not-allowed;box-shadow:none}.btn::-moz-focus-inner{padding:0;border:0}.btn-small{font-size:80%}.btn-info{background-color:#2980b9!important}.btn-info:hover{background-color:#2e8ece!important}.btn-neutral{background-color:#f3f6f6!important;color:#404040!important}.btn-neutral:hover{background-color:#e5ebeb!important;color:#404040}.btn-neutral:visited{color:#404040!important}.btn-success{background-color:#27ae60!important}.btn-success:hover{background-color:#295!important}.btn-danger{background-color:#e74c3c!important}.btn-danger:hover{background-color:#ea6153!important}.btn-warning{background-color:#e67e22!important}.btn-warning:hover{background-color:#e98b39!important}.btn-invert{background-color:#222}.btn-invert:hover{background-color:#2f2f2f!important}.btn-link{background-color:transparent!important;color:#2980b9;box-shadow:none;border-color:transparent!important}.btn-link:active,.btn-link:hover{background-color:transparent!important;color:#409ad5!important;box-shadow:none}.btn-link:visited{color:#9b59b6}.wy-btn-group .btn,.wy-control .btn{vertical-align:middle}.wy-btn-group{margin-bottom:24px;*zoom:1}.wy-btn-group:after,.wy-btn-group:before{display:table;content:""}.wy-btn-group:after{clear:both}.wy-dropdown{position:relative;display:inline-block}.wy-dropdown-active .wy-dropdown-menu{display:block}.wy-dropdown-menu{position:absolute;left:0;display:none;float:left;top:100%;min-width:100%;background:#fcfcfc;z-index:100;border:1px solid #cfd7dd;box-shadow:0 2px 2px 0 rgba(0,0,0,.1);padding:12px}.wy-dropdown-menu>dd>a{display:block;clear:both;color:#404040;white-space:nowrap;font-size:90%;padding:0 12px;cursor:pointer}.wy-dropdown-menu>dd>a:hover{background:#2980b9;color:#fff}.wy-dropdown-menu>dd.divider{border-top:1px solid #cfd7dd;margin:6px 0}.wy-dropdown-menu>dd.search{padding-bottom:12px}.wy-dropdown-menu>dd.search input[type=search]{width:100%}.wy-dropdown-menu>dd.call-to-action{background:#e3e3e3;text-transform:uppercase;font-weight:500;font-size:80%}.wy-dropdown-menu>dd.call-to-action:hover{background:#e3e3e3}.wy-dropdown-menu>dd.call-to-action .btn{color:#fff}.wy-dropdown.wy-dropdown-up .wy-dropdown-menu{bottom:100%;top:auto;left:auto;right:0}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu{background:#fcfcfc;margin-top:2px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a{padding:6px 12px}.wy-dropdown.wy-dropdown-bubble .wy-dropdown-menu a:hover{background:#2980b9;color:#fff}.wy-dropdown.wy-dropdown-left .wy-dropdown-menu{right:0;left:auto;text-align:right}.wy-dropdown-arrow:before{content:" ";border-bottom:5px solid #f5f5f5;border-left:5px solid transparent;border-right:5px solid transparent;position:absolute;display:block;top:-4px;left:50%;margin-left:-3px}.wy-dropdown-arrow.wy-dropdown-arrow-left:before{left:11px}.wy-form-stacked select{display:block}.wy-form-aligned .wy-help-inline,.wy-form-aligned input,.wy-form-aligned label,.wy-form-aligned select,.wy-form-aligned textarea{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-form-aligned .wy-control-group>label{display:inline-block;vertical-align:middle;width:10em;margin:6px 12px 0 0;float:left}.wy-form-aligned .wy-control{float:left}.wy-form-aligned .wy-control label{display:block}.wy-form-aligned .wy-control select{margin-top:6px}fieldset{margin:0}fieldset,legend{border:0;padding:0}legend{width:100%;white-space:normal;margin-bottom:24px;font-size:150%;*margin-left:-7px}label,legend{display:block}label{margin:0 0 .3125em;color:#333;font-size:90%}input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}.wy-control-group{margin-bottom:24px;max-width:1200px;margin-left:auto;margin-right:auto;*zoom:1}.wy-control-group:after,.wy-control-group:before{display:table;content:""}.wy-control-group:after{clear:both}.wy-control-group.wy-control-group-required>label:after{content:" *";color:#e74c3c}.wy-control-group .wy-form-full,.wy-control-group .wy-form-halves,.wy-control-group .wy-form-thirds{padding-bottom:12px}.wy-control-group .wy-form-full input[type=color],.wy-control-group .wy-form-full input[type=date],.wy-control-group .wy-form-full input[type=datetime-local],.wy-control-group .wy-form-full input[type=datetime],.wy-control-group .wy-form-full input[type=email],.wy-control-group .wy-form-full input[type=month],.wy-control-group .wy-form-full input[type=number],.wy-control-group .wy-form-full input[type=password],.wy-control-group .wy-form-full input[type=search],.wy-control-group .wy-form-full input[type=tel],.wy-control-group .wy-form-full input[type=text],.wy-control-group .wy-form-full input[type=time],.wy-control-group .wy-form-full input[type=url],.wy-control-group .wy-form-full input[type=week],.wy-control-group .wy-form-full select,.wy-control-group .wy-form-halves input[type=color],.wy-control-group .wy-form-halves input[type=date],.wy-control-group .wy-form-halves input[type=datetime-local],.wy-control-group .wy-form-halves input[type=datetime],.wy-control-group .wy-form-halves input[type=email],.wy-control-group .wy-form-halves input[type=month],.wy-control-group .wy-form-halves input[type=number],.wy-control-group .wy-form-halves input[type=password],.wy-control-group .wy-form-halves input[type=search],.wy-control-group .wy-form-halves input[type=tel],.wy-control-group .wy-form-halves input[type=text],.wy-control-group .wy-form-halves input[type=time],.wy-control-group .wy-form-halves input[type=url],.wy-control-group .wy-form-halves input[type=week],.wy-control-group .wy-form-halves select,.wy-control-group .wy-form-thirds input[type=color],.wy-control-group .wy-form-thirds input[type=date],.wy-control-group .wy-form-thirds input[type=datetime-local],.wy-control-group .wy-form-thirds input[type=datetime],.wy-control-group .wy-form-thirds input[type=email],.wy-control-group .wy-form-thirds input[type=month],.wy-control-group .wy-form-thirds input[type=number],.wy-control-group .wy-form-thirds input[type=password],.wy-control-group .wy-form-thirds input[type=search],.wy-control-group .wy-form-thirds input[type=tel],.wy-control-group .wy-form-thirds input[type=text],.wy-control-group .wy-form-thirds input[type=time],.wy-control-group .wy-form-thirds input[type=url],.wy-control-group .wy-form-thirds input[type=week],.wy-control-group .wy-form-thirds select{width:100%}.wy-control-group .wy-form-full{float:left;display:block;width:100%;margin-right:0}.wy-control-group .wy-form-full:last-child{margin-right:0}.wy-control-group .wy-form-halves{float:left;display:block;margin-right:2.35765%;width:48.82117%}.wy-control-group .wy-form-halves:last-child,.wy-control-group .wy-form-halves:nth-of-type(2n){margin-right:0}.wy-control-group .wy-form-halves:nth-of-type(odd){clear:left}.wy-control-group .wy-form-thirds{float:left;display:block;margin-right:2.35765%;width:31.76157%}.wy-control-group .wy-form-thirds:last-child,.wy-control-group .wy-form-thirds:nth-of-type(3n){margin-right:0}.wy-control-group .wy-form-thirds:nth-of-type(3n+1){clear:left}.wy-control-group.wy-control-group-no-input .wy-control,.wy-control-no-input{margin:6px 0 0;font-size:90%}.wy-control-no-input{display:inline-block}.wy-control-group.fluid-input input[type=color],.wy-control-group.fluid-input input[type=date],.wy-control-group.fluid-input input[type=datetime-local],.wy-control-group.fluid-input input[type=datetime],.wy-control-group.fluid-input input[type=email],.wy-control-group.fluid-input input[type=month],.wy-control-group.fluid-input input[type=number],.wy-control-group.fluid-input input[type=password],.wy-control-group.fluid-input input[type=search],.wy-control-group.fluid-input input[type=tel],.wy-control-group.fluid-input input[type=text],.wy-control-group.fluid-input input[type=time],.wy-control-group.fluid-input input[type=url],.wy-control-group.fluid-input input[type=week]{width:100%}.wy-form-message-inline{padding-left:.3em;color:#666;font-size:90%}.wy-form-message{display:block;color:#999;font-size:70%;margin-top:.3125em;font-style:italic}.wy-form-message p{font-size:inherit;font-style:italic;margin-bottom:6px}.wy-form-message p:last-child{margin-bottom:0}input{line-height:normal}input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;*overflow:visible}input[type=color],input[type=date],input[type=datetime-local],input[type=datetime],input[type=email],input[type=month],input[type=number],input[type=password],input[type=search],input[type=tel],input[type=text],input[type=time],input[type=url],input[type=week]{-webkit-appearance:none;padding:6px;display:inline-block;border:1px solid #ccc;font-size:80%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;box-shadow:inset 0 1px 3px #ddd;border-radius:0;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}input[type=datetime-local]{padding:.34375em .625em}input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{padding:0;margin-right:.3125em;*height:13px;*width:13px}input[type=checkbox],input[type=radio],input[type=search]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}input[type=color]:focus,input[type=date]:focus,input[type=datetime-local]:focus,input[type=datetime]:focus,input[type=email]:focus,input[type=month]:focus,input[type=number]:focus,input[type=password]:focus,input[type=search]:focus,input[type=tel]:focus,input[type=text]:focus,input[type=time]:focus,input[type=url]:focus,input[type=week]:focus{outline:0;outline:thin dotted\9;border-color:#333}input.no-focus:focus{border-color:#ccc!important}input[type=checkbox]:focus,input[type=file]:focus,input[type=radio]:focus{outline:thin dotted #333;outline:1px auto #129fea}input[type=color][disabled],input[type=date][disabled],input[type=datetime-local][disabled],input[type=datetime][disabled],input[type=email][disabled],input[type=month][disabled],input[type=number][disabled],input[type=password][disabled],input[type=search][disabled],input[type=tel][disabled],input[type=text][disabled],input[type=time][disabled],input[type=url][disabled],input[type=week][disabled]{cursor:not-allowed;background-color:#fafafa}input:focus:invalid,select:focus:invalid,textarea:focus:invalid{color:#e74c3c;border:1px solid #e74c3c}input:focus:invalid:focus,select:focus:invalid:focus,textarea:focus:invalid:focus{border-color:#e74c3c}input[type=checkbox]:focus:invalid:focus,input[type=file]:focus:invalid:focus,input[type=radio]:focus:invalid:focus{outline-color:#e74c3c}input.wy-input-large{padding:12px;font-size:100%}textarea{overflow:auto;vertical-align:top;width:100%;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif}select,textarea{padding:.5em .625em;display:inline-block;border:1px solid #ccc;font-size:80%;box-shadow:inset 0 1px 3px #ddd;-webkit-transition:border .3s linear;-moz-transition:border .3s linear;transition:border .3s linear}select{border:1px solid #ccc;background-color:#fff}select[multiple]{height:auto}select:focus,textarea:focus{outline:0}input[readonly],select[disabled],select[readonly],textarea[disabled],textarea[readonly]{cursor:not-allowed;background-color:#fafafa}input[type=checkbox][disabled],input[type=radio][disabled]{cursor:not-allowed}.wy-checkbox,.wy-radio{margin:6px 0;color:#404040;display:block}.wy-checkbox input,.wy-radio input{vertical-align:baseline}.wy-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.wy-input-prefix,.wy-input-suffix{white-space:nowrap;padding:6px}.wy-input-prefix .wy-input-context,.wy-input-suffix .wy-input-context{line-height:27px;padding:0 8px;display:inline-block;font-size:80%;background-color:#f3f6f6;border:1px solid #ccc;color:#999}.wy-input-suffix .wy-input-context{border-left:0}.wy-input-prefix .wy-input-context{border-right:0}.wy-switch{position:relative;display:block;height:24px;margin-top:12px;cursor:pointer}.wy-switch:before{left:0;top:0;width:36px;height:12px;background:#ccc}.wy-switch:after,.wy-switch:before{position:absolute;content:"";display:block;border-radius:4px;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.wy-switch:after{width:18px;height:18px;background:#999;left:-3px;top:-3px}.wy-switch span{position:absolute;left:48px;display:block;font-size:12px;color:#ccc;line-height:1}.wy-switch.active:before{background:#1e8449}.wy-switch.active:after{left:24px;background:#27ae60}.wy-switch.disabled{cursor:not-allowed;opacity:.8}.wy-control-group.wy-control-group-error .wy-form-message,.wy-control-group.wy-control-group-error>label{color:#e74c3c}.wy-control-group.wy-control-group-error input[type=color],.wy-control-group.wy-control-group-error input[type=date],.wy-control-group.wy-control-group-error input[type=datetime-local],.wy-control-group.wy-control-group-error input[type=datetime],.wy-control-group.wy-control-group-error input[type=email],.wy-control-group.wy-control-group-error input[type=month],.wy-control-group.wy-control-group-error input[type=number],.wy-control-group.wy-control-group-error input[type=password],.wy-control-group.wy-control-group-error input[type=search],.wy-control-group.wy-control-group-error input[type=tel],.wy-control-group.wy-control-group-error input[type=text],.wy-control-group.wy-control-group-error input[type=time],.wy-control-group.wy-control-group-error input[type=url],.wy-control-group.wy-control-group-error input[type=week],.wy-control-group.wy-control-group-error textarea{border:1px solid #e74c3c}.wy-inline-validate{white-space:nowrap}.wy-inline-validate .wy-input-context{padding:.5em .625em;display:inline-block;font-size:80%}.wy-inline-validate.wy-inline-validate-success .wy-input-context{color:#27ae60}.wy-inline-validate.wy-inline-validate-danger .wy-input-context{color:#e74c3c}.wy-inline-validate.wy-inline-validate-warning .wy-input-context{color:#e67e22}.wy-inline-validate.wy-inline-validate-info .wy-input-context{color:#2980b9}.rotate-90{-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);-o-transform:rotate(90deg);transform:rotate(90deg)}.rotate-180{-webkit-transform:rotate(180deg);-moz-transform:rotate(180deg);-ms-transform:rotate(180deg);-o-transform:rotate(180deg);transform:rotate(180deg)}.rotate-270{-webkit-transform:rotate(270deg);-moz-transform:rotate(270deg);-ms-transform:rotate(270deg);-o-transform:rotate(270deg);transform:rotate(270deg)}.mirror{-webkit-transform:scaleX(-1);-moz-transform:scaleX(-1);-ms-transform:scaleX(-1);-o-transform:scaleX(-1);transform:scaleX(-1)}.mirror.rotate-90{-webkit-transform:scaleX(-1) rotate(90deg);-moz-transform:scaleX(-1) rotate(90deg);-ms-transform:scaleX(-1) rotate(90deg);-o-transform:scaleX(-1) rotate(90deg);transform:scaleX(-1) rotate(90deg)}.mirror.rotate-180{-webkit-transform:scaleX(-1) rotate(180deg);-moz-transform:scaleX(-1) rotate(180deg);-ms-transform:scaleX(-1) rotate(180deg);-o-transform:scaleX(-1) rotate(180deg);transform:scaleX(-1) rotate(180deg)}.mirror.rotate-270{-webkit-transform:scaleX(-1) rotate(270deg);-moz-transform:scaleX(-1) rotate(270deg);-ms-transform:scaleX(-1) rotate(270deg);-o-transform:scaleX(-1) rotate(270deg);transform:scaleX(-1) rotate(270deg)}@media only screen and (max-width:480px){.wy-form button[type=submit]{margin:.7em 0 0}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=text],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week],.wy-form label{margin-bottom:.3em;display:block}.wy-form input[type=color],.wy-form input[type=date],.wy-form input[type=datetime-local],.wy-form input[type=datetime],.wy-form input[type=email],.wy-form input[type=month],.wy-form input[type=number],.wy-form input[type=password],.wy-form input[type=search],.wy-form input[type=tel],.wy-form input[type=time],.wy-form input[type=url],.wy-form input[type=week]{margin-bottom:0}.wy-form-aligned .wy-control-group label{margin-bottom:.3em;text-align:left;display:block;width:100%}.wy-form-aligned .wy-control{margin:1.5em 0 0}.wy-form-message,.wy-form-message-inline,.wy-form .wy-help-inline{display:block;font-size:80%;padding:6px 0}}@media screen and (max-width:768px){.tablet-hide{display:none}}@media screen and (max-width:480px){.mobile-hide{display:none}}.float-left{float:left}.float-right{float:right}.full-width{width:100%}.rst-content table.docutils,.rst-content table.field-list,.wy-table{border-collapse:collapse;border-spacing:0;empty-cells:show;margin-bottom:24px}.rst-content table.docutils caption,.rst-content table.field-list caption,.wy-table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.rst-content table.docutils td,.rst-content table.docutils th,.rst-content table.field-list td,.rst-content table.field-list th,.wy-table td,.wy-table th{font-size:90%;margin:0;overflow:visible;padding:8px 16px}.rst-content table.docutils td:first-child,.rst-content table.docutils th:first-child,.rst-content table.field-list td:first-child,.rst-content table.field-list th:first-child,.wy-table td:first-child,.wy-table th:first-child{border-left-width:0}.rst-content table.docutils thead,.rst-content table.field-list thead,.wy-table thead{color:#000;text-align:left;vertical-align:bottom;white-space:nowrap}.rst-content table.docutils thead th,.rst-content table.field-list thead th,.wy-table thead th{font-weight:700;border-bottom:2px solid #e1e4e5}.rst-content table.docutils td,.rst-content table.field-list td,.wy-table td{background-color:transparent;vertical-align:middle}.rst-content table.docutils td p,.rst-content table.field-list td p,.wy-table td p{line-height:18px}.rst-content table.docutils td p:last-child,.rst-content table.field-list td p:last-child,.wy-table td p:last-child{margin-bottom:0}.rst-content table.docutils .wy-table-cell-min,.rst-content table.field-list .wy-table-cell-min,.wy-table .wy-table-cell-min{width:1%;padding-right:0}.rst-content table.docutils .wy-table-cell-min input[type=checkbox],.rst-content table.field-list .wy-table-cell-min input[type=checkbox],.wy-table .wy-table-cell-min input[type=checkbox]{margin:0}.wy-table-secondary{color:grey;font-size:90%}.wy-table-tertiary{color:grey;font-size:80%}.rst-content table.docutils:not(.field-list) tr:nth-child(2n-1) td,.wy-table-backed,.wy-table-odd td,.wy-table-striped tr:nth-child(2n-1) td{background-color:#f3f6f6}.rst-content table.docutils,.wy-table-bordered-all{border:1px solid #e1e4e5}.rst-content table.docutils td,.wy-table-bordered-all td{border-bottom:1px solid #e1e4e5;border-left:1px solid #e1e4e5}.rst-content table.docutils tbody>tr:last-child td,.wy-table-bordered-all tbody>tr:last-child td{border-bottom-width:0}.wy-table-bordered{border:1px solid #e1e4e5}.wy-table-bordered-rows td{border-bottom:1px solid #e1e4e5}.wy-table-bordered-rows tbody>tr:last-child td{border-bottom-width:0}.wy-table-horizontal td,.wy-table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #e1e4e5}.wy-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.wy-table-responsive{margin-bottom:24px;max-width:100%;overflow:auto}.wy-table-responsive table{margin-bottom:0!important}.wy-table-responsive table td,.wy-table-responsive table th{white-space:nowrap}a{color:#2980b9;text-decoration:none;cursor:pointer}a:hover{color:#3091d1}a:visited{color:#9b59b6}html{height:100%}body,html{overflow-x:hidden}body{font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;font-weight:400;color:#404040;min-height:100%;background:#edf0f2}.wy-text-left{text-align:left}.wy-text-center{text-align:center}.wy-text-right{text-align:right}.wy-text-large{font-size:120%}.wy-text-normal{font-size:100%}.wy-text-small,small{font-size:80%}.wy-text-strike{text-decoration:line-through}.wy-text-warning{color:#e67e22!important}a.wy-text-warning:hover{color:#eb9950!important}.wy-text-info{color:#2980b9!important}a.wy-text-info:hover{color:#409ad5!important}.wy-text-success{color:#27ae60!important}a.wy-text-success:hover{color:#36d278!important}.wy-text-danger{color:#e74c3c!important}a.wy-text-danger:hover{color:#ed7669!important}.wy-text-neutral{color:#404040!important}a.wy-text-neutral:hover{color:#595959!important}.rst-content .toctree-wrapper>p.caption,h1,h2,h3,h4,h5,h6,legend{margin-top:0;font-weight:700;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif}p{line-height:24px;font-size:16px;margin:0 0 24px}h1{font-size:175%}.rst-content .toctree-wrapper>p.caption,h2{font-size:150%}h3{font-size:125%}h4{font-size:115%}h5{font-size:110%}h6{font-size:100%}hr{display:block;height:1px;border:0;border-top:1px solid #e1e4e5;margin:24px 0;padding:0}.rst-content code,.rst-content tt,code{white-space:nowrap;max-width:100%;background:#fff;border:1px solid #e1e4e5;font-size:75%;padding:0 5px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#e74c3c;overflow-x:auto}.rst-content tt.code-large,code.code-large{font-size:90%}.rst-content .section ul,.rst-content .toctree-wrapper ul,.rst-content section ul,.wy-plain-list-disc,article ul{list-style:disc;line-height:24px;margin-bottom:24px}.rst-content .section ul li,.rst-content .toctree-wrapper ul li,.rst-content section ul li,.wy-plain-list-disc li,article ul li{list-style:disc;margin-left:24px}.rst-content .section ul li p:last-child,.rst-content .section ul li ul,.rst-content .toctree-wrapper ul li p:last-child,.rst-content .toctree-wrapper ul li ul,.rst-content section ul li p:last-child,.rst-content section ul li ul,.wy-plain-list-disc li p:last-child,.wy-plain-list-disc li ul,article ul li p:last-child,article ul li ul{margin-bottom:0}.rst-content .section ul li li,.rst-content .toctree-wrapper ul li li,.rst-content section ul li li,.wy-plain-list-disc li li,article ul li li{list-style:circle}.rst-content .section ul li li li,.rst-content .toctree-wrapper ul li li li,.rst-content section ul li li li,.wy-plain-list-disc li li li,article ul li li li{list-style:square}.rst-content .section ul li ol li,.rst-content .toctree-wrapper ul li ol li,.rst-content section ul li ol li,.wy-plain-list-disc li ol li,article ul li ol li{list-style:decimal}.rst-content .section ol,.rst-content .section ol.arabic,.rst-content .toctree-wrapper ol,.rst-content .toctree-wrapper ol.arabic,.rst-content section ol,.rst-content section ol.arabic,.wy-plain-list-decimal,article ol{list-style:decimal;line-height:24px;margin-bottom:24px}.rst-content .section ol.arabic li,.rst-content .section ol li,.rst-content .toctree-wrapper ol.arabic li,.rst-content .toctree-wrapper ol li,.rst-content section ol.arabic li,.rst-content section ol li,.wy-plain-list-decimal li,article ol li{list-style:decimal;margin-left:24px}.rst-content .section ol.arabic li ul,.rst-content .section ol li p:last-child,.rst-content .section ol li ul,.rst-content .toctree-wrapper ol.arabic li ul,.rst-content .toctree-wrapper ol li p:last-child,.rst-content .toctree-wrapper ol li ul,.rst-content section ol.arabic li ul,.rst-content section ol li p:last-child,.rst-content section ol li ul,.wy-plain-list-decimal li p:last-child,.wy-plain-list-decimal li ul,article ol li p:last-child,article ol li ul{margin-bottom:0}.rst-content .section ol.arabic li ul li,.rst-content .section ol li ul li,.rst-content .toctree-wrapper ol.arabic li ul li,.rst-content .toctree-wrapper ol li ul li,.rst-content section ol.arabic li ul li,.rst-content section ol li ul li,.wy-plain-list-decimal li ul li,article ol li ul li{list-style:disc}.wy-breadcrumbs{*zoom:1}.wy-breadcrumbs:after,.wy-breadcrumbs:before{display:table;content:""}.wy-breadcrumbs:after{clear:both}.wy-breadcrumbs>li{display:inline-block;padding-top:5px}.wy-breadcrumbs>li.wy-breadcrumbs-aside{float:right}.rst-content .wy-breadcrumbs>li code,.rst-content .wy-breadcrumbs>li tt,.wy-breadcrumbs>li .rst-content tt,.wy-breadcrumbs>li code{all:inherit;color:inherit}.breadcrumb-item:before{content:"/";color:#bbb;font-size:13px;padding:0 6px 0 3px}.wy-breadcrumbs-extra{margin-bottom:0;color:#b3b3b3;font-size:80%;display:inline-block}@media screen and (max-width:480px){.wy-breadcrumbs-extra,.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}@media print{.wy-breadcrumbs li.wy-breadcrumbs-aside{display:none}}html{font-size:16px}.wy-affix{position:fixed;top:1.618em}.wy-menu a:hover{text-decoration:none}.wy-menu-horiz{*zoom:1}.wy-menu-horiz:after,.wy-menu-horiz:before{display:table;content:""}.wy-menu-horiz:after{clear:both}.wy-menu-horiz li,.wy-menu-horiz ul{display:inline-block}.wy-menu-horiz li:hover{background:hsla(0,0%,100%,.1)}.wy-menu-horiz li.divide-left{border-left:1px solid #404040}.wy-menu-horiz li.divide-right{border-right:1px solid #404040}.wy-menu-horiz a{height:32px;display:inline-block;line-height:32px;padding:0 16px}.wy-menu-vertical{width:300px}.wy-menu-vertical header,.wy-menu-vertical p.caption{color:#55a5d9;height:32px;line-height:32px;padding:0 1.618em;margin:12px 0 0;display:block;font-weight:700;text-transform:uppercase;font-size:85%;white-space:nowrap}.wy-menu-vertical ul{margin-bottom:0}.wy-menu-vertical li.divide-top{border-top:1px solid #404040}.wy-menu-vertical li.divide-bottom{border-bottom:1px solid #404040}.wy-menu-vertical li.current{background:#e3e3e3}.wy-menu-vertical li.current a{color:grey;border-right:1px solid #c9c9c9;padding:.4045em 2.427em}.wy-menu-vertical li.current a:hover{background:#d6d6d6}.rst-content .wy-menu-vertical li tt,.wy-menu-vertical li .rst-content tt,.wy-menu-vertical li code{border:none;background:inherit;color:inherit;padding-left:0;padding-right:0}.wy-menu-vertical li button.toctree-expand{display:block;float:left;margin-left:-1.2em;line-height:18px;color:#4d4d4d;border:none;background:none;padding:0}.wy-menu-vertical li.current>a,.wy-menu-vertical li.on a{color:#404040;font-weight:700;position:relative;background:#fcfcfc;border:none;padding:.4045em 1.618em}.wy-menu-vertical li.current>a:hover,.wy-menu-vertical li.on a:hover{background:#fcfcfc}.wy-menu-vertical li.current>a:hover button.toctree-expand,.wy-menu-vertical li.on a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.current>a button.toctree-expand,.wy-menu-vertical li.on a button.toctree-expand{display:block;line-height:18px;color:#333}.wy-menu-vertical li.toctree-l1.current>a{border-bottom:1px solid #c9c9c9;border-top:1px solid #c9c9c9}.wy-menu-vertical .toctree-l1.current .toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .toctree-l11>ul{display:none}.wy-menu-vertical .toctree-l1.current .current.toctree-l2>ul,.wy-menu-vertical .toctree-l2.current .current.toctree-l3>ul,.wy-menu-vertical .toctree-l3.current .current.toctree-l4>ul,.wy-menu-vertical .toctree-l4.current .current.toctree-l5>ul,.wy-menu-vertical .toctree-l5.current .current.toctree-l6>ul,.wy-menu-vertical .toctree-l6.current .current.toctree-l7>ul,.wy-menu-vertical .toctree-l7.current .current.toctree-l8>ul,.wy-menu-vertical .toctree-l8.current .current.toctree-l9>ul,.wy-menu-vertical .toctree-l9.current .current.toctree-l10>ul,.wy-menu-vertical .toctree-l10.current .current.toctree-l11>ul{display:block}.wy-menu-vertical li.toctree-l3,.wy-menu-vertical li.toctree-l4{font-size:.9em}.wy-menu-vertical li.toctree-l2 a,.wy-menu-vertical li.toctree-l3 a,.wy-menu-vertical li.toctree-l4 a,.wy-menu-vertical li.toctree-l5 a,.wy-menu-vertical li.toctree-l6 a,.wy-menu-vertical li.toctree-l7 a,.wy-menu-vertical li.toctree-l8 a,.wy-menu-vertical li.toctree-l9 a,.wy-menu-vertical li.toctree-l10 a{color:#404040}.wy-menu-vertical li.toctree-l2 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l3 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l4 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l5 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l6 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l7 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l8 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l9 a:hover button.toctree-expand,.wy-menu-vertical li.toctree-l10 a:hover button.toctree-expand{color:grey}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a,.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a,.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a,.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a,.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a,.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a,.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a,.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{display:block}.wy-menu-vertical li.toctree-l2.current>a{padding:.4045em 2.427em}.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{padding:.4045em 1.618em .4045em 4.045em}.wy-menu-vertical li.toctree-l3.current>a{padding:.4045em 4.045em}.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{padding:.4045em 1.618em .4045em 5.663em}.wy-menu-vertical li.toctree-l4.current>a{padding:.4045em 5.663em}.wy-menu-vertical li.toctree-l4.current li.toctree-l5>a{padding:.4045em 1.618em .4045em 7.281em}.wy-menu-vertical li.toctree-l5.current>a{padding:.4045em 7.281em}.wy-menu-vertical li.toctree-l5.current li.toctree-l6>a{padding:.4045em 1.618em .4045em 8.899em}.wy-menu-vertical li.toctree-l6.current>a{padding:.4045em 8.899em}.wy-menu-vertical li.toctree-l6.current li.toctree-l7>a{padding:.4045em 1.618em .4045em 10.517em}.wy-menu-vertical li.toctree-l7.current>a{padding:.4045em 10.517em}.wy-menu-vertical li.toctree-l7.current li.toctree-l8>a{padding:.4045em 1.618em .4045em 12.135em}.wy-menu-vertical li.toctree-l8.current>a{padding:.4045em 12.135em}.wy-menu-vertical li.toctree-l8.current li.toctree-l9>a{padding:.4045em 1.618em .4045em 13.753em}.wy-menu-vertical li.toctree-l9.current>a{padding:.4045em 13.753em}.wy-menu-vertical li.toctree-l9.current li.toctree-l10>a{padding:.4045em 1.618em .4045em 15.371em}.wy-menu-vertical li.toctree-l10.current>a{padding:.4045em 15.371em}.wy-menu-vertical li.toctree-l10.current li.toctree-l11>a{padding:.4045em 1.618em .4045em 16.989em}.wy-menu-vertical li.toctree-l2.current>a,.wy-menu-vertical li.toctree-l2.current li.toctree-l3>a{background:#c9c9c9}.wy-menu-vertical li.toctree-l2 button.toctree-expand{color:#a3a3a3}.wy-menu-vertical li.toctree-l3.current>a,.wy-menu-vertical li.toctree-l3.current li.toctree-l4>a{background:#bdbdbd}.wy-menu-vertical li.toctree-l3 button.toctree-expand{color:#969696}.wy-menu-vertical li.current ul{display:block}.wy-menu-vertical li ul{margin-bottom:0;display:none}.wy-menu-vertical li ul li a{margin-bottom:0;color:#d9d9d9;font-weight:400}.wy-menu-vertical a{line-height:18px;padding:.4045em 1.618em;display:block;position:relative;font-size:90%;color:#d9d9d9}.wy-menu-vertical a:hover{background-color:#4e4a4a;cursor:pointer}.wy-menu-vertical a:hover button.toctree-expand{color:#d9d9d9}.wy-menu-vertical a:active{background-color:#2980b9;cursor:pointer;color:#fff}.wy-menu-vertical a:active button.toctree-expand{color:#fff}.wy-side-nav-search{display:block;width:300px;padding:.809em;margin-bottom:.809em;z-index:200;background-color:#2980b9;text-align:center;color:#fcfcfc}.wy-side-nav-search input[type=text]{width:100%;border-radius:50px;padding:6px 12px;border-color:#2472a4}.wy-side-nav-search img{display:block;margin:auto auto .809em;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-side-nav-search .wy-dropdown>a,.wy-side-nav-search>a{color:#fcfcfc;font-size:100%;font-weight:700;display:inline-block;padding:4px 6px;margin-bottom:.809em;max-width:100%}.wy-side-nav-search .wy-dropdown>a:hover,.wy-side-nav-search>a:hover{background:hsla(0,0%,100%,.1)}.wy-side-nav-search .wy-dropdown>a img.logo,.wy-side-nav-search>a img.logo{display:block;margin:0 auto;height:auto;width:auto;border-radius:0;max-width:100%;background:transparent}.wy-side-nav-search .wy-dropdown>a.icon img.logo,.wy-side-nav-search>a.icon img.logo{margin-top:.85em}.wy-side-nav-search>div.version{margin-top:-.4045em;margin-bottom:.809em;font-weight:400;color:hsla(0,0%,100%,.3)}.wy-nav .wy-menu-vertical header{color:#2980b9}.wy-nav .wy-menu-vertical a{color:#b3b3b3}.wy-nav .wy-menu-vertical a:hover{background-color:#2980b9;color:#fff}[data-menu-wrap]{-webkit-transition:all .2s ease-in;-moz-transition:all .2s ease-in;transition:all .2s ease-in;position:absolute;opacity:1;width:100%;opacity:0}[data-menu-wrap].move-center{left:0;right:auto;opacity:1}[data-menu-wrap].move-left{right:auto;left:-100%;opacity:0}[data-menu-wrap].move-right{right:-100%;left:auto;opacity:0}.wy-body-for-nav{background:#fcfcfc}.wy-grid-for-nav{position:absolute;width:100%;height:100%}.wy-nav-side{position:fixed;top:0;bottom:0;left:0;padding-bottom:2em;width:300px;overflow-x:hidden;overflow-y:hidden;min-height:100%;color:#9b9b9b;background:#343131;z-index:200}.wy-side-scroll{width:320px;position:relative;overflow-x:hidden;overflow-y:scroll;height:100%}.wy-nav-top{display:none;background:#2980b9;color:#fff;padding:.4045em .809em;position:relative;line-height:50px;text-align:center;font-size:100%;*zoom:1}.wy-nav-top:after,.wy-nav-top:before{display:table;content:""}.wy-nav-top:after{clear:both}.wy-nav-top a{color:#fff;font-weight:700}.wy-nav-top img{margin-right:12px;height:45px;width:45px;background-color:#2980b9;padding:5px;border-radius:100%}.wy-nav-top i{font-size:30px;float:left;cursor:pointer;padding-top:inherit}.wy-nav-content-wrap{margin-left:300px;background:#fcfcfc;min-height:100%}.wy-nav-content{padding:1.618em 3.236em;height:100%;max-width:800px;margin:auto}.wy-body-mask{position:fixed;width:100%;height:100%;background:rgba(0,0,0,.2);display:none;z-index:499}.wy-body-mask.on{display:block}footer{color:grey}footer p{margin-bottom:12px}.rst-content footer span.commit tt,footer span.commit .rst-content tt,footer span.commit code{padding:0;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:1em;background:none;border:none;color:grey}.rst-footer-buttons{*zoom:1}.rst-footer-buttons:after,.rst-footer-buttons:before{width:100%;display:table;content:""}.rst-footer-buttons:after{clear:both}.rst-breadcrumbs-buttons{margin-top:12px;*zoom:1}.rst-breadcrumbs-buttons:after,.rst-breadcrumbs-buttons:before{display:table;content:""}.rst-breadcrumbs-buttons:after{clear:both}#search-results .search li{margin-bottom:24px;border-bottom:1px solid #e1e4e5;padding-bottom:24px}#search-results .search li:first-child{border-top:1px solid #e1e4e5;padding-top:24px}#search-results .search li a{font-size:120%;margin-bottom:12px;display:inline-block}#search-results .context{color:grey;font-size:90%}.genindextable li>ul{margin-left:24px}@media screen and (max-width:768px){.wy-body-for-nav{background:#fcfcfc}.wy-nav-top{display:block}.wy-nav-side{left:-300px}.wy-nav-side.shift{width:85%;left:0}.wy-menu.wy-menu-vertical,.wy-side-nav-search,.wy-side-scroll{width:auto}.wy-nav-content-wrap{margin-left:0}.wy-nav-content-wrap .wy-nav-content{padding:1.618em}.wy-nav-content-wrap.shift{position:fixed;min-width:100%;left:85%;top:0;height:100%;overflow:hidden}}@media screen and (min-width:1100px){.wy-nav-content-wrap{background:rgba(0,0,0,.05)}.wy-nav-content{margin:0;background:#fcfcfc}}@media print{.rst-versions,.wy-nav-side,footer{display:none}.wy-nav-content-wrap{margin-left:0}}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60;*zoom:1}.rst-versions .rst-current-version:after,.rst-versions .rst-current-version:before{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-content .code-block-caption .rst-versions .rst-current-version .headerlink,.rst-content .eqno .rst-versions .rst-current-version .headerlink,.rst-content .rst-versions .rst-current-version .admonition-title,.rst-content code.download .rst-versions .rst-current-version span:first-child,.rst-content dl dt .rst-versions .rst-current-version .headerlink,.rst-content h1 .rst-versions .rst-current-version .headerlink,.rst-content h2 .rst-versions .rst-current-version .headerlink,.rst-content h3 .rst-versions .rst-current-version .headerlink,.rst-content h4 .rst-versions .rst-current-version .headerlink,.rst-content h5 .rst-versions .rst-current-version .headerlink,.rst-content h6 .rst-versions .rst-current-version .headerlink,.rst-content p .rst-versions .rst-current-version .headerlink,.rst-content table>caption .rst-versions .rst-current-version .headerlink,.rst-content tt.download .rst-versions .rst-current-version span:first-child,.rst-versions .rst-current-version .fa,.rst-versions .rst-current-version .icon,.rst-versions .rst-current-version .rst-content .admonition-title,.rst-versions .rst-current-version .rst-content .code-block-caption .headerlink,.rst-versions .rst-current-version .rst-content .eqno .headerlink,.rst-versions .rst-current-version .rst-content code.download span:first-child,.rst-versions .rst-current-version .rst-content dl dt .headerlink,.rst-versions .rst-current-version .rst-content h1 .headerlink,.rst-versions .rst-current-version .rst-content h2 .headerlink,.rst-versions .rst-current-version .rst-content h3 .headerlink,.rst-versions .rst-current-version .rst-content h4 .headerlink,.rst-versions .rst-current-version .rst-content h5 .headerlink,.rst-versions .rst-current-version .rst-content h6 .headerlink,.rst-versions .rst-current-version .rst-content p .headerlink,.rst-versions .rst-current-version .rst-content table>caption .headerlink,.rst-versions .rst-current-version .rst-content tt.download span:first-child,.rst-versions .rst-current-version .wy-menu-vertical li button.toctree-expand,.wy-menu-vertical li .rst-versions .rst-current-version button.toctree-expand{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}.rst-content .toctree-wrapper>p.caption,.rst-content h1,.rst-content h2,.rst-content h3,.rst-content h4,.rst-content h5,.rst-content h6{margin-bottom:24px}.rst-content img{max-width:100%;height:auto}.rst-content div.figure,.rst-content figure{margin-bottom:24px}.rst-content div.figure .caption-text,.rst-content figure .caption-text{font-style:italic}.rst-content div.figure p:last-child.caption,.rst-content figure p:last-child.caption{margin-bottom:0}.rst-content div.figure.align-center,.rst-content figure.align-center{text-align:center}.rst-content .section>a>img,.rst-content .section>img,.rst-content section>a>img,.rst-content section>img{margin-bottom:24px}.rst-content abbr[title]{text-decoration:none}.rst-content.style-external-links a.reference.external:after{font-family:FontAwesome;content:"\f08e";color:#b3b3b3;vertical-align:super;font-size:60%;margin:0 .2em}.rst-content blockquote{margin-left:24px;line-height:24px;margin-bottom:24px}.rst-content pre.literal-block{white-space:pre;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;display:block;overflow:auto}.rst-content div[class^=highlight],.rst-content pre.literal-block{border:1px solid #e1e4e5;overflow-x:auto;margin:1px 0 24px}.rst-content div[class^=highlight] div[class^=highlight],.rst-content pre.literal-block div[class^=highlight]{padding:0;border:none;margin:0}.rst-content div[class^=highlight] td.code{width:100%}.rst-content .linenodiv pre{border-right:1px solid #e6e9ea;margin:0;padding:12px;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;user-select:none;pointer-events:none}.rst-content div[class^=highlight] pre{white-space:pre;margin:0;padding:12px;display:block;overflow:auto}.rst-content div[class^=highlight] pre .hll{display:block;margin:0 -12px;padding:0 12px}.rst-content .linenodiv pre,.rst-content div[class^=highlight] pre,.rst-content pre.literal-block{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;font-size:12px;line-height:1.4}.rst-content div.highlight .gp,.rst-content div.highlight span.linenos{user-select:none;pointer-events:none}.rst-content div.highlight span.linenos{display:inline-block;padding-left:0;padding-right:12px;margin-right:12px;border-right:1px solid #e6e9ea}.rst-content .code-block-caption{font-style:italic;font-size:85%;line-height:1;padding:1em 0;text-align:center}@media print{.rst-content .codeblock,.rst-content div[class^=highlight],.rst-content div[class^=highlight] pre{white-space:pre-wrap}}.rst-content .admonition,.rst-content .admonition-todo,.rst-content .attention,.rst-content .caution,.rst-content .danger,.rst-content .error,.rst-content .hint,.rst-content .important,.rst-content .note,.rst-content .seealso,.rst-content .tip,.rst-content .warning{clear:both}.rst-content .admonition-todo .last,.rst-content .admonition-todo>:last-child,.rst-content .admonition .last,.rst-content .admonition>:last-child,.rst-content .attention .last,.rst-content .attention>:last-child,.rst-content .caution .last,.rst-content .caution>:last-child,.rst-content .danger .last,.rst-content .danger>:last-child,.rst-content .error .last,.rst-content .error>:last-child,.rst-content .hint .last,.rst-content .hint>:last-child,.rst-content .important .last,.rst-content .important>:last-child,.rst-content .note .last,.rst-content .note>:last-child,.rst-content .seealso .last,.rst-content .seealso>:last-child,.rst-content .tip .last,.rst-content .tip>:last-child,.rst-content .warning .last,.rst-content .warning>:last-child{margin-bottom:0}.rst-content .admonition-title:before{margin-right:4px}.rst-content .admonition table{border-color:rgba(0,0,0,.1)}.rst-content .admonition table td,.rst-content .admonition table th{background:transparent!important;border-color:rgba(0,0,0,.1)!important}.rst-content .section ol.loweralpha,.rst-content .section ol.loweralpha>li,.rst-content .toctree-wrapper ol.loweralpha,.rst-content .toctree-wrapper ol.loweralpha>li,.rst-content section ol.loweralpha,.rst-content section ol.loweralpha>li{list-style:lower-alpha}.rst-content .section ol.upperalpha,.rst-content .section ol.upperalpha>li,.rst-content .toctree-wrapper ol.upperalpha,.rst-content .toctree-wrapper ol.upperalpha>li,.rst-content section ol.upperalpha,.rst-content section ol.upperalpha>li{list-style:upper-alpha}.rst-content .section ol li>*,.rst-content .section ul li>*,.rst-content .toctree-wrapper ol li>*,.rst-content .toctree-wrapper ul li>*,.rst-content section ol li>*,.rst-content section ul li>*{margin-top:12px;margin-bottom:12px}.rst-content .section ol li>:first-child,.rst-content .section ul li>:first-child,.rst-content .toctree-wrapper ol li>:first-child,.rst-content .toctree-wrapper ul li>:first-child,.rst-content section ol li>:first-child,.rst-content section ul li>:first-child{margin-top:0}.rst-content .section ol li>p,.rst-content .section ol li>p:last-child,.rst-content .section ul li>p,.rst-content .section ul li>p:last-child,.rst-content .toctree-wrapper ol li>p,.rst-content .toctree-wrapper ol li>p:last-child,.rst-content .toctree-wrapper ul li>p,.rst-content .toctree-wrapper ul li>p:last-child,.rst-content section ol li>p,.rst-content section ol li>p:last-child,.rst-content section ul li>p,.rst-content section ul li>p:last-child{margin-bottom:12px}.rst-content .section ol li>p:only-child,.rst-content .section ol li>p:only-child:last-child,.rst-content .section ul li>p:only-child,.rst-content .section ul li>p:only-child:last-child,.rst-content .toctree-wrapper ol li>p:only-child,.rst-content .toctree-wrapper ol li>p:only-child:last-child,.rst-content .toctree-wrapper ul li>p:only-child,.rst-content .toctree-wrapper ul li>p:only-child:last-child,.rst-content section ol li>p:only-child,.rst-content section ol li>p:only-child:last-child,.rst-content section ul li>p:only-child,.rst-content section ul li>p:only-child:last-child{margin-bottom:0}.rst-content .section ol li>ol,.rst-content .section ol li>ul,.rst-content .section ul li>ol,.rst-content .section ul li>ul,.rst-content .toctree-wrapper ol li>ol,.rst-content .toctree-wrapper ol li>ul,.rst-content .toctree-wrapper ul li>ol,.rst-content .toctree-wrapper ul li>ul,.rst-content section ol li>ol,.rst-content section ol li>ul,.rst-content section ul li>ol,.rst-content section ul li>ul{margin-bottom:12px}.rst-content .section ol.simple li>*,.rst-content .section ol.simple li ol,.rst-content .section ol.simple li ul,.rst-content .section ul.simple li>*,.rst-content .section ul.simple li ol,.rst-content .section ul.simple li ul,.rst-content .toctree-wrapper ol.simple li>*,.rst-content .toctree-wrapper ol.simple li ol,.rst-content .toctree-wrapper ol.simple li ul,.rst-content .toctree-wrapper ul.simple li>*,.rst-content .toctree-wrapper ul.simple li ol,.rst-content .toctree-wrapper ul.simple li ul,.rst-content section ol.simple li>*,.rst-content section ol.simple li ol,.rst-content section ol.simple li ul,.rst-content section ul.simple li>*,.rst-content section ul.simple li ol,.rst-content section ul.simple li ul{margin-top:0;margin-bottom:0}.rst-content .line-block{margin-left:0;margin-bottom:24px;line-height:24px}.rst-content .line-block .line-block{margin-left:24px;margin-bottom:0}.rst-content .topic-title{font-weight:700;margin-bottom:12px}.rst-content .toc-backref{color:#404040}.rst-content .align-right{float:right;margin:0 0 24px 24px}.rst-content .align-left{float:left;margin:0 24px 24px 0}.rst-content .align-center{margin:auto}.rst-content .align-center:not(table){display:block}.rst-content .code-block-caption .headerlink,.rst-content .eqno .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink,.rst-content dl dt .headerlink,.rst-content h1 .headerlink,.rst-content h2 .headerlink,.rst-content h3 .headerlink,.rst-content h4 .headerlink,.rst-content h5 .headerlink,.rst-content h6 .headerlink,.rst-content p.caption .headerlink,.rst-content p .headerlink,.rst-content table>caption .headerlink{opacity:0;font-size:14px;font-family:FontAwesome;margin-left:.5em}.rst-content .code-block-caption .headerlink:focus,.rst-content .code-block-caption:hover .headerlink,.rst-content .eqno .headerlink:focus,.rst-content .eqno:hover .headerlink,.rst-content .toctree-wrapper>p.caption .headerlink:focus,.rst-content .toctree-wrapper>p.caption:hover .headerlink,.rst-content dl dt .headerlink:focus,.rst-content dl dt:hover .headerlink,.rst-content h1 .headerlink:focus,.rst-content h1:hover .headerlink,.rst-content h2 .headerlink:focus,.rst-content h2:hover .headerlink,.rst-content h3 .headerlink:focus,.rst-content h3:hover .headerlink,.rst-content h4 .headerlink:focus,.rst-content h4:hover .headerlink,.rst-content h5 .headerlink:focus,.rst-content h5:hover .headerlink,.rst-content h6 .headerlink:focus,.rst-content h6:hover .headerlink,.rst-content p.caption .headerlink:focus,.rst-content p.caption:hover .headerlink,.rst-content p .headerlink:focus,.rst-content p:hover .headerlink,.rst-content table>caption .headerlink:focus,.rst-content table>caption:hover .headerlink{opacity:1}.rst-content p a{overflow-wrap:anywhere}.rst-content .wy-table td p,.rst-content .wy-table td ul,.rst-content .wy-table th p,.rst-content .wy-table th ul,.rst-content table.docutils td p,.rst-content table.docutils td ul,.rst-content table.docutils th p,.rst-content table.docutils th ul,.rst-content table.field-list td p,.rst-content table.field-list td ul,.rst-content table.field-list th p,.rst-content table.field-list th ul{font-size:inherit}.rst-content .btn:focus{outline:2px solid}.rst-content table>caption .headerlink:after{font-size:12px}.rst-content .centered{text-align:center}.rst-content .sidebar{float:right;width:40%;display:block;margin:0 0 24px 24px;padding:24px;background:#f3f6f6;border:1px solid #e1e4e5}.rst-content .sidebar dl,.rst-content .sidebar p,.rst-content .sidebar ul{font-size:90%}.rst-content .sidebar .last,.rst-content .sidebar>:last-child{margin-bottom:0}.rst-content .sidebar .sidebar-title{display:block;font-family:Roboto Slab,ff-tisa-web-pro,Georgia,Arial,sans-serif;font-weight:700;background:#e1e4e5;padding:6px 12px;margin:-24px -24px 24px;font-size:100%}.rst-content .highlighted{background:#f1c40f;box-shadow:0 0 0 2px #f1c40f;display:inline;font-weight:700}.rst-content .citation-reference,.rst-content .footnote-reference{vertical-align:baseline;position:relative;top:-.4em;line-height:0;font-size:90%}.rst-content .citation-reference>span.fn-bracket,.rst-content .footnote-reference>span.fn-bracket{display:none}.rst-content .hlist{width:100%}.rst-content dl dt span.classifier:before{content:" : "}.rst-content dl dt span.classifier-delimiter{display:none!important}html.writer-html4 .rst-content table.docutils.citation,html.writer-html4 .rst-content table.docutils.footnote{background:none;border:none}html.writer-html4 .rst-content table.docutils.citation td,html.writer-html4 .rst-content table.docutils.citation tr,html.writer-html4 .rst-content table.docutils.footnote td,html.writer-html4 .rst-content table.docutils.footnote tr{border:none;background-color:transparent!important;white-space:normal}html.writer-html4 .rst-content table.docutils.citation td.label,html.writer-html4 .rst-content table.docutils.footnote td.label{padding-left:0;padding-right:0;vertical-align:top}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{display:grid;grid-template-columns:auto minmax(80%,95%)}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{display:inline-grid;grid-template-columns:max-content auto}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{display:grid;grid-template-columns:auto auto minmax(.65rem,auto) minmax(40%,95%)}html.writer-html5 .rst-content aside.citation>span.label,html.writer-html5 .rst-content aside.footnote>span.label,html.writer-html5 .rst-content div.citation>span.label{grid-column-start:1;grid-column-end:2}html.writer-html5 .rst-content aside.citation>span.backrefs,html.writer-html5 .rst-content aside.footnote>span.backrefs,html.writer-html5 .rst-content div.citation>span.backrefs{grid-column-start:2;grid-column-end:3;grid-row-start:1;grid-row-end:3}html.writer-html5 .rst-content aside.citation>p,html.writer-html5 .rst-content aside.footnote>p,html.writer-html5 .rst-content div.citation>p{grid-column-start:4;grid-column-end:5}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.field-list,html.writer-html5 .rst-content dl.footnote{margin-bottom:24px}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dt{padding-left:1rem}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.field-list>dd,html.writer-html5 .rst-content dl.field-list>dt,html.writer-html5 .rst-content dl.footnote>dd,html.writer-html5 .rst-content dl.footnote>dt{margin-bottom:0}html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{font-size:.9rem}html.writer-html5 .rst-content dl.citation>dt,html.writer-html5 .rst-content dl.footnote>dt{margin:0 .5rem .5rem 0;line-height:1.2rem;word-break:break-all;font-weight:400}html.writer-html5 .rst-content dl.citation>dt>span.brackets:before,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:before{content:"["}html.writer-html5 .rst-content dl.citation>dt>span.brackets:after,html.writer-html5 .rst-content dl.footnote>dt>span.brackets:after{content:"]"}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a{word-break:keep-all}html.writer-html5 .rst-content dl.citation>dt>span.fn-backref>a:not(:first-child):before,html.writer-html5 .rst-content dl.footnote>dt>span.fn-backref>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content dl.citation>dd,html.writer-html5 .rst-content dl.footnote>dd{margin:0 0 .5rem;line-height:1.2rem}html.writer-html5 .rst-content dl.citation>dd p,html.writer-html5 .rst-content dl.footnote>dd p{font-size:.9rem}html.writer-html5 .rst-content aside.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content div.citation{padding-left:1rem;padding-right:1rem;font-size:.9rem;line-height:1.2rem}html.writer-html5 .rst-content aside.citation p,html.writer-html5 .rst-content aside.footnote p,html.writer-html5 .rst-content div.citation p{font-size:.9rem;line-height:1.2rem;margin-bottom:12px}html.writer-html5 .rst-content aside.citation span.backrefs,html.writer-html5 .rst-content aside.footnote span.backrefs,html.writer-html5 .rst-content div.citation span.backrefs{text-align:left;font-style:italic;margin-left:.65rem;word-break:break-word;word-spacing:-.1rem;max-width:5rem}html.writer-html5 .rst-content aside.citation span.backrefs>a,html.writer-html5 .rst-content aside.footnote span.backrefs>a,html.writer-html5 .rst-content div.citation span.backrefs>a{word-break:keep-all}html.writer-html5 .rst-content aside.citation span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content aside.footnote span.backrefs>a:not(:first-child):before,html.writer-html5 .rst-content div.citation span.backrefs>a:not(:first-child):before{content:" "}html.writer-html5 .rst-content aside.citation span.label,html.writer-html5 .rst-content aside.footnote span.label,html.writer-html5 .rst-content div.citation span.label{line-height:1.2rem}html.writer-html5 .rst-content aside.citation-list,html.writer-html5 .rst-content aside.footnote-list,html.writer-html5 .rst-content div.citation-list{margin-bottom:24px}html.writer-html5 .rst-content dl.option-list kbd{font-size:.9rem}.rst-content table.docutils.footnote,html.writer-html4 .rst-content table.docutils.citation,html.writer-html5 .rst-content aside.footnote,html.writer-html5 .rst-content aside.footnote-list aside.footnote,html.writer-html5 .rst-content div.citation-list>div.citation,html.writer-html5 .rst-content dl.citation,html.writer-html5 .rst-content dl.footnote{color:grey}.rst-content table.docutils.footnote code,.rst-content table.docutils.footnote tt,html.writer-html4 .rst-content table.docutils.citation code,html.writer-html4 .rst-content table.docutils.citation tt,html.writer-html5 .rst-content aside.footnote-list aside.footnote code,html.writer-html5 .rst-content aside.footnote-list aside.footnote tt,html.writer-html5 .rst-content aside.footnote code,html.writer-html5 .rst-content aside.footnote tt,html.writer-html5 .rst-content div.citation-list>div.citation code,html.writer-html5 .rst-content div.citation-list>div.citation tt,html.writer-html5 .rst-content dl.citation code,html.writer-html5 .rst-content dl.citation tt,html.writer-html5 .rst-content dl.footnote code,html.writer-html5 .rst-content dl.footnote tt{color:#555}.rst-content .wy-table-responsive.citation,.rst-content .wy-table-responsive.footnote{margin-bottom:0}.rst-content .wy-table-responsive.citation+:not(.citation),.rst-content .wy-table-responsive.footnote+:not(.footnote){margin-top:24px}.rst-content .wy-table-responsive.citation:last-child,.rst-content .wy-table-responsive.footnote:last-child{margin-bottom:24px}.rst-content table.docutils th{border-color:#e1e4e5}html.writer-html5 .rst-content table.docutils th{border:1px solid #e1e4e5}html.writer-html5 .rst-content table.docutils td>p,html.writer-html5 .rst-content table.docutils th>p{line-height:1rem;margin-bottom:0;font-size:.9rem}.rst-content table.docutils td .last,.rst-content table.docutils td .last>:last-child{margin-bottom:0}.rst-content table.field-list,.rst-content table.field-list td{border:none}.rst-content table.field-list td p{line-height:inherit}.rst-content table.field-list td>strong{display:inline-block}.rst-content table.field-list .field-name{padding-right:10px;text-align:left;white-space:nowrap}.rst-content table.field-list .field-body{text-align:left}.rst-content code,.rst-content tt{color:#000;font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;padding:2px 5px}.rst-content code big,.rst-content code em,.rst-content tt big,.rst-content tt em{font-size:100%!important;line-height:normal}.rst-content code.literal,.rst-content tt.literal{color:#e74c3c;white-space:normal}.rst-content code.xref,.rst-content tt.xref,a .rst-content code,a .rst-content tt{font-weight:700;color:#404040;overflow-wrap:normal}.rst-content kbd,.rst-content pre,.rst-content samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace}.rst-content a code,.rst-content a tt{color:#2980b9}.rst-content dl{margin-bottom:24px}.rst-content dl dt{font-weight:700;margin-bottom:12px}.rst-content dl ol,.rst-content dl p,.rst-content dl table,.rst-content dl ul{margin-bottom:12px}.rst-content dl dd{margin:0 0 12px 24px;line-height:24px}.rst-content dl dd>ol:last-child,.rst-content dl dd>p:last-child,.rst-content dl dd>table:last-child,.rst-content dl dd>ul:last-child{margin-bottom:0}html.writer-html4 .rst-content dl:not(.docutils),html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple){margin-bottom:24px}html.writer-html4 .rst-content dl:not(.docutils)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{display:table;margin:6px 0;font-size:90%;line-height:normal;background:#e7f2fa;color:#2980b9;border-top:3px solid #6ab0de;padding:6px;position:relative}html.writer-html4 .rst-content dl:not(.docutils)>dt:before,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:before{color:#6ab0de}html.writer-html4 .rst-content dl:not(.docutils)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt{margin-bottom:6px;border:none;border-left:3px solid #ccc;background:#f0f0f0;color:#555}html.writer-html4 .rst-content dl:not(.docutils) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) dl:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt .headerlink{color:#404040;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils)>dt:first-child,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple)>dt:first-child{margin-top:0}html.writer-html4 .rst-content dl:not(.docutils) code.descclassname,html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descclassname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{background-color:transparent;border:none;padding:0;font-size:100%!important}html.writer-html4 .rst-content dl:not(.docutils) code.descname,html.writer-html4 .rst-content dl:not(.docutils) tt.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) code.descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) tt.descname{font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .optional,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .optional{display:inline-block;padding:0 4px;color:#000;font-weight:700}html.writer-html4 .rst-content dl:not(.docutils) .property,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .property{display:inline-block;padding-right:8px;max-width:100%}html.writer-html4 .rst-content dl:not(.docutils) .k,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .k{font-style:italic}html.writer-html4 .rst-content dl:not(.docutils) .descclassname,html.writer-html4 .rst-content dl:not(.docutils) .descname,html.writer-html4 .rst-content dl:not(.docutils) .sig-name,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descclassname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .descname,html.writer-html5 .rst-content dl[class]:not(.option-list):not(.field-list):not(.footnote):not(.citation):not(.glossary):not(.simple) .sig-name{font-family:SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,Courier,monospace;color:#000}.rst-content .viewcode-back,.rst-content .viewcode-link{display:inline-block;color:#27ae60;font-size:80%;padding-left:24px}.rst-content .viewcode-back{display:block;float:right}.rst-content p.rubric{margin-bottom:12px;font-weight:700}.rst-content code.download,.rst-content tt.download{background:inherit;padding:inherit;font-weight:400;font-family:inherit;font-size:inherit;color:inherit;border:inherit;white-space:inherit}.rst-content code.download span:first-child,.rst-content tt.download span:first-child{-webkit-font-smoothing:subpixel-antialiased}.rst-content code.download span:first-child:before,.rst-content tt.download span:first-child:before{margin-right:4px}.rst-content .guilabel,.rst-content .menuselection{font-size:80%;font-weight:700;border-radius:4px;padding:2.4px 6px;margin:auto 2px}.rst-content .guilabel,.rst-content .menuselection{border:1px solid #7fbbe3;background:#e7f2fa}.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>.kbd,.rst-content :not(dl.option-list)>:not(dt):not(kbd):not(.kbd)>kbd{color:inherit;font-size:80%;background-color:#fff;border:1px solid #a6a6a6;border-radius:4px;box-shadow:0 2px grey;padding:2.4px 6px;margin:auto 0}.rst-content .versionmodified{font-style:italic}@media screen and (max-width:480px){.rst-content .sidebar{width:100%}}span[id*=MathJax-Span]{color:#404040}.math{text-align:center}@font-face{font-family:Lato;src:url(fonts/lato-normal.woff2?bd03a2cc277bbbc338d464e679fe9942) format("woff2"),url(fonts/lato-normal.woff?27bd77b9162d388cb8d4c4217c7c5e2a) format("woff");font-weight:400;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold.woff2?cccb897485813c7c256901dbca54ecf2) format("woff2"),url(fonts/lato-bold.woff?d878b6c29b10beca227e9eef4246111b) format("woff");font-weight:700;font-style:normal;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-bold-italic.woff2?0b6bb6725576b072c5d0b02ecdd1900d) format("woff2"),url(fonts/lato-bold-italic.woff?9c7e4e9eb485b4a121c760e61bc3707c) format("woff");font-weight:700;font-style:italic;font-display:block}@font-face{font-family:Lato;src:url(fonts/lato-normal-italic.woff2?4eb103b4d12be57cb1d040ed5e162e9d) format("woff2"),url(fonts/lato-normal-italic.woff?f28f2d6482446544ef1ea1ccc6dd5892) format("woff");font-weight:400;font-style:italic;font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:400;src:url(fonts/Roboto-Slab-Regular.woff2?7abf5b8d04d26a2cafea937019bca958) format("woff2"),url(fonts/Roboto-Slab-Regular.woff?c1be9284088d487c5e3ff0a10a92e58c) format("woff");font-display:block}@font-face{font-family:Roboto Slab;font-style:normal;font-weight:700;src:url(fonts/Roboto-Slab-Bold.woff2?9984f4a9bda09be08e83f2506954adbe) format("woff2"),url(fonts/Roboto-Slab-Bold.woff?bed5564a116b05148e3b3bea6fb1162a) format("woff");font-display:block} \ No newline at end of file diff --git a/_static/doctools.js b/_static/doctools.js new file mode 100644 index 0000000..527b876 --- /dev/null +++ b/_static/doctools.js @@ -0,0 +1,156 @@ +/* + * doctools.js + * ~~~~~~~~~~~ + * + * Base JavaScript utilities for all Sphinx HTML documentation. + * + * :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS. + * :license: BSD, see LICENSE for details. + * + */ +"use strict"; + +const BLACKLISTED_KEY_CONTROL_ELEMENTS = new Set([ + "TEXTAREA", + "INPUT", + "SELECT", + "BUTTON", +]); + +const _ready = (callback) => { + if (document.readyState !== "loading") { + callback(); + } else { + document.addEventListener("DOMContentLoaded", callback); + } +}; + +/** + * Small JavaScript module for the documentation. + */ +const Documentation = { + init: () => { + Documentation.initDomainIndexTable(); + Documentation.initOnKeyListeners(); + }, + + /** + * i18n support + */ + TRANSLATIONS: {}, + PLURAL_EXPR: (n) => (n === 1 ? 0 : 1), + LOCALE: "unknown", + + // gettext and ngettext don't access this so that the functions + // can safely bound to a different name (_ = Documentation.gettext) + gettext: (string) => { + const translated = Documentation.TRANSLATIONS[string]; + switch (typeof translated) { + case "undefined": + return string; // no translation + case "string": + return translated; // translation exists + default: + return translated[0]; // (singular, plural) translation tuple exists + } + }, + + ngettext: (singular, plural, n) => { + const translated = Documentation.TRANSLATIONS[singular]; + if (typeof translated !== "undefined") + return translated[Documentation.PLURAL_EXPR(n)]; + return n === 1 ? singular : plural; + }, + + addTranslations: (catalog) => { + Object.assign(Documentation.TRANSLATIONS, catalog.messages); + Documentation.PLURAL_EXPR = new Function( + "n", + `return (${catalog.plural_expr})` + ); + Documentation.LOCALE = catalog.locale; + }, + + /** + * helper function to focus on search bar + */ + focusSearchBar: () => { + document.querySelectorAll("input[name=q]")[0]?.focus(); + }, + + /** + * Initialise the domain index toggle buttons + */ + initDomainIndexTable: () => { + const toggler = (el) => { + const idNumber = el.id.substr(7); + const toggledRows = document.querySelectorAll(`tr.cg-${idNumber}`); + if (el.src.substr(-9) === "minus.png") { + el.src = `${el.src.substr(0, el.src.length - 9)}plus.png`; + toggledRows.forEach((el) => (el.style.display = "none")); + } else { + el.src = `${el.src.substr(0, el.src.length - 8)}minus.png`; + toggledRows.forEach((el) => (el.style.display = "")); + } + }; + + const togglerElements = document.querySelectorAll("img.toggler"); + togglerElements.forEach((el) => + el.addEventListener("click", (event) => toggler(event.currentTarget)) + ); + togglerElements.forEach((el) => (el.style.display = "")); + if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) togglerElements.forEach(toggler); + }, + + initOnKeyListeners: () => { + // only install a listener if it is really needed + if ( + !DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS && + !DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS + ) + return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.altKey || event.ctrlKey || event.metaKey) return; + + if (!event.shiftKey) { + switch (event.key) { + case "ArrowLeft": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const prevLink = document.querySelector('link[rel="prev"]'); + if (prevLink && prevLink.href) { + window.location.href = prevLink.href; + event.preventDefault(); + } + break; + case "ArrowRight": + if (!DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) break; + + const nextLink = document.querySelector('link[rel="next"]'); + if (nextLink && nextLink.href) { + window.location.href = nextLink.href; + event.preventDefault(); + } + break; + } + } + + // some keyboard layouts may need Shift to get / + switch (event.key) { + case "/": + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) break; + Documentation.focusSearchBar(); + event.preventDefault(); + } + }); + }, +}; + +// quick alias for translations +const _ = Documentation.gettext; + +_ready(Documentation.init); diff --git a/_static/documentation_options.js b/_static/documentation_options.js new file mode 100644 index 0000000..e49ed18 --- /dev/null +++ b/_static/documentation_options.js @@ -0,0 +1,14 @@ +var DOCUMENTATION_OPTIONS = { + URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), + VERSION: '0.1.0', + LANGUAGE: 'en', + COLLAPSE_INDEX: false, + BUILDER: 'html', + FILE_SUFFIX: '.html', + LINK_SUFFIX: '.html', + HAS_SOURCE: true, + SOURCELINK_SUFFIX: '.txt', + NAVIGATION_WITH_KEYS: false, + SHOW_SEARCH_SUMMARY: true, + ENABLE_SEARCH_SHORTCUTS: true, +}; \ No newline at end of file diff --git a/_static/file.png b/_static/file.png new file mode 100644 index 0000000..a858a41 Binary files /dev/null and b/_static/file.png differ diff --git a/_static/jquery-3.6.0.js b/_static/jquery-3.6.0.js new file mode 100644 index 0000000..fc6c299 --- /dev/null +++ b/_static/jquery-3.6.0.js @@ -0,0 +1,10881 @@ +/*! + * jQuery JavaScript Library v3.6.0 + * https://jquery.com/ + * + * Includes Sizzle.js + * https://sizzlejs.com/ + * + * Copyright OpenJS Foundation and other contributors + * Released under the MIT license + * https://jquery.org/license + * + * Date: 2021-03-02T17:08Z + */ +( function( global, factory ) { + + "use strict"; + + if ( typeof module === "object" && typeof module.exports === "object" ) { + + // For CommonJS and CommonJS-like environments where a proper `window` + // is present, execute the factory and get jQuery. + // For environments that do not have a `window` with a `document` + // (such as Node.js), expose a factory as module.exports. + // This accentuates the need for the creation of a real `window`. + // e.g. var jQuery = require("jquery")(window); + // See ticket #14549 for more info. + module.exports = global.document ? + factory( global, true ) : + function( w ) { + if ( !w.document ) { + throw new Error( "jQuery requires a window with a document" ); + } + return factory( w ); + }; + } else { + factory( global ); + } + +// Pass this if window is not defined yet +} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { + +// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 +// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode +// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common +// enough that all such attempts are guarded in a try block. +"use strict"; + +var arr = []; + +var getProto = Object.getPrototypeOf; + +var slice = arr.slice; + +var flat = arr.flat ? function( array ) { + return arr.flat.call( array ); +} : function( array ) { + return arr.concat.apply( [], array ); +}; + + +var push = arr.push; + +var indexOf = arr.indexOf; + +var class2type = {}; + +var toString = class2type.toString; + +var hasOwn = class2type.hasOwnProperty; + +var fnToString = hasOwn.toString; + +var ObjectFunctionString = fnToString.call( Object ); + +var support = {}; + +var isFunction = function isFunction( obj ) { + + // Support: Chrome <=57, Firefox <=52 + // In some browsers, typeof returns "function" for HTML elements + // (i.e., `typeof document.createElement( "object" ) === "function"`). + // We don't want to classify *any* DOM node as a function. + // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 + // Plus for old WebKit, typeof returns "function" for HTML collections + // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) + return typeof obj === "function" && typeof obj.nodeType !== "number" && + typeof obj.item !== "function"; + }; + + +var isWindow = function isWindow( obj ) { + return obj != null && obj === obj.window; + }; + + +var document = window.document; + + + + var preservedScriptAttributes = { + type: true, + src: true, + nonce: true, + noModule: true + }; + + function DOMEval( code, node, doc ) { + doc = doc || document; + + var i, val, + script = doc.createElement( "script" ); + + script.text = code; + if ( node ) { + for ( i in preservedScriptAttributes ) { + + // Support: Firefox 64+, Edge 18+ + // Some browsers don't support the "nonce" property on scripts. + // On the other hand, just using `getAttribute` is not enough as + // the `nonce` attribute is reset to an empty string whenever it + // becomes browsing-context connected. + // See https://github.com/whatwg/html/issues/2369 + // See https://html.spec.whatwg.org/#nonce-attributes + // The `node.getAttribute` check was added for the sake of + // `jQuery.globalEval` so that it can fake a nonce-containing node + // via an object. + val = node[ i ] || node.getAttribute && node.getAttribute( i ); + if ( val ) { + script.setAttribute( i, val ); + } + } + } + doc.head.appendChild( script ).parentNode.removeChild( script ); + } + + +function toType( obj ) { + if ( obj == null ) { + return obj + ""; + } + + // Support: Android <=2.3 only (functionish RegExp) + return typeof obj === "object" || typeof obj === "function" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; +} +/* global Symbol */ +// Defining this global in .eslintrc.json would create a danger of using the global +// unguarded in another place, it seems safer to define global only for this module + + + +var + version = "3.6.0", + + // Define a local copy of jQuery + jQuery = function( selector, context ) { + + // The jQuery object is actually just the init constructor 'enhanced' + // Need init if jQuery is called (just allow error to be thrown if not included) + return new jQuery.fn.init( selector, context ); + }; + +jQuery.fn = jQuery.prototype = { + + // The current version of jQuery being used + jquery: version, + + constructor: jQuery, + + // The default length of a jQuery object is 0 + length: 0, + + toArray: function() { + return slice.call( this ); + }, + + // Get the Nth element in the matched element set OR + // Get the whole matched element set as a clean array + get: function( num ) { + + // Return all the elements in a clean array + if ( num == null ) { + return slice.call( this ); + } + + // Return just the one element from the set + return num < 0 ? this[ num + this.length ] : this[ num ]; + }, + + // Take an array of elements and push it onto the stack + // (returning the new matched element set) + pushStack: function( elems ) { + + // Build a new jQuery matched element set + var ret = jQuery.merge( this.constructor(), elems ); + + // Add the old object onto the stack (as a reference) + ret.prevObject = this; + + // Return the newly-formed element set + return ret; + }, + + // Execute a callback for every element in the matched set. + each: function( callback ) { + return jQuery.each( this, callback ); + }, + + map: function( callback ) { + return this.pushStack( jQuery.map( this, function( elem, i ) { + return callback.call( elem, i, elem ); + } ) ); + }, + + slice: function() { + return this.pushStack( slice.apply( this, arguments ) ); + }, + + first: function() { + return this.eq( 0 ); + }, + + last: function() { + return this.eq( -1 ); + }, + + even: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return ( i + 1 ) % 2; + } ) ); + }, + + odd: function() { + return this.pushStack( jQuery.grep( this, function( _elem, i ) { + return i % 2; + } ) ); + }, + + eq: function( i ) { + var len = this.length, + j = +i + ( i < 0 ? len : 0 ); + return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); + }, + + end: function() { + return this.prevObject || this.constructor(); + }, + + // For internal use only. + // Behaves like an Array's method, not like a jQuery method. + push: push, + sort: arr.sort, + splice: arr.splice +}; + +jQuery.extend = jQuery.fn.extend = function() { + var options, name, src, copy, copyIsArray, clone, + target = arguments[ 0 ] || {}, + i = 1, + length = arguments.length, + deep = false; + + // Handle a deep copy situation + if ( typeof target === "boolean" ) { + deep = target; + + // Skip the boolean and the target + target = arguments[ i ] || {}; + i++; + } + + // Handle case when target is a string or something (possible in deep copy) + if ( typeof target !== "object" && !isFunction( target ) ) { + target = {}; + } + + // Extend jQuery itself if only one argument is passed + if ( i === length ) { + target = this; + i--; + } + + for ( ; i < length; i++ ) { + + // Only deal with non-null/undefined values + if ( ( options = arguments[ i ] ) != null ) { + + // Extend the base object + for ( name in options ) { + copy = options[ name ]; + + // Prevent Object.prototype pollution + // Prevent never-ending loop + if ( name === "__proto__" || target === copy ) { + continue; + } + + // Recurse if we're merging plain objects or arrays + if ( deep && copy && ( jQuery.isPlainObject( copy ) || + ( copyIsArray = Array.isArray( copy ) ) ) ) { + src = target[ name ]; + + // Ensure proper type for the source value + if ( copyIsArray && !Array.isArray( src ) ) { + clone = []; + } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { + clone = {}; + } else { + clone = src; + } + copyIsArray = false; + + // Never move original objects, clone them + target[ name ] = jQuery.extend( deep, clone, copy ); + + // Don't bring in undefined values + } else if ( copy !== undefined ) { + target[ name ] = copy; + } + } + } + } + + // Return the modified object + return target; +}; + +jQuery.extend( { + + // Unique for each copy of jQuery on the page + expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), + + // Assume jQuery is ready without the ready module + isReady: true, + + error: function( msg ) { + throw new Error( msg ); + }, + + noop: function() {}, + + isPlainObject: function( obj ) { + var proto, Ctor; + + // Detect obvious negatives + // Use toString instead of jQuery.type to catch host objects + if ( !obj || toString.call( obj ) !== "[object Object]" ) { + return false; + } + + proto = getProto( obj ); + + // Objects with no prototype (e.g., `Object.create( null )`) are plain + if ( !proto ) { + return true; + } + + // Objects with prototype are plain iff they were constructed by a global Object function + Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; + return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; + }, + + isEmptyObject: function( obj ) { + var name; + + for ( name in obj ) { + return false; + } + return true; + }, + + // Evaluates a script in a provided context; falls back to the global one + // if not specified. + globalEval: function( code, options, doc ) { + DOMEval( code, { nonce: options && options.nonce }, doc ); + }, + + each: function( obj, callback ) { + var length, i = 0; + + if ( isArrayLike( obj ) ) { + length = obj.length; + for ( ; i < length; i++ ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } else { + for ( i in obj ) { + if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { + break; + } + } + } + + return obj; + }, + + // results is for internal usage only + makeArray: function( arr, results ) { + var ret = results || []; + + if ( arr != null ) { + if ( isArrayLike( Object( arr ) ) ) { + jQuery.merge( ret, + typeof arr === "string" ? + [ arr ] : arr + ); + } else { + push.call( ret, arr ); + } + } + + return ret; + }, + + inArray: function( elem, arr, i ) { + return arr == null ? -1 : indexOf.call( arr, elem, i ); + }, + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + merge: function( first, second ) { + var len = +second.length, + j = 0, + i = first.length; + + for ( ; j < len; j++ ) { + first[ i++ ] = second[ j ]; + } + + first.length = i; + + return first; + }, + + grep: function( elems, callback, invert ) { + var callbackInverse, + matches = [], + i = 0, + length = elems.length, + callbackExpect = !invert; + + // Go through the array, only saving the items + // that pass the validator function + for ( ; i < length; i++ ) { + callbackInverse = !callback( elems[ i ], i ); + if ( callbackInverse !== callbackExpect ) { + matches.push( elems[ i ] ); + } + } + + return matches; + }, + + // arg is for internal usage only + map: function( elems, callback, arg ) { + var length, value, + i = 0, + ret = []; + + // Go through the array, translating each of the items to their new values + if ( isArrayLike( elems ) ) { + length = elems.length; + for ( ; i < length; i++ ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + + // Go through every key on the object, + } else { + for ( i in elems ) { + value = callback( elems[ i ], i, arg ); + + if ( value != null ) { + ret.push( value ); + } + } + } + + // Flatten any nested arrays + return flat( ret ); + }, + + // A global GUID counter for objects + guid: 1, + + // jQuery.support is not used in Core but other projects attach their + // properties to it so it needs to exist. + support: support +} ); + +if ( typeof Symbol === "function" ) { + jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; +} + +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + +function isArrayLike( obj ) { + + // Support: real iOS 8.2 only (not reproducible in simulator) + // `in` check used to prevent JIT error (gh-2145) + // hasOwn isn't used here due to false negatives + // regarding Nodelist length in IE + var length = !!obj && "length" in obj && obj.length, + type = toType( obj ); + + if ( isFunction( obj ) || isWindow( obj ) ) { + return false; + } + + return type === "array" || length === 0 || + typeof length === "number" && length > 0 && ( length - 1 ) in obj; +} +var Sizzle = +/*! + * Sizzle CSS Selector Engine v2.3.6 + * https://sizzlejs.com/ + * + * Copyright JS Foundation and other contributors + * Released under the MIT license + * https://js.foundation/ + * + * Date: 2021-02-16 + */ +( function( window ) { +var i, + support, + Expr, + getText, + isXML, + tokenize, + compile, + select, + outermostContext, + sortInput, + hasDuplicate, + + // Local document vars + setDocument, + document, + docElem, + documentIsHTML, + rbuggyQSA, + rbuggyMatches, + matches, + contains, + + // Instance-specific data + expando = "sizzle" + 1 * new Date(), + preferredDoc = window.document, + dirruns = 0, + done = 0, + classCache = createCache(), + tokenCache = createCache(), + compilerCache = createCache(), + nonnativeSelectorCache = createCache(), + sortOrder = function( a, b ) { + if ( a === b ) { + hasDuplicate = true; + } + return 0; + }, + + // Instance methods + hasOwn = ( {} ).hasOwnProperty, + arr = [], + pop = arr.pop, + pushNative = arr.push, + push = arr.push, + slice = arr.slice, + + // Use a stripped-down indexOf as it's faster than native + // https://jsperf.com/thor-indexof-vs-for/5 + indexOf = function( list, elem ) { + var i = 0, + len = list.length; + for ( ; i < len; i++ ) { + if ( list[ i ] === elem ) { + return i; + } + } + return -1; + }, + + booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + + "ismap|loop|multiple|open|readonly|required|scoped", + + // Regular expressions + + // http://www.w3.org/TR/css3-selectors/#whitespace + whitespace = "[\\x20\\t\\r\\n\\f]", + + // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram + identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", + + // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors + attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + + + // Operator (capture 2) + "*([*^$|!~]?=)" + whitespace + + + // "Attribute values must be CSS identifiers [capture 5] + // or strings [capture 3 or capture 4]" + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + + whitespace + "*\\]", + + pseudos = ":(" + identifier + ")(?:\\((" + + + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: + // 1. quoted (capture 3; capture 4 or capture 5) + "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + + + // 2. simple (capture 6) + "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + + + // 3. anything else (capture 2) + ".*" + + ")\\)|)", + + // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter + rwhitespace = new RegExp( whitespace + "+", "g" ), + rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + + whitespace + "+$", "g" ), + + rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), + rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + + "*" ), + rdescend = new RegExp( whitespace + "|>" ), + + rpseudo = new RegExp( pseudos ), + ridentifier = new RegExp( "^" + identifier + "$" ), + + matchExpr = { + "ID": new RegExp( "^#(" + identifier + ")" ), + "CLASS": new RegExp( "^\\.(" + identifier + ")" ), + "TAG": new RegExp( "^(" + identifier + "|[*])" ), + "ATTR": new RegExp( "^" + attributes ), + "PSEUDO": new RegExp( "^" + pseudos ), + "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), + "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), + + // For use in libraries implementing .is() + // We use this for POS matching in `select` + "needsContext": new RegExp( "^" + whitespace + + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) + }, + + rhtml = /HTML$/i, + rinputs = /^(?:input|select|textarea|button)$/i, + rheader = /^h\d$/i, + + rnative = /^[^{]+\{\s*\[native \w/, + + // Easily-parseable/retrievable ID or TAG or CLASS selectors + rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, + + rsibling = /[+~]/, + + // CSS escapes + // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters + runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), + funescape = function( escape, nonHex ) { + var high = "0x" + escape.slice( 1 ) - 0x10000; + + return nonHex ? + + // Strip the backslash prefix from a non-hex escape sequence + nonHex : + + // Replace a hexadecimal escape sequence with the encoded Unicode code point + // Support: IE <=11+ + // For values outside the Basic Multilingual Plane (BMP), manually construct a + // surrogate pair + high < 0 ? + String.fromCharCode( high + 0x10000 ) : + String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); + }, + + // CSS string/identifier serialization + // https://drafts.csswg.org/cssom/#common-serializing-idioms + rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, + fcssescape = function( ch, asCodePoint ) { + if ( asCodePoint ) { + + // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER + if ( ch === "\0" ) { + return "\uFFFD"; + } + + // Control characters and (dependent upon position) numbers get escaped as code points + return ch.slice( 0, -1 ) + "\\" + + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; + } + + // Other potentially-special ASCII characters get backslash-escaped + return "\\" + ch; + }, + + // Used for iframes + // See setDocument() + // Removing the function wrapper causes a "Permission Denied" + // error in IE + unloadHandler = function() { + setDocument(); + }, + + inDisabledFieldset = addCombinator( + function( elem ) { + return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; + }, + { dir: "parentNode", next: "legend" } + ); + +// Optimize for push.apply( _, NodeList ) +try { + push.apply( + ( arr = slice.call( preferredDoc.childNodes ) ), + preferredDoc.childNodes + ); + + // Support: Android<4.0 + // Detect silently failing push.apply + // eslint-disable-next-line no-unused-expressions + arr[ preferredDoc.childNodes.length ].nodeType; +} catch ( e ) { + push = { apply: arr.length ? + + // Leverage slice if possible + function( target, els ) { + pushNative.apply( target, slice.call( els ) ); + } : + + // Support: IE<9 + // Otherwise append directly + function( target, els ) { + var j = target.length, + i = 0; + + // Can't trust NodeList.length + while ( ( target[ j++ ] = els[ i++ ] ) ) {} + target.length = j - 1; + } + }; +} + +function Sizzle( selector, context, results, seed ) { + var m, i, elem, nid, match, groups, newSelector, + newContext = context && context.ownerDocument, + + // nodeType defaults to 9, since context defaults to document + nodeType = context ? context.nodeType : 9; + + results = results || []; + + // Return early from calls with invalid selector or context + if ( typeof selector !== "string" || !selector || + nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { + + return results; + } + + // Try to shortcut find operations (as opposed to filters) in HTML documents + if ( !seed ) { + setDocument( context ); + context = context || document; + + if ( documentIsHTML ) { + + // If the selector is sufficiently simple, try using a "get*By*" DOM method + // (excepting DocumentFragment context, where the methods don't exist) + if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { + + // ID selector + if ( ( m = match[ 1 ] ) ) { + + // Document context + if ( nodeType === 9 ) { + if ( ( elem = context.getElementById( m ) ) ) { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( elem.id === m ) { + results.push( elem ); + return results; + } + } else { + return results; + } + + // Element context + } else { + + // Support: IE, Opera, Webkit + // TODO: identify versions + // getElementById can match elements by name instead of ID + if ( newContext && ( elem = newContext.getElementById( m ) ) && + contains( context, elem ) && + elem.id === m ) { + + results.push( elem ); + return results; + } + } + + // Type selector + } else if ( match[ 2 ] ) { + push.apply( results, context.getElementsByTagName( selector ) ); + return results; + + // Class selector + } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && + context.getElementsByClassName ) { + + push.apply( results, context.getElementsByClassName( m ) ); + return results; + } + } + + // Take advantage of querySelectorAll + if ( support.qsa && + !nonnativeSelectorCache[ selector + " " ] && + ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && + + // Support: IE 8 only + // Exclude object elements + ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { + + newSelector = selector; + newContext = context; + + // qSA considers elements outside a scoping root when evaluating child or + // descendant combinators, which is not what we want. + // In such cases, we work around the behavior by prefixing every selector in the + // list with an ID selector referencing the scope context. + // The technique has to be used as well when a leading combinator is used + // as such selectors are not recognized by querySelectorAll. + // Thanks to Andrew Dupont for this technique. + if ( nodeType === 1 && + ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { + + // Expand context for sibling selectors + newContext = rsibling.test( selector ) && testContext( context.parentNode ) || + context; + + // We can use :scope instead of the ID hack if the browser + // supports it & if we're not changing the context. + if ( newContext !== context || !support.scope ) { + + // Capture the context ID, setting it first if necessary + if ( ( nid = context.getAttribute( "id" ) ) ) { + nid = nid.replace( rcssescape, fcssescape ); + } else { + context.setAttribute( "id", ( nid = expando ) ); + } + } + + // Prefix every selector in the list + groups = tokenize( selector ); + i = groups.length; + while ( i-- ) { + groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + + toSelector( groups[ i ] ); + } + newSelector = groups.join( "," ); + } + + try { + push.apply( results, + newContext.querySelectorAll( newSelector ) + ); + return results; + } catch ( qsaError ) { + nonnativeSelectorCache( selector, true ); + } finally { + if ( nid === expando ) { + context.removeAttribute( "id" ); + } + } + } + } + } + + // All others + return select( selector.replace( rtrim, "$1" ), context, results, seed ); +} + +/** + * Create key-value caches of limited size + * @returns {function(string, object)} Returns the Object data after storing it on itself with + * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) + * deleting the oldest entry + */ +function createCache() { + var keys = []; + + function cache( key, value ) { + + // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) + if ( keys.push( key + " " ) > Expr.cacheLength ) { + + // Only keep the most recent entries + delete cache[ keys.shift() ]; + } + return ( cache[ key + " " ] = value ); + } + return cache; +} + +/** + * Mark a function for special use by Sizzle + * @param {Function} fn The function to mark + */ +function markFunction( fn ) { + fn[ expando ] = true; + return fn; +} + +/** + * Support testing using an element + * @param {Function} fn Passed the created element and returns a boolean result + */ +function assert( fn ) { + var el = document.createElement( "fieldset" ); + + try { + return !!fn( el ); + } catch ( e ) { + return false; + } finally { + + // Remove from its parent by default + if ( el.parentNode ) { + el.parentNode.removeChild( el ); + } + + // release memory in IE + el = null; + } +} + +/** + * Adds the same handler for all of the specified attrs + * @param {String} attrs Pipe-separated list of attributes + * @param {Function} handler The method that will be applied + */ +function addHandle( attrs, handler ) { + var arr = attrs.split( "|" ), + i = arr.length; + + while ( i-- ) { + Expr.attrHandle[ arr[ i ] ] = handler; + } +} + +/** + * Checks document order of two siblings + * @param {Element} a + * @param {Element} b + * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b + */ +function siblingCheck( a, b ) { + var cur = b && a, + diff = cur && a.nodeType === 1 && b.nodeType === 1 && + a.sourceIndex - b.sourceIndex; + + // Use IE sourceIndex if available on both nodes + if ( diff ) { + return diff; + } + + // Check if b follows a + if ( cur ) { + while ( ( cur = cur.nextSibling ) ) { + if ( cur === b ) { + return -1; + } + } + } + + return a ? 1 : -1; +} + +/** + * Returns a function to use in pseudos for input types + * @param {String} type + */ +function createInputPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for buttons + * @param {String} type + */ +function createButtonPseudo( type ) { + return function( elem ) { + var name = elem.nodeName.toLowerCase(); + return ( name === "input" || name === "button" ) && elem.type === type; + }; +} + +/** + * Returns a function to use in pseudos for :enabled/:disabled + * @param {Boolean} disabled true for :disabled; false for :enabled + */ +function createDisabledPseudo( disabled ) { + + // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable + return function( elem ) { + + // Only certain elements can match :enabled or :disabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled + // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled + if ( "form" in elem ) { + + // Check for inherited disabledness on relevant non-disabled elements: + // * listed form-associated elements in a disabled fieldset + // https://html.spec.whatwg.org/multipage/forms.html#category-listed + // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled + // * option elements in a disabled optgroup + // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled + // All such elements have a "form" property. + if ( elem.parentNode && elem.disabled === false ) { + + // Option elements defer to a parent optgroup if present + if ( "label" in elem ) { + if ( "label" in elem.parentNode ) { + return elem.parentNode.disabled === disabled; + } else { + return elem.disabled === disabled; + } + } + + // Support: IE 6 - 11 + // Use the isDisabled shortcut property to check for disabled fieldset ancestors + return elem.isDisabled === disabled || + + // Where there is no isDisabled, check manually + /* jshint -W018 */ + elem.isDisabled !== !disabled && + inDisabledFieldset( elem ) === disabled; + } + + return elem.disabled === disabled; + + // Try to winnow out elements that can't be disabled before trusting the disabled property. + // Some victims get caught in our net (label, legend, menu, track), but it shouldn't + // even exist on them, let alone have a boolean value. + } else if ( "label" in elem ) { + return elem.disabled === disabled; + } + + // Remaining elements are neither :enabled nor :disabled + return false; + }; +} + +/** + * Returns a function to use in pseudos for positionals + * @param {Function} fn + */ +function createPositionalPseudo( fn ) { + return markFunction( function( argument ) { + argument = +argument; + return markFunction( function( seed, matches ) { + var j, + matchIndexes = fn( [], seed.length, argument ), + i = matchIndexes.length; + + // Match elements found at the specified indexes + while ( i-- ) { + if ( seed[ ( j = matchIndexes[ i ] ) ] ) { + seed[ j ] = !( matches[ j ] = seed[ j ] ); + } + } + } ); + } ); +} + +/** + * Checks a node for validity as a Sizzle context + * @param {Element|Object=} context + * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value + */ +function testContext( context ) { + return context && typeof context.getElementsByTagName !== "undefined" && context; +} + +// Expose support vars for convenience +support = Sizzle.support = {}; + +/** + * Detects XML nodes + * @param {Element|Object} elem An element or a document + * @returns {Boolean} True iff elem is a non-HTML XML node + */ +isXML = Sizzle.isXML = function( elem ) { + var namespace = elem && elem.namespaceURI, + docElem = elem && ( elem.ownerDocument || elem ).documentElement; + + // Support: IE <=8 + // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes + // https://bugs.jquery.com/ticket/4833 + return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); +}; + +/** + * Sets document-related variables once based on the current document + * @param {Element|Object} [doc] An element or document object to use to set the document + * @returns {Object} Returns the current document + */ +setDocument = Sizzle.setDocument = function( node ) { + var hasCompare, subWindow, + doc = node ? node.ownerDocument || node : preferredDoc; + + // Return early if doc is invalid or already selected + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { + return document; + } + + // Update global variables + document = doc; + docElem = document.documentElement; + documentIsHTML = !isXML( document ); + + // Support: IE 9 - 11+, Edge 12 - 18+ + // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( preferredDoc != document && + ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { + + // Support: IE 11, Edge + if ( subWindow.addEventListener ) { + subWindow.addEventListener( "unload", unloadHandler, false ); + + // Support: IE 9 - 10 only + } else if ( subWindow.attachEvent ) { + subWindow.attachEvent( "onunload", unloadHandler ); + } + } + + // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, + // Safari 4 - 5 only, Opera <=11.6 - 12.x only + // IE/Edge & older browsers don't support the :scope pseudo-class. + // Support: Safari 6.0 only + // Safari 6.0 supports :scope but it's an alias of :root there. + support.scope = assert( function( el ) { + docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); + return typeof el.querySelectorAll !== "undefined" && + !el.querySelectorAll( ":scope fieldset div" ).length; + } ); + + /* Attributes + ---------------------------------------------------------------------- */ + + // Support: IE<8 + // Verify that getAttribute really returns attributes and not properties + // (excepting IE8 booleans) + support.attributes = assert( function( el ) { + el.className = "i"; + return !el.getAttribute( "className" ); + } ); + + /* getElement(s)By* + ---------------------------------------------------------------------- */ + + // Check if getElementsByTagName("*") returns only elements + support.getElementsByTagName = assert( function( el ) { + el.appendChild( document.createComment( "" ) ); + return !el.getElementsByTagName( "*" ).length; + } ); + + // Support: IE<9 + support.getElementsByClassName = rnative.test( document.getElementsByClassName ); + + // Support: IE<10 + // Check if getElementById returns elements by name + // The broken getElementById methods don't pick up programmatically-set names, + // so use a roundabout getElementsByName test + support.getById = assert( function( el ) { + docElem.appendChild( el ).id = expando; + return !document.getElementsByName || !document.getElementsByName( expando ).length; + } ); + + // ID filter and find + if ( support.getById ) { + Expr.filter[ "ID" ] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + return elem.getAttribute( "id" ) === attrId; + }; + }; + Expr.find[ "ID" ] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var elem = context.getElementById( id ); + return elem ? [ elem ] : []; + } + }; + } else { + Expr.filter[ "ID" ] = function( id ) { + var attrId = id.replace( runescape, funescape ); + return function( elem ) { + var node = typeof elem.getAttributeNode !== "undefined" && + elem.getAttributeNode( "id" ); + return node && node.value === attrId; + }; + }; + + // Support: IE 6 - 7 only + // getElementById is not reliable as a find shortcut + Expr.find[ "ID" ] = function( id, context ) { + if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { + var node, i, elems, + elem = context.getElementById( id ); + + if ( elem ) { + + // Verify the id attribute + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + + // Fall back on getElementsByName + elems = context.getElementsByName( id ); + i = 0; + while ( ( elem = elems[ i++ ] ) ) { + node = elem.getAttributeNode( "id" ); + if ( node && node.value === id ) { + return [ elem ]; + } + } + } + + return []; + } + }; + } + + // Tag + Expr.find[ "TAG" ] = support.getElementsByTagName ? + function( tag, context ) { + if ( typeof context.getElementsByTagName !== "undefined" ) { + return context.getElementsByTagName( tag ); + + // DocumentFragment nodes don't have gEBTN + } else if ( support.qsa ) { + return context.querySelectorAll( tag ); + } + } : + + function( tag, context ) { + var elem, + tmp = [], + i = 0, + + // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too + results = context.getElementsByTagName( tag ); + + // Filter out possible comments + if ( tag === "*" ) { + while ( ( elem = results[ i++ ] ) ) { + if ( elem.nodeType === 1 ) { + tmp.push( elem ); + } + } + + return tmp; + } + return results; + }; + + // Class + Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { + if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { + return context.getElementsByClassName( className ); + } + }; + + /* QSA/matchesSelector + ---------------------------------------------------------------------- */ + + // QSA and matchesSelector support + + // matchesSelector(:active) reports false when true (IE9/Opera 11.5) + rbuggyMatches = []; + + // qSa(:focus) reports false when true (Chrome 21) + // We allow this because of a bug in IE8/9 that throws an error + // whenever `document.activeElement` is accessed on an iframe + // So, we allow :focus to pass through QSA all the time to avoid the IE error + // See https://bugs.jquery.com/ticket/13378 + rbuggyQSA = []; + + if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { + + // Build QSA regex + // Regex strategy adopted from Diego Perini + assert( function( el ) { + + var input; + + // Select is set to empty string on purpose + // This is to test IE's treatment of not explicitly + // setting a boolean content attribute, + // since its presence should be enough + // https://bugs.jquery.com/ticket/12359 + docElem.appendChild( el ).innerHTML = "" + + ""; + + // Support: IE8, Opera 11-12.16 + // Nothing should be selected when empty strings follow ^= or $= or *= + // The test attribute must be unknown in Opera but "safe" for WinRT + // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section + if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { + rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); + } + + // Support: IE8 + // Boolean attributes and "value" are not treated correctly + if ( !el.querySelectorAll( "[selected]" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); + } + + // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ + if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { + rbuggyQSA.push( "~=" ); + } + + // Support: IE 11+, Edge 15 - 18+ + // IE 11/Edge don't find elements on a `[name='']` query in some cases. + // Adding a temporary attribute to the document before the selection works + // around the issue. + // Interestingly, IE 10 & older don't seem to have the issue. + input = document.createElement( "input" ); + input.setAttribute( "name", "" ); + el.appendChild( input ); + if ( !el.querySelectorAll( "[name='']" ).length ) { + rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + + whitespace + "*(?:''|\"\")" ); + } + + // Webkit/Opera - :checked should return selected option elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + // IE8 throws error here and will not see later tests + if ( !el.querySelectorAll( ":checked" ).length ) { + rbuggyQSA.push( ":checked" ); + } + + // Support: Safari 8+, iOS 8+ + // https://bugs.webkit.org/show_bug.cgi?id=136851 + // In-page `selector#id sibling-combinator selector` fails + if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { + rbuggyQSA.push( ".#.+[+~]" ); + } + + // Support: Firefox <=3.6 - 5 only + // Old Firefox doesn't throw on a badly-escaped identifier. + el.querySelectorAll( "\\\f" ); + rbuggyQSA.push( "[\\r\\n\\f]" ); + } ); + + assert( function( el ) { + el.innerHTML = "" + + ""; + + // Support: Windows 8 Native Apps + // The type and name attributes are restricted during .innerHTML assignment + var input = document.createElement( "input" ); + input.setAttribute( "type", "hidden" ); + el.appendChild( input ).setAttribute( "name", "D" ); + + // Support: IE8 + // Enforce case-sensitivity of name attribute + if ( el.querySelectorAll( "[name=d]" ).length ) { + rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); + } + + // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) + // IE8 throws error here and will not see later tests + if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: IE9-11+ + // IE's :disabled selector does not pick up the children of disabled fieldsets + docElem.appendChild( el ).disabled = true; + if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { + rbuggyQSA.push( ":enabled", ":disabled" ); + } + + // Support: Opera 10 - 11 only + // Opera 10-11 does not throw on post-comma invalid pseudos + el.querySelectorAll( "*,:x" ); + rbuggyQSA.push( ",.*:" ); + } ); + } + + if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || + docElem.webkitMatchesSelector || + docElem.mozMatchesSelector || + docElem.oMatchesSelector || + docElem.msMatchesSelector ) ) ) ) { + + assert( function( el ) { + + // Check to see if it's possible to do matchesSelector + // on a disconnected node (IE 9) + support.disconnectedMatch = matches.call( el, "*" ); + + // This should fail with an exception + // Gecko does not error, returns false instead + matches.call( el, "[s!='']:x" ); + rbuggyMatches.push( "!=", pseudos ); + } ); + } + + rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); + rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); + + /* Contains + ---------------------------------------------------------------------- */ + hasCompare = rnative.test( docElem.compareDocumentPosition ); + + // Element contains another + // Purposefully self-exclusive + // As in, an element does not contain itself + contains = hasCompare || rnative.test( docElem.contains ) ? + function( a, b ) { + var adown = a.nodeType === 9 ? a.documentElement : a, + bup = b && b.parentNode; + return a === bup || !!( bup && bup.nodeType === 1 && ( + adown.contains ? + adown.contains( bup ) : + a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 + ) ); + } : + function( a, b ) { + if ( b ) { + while ( ( b = b.parentNode ) ) { + if ( b === a ) { + return true; + } + } + } + return false; + }; + + /* Sorting + ---------------------------------------------------------------------- */ + + // Document order sorting + sortOrder = hasCompare ? + function( a, b ) { + + // Flag for duplicate removal + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + // Sort on method existence if only one input has compareDocumentPosition + var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; + if ( compare ) { + return compare; + } + + // Calculate position if both inputs belong to the same document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? + a.compareDocumentPosition( b ) : + + // Otherwise we know they are disconnected + 1; + + // Disconnected nodes + if ( compare & 1 || + ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { + + // Choose the first element that is related to our preferred document + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( a == document || a.ownerDocument == preferredDoc && + contains( preferredDoc, a ) ) { + return -1; + } + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( b == document || b.ownerDocument == preferredDoc && + contains( preferredDoc, b ) ) { + return 1; + } + + // Maintain original order + return sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + } + + return compare & 4 ? -1 : 1; + } : + function( a, b ) { + + // Exit early if the nodes are identical + if ( a === b ) { + hasDuplicate = true; + return 0; + } + + var cur, + i = 0, + aup = a.parentNode, + bup = b.parentNode, + ap = [ a ], + bp = [ b ]; + + // Parentless nodes are either documents or disconnected + if ( !aup || !bup ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + /* eslint-disable eqeqeq */ + return a == document ? -1 : + b == document ? 1 : + /* eslint-enable eqeqeq */ + aup ? -1 : + bup ? 1 : + sortInput ? + ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : + 0; + + // If the nodes are siblings, we can do a quick check + } else if ( aup === bup ) { + return siblingCheck( a, b ); + } + + // Otherwise we need full lists of their ancestors for comparison + cur = a; + while ( ( cur = cur.parentNode ) ) { + ap.unshift( cur ); + } + cur = b; + while ( ( cur = cur.parentNode ) ) { + bp.unshift( cur ); + } + + // Walk down the tree looking for a discrepancy + while ( ap[ i ] === bp[ i ] ) { + i++; + } + + return i ? + + // Do a sibling check if the nodes have a common ancestor + siblingCheck( ap[ i ], bp[ i ] ) : + + // Otherwise nodes in our document sort first + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + /* eslint-disable eqeqeq */ + ap[ i ] == preferredDoc ? -1 : + bp[ i ] == preferredDoc ? 1 : + /* eslint-enable eqeqeq */ + 0; + }; + + return document; +}; + +Sizzle.matches = function( expr, elements ) { + return Sizzle( expr, null, null, elements ); +}; + +Sizzle.matchesSelector = function( elem, expr ) { + setDocument( elem ); + + if ( support.matchesSelector && documentIsHTML && + !nonnativeSelectorCache[ expr + " " ] && + ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && + ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { + + try { + var ret = matches.call( elem, expr ); + + // IE 9's matchesSelector returns false on disconnected nodes + if ( ret || support.disconnectedMatch || + + // As well, disconnected nodes are said to be in a document + // fragment in IE 9 + elem.document && elem.document.nodeType !== 11 ) { + return ret; + } + } catch ( e ) { + nonnativeSelectorCache( expr, true ); + } + } + + return Sizzle( expr, document, null, [ elem ] ).length > 0; +}; + +Sizzle.contains = function( context, elem ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( context.ownerDocument || context ) != document ) { + setDocument( context ); + } + return contains( context, elem ); +}; + +Sizzle.attr = function( elem, name ) { + + // Set document vars if needed + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( ( elem.ownerDocument || elem ) != document ) { + setDocument( elem ); + } + + var fn = Expr.attrHandle[ name.toLowerCase() ], + + // Don't get fooled by Object.prototype properties (jQuery #13807) + val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? + fn( elem, name, !documentIsHTML ) : + undefined; + + return val !== undefined ? + val : + support.attributes || !documentIsHTML ? + elem.getAttribute( name ) : + ( val = elem.getAttributeNode( name ) ) && val.specified ? + val.value : + null; +}; + +Sizzle.escape = function( sel ) { + return ( sel + "" ).replace( rcssescape, fcssescape ); +}; + +Sizzle.error = function( msg ) { + throw new Error( "Syntax error, unrecognized expression: " + msg ); +}; + +/** + * Document sorting and removing duplicates + * @param {ArrayLike} results + */ +Sizzle.uniqueSort = function( results ) { + var elem, + duplicates = [], + j = 0, + i = 0; + + // Unless we *know* we can detect duplicates, assume their presence + hasDuplicate = !support.detectDuplicates; + sortInput = !support.sortStable && results.slice( 0 ); + results.sort( sortOrder ); + + if ( hasDuplicate ) { + while ( ( elem = results[ i++ ] ) ) { + if ( elem === results[ i ] ) { + j = duplicates.push( i ); + } + } + while ( j-- ) { + results.splice( duplicates[ j ], 1 ); + } + } + + // Clear input after sorting to release objects + // See https://github.com/jquery/sizzle/pull/225 + sortInput = null; + + return results; +}; + +/** + * Utility function for retrieving the text value of an array of DOM nodes + * @param {Array|Element} elem + */ +getText = Sizzle.getText = function( elem ) { + var node, + ret = "", + i = 0, + nodeType = elem.nodeType; + + if ( !nodeType ) { + + // If no nodeType, this is expected to be an array + while ( ( node = elem[ i++ ] ) ) { + + // Do not traverse comment nodes + ret += getText( node ); + } + } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { + + // Use textContent for elements + // innerText usage removed for consistency of new lines (jQuery #11153) + if ( typeof elem.textContent === "string" ) { + return elem.textContent; + } else { + + // Traverse its children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + ret += getText( elem ); + } + } + } else if ( nodeType === 3 || nodeType === 4 ) { + return elem.nodeValue; + } + + // Do not include comment or processing instruction nodes + + return ret; +}; + +Expr = Sizzle.selectors = { + + // Can be adjusted by the user + cacheLength: 50, + + createPseudo: markFunction, + + match: matchExpr, + + attrHandle: {}, + + find: {}, + + relative: { + ">": { dir: "parentNode", first: true }, + " ": { dir: "parentNode" }, + "+": { dir: "previousSibling", first: true }, + "~": { dir: "previousSibling" } + }, + + preFilter: { + "ATTR": function( match ) { + match[ 1 ] = match[ 1 ].replace( runescape, funescape ); + + // Move the given value to match[3] whether quoted or unquoted + match[ 3 ] = ( match[ 3 ] || match[ 4 ] || + match[ 5 ] || "" ).replace( runescape, funescape ); + + if ( match[ 2 ] === "~=" ) { + match[ 3 ] = " " + match[ 3 ] + " "; + } + + return match.slice( 0, 4 ); + }, + + "CHILD": function( match ) { + + /* matches from matchExpr["CHILD"] + 1 type (only|nth|...) + 2 what (child|of-type) + 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) + 4 xn-component of xn+y argument ([+-]?\d*n|) + 5 sign of xn-component + 6 x of xn-component + 7 sign of y-component + 8 y of y-component + */ + match[ 1 ] = match[ 1 ].toLowerCase(); + + if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { + + // nth-* requires argument + if ( !match[ 3 ] ) { + Sizzle.error( match[ 0 ] ); + } + + // numeric x and y parameters for Expr.filter.CHILD + // remember that false/true cast respectively to 0/1 + match[ 4 ] = +( match[ 4 ] ? + match[ 5 ] + ( match[ 6 ] || 1 ) : + 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); + match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); + + // other types prohibit arguments + } else if ( match[ 3 ] ) { + Sizzle.error( match[ 0 ] ); + } + + return match; + }, + + "PSEUDO": function( match ) { + var excess, + unquoted = !match[ 6 ] && match[ 2 ]; + + if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { + return null; + } + + // Accept quoted arguments as-is + if ( match[ 3 ] ) { + match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; + + // Strip excess characters from unquoted arguments + } else if ( unquoted && rpseudo.test( unquoted ) && + + // Get excess from tokenize (recursively) + ( excess = tokenize( unquoted, true ) ) && + + // advance to the next closing parenthesis + ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { + + // excess is a negative index + match[ 0 ] = match[ 0 ].slice( 0, excess ); + match[ 2 ] = unquoted.slice( 0, excess ); + } + + // Return only captures needed by the pseudo filter method (type and argument) + return match.slice( 0, 3 ); + } + }, + + filter: { + + "TAG": function( nodeNameSelector ) { + var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); + return nodeNameSelector === "*" ? + function() { + return true; + } : + function( elem ) { + return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; + }; + }, + + "CLASS": function( className ) { + var pattern = classCache[ className + " " ]; + + return pattern || + ( pattern = new RegExp( "(^|" + whitespace + + ")" + className + "(" + whitespace + "|$)" ) ) && classCache( + className, function( elem ) { + return pattern.test( + typeof elem.className === "string" && elem.className || + typeof elem.getAttribute !== "undefined" && + elem.getAttribute( "class" ) || + "" + ); + } ); + }, + + "ATTR": function( name, operator, check ) { + return function( elem ) { + var result = Sizzle.attr( elem, name ); + + if ( result == null ) { + return operator === "!="; + } + if ( !operator ) { + return true; + } + + result += ""; + + /* eslint-disable max-len */ + + return operator === "=" ? result === check : + operator === "!=" ? result !== check : + operator === "^=" ? check && result.indexOf( check ) === 0 : + operator === "*=" ? check && result.indexOf( check ) > -1 : + operator === "$=" ? check && result.slice( -check.length ) === check : + operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : + operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : + false; + /* eslint-enable max-len */ + + }; + }, + + "CHILD": function( type, what, _argument, first, last ) { + var simple = type.slice( 0, 3 ) !== "nth", + forward = type.slice( -4 ) !== "last", + ofType = what === "of-type"; + + return first === 1 && last === 0 ? + + // Shortcut for :nth-*(n) + function( elem ) { + return !!elem.parentNode; + } : + + function( elem, _context, xml ) { + var cache, uniqueCache, outerCache, node, nodeIndex, start, + dir = simple !== forward ? "nextSibling" : "previousSibling", + parent = elem.parentNode, + name = ofType && elem.nodeName.toLowerCase(), + useCache = !xml && !ofType, + diff = false; + + if ( parent ) { + + // :(first|last|only)-(child|of-type) + if ( simple ) { + while ( dir ) { + node = elem; + while ( ( node = node[ dir ] ) ) { + if ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) { + + return false; + } + } + + // Reverse direction for :only-* (if we haven't yet done so) + start = dir = type === "only" && !start && "nextSibling"; + } + return true; + } + + start = [ forward ? parent.firstChild : parent.lastChild ]; + + // non-xml :nth-child(...) stores cache data on `parent` + if ( forward && useCache ) { + + // Seek `elem` from a previously-cached index + + // ...in a gzip-friendly way + node = parent; + outerCache = node[ expando ] || ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex && cache[ 2 ]; + node = nodeIndex && parent.childNodes[ nodeIndex ]; + + while ( ( node = ++nodeIndex && node && node[ dir ] || + + // Fallback to seeking `elem` from the start + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + // When found, cache indexes on `parent` and break + if ( node.nodeType === 1 && ++diff && node === elem ) { + uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; + break; + } + } + + } else { + + // Use previously-cached element index if available + if ( useCache ) { + + // ...in a gzip-friendly way + node = elem; + outerCache = node[ expando ] || ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + cache = uniqueCache[ type ] || []; + nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; + diff = nodeIndex; + } + + // xml :nth-child(...) + // or :nth-last-child(...) or :nth(-last)?-of-type(...) + if ( diff === false ) { + + // Use the same loop as above to seek `elem` from the start + while ( ( node = ++nodeIndex && node && node[ dir ] || + ( diff = nodeIndex = 0 ) || start.pop() ) ) { + + if ( ( ofType ? + node.nodeName.toLowerCase() === name : + node.nodeType === 1 ) && + ++diff ) { + + // Cache the index of each encountered element + if ( useCache ) { + outerCache = node[ expando ] || + ( node[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ node.uniqueID ] || + ( outerCache[ node.uniqueID ] = {} ); + + uniqueCache[ type ] = [ dirruns, diff ]; + } + + if ( node === elem ) { + break; + } + } + } + } + } + + // Incorporate the offset, then check against cycle size + diff -= last; + return diff === first || ( diff % first === 0 && diff / first >= 0 ); + } + }; + }, + + "PSEUDO": function( pseudo, argument ) { + + // pseudo-class names are case-insensitive + // http://www.w3.org/TR/selectors/#pseudo-classes + // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters + // Remember that setFilters inherits from pseudos + var args, + fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || + Sizzle.error( "unsupported pseudo: " + pseudo ); + + // The user may use createPseudo to indicate that + // arguments are needed to create the filter function + // just as Sizzle does + if ( fn[ expando ] ) { + return fn( argument ); + } + + // But maintain support for old signatures + if ( fn.length > 1 ) { + args = [ pseudo, pseudo, "", argument ]; + return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? + markFunction( function( seed, matches ) { + var idx, + matched = fn( seed, argument ), + i = matched.length; + while ( i-- ) { + idx = indexOf( seed, matched[ i ] ); + seed[ idx ] = !( matches[ idx ] = matched[ i ] ); + } + } ) : + function( elem ) { + return fn( elem, 0, args ); + }; + } + + return fn; + } + }, + + pseudos: { + + // Potentially complex pseudos + "not": markFunction( function( selector ) { + + // Trim the selector passed to compile + // to avoid treating leading and trailing + // spaces as combinators + var input = [], + results = [], + matcher = compile( selector.replace( rtrim, "$1" ) ); + + return matcher[ expando ] ? + markFunction( function( seed, matches, _context, xml ) { + var elem, + unmatched = matcher( seed, null, xml, [] ), + i = seed.length; + + // Match elements unmatched by `matcher` + while ( i-- ) { + if ( ( elem = unmatched[ i ] ) ) { + seed[ i ] = !( matches[ i ] = elem ); + } + } + } ) : + function( elem, _context, xml ) { + input[ 0 ] = elem; + matcher( input, null, xml, results ); + + // Don't keep the element (issue #299) + input[ 0 ] = null; + return !results.pop(); + }; + } ), + + "has": markFunction( function( selector ) { + return function( elem ) { + return Sizzle( selector, elem ).length > 0; + }; + } ), + + "contains": markFunction( function( text ) { + text = text.replace( runescape, funescape ); + return function( elem ) { + return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; + }; + } ), + + // "Whether an element is represented by a :lang() selector + // is based solely on the element's language value + // being equal to the identifier C, + // or beginning with the identifier C immediately followed by "-". + // The matching of C against the element's language value is performed case-insensitively. + // The identifier C does not have to be a valid language name." + // http://www.w3.org/TR/selectors/#lang-pseudo + "lang": markFunction( function( lang ) { + + // lang value must be a valid identifier + if ( !ridentifier.test( lang || "" ) ) { + Sizzle.error( "unsupported lang: " + lang ); + } + lang = lang.replace( runescape, funescape ).toLowerCase(); + return function( elem ) { + var elemLang; + do { + if ( ( elemLang = documentIsHTML ? + elem.lang : + elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { + + elemLang = elemLang.toLowerCase(); + return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; + } + } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); + return false; + }; + } ), + + // Miscellaneous + "target": function( elem ) { + var hash = window.location && window.location.hash; + return hash && hash.slice( 1 ) === elem.id; + }, + + "root": function( elem ) { + return elem === docElem; + }, + + "focus": function( elem ) { + return elem === document.activeElement && + ( !document.hasFocus || document.hasFocus() ) && + !!( elem.type || elem.href || ~elem.tabIndex ); + }, + + // Boolean properties + "enabled": createDisabledPseudo( false ), + "disabled": createDisabledPseudo( true ), + + "checked": function( elem ) { + + // In CSS3, :checked should return both checked and selected elements + // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked + var nodeName = elem.nodeName.toLowerCase(); + return ( nodeName === "input" && !!elem.checked ) || + ( nodeName === "option" && !!elem.selected ); + }, + + "selected": function( elem ) { + + // Accessing this property makes selected-by-default + // options in Safari work properly + if ( elem.parentNode ) { + // eslint-disable-next-line no-unused-expressions + elem.parentNode.selectedIndex; + } + + return elem.selected === true; + }, + + // Contents + "empty": function( elem ) { + + // http://www.w3.org/TR/selectors/#empty-pseudo + // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), + // but not by others (comment: 8; processing instruction: 7; etc.) + // nodeType < 6 works because attributes (2) do not appear as children + for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { + if ( elem.nodeType < 6 ) { + return false; + } + } + return true; + }, + + "parent": function( elem ) { + return !Expr.pseudos[ "empty" ]( elem ); + }, + + // Element/input types + "header": function( elem ) { + return rheader.test( elem.nodeName ); + }, + + "input": function( elem ) { + return rinputs.test( elem.nodeName ); + }, + + "button": function( elem ) { + var name = elem.nodeName.toLowerCase(); + return name === "input" && elem.type === "button" || name === "button"; + }, + + "text": function( elem ) { + var attr; + return elem.nodeName.toLowerCase() === "input" && + elem.type === "text" && + + // Support: IE<8 + // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" + ( ( attr = elem.getAttribute( "type" ) ) == null || + attr.toLowerCase() === "text" ); + }, + + // Position-in-collection + "first": createPositionalPseudo( function() { + return [ 0 ]; + } ), + + "last": createPositionalPseudo( function( _matchIndexes, length ) { + return [ length - 1 ]; + } ), + + "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { + return [ argument < 0 ? argument + length : argument ]; + } ), + + "even": createPositionalPseudo( function( matchIndexes, length ) { + var i = 0; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "odd": createPositionalPseudo( function( matchIndexes, length ) { + var i = 1; + for ( ; i < length; i += 2 ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { + var i = argument < 0 ? + argument + length : + argument > length ? + length : + argument; + for ( ; --i >= 0; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ), + + "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { + var i = argument < 0 ? argument + length : argument; + for ( ; ++i < length; ) { + matchIndexes.push( i ); + } + return matchIndexes; + } ) + } +}; + +Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; + +// Add button/input type pseudos +for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { + Expr.pseudos[ i ] = createInputPseudo( i ); +} +for ( i in { submit: true, reset: true } ) { + Expr.pseudos[ i ] = createButtonPseudo( i ); +} + +// Easy API for creating new setFilters +function setFilters() {} +setFilters.prototype = Expr.filters = Expr.pseudos; +Expr.setFilters = new setFilters(); + +tokenize = Sizzle.tokenize = function( selector, parseOnly ) { + var matched, match, tokens, type, + soFar, groups, preFilters, + cached = tokenCache[ selector + " " ]; + + if ( cached ) { + return parseOnly ? 0 : cached.slice( 0 ); + } + + soFar = selector; + groups = []; + preFilters = Expr.preFilter; + + while ( soFar ) { + + // Comma and first run + if ( !matched || ( match = rcomma.exec( soFar ) ) ) { + if ( match ) { + + // Don't consume trailing commas as valid + soFar = soFar.slice( match[ 0 ].length ) || soFar; + } + groups.push( ( tokens = [] ) ); + } + + matched = false; + + // Combinators + if ( ( match = rcombinators.exec( soFar ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + + // Cast descendant combinators to space + type: match[ 0 ].replace( rtrim, " " ) + } ); + soFar = soFar.slice( matched.length ); + } + + // Filters + for ( type in Expr.filter ) { + if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || + ( match = preFilters[ type ]( match ) ) ) ) { + matched = match.shift(); + tokens.push( { + value: matched, + type: type, + matches: match + } ); + soFar = soFar.slice( matched.length ); + } + } + + if ( !matched ) { + break; + } + } + + // Return the length of the invalid excess + // if we're just parsing + // Otherwise, throw an error or return tokens + return parseOnly ? + soFar.length : + soFar ? + Sizzle.error( selector ) : + + // Cache the tokens + tokenCache( selector, groups ).slice( 0 ); +}; + +function toSelector( tokens ) { + var i = 0, + len = tokens.length, + selector = ""; + for ( ; i < len; i++ ) { + selector += tokens[ i ].value; + } + return selector; +} + +function addCombinator( matcher, combinator, base ) { + var dir = combinator.dir, + skip = combinator.next, + key = skip || dir, + checkNonElements = base && key === "parentNode", + doneName = done++; + + return combinator.first ? + + // Check against closest ancestor/preceding element + function( elem, context, xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + return matcher( elem, context, xml ); + } + } + return false; + } : + + // Check against all ancestor/preceding elements + function( elem, context, xml ) { + var oldCache, uniqueCache, outerCache, + newCache = [ dirruns, doneName ]; + + // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching + if ( xml ) { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + if ( matcher( elem, context, xml ) ) { + return true; + } + } + } + } else { + while ( ( elem = elem[ dir ] ) ) { + if ( elem.nodeType === 1 || checkNonElements ) { + outerCache = elem[ expando ] || ( elem[ expando ] = {} ); + + // Support: IE <9 only + // Defend against cloned attroperties (jQuery gh-1709) + uniqueCache = outerCache[ elem.uniqueID ] || + ( outerCache[ elem.uniqueID ] = {} ); + + if ( skip && skip === elem.nodeName.toLowerCase() ) { + elem = elem[ dir ] || elem; + } else if ( ( oldCache = uniqueCache[ key ] ) && + oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { + + // Assign to newCache so results back-propagate to previous elements + return ( newCache[ 2 ] = oldCache[ 2 ] ); + } else { + + // Reuse newcache so results back-propagate to previous elements + uniqueCache[ key ] = newCache; + + // A match means we're done; a fail means we have to keep checking + if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { + return true; + } + } + } + } + } + return false; + }; +} + +function elementMatcher( matchers ) { + return matchers.length > 1 ? + function( elem, context, xml ) { + var i = matchers.length; + while ( i-- ) { + if ( !matchers[ i ]( elem, context, xml ) ) { + return false; + } + } + return true; + } : + matchers[ 0 ]; +} + +function multipleContexts( selector, contexts, results ) { + var i = 0, + len = contexts.length; + for ( ; i < len; i++ ) { + Sizzle( selector, contexts[ i ], results ); + } + return results; +} + +function condense( unmatched, map, filter, context, xml ) { + var elem, + newUnmatched = [], + i = 0, + len = unmatched.length, + mapped = map != null; + + for ( ; i < len; i++ ) { + if ( ( elem = unmatched[ i ] ) ) { + if ( !filter || filter( elem, context, xml ) ) { + newUnmatched.push( elem ); + if ( mapped ) { + map.push( i ); + } + } + } + } + + return newUnmatched; +} + +function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { + if ( postFilter && !postFilter[ expando ] ) { + postFilter = setMatcher( postFilter ); + } + if ( postFinder && !postFinder[ expando ] ) { + postFinder = setMatcher( postFinder, postSelector ); + } + return markFunction( function( seed, results, context, xml ) { + var temp, i, elem, + preMap = [], + postMap = [], + preexisting = results.length, + + // Get initial elements from seed or context + elems = seed || multipleContexts( + selector || "*", + context.nodeType ? [ context ] : context, + [] + ), + + // Prefilter to get matcher input, preserving a map for seed-results synchronization + matcherIn = preFilter && ( seed || !selector ) ? + condense( elems, preMap, preFilter, context, xml ) : + elems, + + matcherOut = matcher ? + + // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, + postFinder || ( seed ? preFilter : preexisting || postFilter ) ? + + // ...intermediate processing is necessary + [] : + + // ...otherwise use results directly + results : + matcherIn; + + // Find primary matches + if ( matcher ) { + matcher( matcherIn, matcherOut, context, xml ); + } + + // Apply postFilter + if ( postFilter ) { + temp = condense( matcherOut, postMap ); + postFilter( temp, [], context, xml ); + + // Un-match failing elements by moving them back to matcherIn + i = temp.length; + while ( i-- ) { + if ( ( elem = temp[ i ] ) ) { + matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); + } + } + } + + if ( seed ) { + if ( postFinder || preFilter ) { + if ( postFinder ) { + + // Get the final matcherOut by condensing this intermediate into postFinder contexts + temp = []; + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) ) { + + // Restore matcherIn since elem is not yet a final match + temp.push( ( matcherIn[ i ] = elem ) ); + } + } + postFinder( null, ( matcherOut = [] ), temp, xml ); + } + + // Move matched elements from seed to results to keep them synchronized + i = matcherOut.length; + while ( i-- ) { + if ( ( elem = matcherOut[ i ] ) && + ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { + + seed[ temp ] = !( results[ temp ] = elem ); + } + } + } + + // Add elements to results, through postFinder if defined + } else { + matcherOut = condense( + matcherOut === results ? + matcherOut.splice( preexisting, matcherOut.length ) : + matcherOut + ); + if ( postFinder ) { + postFinder( null, results, matcherOut, xml ); + } else { + push.apply( results, matcherOut ); + } + } + } ); +} + +function matcherFromTokens( tokens ) { + var checkContext, matcher, j, + len = tokens.length, + leadingRelative = Expr.relative[ tokens[ 0 ].type ], + implicitRelative = leadingRelative || Expr.relative[ " " ], + i = leadingRelative ? 1 : 0, + + // The foundational matcher ensures that elements are reachable from top-level context(s) + matchContext = addCombinator( function( elem ) { + return elem === checkContext; + }, implicitRelative, true ), + matchAnyContext = addCombinator( function( elem ) { + return indexOf( checkContext, elem ) > -1; + }, implicitRelative, true ), + matchers = [ function( elem, context, xml ) { + var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( + ( checkContext = context ).nodeType ? + matchContext( elem, context, xml ) : + matchAnyContext( elem, context, xml ) ); + + // Avoid hanging onto element (issue #299) + checkContext = null; + return ret; + } ]; + + for ( ; i < len; i++ ) { + if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { + matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; + } else { + matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); + + // Return special upon seeing a positional matcher + if ( matcher[ expando ] ) { + + // Find the next relative operator (if any) for proper handling + j = ++i; + for ( ; j < len; j++ ) { + if ( Expr.relative[ tokens[ j ].type ] ) { + break; + } + } + return setMatcher( + i > 1 && elementMatcher( matchers ), + i > 1 && toSelector( + + // If the preceding token was a descendant combinator, insert an implicit any-element `*` + tokens + .slice( 0, i - 1 ) + .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) + ).replace( rtrim, "$1" ), + matcher, + i < j && matcherFromTokens( tokens.slice( i, j ) ), + j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), + j < len && toSelector( tokens ) + ); + } + matchers.push( matcher ); + } + } + + return elementMatcher( matchers ); +} + +function matcherFromGroupMatchers( elementMatchers, setMatchers ) { + var bySet = setMatchers.length > 0, + byElement = elementMatchers.length > 0, + superMatcher = function( seed, context, xml, results, outermost ) { + var elem, j, matcher, + matchedCount = 0, + i = "0", + unmatched = seed && [], + setMatched = [], + contextBackup = outermostContext, + + // We must always have either seed elements or outermost context + elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), + + // Use integer dirruns iff this is the outermost matcher + dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), + len = elems.length; + + if ( outermost ) { + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + outermostContext = context == document || context || outermost; + } + + // Add elements passing elementMatchers directly to results + // Support: IE<9, Safari + // Tolerate NodeList properties (IE: "length"; Safari: ) matching elements by id + for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { + if ( byElement && elem ) { + j = 0; + + // Support: IE 11+, Edge 17 - 18+ + // IE/Edge sometimes throw a "Permission denied" error when strict-comparing + // two documents; shallow comparisons work. + // eslint-disable-next-line eqeqeq + if ( !context && elem.ownerDocument != document ) { + setDocument( elem ); + xml = !documentIsHTML; + } + while ( ( matcher = elementMatchers[ j++ ] ) ) { + if ( matcher( elem, context || document, xml ) ) { + results.push( elem ); + break; + } + } + if ( outermost ) { + dirruns = dirrunsUnique; + } + } + + // Track unmatched elements for set filters + if ( bySet ) { + + // They will have gone through all possible matchers + if ( ( elem = !matcher && elem ) ) { + matchedCount--; + } + + // Lengthen the array for every element, matched or not + if ( seed ) { + unmatched.push( elem ); + } + } + } + + // `i` is now the count of elements visited above, and adding it to `matchedCount` + // makes the latter nonnegative. + matchedCount += i; + + // Apply set filters to unmatched elements + // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` + // equals `i`), unless we didn't visit _any_ elements in the above loop because we have + // no element matchers and no seed. + // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that + // case, which will result in a "00" `matchedCount` that differs from `i` but is also + // numerically zero. + if ( bySet && i !== matchedCount ) { + j = 0; + while ( ( matcher = setMatchers[ j++ ] ) ) { + matcher( unmatched, setMatched, context, xml ); + } + + if ( seed ) { + + // Reintegrate element matches to eliminate the need for sorting + if ( matchedCount > 0 ) { + while ( i-- ) { + if ( !( unmatched[ i ] || setMatched[ i ] ) ) { + setMatched[ i ] = pop.call( results ); + } + } + } + + // Discard index placeholder values to get only actual matches + setMatched = condense( setMatched ); + } + + // Add matches to results + push.apply( results, setMatched ); + + // Seedless set matches succeeding multiple successful matchers stipulate sorting + if ( outermost && !seed && setMatched.length > 0 && + ( matchedCount + setMatchers.length ) > 1 ) { + + Sizzle.uniqueSort( results ); + } + } + + // Override manipulation of globals by nested matchers + if ( outermost ) { + dirruns = dirrunsUnique; + outermostContext = contextBackup; + } + + return unmatched; + }; + + return bySet ? + markFunction( superMatcher ) : + superMatcher; +} + +compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { + var i, + setMatchers = [], + elementMatchers = [], + cached = compilerCache[ selector + " " ]; + + if ( !cached ) { + + // Generate a function of recursive functions that can be used to check each element + if ( !match ) { + match = tokenize( selector ); + } + i = match.length; + while ( i-- ) { + cached = matcherFromTokens( match[ i ] ); + if ( cached[ expando ] ) { + setMatchers.push( cached ); + } else { + elementMatchers.push( cached ); + } + } + + // Cache the compiled function + cached = compilerCache( + selector, + matcherFromGroupMatchers( elementMatchers, setMatchers ) + ); + + // Save selector and tokenization + cached.selector = selector; + } + return cached; +}; + +/** + * A low-level selection function that works with Sizzle's compiled + * selector functions + * @param {String|Function} selector A selector or a pre-compiled + * selector function built with Sizzle.compile + * @param {Element} context + * @param {Array} [results] + * @param {Array} [seed] A set of elements to match against + */ +select = Sizzle.select = function( selector, context, results, seed ) { + var i, tokens, token, type, find, + compiled = typeof selector === "function" && selector, + match = !seed && tokenize( ( selector = compiled.selector || selector ) ); + + results = results || []; + + // Try to minimize operations if there is only one selector in the list and no seed + // (the latter of which guarantees us context) + if ( match.length === 1 ) { + + // Reduce context if the leading compound selector is an ID + tokens = match[ 0 ] = match[ 0 ].slice( 0 ); + if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && + context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { + + context = ( Expr.find[ "ID" ]( token.matches[ 0 ] + .replace( runescape, funescape ), context ) || [] )[ 0 ]; + if ( !context ) { + return results; + + // Precompiled matchers will still verify ancestry, so step up a level + } else if ( compiled ) { + context = context.parentNode; + } + + selector = selector.slice( tokens.shift().value.length ); + } + + // Fetch a seed set for right-to-left matching + i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; + while ( i-- ) { + token = tokens[ i ]; + + // Abort if we hit a combinator + if ( Expr.relative[ ( type = token.type ) ] ) { + break; + } + if ( ( find = Expr.find[ type ] ) ) { + + // Search, expanding context for leading sibling combinators + if ( ( seed = find( + token.matches[ 0 ].replace( runescape, funescape ), + rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || + context + ) ) ) { + + // If seed is empty or no tokens remain, we can return early + tokens.splice( i, 1 ); + selector = seed.length && toSelector( tokens ); + if ( !selector ) { + push.apply( results, seed ); + return results; + } + + break; + } + } + } + } + + // Compile and execute a filtering function if one is not provided + // Provide `match` to avoid retokenization if we modified the selector above + ( compiled || compile( selector, match ) )( + seed, + context, + !documentIsHTML, + results, + !context || rsibling.test( selector ) && testContext( context.parentNode ) || context + ); + return results; +}; + +// One-time assignments + +// Sort stability +support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; + +// Support: Chrome 14-35+ +// Always assume duplicates if they aren't passed to the comparison function +support.detectDuplicates = !!hasDuplicate; + +// Initialize against the default document +setDocument(); + +// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) +// Detached nodes confoundingly follow *each other* +support.sortDetached = assert( function( el ) { + + // Should return 1, but returns 4 (following) + return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; +} ); + +// Support: IE<8 +// Prevent attribute/property "interpolation" +// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx +if ( !assert( function( el ) { + el.innerHTML = ""; + return el.firstChild.getAttribute( "href" ) === "#"; +} ) ) { + addHandle( "type|href|height|width", function( elem, name, isXML ) { + if ( !isXML ) { + return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); + } + } ); +} + +// Support: IE<9 +// Use defaultValue in place of getAttribute("value") +if ( !support.attributes || !assert( function( el ) { + el.innerHTML = ""; + el.firstChild.setAttribute( "value", "" ); + return el.firstChild.getAttribute( "value" ) === ""; +} ) ) { + addHandle( "value", function( elem, _name, isXML ) { + if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { + return elem.defaultValue; + } + } ); +} + +// Support: IE<9 +// Use getAttributeNode to fetch booleans when getAttribute lies +if ( !assert( function( el ) { + return el.getAttribute( "disabled" ) == null; +} ) ) { + addHandle( booleans, function( elem, name, isXML ) { + var val; + if ( !isXML ) { + return elem[ name ] === true ? name.toLowerCase() : + ( val = elem.getAttributeNode( name ) ) && val.specified ? + val.value : + null; + } + } ); +} + +return Sizzle; + +} )( window ); + + + +jQuery.find = Sizzle; +jQuery.expr = Sizzle.selectors; + +// Deprecated +jQuery.expr[ ":" ] = jQuery.expr.pseudos; +jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; +jQuery.text = Sizzle.getText; +jQuery.isXMLDoc = Sizzle.isXML; +jQuery.contains = Sizzle.contains; +jQuery.escapeSelector = Sizzle.escape; + + + + +var dir = function( elem, dir, until ) { + var matched = [], + truncate = until !== undefined; + + while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { + if ( elem.nodeType === 1 ) { + if ( truncate && jQuery( elem ).is( until ) ) { + break; + } + matched.push( elem ); + } + } + return matched; +}; + + +var siblings = function( n, elem ) { + var matched = []; + + for ( ; n; n = n.nextSibling ) { + if ( n.nodeType === 1 && n !== elem ) { + matched.push( n ); + } + } + + return matched; +}; + + +var rneedsContext = jQuery.expr.match.needsContext; + + + +function nodeName( elem, name ) { + + return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); + +} +var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); + + + +// Implement the identical functionality for filter and not +function winnow( elements, qualifier, not ) { + if ( isFunction( qualifier ) ) { + return jQuery.grep( elements, function( elem, i ) { + return !!qualifier.call( elem, i, elem ) !== not; + } ); + } + + // Single element + if ( qualifier.nodeType ) { + return jQuery.grep( elements, function( elem ) { + return ( elem === qualifier ) !== not; + } ); + } + + // Arraylike of elements (jQuery, arguments, Array) + if ( typeof qualifier !== "string" ) { + return jQuery.grep( elements, function( elem ) { + return ( indexOf.call( qualifier, elem ) > -1 ) !== not; + } ); + } + + // Filtered directly for both simple and complex selectors + return jQuery.filter( qualifier, elements, not ); +} + +jQuery.filter = function( expr, elems, not ) { + var elem = elems[ 0 ]; + + if ( not ) { + expr = ":not(" + expr + ")"; + } + + if ( elems.length === 1 && elem.nodeType === 1 ) { + return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; + } + + return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { + return elem.nodeType === 1; + } ) ); +}; + +jQuery.fn.extend( { + find: function( selector ) { + var i, ret, + len = this.length, + self = this; + + if ( typeof selector !== "string" ) { + return this.pushStack( jQuery( selector ).filter( function() { + for ( i = 0; i < len; i++ ) { + if ( jQuery.contains( self[ i ], this ) ) { + return true; + } + } + } ) ); + } + + ret = this.pushStack( [] ); + + for ( i = 0; i < len; i++ ) { + jQuery.find( selector, self[ i ], ret ); + } + + return len > 1 ? jQuery.uniqueSort( ret ) : ret; + }, + filter: function( selector ) { + return this.pushStack( winnow( this, selector || [], false ) ); + }, + not: function( selector ) { + return this.pushStack( winnow( this, selector || [], true ) ); + }, + is: function( selector ) { + return !!winnow( + this, + + // If this is a positional/relative selector, check membership in the returned set + // so $("p:first").is("p:last") won't return true for a doc with two "p". + typeof selector === "string" && rneedsContext.test( selector ) ? + jQuery( selector ) : + selector || [], + false + ).length; + } +} ); + + +// Initialize a jQuery object + + +// A central reference to the root jQuery(document) +var rootjQuery, + + // A simple way to check for HTML strings + // Prioritize #id over to avoid XSS via location.hash (#9521) + // Strict HTML recognition (#11290: must start with <) + // Shortcut simple #id case for speed + rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, + + init = jQuery.fn.init = function( selector, context, root ) { + var match, elem; + + // HANDLE: $(""), $(null), $(undefined), $(false) + if ( !selector ) { + return this; + } + + // Method init() accepts an alternate rootjQuery + // so migrate can support jQuery.sub (gh-2101) + root = root || rootjQuery; + + // Handle HTML strings + if ( typeof selector === "string" ) { + if ( selector[ 0 ] === "<" && + selector[ selector.length - 1 ] === ">" && + selector.length >= 3 ) { + + // Assume that strings that start and end with <> are HTML and skip the regex check + match = [ null, selector, null ]; + + } else { + match = rquickExpr.exec( selector ); + } + + // Match html or make sure no context is specified for #id + if ( match && ( match[ 1 ] || !context ) ) { + + // HANDLE: $(html) -> $(array) + if ( match[ 1 ] ) { + context = context instanceof jQuery ? context[ 0 ] : context; + + // Option to run scripts is true for back-compat + // Intentionally let the error be thrown if parseHTML is not present + jQuery.merge( this, jQuery.parseHTML( + match[ 1 ], + context && context.nodeType ? context.ownerDocument || context : document, + true + ) ); + + // HANDLE: $(html, props) + if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { + for ( match in context ) { + + // Properties of context are called as methods if possible + if ( isFunction( this[ match ] ) ) { + this[ match ]( context[ match ] ); + + // ...and otherwise set as attributes + } else { + this.attr( match, context[ match ] ); + } + } + } + + return this; + + // HANDLE: $(#id) + } else { + elem = document.getElementById( match[ 2 ] ); + + if ( elem ) { + + // Inject the element directly into the jQuery object + this[ 0 ] = elem; + this.length = 1; + } + return this; + } + + // HANDLE: $(expr, $(...)) + } else if ( !context || context.jquery ) { + return ( context || root ).find( selector ); + + // HANDLE: $(expr, context) + // (which is just equivalent to: $(context).find(expr) + } else { + return this.constructor( context ).find( selector ); + } + + // HANDLE: $(DOMElement) + } else if ( selector.nodeType ) { + this[ 0 ] = selector; + this.length = 1; + return this; + + // HANDLE: $(function) + // Shortcut for document ready + } else if ( isFunction( selector ) ) { + return root.ready !== undefined ? + root.ready( selector ) : + + // Execute immediately if ready is not present + selector( jQuery ); + } + + return jQuery.makeArray( selector, this ); + }; + +// Give the init function the jQuery prototype for later instantiation +init.prototype = jQuery.fn; + +// Initialize central reference +rootjQuery = jQuery( document ); + + +var rparentsprev = /^(?:parents|prev(?:Until|All))/, + + // Methods guaranteed to produce a unique set when starting from a unique set + guaranteedUnique = { + children: true, + contents: true, + next: true, + prev: true + }; + +jQuery.fn.extend( { + has: function( target ) { + var targets = jQuery( target, this ), + l = targets.length; + + return this.filter( function() { + var i = 0; + for ( ; i < l; i++ ) { + if ( jQuery.contains( this, targets[ i ] ) ) { + return true; + } + } + } ); + }, + + closest: function( selectors, context ) { + var cur, + i = 0, + l = this.length, + matched = [], + targets = typeof selectors !== "string" && jQuery( selectors ); + + // Positional selectors never match, since there's no _selection_ context + if ( !rneedsContext.test( selectors ) ) { + for ( ; i < l; i++ ) { + for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { + + // Always skip document fragments + if ( cur.nodeType < 11 && ( targets ? + targets.index( cur ) > -1 : + + // Don't pass non-elements to Sizzle + cur.nodeType === 1 && + jQuery.find.matchesSelector( cur, selectors ) ) ) { + + matched.push( cur ); + break; + } + } + } + } + + return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); + }, + + // Determine the position of an element within the set + index: function( elem ) { + + // No argument, return index in parent + if ( !elem ) { + return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; + } + + // Index in selector + if ( typeof elem === "string" ) { + return indexOf.call( jQuery( elem ), this[ 0 ] ); + } + + // Locate the position of the desired element + return indexOf.call( this, + + // If it receives a jQuery object, the first element is used + elem.jquery ? elem[ 0 ] : elem + ); + }, + + add: function( selector, context ) { + return this.pushStack( + jQuery.uniqueSort( + jQuery.merge( this.get(), jQuery( selector, context ) ) + ) + ); + }, + + addBack: function( selector ) { + return this.add( selector == null ? + this.prevObject : this.prevObject.filter( selector ) + ); + } +} ); + +function sibling( cur, dir ) { + while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} + return cur; +} + +jQuery.each( { + parent: function( elem ) { + var parent = elem.parentNode; + return parent && parent.nodeType !== 11 ? parent : null; + }, + parents: function( elem ) { + return dir( elem, "parentNode" ); + }, + parentsUntil: function( elem, _i, until ) { + return dir( elem, "parentNode", until ); + }, + next: function( elem ) { + return sibling( elem, "nextSibling" ); + }, + prev: function( elem ) { + return sibling( elem, "previousSibling" ); + }, + nextAll: function( elem ) { + return dir( elem, "nextSibling" ); + }, + prevAll: function( elem ) { + return dir( elem, "previousSibling" ); + }, + nextUntil: function( elem, _i, until ) { + return dir( elem, "nextSibling", until ); + }, + prevUntil: function( elem, _i, until ) { + return dir( elem, "previousSibling", until ); + }, + siblings: function( elem ) { + return siblings( ( elem.parentNode || {} ).firstChild, elem ); + }, + children: function( elem ) { + return siblings( elem.firstChild ); + }, + contents: function( elem ) { + if ( elem.contentDocument != null && + + // Support: IE 11+ + // elements with no `data` attribute has an object + // `contentDocument` with a `null` prototype. + getProto( elem.contentDocument ) ) { + + return elem.contentDocument; + } + + // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only + // Treat the template element as a regular one in browsers that + // don't support it. + if ( nodeName( elem, "template" ) ) { + elem = elem.content || elem; + } + + return jQuery.merge( [], elem.childNodes ); + } +}, function( name, fn ) { + jQuery.fn[ name ] = function( until, selector ) { + var matched = jQuery.map( this, fn, until ); + + if ( name.slice( -5 ) !== "Until" ) { + selector = until; + } + + if ( selector && typeof selector === "string" ) { + matched = jQuery.filter( selector, matched ); + } + + if ( this.length > 1 ) { + + // Remove duplicates + if ( !guaranteedUnique[ name ] ) { + jQuery.uniqueSort( matched ); + } + + // Reverse order for parents* and prev-derivatives + if ( rparentsprev.test( name ) ) { + matched.reverse(); + } + } + + return this.pushStack( matched ); + }; +} ); +var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); + + + +// Convert String-formatted options into Object-formatted ones +function createOptions( options ) { + var object = {}; + jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { + object[ flag ] = true; + } ); + return object; +} + +/* + * Create a callback list using the following parameters: + * + * options: an optional list of space-separated options that will change how + * the callback list behaves or a more traditional option object + * + * By default a callback list will act like an event callback list and can be + * "fired" multiple times. + * + * Possible options: + * + * once: will ensure the callback list can only be fired once (like a Deferred) + * + * memory: will keep track of previous values and will call any callback added + * after the list has been fired right away with the latest "memorized" + * values (like a Deferred) + * + * unique: will ensure a callback can only be added once (no duplicate in the list) + * + * stopOnFalse: interrupt callings when a callback returns false + * + */ +jQuery.Callbacks = function( options ) { + + // Convert options from String-formatted to Object-formatted if needed + // (we check in cache first) + options = typeof options === "string" ? + createOptions( options ) : + jQuery.extend( {}, options ); + + var // Flag to know if list is currently firing + firing, + + // Last fire value for non-forgettable lists + memory, + + // Flag to know if list was already fired + fired, + + // Flag to prevent firing + locked, + + // Actual callback list + list = [], + + // Queue of execution data for repeatable lists + queue = [], + + // Index of currently firing callback (modified by add/remove as needed) + firingIndex = -1, + + // Fire callbacks + fire = function() { + + // Enforce single-firing + locked = locked || options.once; + + // Execute callbacks for all pending executions, + // respecting firingIndex overrides and runtime changes + fired = firing = true; + for ( ; queue.length; firingIndex = -1 ) { + memory = queue.shift(); + while ( ++firingIndex < list.length ) { + + // Run callback and check for early termination + if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && + options.stopOnFalse ) { + + // Jump to end and forget the data so .add doesn't re-fire + firingIndex = list.length; + memory = false; + } + } + } + + // Forget the data if we're done with it + if ( !options.memory ) { + memory = false; + } + + firing = false; + + // Clean up if we're done firing for good + if ( locked ) { + + // Keep an empty list if we have data for future add calls + if ( memory ) { + list = []; + + // Otherwise, this object is spent + } else { + list = ""; + } + } + }, + + // Actual Callbacks object + self = { + + // Add a callback or a collection of callbacks to the list + add: function() { + if ( list ) { + + // If we have memory from a past run, we should fire after adding + if ( memory && !firing ) { + firingIndex = list.length - 1; + queue.push( memory ); + } + + ( function add( args ) { + jQuery.each( args, function( _, arg ) { + if ( isFunction( arg ) ) { + if ( !options.unique || !self.has( arg ) ) { + list.push( arg ); + } + } else if ( arg && arg.length && toType( arg ) !== "string" ) { + + // Inspect recursively + add( arg ); + } + } ); + } )( arguments ); + + if ( memory && !firing ) { + fire(); + } + } + return this; + }, + + // Remove a callback from the list + remove: function() { + jQuery.each( arguments, function( _, arg ) { + var index; + while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { + list.splice( index, 1 ); + + // Handle firing indexes + if ( index <= firingIndex ) { + firingIndex--; + } + } + } ); + return this; + }, + + // Check if a given callback is in the list. + // If no argument is given, return whether or not list has callbacks attached. + has: function( fn ) { + return fn ? + jQuery.inArray( fn, list ) > -1 : + list.length > 0; + }, + + // Remove all callbacks from the list + empty: function() { + if ( list ) { + list = []; + } + return this; + }, + + // Disable .fire and .add + // Abort any current/pending executions + // Clear all callbacks and values + disable: function() { + locked = queue = []; + list = memory = ""; + return this; + }, + disabled: function() { + return !list; + }, + + // Disable .fire + // Also disable .add unless we have memory (since it would have no effect) + // Abort any pending executions + lock: function() { + locked = queue = []; + if ( !memory && !firing ) { + list = memory = ""; + } + return this; + }, + locked: function() { + return !!locked; + }, + + // Call all callbacks with the given context and arguments + fireWith: function( context, args ) { + if ( !locked ) { + args = args || []; + args = [ context, args.slice ? args.slice() : args ]; + queue.push( args ); + if ( !firing ) { + fire(); + } + } + return this; + }, + + // Call all the callbacks with the given arguments + fire: function() { + self.fireWith( this, arguments ); + return this; + }, + + // To know if the callbacks have already been called at least once + fired: function() { + return !!fired; + } + }; + + return self; +}; + + +function Identity( v ) { + return v; +} +function Thrower( ex ) { + throw ex; +} + +function adoptValue( value, resolve, reject, noValue ) { + var method; + + try { + + // Check for promise aspect first to privilege synchronous behavior + if ( value && isFunction( ( method = value.promise ) ) ) { + method.call( value ).done( resolve ).fail( reject ); + + // Other thenables + } else if ( value && isFunction( ( method = value.then ) ) ) { + method.call( value, resolve, reject ); + + // Other non-thenables + } else { + + // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: + // * false: [ value ].slice( 0 ) => resolve( value ) + // * true: [ value ].slice( 1 ) => resolve() + resolve.apply( undefined, [ value ].slice( noValue ) ); + } + + // For Promises/A+, convert exceptions into rejections + // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in + // Deferred#then to conditionally suppress rejection. + } catch ( value ) { + + // Support: Android 4.0 only + // Strict mode functions invoked without .call/.apply get global-object context + reject.apply( undefined, [ value ] ); + } +} + +jQuery.extend( { + + Deferred: function( func ) { + var tuples = [ + + // action, add listener, callbacks, + // ... .then handlers, argument index, [final state] + [ "notify", "progress", jQuery.Callbacks( "memory" ), + jQuery.Callbacks( "memory" ), 2 ], + [ "resolve", "done", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 0, "resolved" ], + [ "reject", "fail", jQuery.Callbacks( "once memory" ), + jQuery.Callbacks( "once memory" ), 1, "rejected" ] + ], + state = "pending", + promise = { + state: function() { + return state; + }, + always: function() { + deferred.done( arguments ).fail( arguments ); + return this; + }, + "catch": function( fn ) { + return promise.then( null, fn ); + }, + + // Keep pipe for back-compat + pipe: function( /* fnDone, fnFail, fnProgress */ ) { + var fns = arguments; + + return jQuery.Deferred( function( newDefer ) { + jQuery.each( tuples, function( _i, tuple ) { + + // Map tuples (progress, done, fail) to arguments (done, fail, progress) + var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; + + // deferred.progress(function() { bind to newDefer or newDefer.notify }) + // deferred.done(function() { bind to newDefer or newDefer.resolve }) + // deferred.fail(function() { bind to newDefer or newDefer.reject }) + deferred[ tuple[ 1 ] ]( function() { + var returned = fn && fn.apply( this, arguments ); + if ( returned && isFunction( returned.promise ) ) { + returned.promise() + .progress( newDefer.notify ) + .done( newDefer.resolve ) + .fail( newDefer.reject ); + } else { + newDefer[ tuple[ 0 ] + "With" ]( + this, + fn ? [ returned ] : arguments + ); + } + } ); + } ); + fns = null; + } ).promise(); + }, + then: function( onFulfilled, onRejected, onProgress ) { + var maxDepth = 0; + function resolve( depth, deferred, handler, special ) { + return function() { + var that = this, + args = arguments, + mightThrow = function() { + var returned, then; + + // Support: Promises/A+ section 2.3.3.3.3 + // https://promisesaplus.com/#point-59 + // Ignore double-resolution attempts + if ( depth < maxDepth ) { + return; + } + + returned = handler.apply( that, args ); + + // Support: Promises/A+ section 2.3.1 + // https://promisesaplus.com/#point-48 + if ( returned === deferred.promise() ) { + throw new TypeError( "Thenable self-resolution" ); + } + + // Support: Promises/A+ sections 2.3.3.1, 3.5 + // https://promisesaplus.com/#point-54 + // https://promisesaplus.com/#point-75 + // Retrieve `then` only once + then = returned && + + // Support: Promises/A+ section 2.3.4 + // https://promisesaplus.com/#point-64 + // Only check objects and functions for thenability + ( typeof returned === "object" || + typeof returned === "function" ) && + returned.then; + + // Handle a returned thenable + if ( isFunction( then ) ) { + + // Special processors (notify) just wait for resolution + if ( special ) { + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ) + ); + + // Normal processors (resolve) also hook into progress + } else { + + // ...and disregard older resolution values + maxDepth++; + + then.call( + returned, + resolve( maxDepth, deferred, Identity, special ), + resolve( maxDepth, deferred, Thrower, special ), + resolve( maxDepth, deferred, Identity, + deferred.notifyWith ) + ); + } + + // Handle all other returned values + } else { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Identity ) { + that = undefined; + args = [ returned ]; + } + + // Process the value(s) + // Default process is resolve + ( special || deferred.resolveWith )( that, args ); + } + }, + + // Only normal processors (resolve) catch and reject exceptions + process = special ? + mightThrow : + function() { + try { + mightThrow(); + } catch ( e ) { + + if ( jQuery.Deferred.exceptionHook ) { + jQuery.Deferred.exceptionHook( e, + process.stackTrace ); + } + + // Support: Promises/A+ section 2.3.3.3.4.1 + // https://promisesaplus.com/#point-61 + // Ignore post-resolution exceptions + if ( depth + 1 >= maxDepth ) { + + // Only substitute handlers pass on context + // and multiple values (non-spec behavior) + if ( handler !== Thrower ) { + that = undefined; + args = [ e ]; + } + + deferred.rejectWith( that, args ); + } + } + }; + + // Support: Promises/A+ section 2.3.3.3.1 + // https://promisesaplus.com/#point-57 + // Re-resolve promises immediately to dodge false rejection from + // subsequent errors + if ( depth ) { + process(); + } else { + + // Call an optional hook to record the stack, in case of exception + // since it's otherwise lost when execution goes async + if ( jQuery.Deferred.getStackHook ) { + process.stackTrace = jQuery.Deferred.getStackHook(); + } + window.setTimeout( process ); + } + }; + } + + return jQuery.Deferred( function( newDefer ) { + + // progress_handlers.add( ... ) + tuples[ 0 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onProgress ) ? + onProgress : + Identity, + newDefer.notifyWith + ) + ); + + // fulfilled_handlers.add( ... ) + tuples[ 1 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onFulfilled ) ? + onFulfilled : + Identity + ) + ); + + // rejected_handlers.add( ... ) + tuples[ 2 ][ 3 ].add( + resolve( + 0, + newDefer, + isFunction( onRejected ) ? + onRejected : + Thrower + ) + ); + } ).promise(); + }, + + // Get a promise for this deferred + // If obj is provided, the promise aspect is added to the object + promise: function( obj ) { + return obj != null ? jQuery.extend( obj, promise ) : promise; + } + }, + deferred = {}; + + // Add list-specific methods + jQuery.each( tuples, function( i, tuple ) { + var list = tuple[ 2 ], + stateString = tuple[ 5 ]; + + // promise.progress = list.add + // promise.done = list.add + // promise.fail = list.add + promise[ tuple[ 1 ] ] = list.add; + + // Handle state + if ( stateString ) { + list.add( + function() { + + // state = "resolved" (i.e., fulfilled) + // state = "rejected" + state = stateString; + }, + + // rejected_callbacks.disable + // fulfilled_callbacks.disable + tuples[ 3 - i ][ 2 ].disable, + + // rejected_handlers.disable + // fulfilled_handlers.disable + tuples[ 3 - i ][ 3 ].disable, + + // progress_callbacks.lock + tuples[ 0 ][ 2 ].lock, + + // progress_handlers.lock + tuples[ 0 ][ 3 ].lock + ); + } + + // progress_handlers.fire + // fulfilled_handlers.fire + // rejected_handlers.fire + list.add( tuple[ 3 ].fire ); + + // deferred.notify = function() { deferred.notifyWith(...) } + // deferred.resolve = function() { deferred.resolveWith(...) } + // deferred.reject = function() { deferred.rejectWith(...) } + deferred[ tuple[ 0 ] ] = function() { + deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); + return this; + }; + + // deferred.notifyWith = list.fireWith + // deferred.resolveWith = list.fireWith + // deferred.rejectWith = list.fireWith + deferred[ tuple[ 0 ] + "With" ] = list.fireWith; + } ); + + // Make the deferred a promise + promise.promise( deferred ); + + // Call given func if any + if ( func ) { + func.call( deferred, deferred ); + } + + // All done! + return deferred; + }, + + // Deferred helper + when: function( singleValue ) { + var + + // count of uncompleted subordinates + remaining = arguments.length, + + // count of unprocessed arguments + i = remaining, + + // subordinate fulfillment data + resolveContexts = Array( i ), + resolveValues = slice.call( arguments ), + + // the primary Deferred + primary = jQuery.Deferred(), + + // subordinate callback factory + updateFunc = function( i ) { + return function( value ) { + resolveContexts[ i ] = this; + resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; + if ( !( --remaining ) ) { + primary.resolveWith( resolveContexts, resolveValues ); + } + }; + }; + + // Single- and empty arguments are adopted like Promise.resolve + if ( remaining <= 1 ) { + adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, + !remaining ); + + // Use .then() to unwrap secondary thenables (cf. gh-3000) + if ( primary.state() === "pending" || + isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { + + return primary.then(); + } + } + + // Multiple arguments are aggregated like Promise.all array elements + while ( i-- ) { + adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); + } + + return primary.promise(); + } +} ); + + +// These usually indicate a programmer mistake during development, +// warn about them ASAP rather than swallowing them by default. +var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; + +jQuery.Deferred.exceptionHook = function( error, stack ) { + + // Support: IE 8 - 9 only + // Console exists when dev tools are open, which can happen at any time + if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { + window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); + } +}; + + + + +jQuery.readyException = function( error ) { + window.setTimeout( function() { + throw error; + } ); +}; + + + + +// The deferred used on DOM ready +var readyList = jQuery.Deferred(); + +jQuery.fn.ready = function( fn ) { + + readyList + .then( fn ) + + // Wrap jQuery.readyException in a function so that the lookup + // happens at the time of error handling instead of callback + // registration. + .catch( function( error ) { + jQuery.readyException( error ); + } ); + + return this; +}; + +jQuery.extend( { + + // Is the DOM ready to be used? Set to true once it occurs. + isReady: false, + + // A counter to track how many items to wait for before + // the ready event fires. See #6781 + readyWait: 1, + + // Handle when the DOM is ready + ready: function( wait ) { + + // Abort if there are pending holds or we're already ready + if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { + return; + } + + // Remember that the DOM is ready + jQuery.isReady = true; + + // If a normal DOM Ready event fired, decrement, and wait if need be + if ( wait !== true && --jQuery.readyWait > 0 ) { + return; + } + + // If there are functions bound, to execute + readyList.resolveWith( document, [ jQuery ] ); + } +} ); + +jQuery.ready.then = readyList.then; + +// The ready event handler and self cleanup method +function completed() { + document.removeEventListener( "DOMContentLoaded", completed ); + window.removeEventListener( "load", completed ); + jQuery.ready(); +} + +// Catch cases where $(document).ready() is called +// after the browser event has already occurred. +// Support: IE <=9 - 10 only +// Older IE sometimes signals "interactive" too soon +if ( document.readyState === "complete" || + ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { + + // Handle it asynchronously to allow scripts the opportunity to delay ready + window.setTimeout( jQuery.ready ); + +} else { + + // Use the handy event callback + document.addEventListener( "DOMContentLoaded", completed ); + + // A fallback to window.onload, that will always work + window.addEventListener( "load", completed ); +} + + + + +// Multifunctional method to get and set values of a collection +// The value/s can optionally be executed if it's a function +var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { + var i = 0, + len = elems.length, + bulk = key == null; + + // Sets many values + if ( toType( key ) === "object" ) { + chainable = true; + for ( i in key ) { + access( elems, fn, i, key[ i ], true, emptyGet, raw ); + } + + // Sets one value + } else if ( value !== undefined ) { + chainable = true; + + if ( !isFunction( value ) ) { + raw = true; + } + + if ( bulk ) { + + // Bulk operations run against the entire set + if ( raw ) { + fn.call( elems, value ); + fn = null; + + // ...except when executing function values + } else { + bulk = fn; + fn = function( elem, _key, value ) { + return bulk.call( jQuery( elem ), value ); + }; + } + } + + if ( fn ) { + for ( ; i < len; i++ ) { + fn( + elems[ i ], key, raw ? + value : + value.call( elems[ i ], i, fn( elems[ i ], key ) ) + ); + } + } + } + + if ( chainable ) { + return elems; + } + + // Gets + if ( bulk ) { + return fn.call( elems ); + } + + return len ? fn( elems[ 0 ], key ) : emptyGet; +}; + + +// Matches dashed string for camelizing +var rmsPrefix = /^-ms-/, + rdashAlpha = /-([a-z])/g; + +// Used by camelCase as callback to replace() +function fcamelCase( _all, letter ) { + return letter.toUpperCase(); +} + +// Convert dashed to camelCase; used by the css and data modules +// Support: IE <=9 - 11, Edge 12 - 15 +// Microsoft forgot to hump their vendor prefix (#9572) +function camelCase( string ) { + return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); +} +var acceptData = function( owner ) { + + // Accepts only: + // - Node + // - Node.ELEMENT_NODE + // - Node.DOCUMENT_NODE + // - Object + // - Any + return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); +}; + + + + +function Data() { + this.expando = jQuery.expando + Data.uid++; +} + +Data.uid = 1; + +Data.prototype = { + + cache: function( owner ) { + + // Check if the owner object already has a cache + var value = owner[ this.expando ]; + + // If not, create one + if ( !value ) { + value = {}; + + // We can accept data for non-element nodes in modern browsers, + // but we should not, see #8335. + // Always return an empty object. + if ( acceptData( owner ) ) { + + // If it is a node unlikely to be stringify-ed or looped over + // use plain assignment + if ( owner.nodeType ) { + owner[ this.expando ] = value; + + // Otherwise secure it in a non-enumerable property + // configurable must be true to allow the property to be + // deleted when data is removed + } else { + Object.defineProperty( owner, this.expando, { + value: value, + configurable: true + } ); + } + } + } + + return value; + }, + set: function( owner, data, value ) { + var prop, + cache = this.cache( owner ); + + // Handle: [ owner, key, value ] args + // Always use camelCase key (gh-2257) + if ( typeof data === "string" ) { + cache[ camelCase( data ) ] = value; + + // Handle: [ owner, { properties } ] args + } else { + + // Copy the properties one-by-one to the cache object + for ( prop in data ) { + cache[ camelCase( prop ) ] = data[ prop ]; + } + } + return cache; + }, + get: function( owner, key ) { + return key === undefined ? + this.cache( owner ) : + + // Always use camelCase key (gh-2257) + owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; + }, + access: function( owner, key, value ) { + + // In cases where either: + // + // 1. No key was specified + // 2. A string key was specified, but no value provided + // + // Take the "read" path and allow the get method to determine + // which value to return, respectively either: + // + // 1. The entire cache object + // 2. The data stored at the key + // + if ( key === undefined || + ( ( key && typeof key === "string" ) && value === undefined ) ) { + + return this.get( owner, key ); + } + + // When the key is not a string, or both a key and value + // are specified, set or extend (existing objects) with either: + // + // 1. An object of properties + // 2. A key and value + // + this.set( owner, key, value ); + + // Since the "set" path can have two possible entry points + // return the expected data based on which path was taken[*] + return value !== undefined ? value : key; + }, + remove: function( owner, key ) { + var i, + cache = owner[ this.expando ]; + + if ( cache === undefined ) { + return; + } + + if ( key !== undefined ) { + + // Support array or space separated string of keys + if ( Array.isArray( key ) ) { + + // If key is an array of keys... + // We always set camelCase keys, so remove that. + key = key.map( camelCase ); + } else { + key = camelCase( key ); + + // If a key with the spaces exists, use it. + // Otherwise, create an array by matching non-whitespace + key = key in cache ? + [ key ] : + ( key.match( rnothtmlwhite ) || [] ); + } + + i = key.length; + + while ( i-- ) { + delete cache[ key[ i ] ]; + } + } + + // Remove the expando if there's no more data + if ( key === undefined || jQuery.isEmptyObject( cache ) ) { + + // Support: Chrome <=35 - 45 + // Webkit & Blink performance suffers when deleting properties + // from DOM nodes, so set to undefined instead + // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) + if ( owner.nodeType ) { + owner[ this.expando ] = undefined; + } else { + delete owner[ this.expando ]; + } + } + }, + hasData: function( owner ) { + var cache = owner[ this.expando ]; + return cache !== undefined && !jQuery.isEmptyObject( cache ); + } +}; +var dataPriv = new Data(); + +var dataUser = new Data(); + + + +// Implementation Summary +// +// 1. Enforce API surface and semantic compatibility with 1.9.x branch +// 2. Improve the module's maintainability by reducing the storage +// paths to a single mechanism. +// 3. Use the same single mechanism to support "private" and "user" data. +// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) +// 5. Avoid exposing implementation details on user objects (eg. expando properties) +// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 + +var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, + rmultiDash = /[A-Z]/g; + +function getData( data ) { + if ( data === "true" ) { + return true; + } + + if ( data === "false" ) { + return false; + } + + if ( data === "null" ) { + return null; + } + + // Only convert to a number if it doesn't change the string + if ( data === +data + "" ) { + return +data; + } + + if ( rbrace.test( data ) ) { + return JSON.parse( data ); + } + + return data; +} + +function dataAttr( elem, key, data ) { + var name; + + // If nothing was found internally, try to fetch any + // data from the HTML5 data-* attribute + if ( data === undefined && elem.nodeType === 1 ) { + name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); + data = elem.getAttribute( name ); + + if ( typeof data === "string" ) { + try { + data = getData( data ); + } catch ( e ) {} + + // Make sure we set the data so it isn't changed later + dataUser.set( elem, key, data ); + } else { + data = undefined; + } + } + return data; +} + +jQuery.extend( { + hasData: function( elem ) { + return dataUser.hasData( elem ) || dataPriv.hasData( elem ); + }, + + data: function( elem, name, data ) { + return dataUser.access( elem, name, data ); + }, + + removeData: function( elem, name ) { + dataUser.remove( elem, name ); + }, + + // TODO: Now that all calls to _data and _removeData have been replaced + // with direct calls to dataPriv methods, these can be deprecated. + _data: function( elem, name, data ) { + return dataPriv.access( elem, name, data ); + }, + + _removeData: function( elem, name ) { + dataPriv.remove( elem, name ); + } +} ); + +jQuery.fn.extend( { + data: function( key, value ) { + var i, name, data, + elem = this[ 0 ], + attrs = elem && elem.attributes; + + // Gets all values + if ( key === undefined ) { + if ( this.length ) { + data = dataUser.get( elem ); + + if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { + i = attrs.length; + while ( i-- ) { + + // Support: IE 11 only + // The attrs elements can be null (#14894) + if ( attrs[ i ] ) { + name = attrs[ i ].name; + if ( name.indexOf( "data-" ) === 0 ) { + name = camelCase( name.slice( 5 ) ); + dataAttr( elem, name, data[ name ] ); + } + } + } + dataPriv.set( elem, "hasDataAttrs", true ); + } + } + + return data; + } + + // Sets multiple values + if ( typeof key === "object" ) { + return this.each( function() { + dataUser.set( this, key ); + } ); + } + + return access( this, function( value ) { + var data; + + // The calling jQuery object (element matches) is not empty + // (and therefore has an element appears at this[ 0 ]) and the + // `value` parameter was not undefined. An empty jQuery object + // will result in `undefined` for elem = this[ 0 ] which will + // throw an exception if an attempt to read a data cache is made. + if ( elem && value === undefined ) { + + // Attempt to get data from the cache + // The key will always be camelCased in Data + data = dataUser.get( elem, key ); + if ( data !== undefined ) { + return data; + } + + // Attempt to "discover" the data in + // HTML5 custom data-* attrs + data = dataAttr( elem, key ); + if ( data !== undefined ) { + return data; + } + + // We tried really hard, but the data doesn't exist. + return; + } + + // Set the data... + this.each( function() { + + // We always store the camelCased key + dataUser.set( this, key, value ); + } ); + }, null, value, arguments.length > 1, null, true ); + }, + + removeData: function( key ) { + return this.each( function() { + dataUser.remove( this, key ); + } ); + } +} ); + + +jQuery.extend( { + queue: function( elem, type, data ) { + var queue; + + if ( elem ) { + type = ( type || "fx" ) + "queue"; + queue = dataPriv.get( elem, type ); + + // Speed up dequeue by getting out quickly if this is just a lookup + if ( data ) { + if ( !queue || Array.isArray( data ) ) { + queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); + } else { + queue.push( data ); + } + } + return queue || []; + } + }, + + dequeue: function( elem, type ) { + type = type || "fx"; + + var queue = jQuery.queue( elem, type ), + startLength = queue.length, + fn = queue.shift(), + hooks = jQuery._queueHooks( elem, type ), + next = function() { + jQuery.dequeue( elem, type ); + }; + + // If the fx queue is dequeued, always remove the progress sentinel + if ( fn === "inprogress" ) { + fn = queue.shift(); + startLength--; + } + + if ( fn ) { + + // Add a progress sentinel to prevent the fx queue from being + // automatically dequeued + if ( type === "fx" ) { + queue.unshift( "inprogress" ); + } + + // Clear up the last queue stop function + delete hooks.stop; + fn.call( elem, next, hooks ); + } + + if ( !startLength && hooks ) { + hooks.empty.fire(); + } + }, + + // Not public - generate a queueHooks object, or return the current one + _queueHooks: function( elem, type ) { + var key = type + "queueHooks"; + return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { + empty: jQuery.Callbacks( "once memory" ).add( function() { + dataPriv.remove( elem, [ type + "queue", key ] ); + } ) + } ); + } +} ); + +jQuery.fn.extend( { + queue: function( type, data ) { + var setter = 2; + + if ( typeof type !== "string" ) { + data = type; + type = "fx"; + setter--; + } + + if ( arguments.length < setter ) { + return jQuery.queue( this[ 0 ], type ); + } + + return data === undefined ? + this : + this.each( function() { + var queue = jQuery.queue( this, type, data ); + + // Ensure a hooks for this queue + jQuery._queueHooks( this, type ); + + if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { + jQuery.dequeue( this, type ); + } + } ); + }, + dequeue: function( type ) { + return this.each( function() { + jQuery.dequeue( this, type ); + } ); + }, + clearQueue: function( type ) { + return this.queue( type || "fx", [] ); + }, + + // Get a promise resolved when queues of a certain type + // are emptied (fx is the type by default) + promise: function( type, obj ) { + var tmp, + count = 1, + defer = jQuery.Deferred(), + elements = this, + i = this.length, + resolve = function() { + if ( !( --count ) ) { + defer.resolveWith( elements, [ elements ] ); + } + }; + + if ( typeof type !== "string" ) { + obj = type; + type = undefined; + } + type = type || "fx"; + + while ( i-- ) { + tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); + if ( tmp && tmp.empty ) { + count++; + tmp.empty.add( resolve ); + } + } + resolve(); + return defer.promise( obj ); + } +} ); +var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; + +var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); + + +var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; + +var documentElement = document.documentElement; + + + + var isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ); + }, + composed = { composed: true }; + + // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only + // Check attachment across shadow DOM boundaries when possible (gh-3504) + // Support: iOS 10.0-10.2 only + // Early iOS 10 versions support `attachShadow` but not `getRootNode`, + // leading to errors. We need to check for `getRootNode`. + if ( documentElement.getRootNode ) { + isAttached = function( elem ) { + return jQuery.contains( elem.ownerDocument, elem ) || + elem.getRootNode( composed ) === elem.ownerDocument; + }; + } +var isHiddenWithinTree = function( elem, el ) { + + // isHiddenWithinTree might be called from jQuery#filter function; + // in that case, element will be second argument + elem = el || elem; + + // Inline style trumps all + return elem.style.display === "none" || + elem.style.display === "" && + + // Otherwise, check computed style + // Support: Firefox <=43 - 45 + // Disconnected elements can have computed display: none, so first confirm that elem is + // in the document. + isAttached( elem ) && + + jQuery.css( elem, "display" ) === "none"; + }; + + + +function adjustCSS( elem, prop, valueParts, tween ) { + var adjusted, scale, + maxIterations = 20, + currentValue = tween ? + function() { + return tween.cur(); + } : + function() { + return jQuery.css( elem, prop, "" ); + }, + initial = currentValue(), + unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), + + // Starting value computation is required for potential unit mismatches + initialInUnit = elem.nodeType && + ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && + rcssNum.exec( jQuery.css( elem, prop ) ); + + if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { + + // Support: Firefox <=54 + // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) + initial = initial / 2; + + // Trust units reported by jQuery.css + unit = unit || initialInUnit[ 3 ]; + + // Iteratively approximate from a nonzero starting point + initialInUnit = +initial || 1; + + while ( maxIterations-- ) { + + // Evaluate and update our best guess (doubling guesses that zero out). + // Finish if the scale equals or crosses 1 (making the old*new product non-positive). + jQuery.style( elem, prop, initialInUnit + unit ); + if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { + maxIterations = 0; + } + initialInUnit = initialInUnit / scale; + + } + + initialInUnit = initialInUnit * 2; + jQuery.style( elem, prop, initialInUnit + unit ); + + // Make sure we update the tween properties later on + valueParts = valueParts || []; + } + + if ( valueParts ) { + initialInUnit = +initialInUnit || +initial || 0; + + // Apply relative offset (+=/-=) if specified + adjusted = valueParts[ 1 ] ? + initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : + +valueParts[ 2 ]; + if ( tween ) { + tween.unit = unit; + tween.start = initialInUnit; + tween.end = adjusted; + } + } + return adjusted; +} + + +var defaultDisplayMap = {}; + +function getDefaultDisplay( elem ) { + var temp, + doc = elem.ownerDocument, + nodeName = elem.nodeName, + display = defaultDisplayMap[ nodeName ]; + + if ( display ) { + return display; + } + + temp = doc.body.appendChild( doc.createElement( nodeName ) ); + display = jQuery.css( temp, "display" ); + + temp.parentNode.removeChild( temp ); + + if ( display === "none" ) { + display = "block"; + } + defaultDisplayMap[ nodeName ] = display; + + return display; +} + +function showHide( elements, show ) { + var display, elem, + values = [], + index = 0, + length = elements.length; + + // Determine new display value for elements that need to change + for ( ; index < length; index++ ) { + elem = elements[ index ]; + if ( !elem.style ) { + continue; + } + + display = elem.style.display; + if ( show ) { + + // Since we force visibility upon cascade-hidden elements, an immediate (and slow) + // check is required in this first loop unless we have a nonempty display value (either + // inline or about-to-be-restored) + if ( display === "none" ) { + values[ index ] = dataPriv.get( elem, "display" ) || null; + if ( !values[ index ] ) { + elem.style.display = ""; + } + } + if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { + values[ index ] = getDefaultDisplay( elem ); + } + } else { + if ( display !== "none" ) { + values[ index ] = "none"; + + // Remember what we're overwriting + dataPriv.set( elem, "display", display ); + } + } + } + + // Set the display of the elements in a second loop to avoid constant reflow + for ( index = 0; index < length; index++ ) { + if ( values[ index ] != null ) { + elements[ index ].style.display = values[ index ]; + } + } + + return elements; +} + +jQuery.fn.extend( { + show: function() { + return showHide( this, true ); + }, + hide: function() { + return showHide( this ); + }, + toggle: function( state ) { + if ( typeof state === "boolean" ) { + return state ? this.show() : this.hide(); + } + + return this.each( function() { + if ( isHiddenWithinTree( this ) ) { + jQuery( this ).show(); + } else { + jQuery( this ).hide(); + } + } ); + } +} ); +var rcheckableType = ( /^(?:checkbox|radio)$/i ); + +var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); + +var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); + + + +( function() { + var fragment = document.createDocumentFragment(), + div = fragment.appendChild( document.createElement( "div" ) ), + input = document.createElement( "input" ); + + // Support: Android 4.0 - 4.3 only + // Check state lost if the name is set (#11217) + // Support: Windows Web Apps (WWA) + // `name` and `type` must use .setAttribute for WWA (#14901) + input.setAttribute( "type", "radio" ); + input.setAttribute( "checked", "checked" ); + input.setAttribute( "name", "t" ); + + div.appendChild( input ); + + // Support: Android <=4.1 only + // Older WebKit doesn't clone checked state correctly in fragments + support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; + + // Support: IE <=11 only + // Make sure textarea (and checkbox) defaultValue is properly cloned + div.innerHTML = ""; + support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; + + // Support: IE <=9 only + // IE <=9 replaces "; + support.option = !!div.lastChild; +} )(); + + +// We have to close these tags to support XHTML (#13200) +var wrapMap = { + + // XHTML parsers do not magically insert elements in the + // same way that tag soup parsers do. So we cannot shorten + // this by omitting or other required elements. + thead: [ 1, "", "
" ], + col: [ 2, "", "
" ], + tr: [ 2, "", "
" ], + td: [ 3, "", "
" ], + + _default: [ 0, "", "" ] +}; + +wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; +wrapMap.th = wrapMap.td; + +// Support: IE <=9 only +if ( !support.option ) { + wrapMap.optgroup = wrapMap.option = [ 1, "" ]; +} + + +function getAll( context, tag ) { + + // Support: IE <=9 - 11 only + // Use typeof to avoid zero-argument method invocation on host objects (#15151) + var ret; + + if ( typeof context.getElementsByTagName !== "undefined" ) { + ret = context.getElementsByTagName( tag || "*" ); + + } else if ( typeof context.querySelectorAll !== "undefined" ) { + ret = context.querySelectorAll( tag || "*" ); + + } else { + ret = []; + } + + if ( tag === undefined || tag && nodeName( context, tag ) ) { + return jQuery.merge( [ context ], ret ); + } + + return ret; +} + + +// Mark scripts as having already been evaluated +function setGlobalEval( elems, refElements ) { + var i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + dataPriv.set( + elems[ i ], + "globalEval", + !refElements || dataPriv.get( refElements[ i ], "globalEval" ) + ); + } +} + + +var rhtml = /<|&#?\w+;/; + +function buildFragment( elems, context, scripts, selection, ignored ) { + var elem, tmp, tag, wrap, attached, j, + fragment = context.createDocumentFragment(), + nodes = [], + i = 0, + l = elems.length; + + for ( ; i < l; i++ ) { + elem = elems[ i ]; + + if ( elem || elem === 0 ) { + + // Add nodes directly + if ( toType( elem ) === "object" ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); + + // Convert non-html into a text node + } else if ( !rhtml.test( elem ) ) { + nodes.push( context.createTextNode( elem ) ); + + // Convert html into DOM nodes + } else { + tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); + + // Deserialize a standard representation + tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); + wrap = wrapMap[ tag ] || wrapMap._default; + tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; + + // Descend through wrappers to the right content + j = wrap[ 0 ]; + while ( j-- ) { + tmp = tmp.lastChild; + } + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( nodes, tmp.childNodes ); + + // Remember the top-level container + tmp = fragment.firstChild; + + // Ensure the created nodes are orphaned (#12392) + tmp.textContent = ""; + } + } + } + + // Remove wrapper from fragment + fragment.textContent = ""; + + i = 0; + while ( ( elem = nodes[ i++ ] ) ) { + + // Skip elements already in the context collection (trac-4087) + if ( selection && jQuery.inArray( elem, selection ) > -1 ) { + if ( ignored ) { + ignored.push( elem ); + } + continue; + } + + attached = isAttached( elem ); + + // Append to fragment + tmp = getAll( fragment.appendChild( elem ), "script" ); + + // Preserve script evaluation history + if ( attached ) { + setGlobalEval( tmp ); + } + + // Capture executables + if ( scripts ) { + j = 0; + while ( ( elem = tmp[ j++ ] ) ) { + if ( rscriptType.test( elem.type || "" ) ) { + scripts.push( elem ); + } + } + } + } + + return fragment; +} + + +var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; + +function returnTrue() { + return true; +} + +function returnFalse() { + return false; +} + +// Support: IE <=9 - 11+ +// focus() and blur() are asynchronous, except when they are no-op. +// So expect focus to be synchronous when the element is already active, +// and blur to be synchronous when the element is not already active. +// (focus and blur are always synchronous in other supported browsers, +// this just defines when we can count on it). +function expectSync( elem, type ) { + return ( elem === safeActiveElement() ) === ( type === "focus" ); +} + +// Support: IE <=9 only +// Accessing document.activeElement can throw unexpectedly +// https://bugs.jquery.com/ticket/13393 +function safeActiveElement() { + try { + return document.activeElement; + } catch ( err ) { } +} + +function on( elem, types, selector, data, fn, one ) { + var origFn, type; + + // Types can be a map of types/handlers + if ( typeof types === "object" ) { + + // ( types-Object, selector, data ) + if ( typeof selector !== "string" ) { + + // ( types-Object, data ) + data = data || selector; + selector = undefined; + } + for ( type in types ) { + on( elem, type, selector, data, types[ type ], one ); + } + return elem; + } + + if ( data == null && fn == null ) { + + // ( types, fn ) + fn = selector; + data = selector = undefined; + } else if ( fn == null ) { + if ( typeof selector === "string" ) { + + // ( types, selector, fn ) + fn = data; + data = undefined; + } else { + + // ( types, data, fn ) + fn = data; + data = selector; + selector = undefined; + } + } + if ( fn === false ) { + fn = returnFalse; + } else if ( !fn ) { + return elem; + } + + if ( one === 1 ) { + origFn = fn; + fn = function( event ) { + + // Can use an empty set, since event contains the info + jQuery().off( event ); + return origFn.apply( this, arguments ); + }; + + // Use same guid so caller can remove using origFn + fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); + } + return elem.each( function() { + jQuery.event.add( this, types, fn, data, selector ); + } ); +} + +/* + * Helper functions for managing events -- not part of the public interface. + * Props to Dean Edwards' addEvent library for many of the ideas. + */ +jQuery.event = { + + global: {}, + + add: function( elem, types, handler, data, selector ) { + + var handleObjIn, eventHandle, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.get( elem ); + + // Only attach events to objects that accept data + if ( !acceptData( elem ) ) { + return; + } + + // Caller can pass in an object of custom data in lieu of the handler + if ( handler.handler ) { + handleObjIn = handler; + handler = handleObjIn.handler; + selector = handleObjIn.selector; + } + + // Ensure that invalid selectors throw exceptions at attach time + // Evaluate against documentElement in case elem is a non-element node (e.g., document) + if ( selector ) { + jQuery.find.matchesSelector( documentElement, selector ); + } + + // Make sure that the handler has a unique ID, used to find/remove it later + if ( !handler.guid ) { + handler.guid = jQuery.guid++; + } + + // Init the element's event structure and main handler, if this is the first + if ( !( events = elemData.events ) ) { + events = elemData.events = Object.create( null ); + } + if ( !( eventHandle = elemData.handle ) ) { + eventHandle = elemData.handle = function( e ) { + + // Discard the second event of a jQuery.event.trigger() and + // when an event is called after a page has unloaded + return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? + jQuery.event.dispatch.apply( elem, arguments ) : undefined; + }; + } + + // Handle multiple events separated by a space + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // There *must* be a type, no attaching namespace-only handlers + if ( !type ) { + continue; + } + + // If event changes its type, use the special event handlers for the changed type + special = jQuery.event.special[ type ] || {}; + + // If selector defined, determine special event api type, otherwise given type + type = ( selector ? special.delegateType : special.bindType ) || type; + + // Update special based on newly reset type + special = jQuery.event.special[ type ] || {}; + + // handleObj is passed to all event handlers + handleObj = jQuery.extend( { + type: type, + origType: origType, + data: data, + handler: handler, + guid: handler.guid, + selector: selector, + needsContext: selector && jQuery.expr.match.needsContext.test( selector ), + namespace: namespaces.join( "." ) + }, handleObjIn ); + + // Init the event handler queue if we're the first + if ( !( handlers = events[ type ] ) ) { + handlers = events[ type ] = []; + handlers.delegateCount = 0; + + // Only use addEventListener if the special events handler returns false + if ( !special.setup || + special.setup.call( elem, data, namespaces, eventHandle ) === false ) { + + if ( elem.addEventListener ) { + elem.addEventListener( type, eventHandle ); + } + } + } + + if ( special.add ) { + special.add.call( elem, handleObj ); + + if ( !handleObj.handler.guid ) { + handleObj.handler.guid = handler.guid; + } + } + + // Add to the element's handler list, delegates in front + if ( selector ) { + handlers.splice( handlers.delegateCount++, 0, handleObj ); + } else { + handlers.push( handleObj ); + } + + // Keep track of which events have ever been used, for event optimization + jQuery.event.global[ type ] = true; + } + + }, + + // Detach an event or set of events from an element + remove: function( elem, types, handler, selector, mappedTypes ) { + + var j, origCount, tmp, + events, t, handleObj, + special, handlers, type, namespaces, origType, + elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); + + if ( !elemData || !( events = elemData.events ) ) { + return; + } + + // Once for each type.namespace in types; type may be omitted + types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; + t = types.length; + while ( t-- ) { + tmp = rtypenamespace.exec( types[ t ] ) || []; + type = origType = tmp[ 1 ]; + namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); + + // Unbind all events (on this namespace, if provided) for the element + if ( !type ) { + for ( type in events ) { + jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); + } + continue; + } + + special = jQuery.event.special[ type ] || {}; + type = ( selector ? special.delegateType : special.bindType ) || type; + handlers = events[ type ] || []; + tmp = tmp[ 2 ] && + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); + + // Remove matching events + origCount = j = handlers.length; + while ( j-- ) { + handleObj = handlers[ j ]; + + if ( ( mappedTypes || origType === handleObj.origType ) && + ( !handler || handler.guid === handleObj.guid ) && + ( !tmp || tmp.test( handleObj.namespace ) ) && + ( !selector || selector === handleObj.selector || + selector === "**" && handleObj.selector ) ) { + handlers.splice( j, 1 ); + + if ( handleObj.selector ) { + handlers.delegateCount--; + } + if ( special.remove ) { + special.remove.call( elem, handleObj ); + } + } + } + + // Remove generic event handler if we removed something and no more handlers exist + // (avoids potential for endless recursion during removal of special event handlers) + if ( origCount && !handlers.length ) { + if ( !special.teardown || + special.teardown.call( elem, namespaces, elemData.handle ) === false ) { + + jQuery.removeEvent( elem, type, elemData.handle ); + } + + delete events[ type ]; + } + } + + // Remove data and the expando if it's no longer used + if ( jQuery.isEmptyObject( events ) ) { + dataPriv.remove( elem, "handle events" ); + } + }, + + dispatch: function( nativeEvent ) { + + var i, j, ret, matched, handleObj, handlerQueue, + args = new Array( arguments.length ), + + // Make a writable jQuery.Event from the native event object + event = jQuery.event.fix( nativeEvent ), + + handlers = ( + dataPriv.get( this, "events" ) || Object.create( null ) + )[ event.type ] || [], + special = jQuery.event.special[ event.type ] || {}; + + // Use the fix-ed jQuery.Event rather than the (read-only) native event + args[ 0 ] = event; + + for ( i = 1; i < arguments.length; i++ ) { + args[ i ] = arguments[ i ]; + } + + event.delegateTarget = this; + + // Call the preDispatch hook for the mapped type, and let it bail if desired + if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { + return; + } + + // Determine handlers + handlerQueue = jQuery.event.handlers.call( this, event, handlers ); + + // Run delegates first; they may want to stop propagation beneath us + i = 0; + while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { + event.currentTarget = matched.elem; + + j = 0; + while ( ( handleObj = matched.handlers[ j++ ] ) && + !event.isImmediatePropagationStopped() ) { + + // If the event is namespaced, then each handler is only invoked if it is + // specially universal or its namespaces are a superset of the event's. + if ( !event.rnamespace || handleObj.namespace === false || + event.rnamespace.test( handleObj.namespace ) ) { + + event.handleObj = handleObj; + event.data = handleObj.data; + + ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || + handleObj.handler ).apply( matched.elem, args ); + + if ( ret !== undefined ) { + if ( ( event.result = ret ) === false ) { + event.preventDefault(); + event.stopPropagation(); + } + } + } + } + } + + // Call the postDispatch hook for the mapped type + if ( special.postDispatch ) { + special.postDispatch.call( this, event ); + } + + return event.result; + }, + + handlers: function( event, handlers ) { + var i, handleObj, sel, matchedHandlers, matchedSelectors, + handlerQueue = [], + delegateCount = handlers.delegateCount, + cur = event.target; + + // Find delegate handlers + if ( delegateCount && + + // Support: IE <=9 + // Black-hole SVG instance trees (trac-13180) + cur.nodeType && + + // Support: Firefox <=42 + // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) + // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click + // Support: IE 11 only + // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) + !( event.type === "click" && event.button >= 1 ) ) { + + for ( ; cur !== this; cur = cur.parentNode || this ) { + + // Don't check non-elements (#13208) + // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) + if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { + matchedHandlers = []; + matchedSelectors = {}; + for ( i = 0; i < delegateCount; i++ ) { + handleObj = handlers[ i ]; + + // Don't conflict with Object.prototype properties (#13203) + sel = handleObj.selector + " "; + + if ( matchedSelectors[ sel ] === undefined ) { + matchedSelectors[ sel ] = handleObj.needsContext ? + jQuery( sel, this ).index( cur ) > -1 : + jQuery.find( sel, this, null, [ cur ] ).length; + } + if ( matchedSelectors[ sel ] ) { + matchedHandlers.push( handleObj ); + } + } + if ( matchedHandlers.length ) { + handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); + } + } + } + } + + // Add the remaining (directly-bound) handlers + cur = this; + if ( delegateCount < handlers.length ) { + handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); + } + + return handlerQueue; + }, + + addProp: function( name, hook ) { + Object.defineProperty( jQuery.Event.prototype, name, { + enumerable: true, + configurable: true, + + get: isFunction( hook ) ? + function() { + if ( this.originalEvent ) { + return hook( this.originalEvent ); + } + } : + function() { + if ( this.originalEvent ) { + return this.originalEvent[ name ]; + } + }, + + set: function( value ) { + Object.defineProperty( this, name, { + enumerable: true, + configurable: true, + writable: true, + value: value + } ); + } + } ); + }, + + fix: function( originalEvent ) { + return originalEvent[ jQuery.expando ] ? + originalEvent : + new jQuery.Event( originalEvent ); + }, + + special: { + load: { + + // Prevent triggered image.load events from bubbling to window.load + noBubble: true + }, + click: { + + // Utilize native event to ensure correct state for checkable inputs + setup: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Claim the first handler + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + // dataPriv.set( el, "click", ... ) + leverageNative( el, "click", returnTrue ); + } + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function( data ) { + + // For mutual compressibility with _default, replace `this` access with a local var. + // `|| data` is dead code meant only to preserve the variable through minification. + var el = this || data; + + // Force setup before triggering a click + if ( rcheckableType.test( el.type ) && + el.click && nodeName( el, "input" ) ) { + + leverageNative( el, "click" ); + } + + // Return non-false to allow normal event-path propagation + return true; + }, + + // For cross-browser consistency, suppress native .click() on links + // Also prevent it if we're currently inside a leveraged native-event stack + _default: function( event ) { + var target = event.target; + return rcheckableType.test( target.type ) && + target.click && nodeName( target, "input" ) && + dataPriv.get( target, "click" ) || + nodeName( target, "a" ); + } + }, + + beforeunload: { + postDispatch: function( event ) { + + // Support: Firefox 20+ + // Firefox doesn't alert if the returnValue field is not set. + if ( event.result !== undefined && event.originalEvent ) { + event.originalEvent.returnValue = event.result; + } + } + } + } +}; + +// Ensure the presence of an event listener that handles manually-triggered +// synthetic events by interrupting progress until reinvoked in response to +// *native* events that it fires directly, ensuring that state changes have +// already occurred before other listeners are invoked. +function leverageNative( el, type, expectSync ) { + + // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add + if ( !expectSync ) { + if ( dataPriv.get( el, type ) === undefined ) { + jQuery.event.add( el, type, returnTrue ); + } + return; + } + + // Register the controller as a special universal handler for all event namespaces + dataPriv.set( el, type, false ); + jQuery.event.add( el, type, { + namespace: false, + handler: function( event ) { + var notAsync, result, + saved = dataPriv.get( this, type ); + + if ( ( event.isTrigger & 1 ) && this[ type ] ) { + + // Interrupt processing of the outer synthetic .trigger()ed event + // Saved data should be false in such cases, but might be a leftover capture object + // from an async native handler (gh-4350) + if ( !saved.length ) { + + // Store arguments for use when handling the inner native event + // There will always be at least one argument (an event object), so this array + // will not be confused with a leftover capture object. + saved = slice.call( arguments ); + dataPriv.set( this, type, saved ); + + // Trigger the native event and capture its result + // Support: IE <=9 - 11+ + // focus() and blur() are asynchronous + notAsync = expectSync( this, type ); + this[ type ](); + result = dataPriv.get( this, type ); + if ( saved !== result || notAsync ) { + dataPriv.set( this, type, false ); + } else { + result = {}; + } + if ( saved !== result ) { + + // Cancel the outer synthetic event + event.stopImmediatePropagation(); + event.preventDefault(); + + // Support: Chrome 86+ + // In Chrome, if an element having a focusout handler is blurred by + // clicking outside of it, it invokes the handler synchronously. If + // that handler calls `.remove()` on the element, the data is cleared, + // leaving `result` undefined. We need to guard against this. + return result && result.value; + } + + // If this is an inner synthetic event for an event with a bubbling surrogate + // (focus or blur), assume that the surrogate already propagated from triggering the + // native event and prevent that from happening again here. + // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the + // bubbling surrogate propagates *after* the non-bubbling base), but that seems + // less bad than duplication. + } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { + event.stopPropagation(); + } + + // If this is a native event triggered above, everything is now in order + // Fire an inner synthetic event with the original arguments + } else if ( saved.length ) { + + // ...and capture the result + dataPriv.set( this, type, { + value: jQuery.event.trigger( + + // Support: IE <=9 - 11+ + // Extend with the prototype to reset the above stopImmediatePropagation() + jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), + saved.slice( 1 ), + this + ) + } ); + + // Abort handling of the native event + event.stopImmediatePropagation(); + } + } + } ); +} + +jQuery.removeEvent = function( elem, type, handle ) { + + // This "if" is needed for plain objects + if ( elem.removeEventListener ) { + elem.removeEventListener( type, handle ); + } +}; + +jQuery.Event = function( src, props ) { + + // Allow instantiation without the 'new' keyword + if ( !( this instanceof jQuery.Event ) ) { + return new jQuery.Event( src, props ); + } + + // Event object + if ( src && src.type ) { + this.originalEvent = src; + this.type = src.type; + + // Events bubbling up the document may have been marked as prevented + // by a handler lower down the tree; reflect the correct value. + this.isDefaultPrevented = src.defaultPrevented || + src.defaultPrevented === undefined && + + // Support: Android <=2.3 only + src.returnValue === false ? + returnTrue : + returnFalse; + + // Create target properties + // Support: Safari <=6 - 7 only + // Target should not be a text node (#504, #13143) + this.target = ( src.target && src.target.nodeType === 3 ) ? + src.target.parentNode : + src.target; + + this.currentTarget = src.currentTarget; + this.relatedTarget = src.relatedTarget; + + // Event type + } else { + this.type = src; + } + + // Put explicitly provided properties onto the event object + if ( props ) { + jQuery.extend( this, props ); + } + + // Create a timestamp if incoming event doesn't have one + this.timeStamp = src && src.timeStamp || Date.now(); + + // Mark it as fixed + this[ jQuery.expando ] = true; +}; + +// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding +// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html +jQuery.Event.prototype = { + constructor: jQuery.Event, + isDefaultPrevented: returnFalse, + isPropagationStopped: returnFalse, + isImmediatePropagationStopped: returnFalse, + isSimulated: false, + + preventDefault: function() { + var e = this.originalEvent; + + this.isDefaultPrevented = returnTrue; + + if ( e && !this.isSimulated ) { + e.preventDefault(); + } + }, + stopPropagation: function() { + var e = this.originalEvent; + + this.isPropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopPropagation(); + } + }, + stopImmediatePropagation: function() { + var e = this.originalEvent; + + this.isImmediatePropagationStopped = returnTrue; + + if ( e && !this.isSimulated ) { + e.stopImmediatePropagation(); + } + + this.stopPropagation(); + } +}; + +// Includes all common event props including KeyEvent and MouseEvent specific props +jQuery.each( { + altKey: true, + bubbles: true, + cancelable: true, + changedTouches: true, + ctrlKey: true, + detail: true, + eventPhase: true, + metaKey: true, + pageX: true, + pageY: true, + shiftKey: true, + view: true, + "char": true, + code: true, + charCode: true, + key: true, + keyCode: true, + button: true, + buttons: true, + clientX: true, + clientY: true, + offsetX: true, + offsetY: true, + pointerId: true, + pointerType: true, + screenX: true, + screenY: true, + targetTouches: true, + toElement: true, + touches: true, + which: true +}, jQuery.event.addProp ); + +jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { + jQuery.event.special[ type ] = { + + // Utilize native event if possible so blur/focus sequence is correct + setup: function() { + + // Claim the first handler + // dataPriv.set( this, "focus", ... ) + // dataPriv.set( this, "blur", ... ) + leverageNative( this, type, expectSync ); + + // Return false to allow normal processing in the caller + return false; + }, + trigger: function() { + + // Force setup before trigger + leverageNative( this, type ); + + // Return non-false to allow normal event-path propagation + return true; + }, + + // Suppress native focus or blur as it's already being fired + // in leverageNative. + _default: function() { + return true; + }, + + delegateType: delegateType + }; +} ); + +// Create mouseenter/leave events using mouseover/out and event-time checks +// so that event delegation works in jQuery. +// Do the same for pointerenter/pointerleave and pointerover/pointerout +// +// Support: Safari 7 only +// Safari sends mouseenter too often; see: +// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 +// for the description of the bug (it existed in older Chrome versions as well). +jQuery.each( { + mouseenter: "mouseover", + mouseleave: "mouseout", + pointerenter: "pointerover", + pointerleave: "pointerout" +}, function( orig, fix ) { + jQuery.event.special[ orig ] = { + delegateType: fix, + bindType: fix, + + handle: function( event ) { + var ret, + target = this, + related = event.relatedTarget, + handleObj = event.handleObj; + + // For mouseenter/leave call the handler if related is outside the target. + // NB: No relatedTarget if the mouse left/entered the browser window + if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { + event.type = handleObj.origType; + ret = handleObj.handler.apply( this, arguments ); + event.type = fix; + } + return ret; + } + }; +} ); + +jQuery.fn.extend( { + + on: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn ); + }, + one: function( types, selector, data, fn ) { + return on( this, types, selector, data, fn, 1 ); + }, + off: function( types, selector, fn ) { + var handleObj, type; + if ( types && types.preventDefault && types.handleObj ) { + + // ( event ) dispatched jQuery.Event + handleObj = types.handleObj; + jQuery( types.delegateTarget ).off( + handleObj.namespace ? + handleObj.origType + "." + handleObj.namespace : + handleObj.origType, + handleObj.selector, + handleObj.handler + ); + return this; + } + if ( typeof types === "object" ) { + + // ( types-object [, selector] ) + for ( type in types ) { + this.off( type, selector, types[ type ] ); + } + return this; + } + if ( selector === false || typeof selector === "function" ) { + + // ( types [, fn] ) + fn = selector; + selector = undefined; + } + if ( fn === false ) { + fn = returnFalse; + } + return this.each( function() { + jQuery.event.remove( this, types, fn, selector ); + } ); + } +} ); + + +var + + // Support: IE <=10 - 11, Edge 12 - 13 only + // In IE/Edge using regex groups here causes severe slowdowns. + // See https://connect.microsoft.com/IE/feedback/details/1736512/ + rnoInnerhtml = /\s*$/g; + +// Prefer a tbody over its parent table for containing new rows +function manipulationTarget( elem, content ) { + if ( nodeName( elem, "table" ) && + nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { + + return jQuery( elem ).children( "tbody" )[ 0 ] || elem; + } + + return elem; +} + +// Replace/restore the type attribute of script elements for safe DOM manipulation +function disableScript( elem ) { + elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; + return elem; +} +function restoreScript( elem ) { + if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { + elem.type = elem.type.slice( 5 ); + } else { + elem.removeAttribute( "type" ); + } + + return elem; +} + +function cloneCopyEvent( src, dest ) { + var i, l, type, pdataOld, udataOld, udataCur, events; + + if ( dest.nodeType !== 1 ) { + return; + } + + // 1. Copy private data: events, handlers, etc. + if ( dataPriv.hasData( src ) ) { + pdataOld = dataPriv.get( src ); + events = pdataOld.events; + + if ( events ) { + dataPriv.remove( dest, "handle events" ); + + for ( type in events ) { + for ( i = 0, l = events[ type ].length; i < l; i++ ) { + jQuery.event.add( dest, type, events[ type ][ i ] ); + } + } + } + } + + // 2. Copy user data + if ( dataUser.hasData( src ) ) { + udataOld = dataUser.access( src ); + udataCur = jQuery.extend( {}, udataOld ); + + dataUser.set( dest, udataCur ); + } +} + +// Fix IE bugs, see support tests +function fixInput( src, dest ) { + var nodeName = dest.nodeName.toLowerCase(); + + // Fails to persist the checked state of a cloned checkbox or radio button. + if ( nodeName === "input" && rcheckableType.test( src.type ) ) { + dest.checked = src.checked; + + // Fails to return the selected option to the default selected state when cloning options + } else if ( nodeName === "input" || nodeName === "textarea" ) { + dest.defaultValue = src.defaultValue; + } +} + +function domManip( collection, args, callback, ignored ) { + + // Flatten any nested arrays + args = flat( args ); + + var fragment, first, scripts, hasScripts, node, doc, + i = 0, + l = collection.length, + iNoClone = l - 1, + value = args[ 0 ], + valueIsFunction = isFunction( value ); + + // We can't cloneNode fragments that contain checked, in WebKit + if ( valueIsFunction || + ( l > 1 && typeof value === "string" && + !support.checkClone && rchecked.test( value ) ) ) { + return collection.each( function( index ) { + var self = collection.eq( index ); + if ( valueIsFunction ) { + args[ 0 ] = value.call( this, index, self.html() ); + } + domManip( self, args, callback, ignored ); + } ); + } + + if ( l ) { + fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); + first = fragment.firstChild; + + if ( fragment.childNodes.length === 1 ) { + fragment = first; + } + + // Require either new content or an interest in ignored elements to invoke the callback + if ( first || ignored ) { + scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); + hasScripts = scripts.length; + + // Use the original fragment for the last item + // instead of the first because it can end up + // being emptied incorrectly in certain situations (#8070). + for ( ; i < l; i++ ) { + node = fragment; + + if ( i !== iNoClone ) { + node = jQuery.clone( node, true, true ); + + // Keep references to cloned scripts for later restoration + if ( hasScripts ) { + + // Support: Android <=4.0 only, PhantomJS 1 only + // push.apply(_, arraylike) throws on ancient WebKit + jQuery.merge( scripts, getAll( node, "script" ) ); + } + } + + callback.call( collection[ i ], node, i ); + } + + if ( hasScripts ) { + doc = scripts[ scripts.length - 1 ].ownerDocument; + + // Reenable scripts + jQuery.map( scripts, restoreScript ); + + // Evaluate executable scripts on first document insertion + for ( i = 0; i < hasScripts; i++ ) { + node = scripts[ i ]; + if ( rscriptType.test( node.type || "" ) && + !dataPriv.access( node, "globalEval" ) && + jQuery.contains( doc, node ) ) { + + if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { + + // Optional AJAX dependency, but won't run scripts if not present + if ( jQuery._evalUrl && !node.noModule ) { + jQuery._evalUrl( node.src, { + nonce: node.nonce || node.getAttribute( "nonce" ) + }, doc ); + } + } else { + DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); + } + } + } + } + } + } + + return collection; +} + +function remove( elem, selector, keepData ) { + var node, + nodes = selector ? jQuery.filter( selector, elem ) : elem, + i = 0; + + for ( ; ( node = nodes[ i ] ) != null; i++ ) { + if ( !keepData && node.nodeType === 1 ) { + jQuery.cleanData( getAll( node ) ); + } + + if ( node.parentNode ) { + if ( keepData && isAttached( node ) ) { + setGlobalEval( getAll( node, "script" ) ); + } + node.parentNode.removeChild( node ); + } + } + + return elem; +} + +jQuery.extend( { + htmlPrefilter: function( html ) { + return html; + }, + + clone: function( elem, dataAndEvents, deepDataAndEvents ) { + var i, l, srcElements, destElements, + clone = elem.cloneNode( true ), + inPage = isAttached( elem ); + + // Fix IE cloning issues + if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && + !jQuery.isXMLDoc( elem ) ) { + + // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 + destElements = getAll( clone ); + srcElements = getAll( elem ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + fixInput( srcElements[ i ], destElements[ i ] ); + } + } + + // Copy the events from the original to the clone + if ( dataAndEvents ) { + if ( deepDataAndEvents ) { + srcElements = srcElements || getAll( elem ); + destElements = destElements || getAll( clone ); + + for ( i = 0, l = srcElements.length; i < l; i++ ) { + cloneCopyEvent( srcElements[ i ], destElements[ i ] ); + } + } else { + cloneCopyEvent( elem, clone ); + } + } + + // Preserve script evaluation history + destElements = getAll( clone, "script" ); + if ( destElements.length > 0 ) { + setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); + } + + // Return the cloned set + return clone; + }, + + cleanData: function( elems ) { + var data, elem, type, + special = jQuery.event.special, + i = 0; + + for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { + if ( acceptData( elem ) ) { + if ( ( data = elem[ dataPriv.expando ] ) ) { + if ( data.events ) { + for ( type in data.events ) { + if ( special[ type ] ) { + jQuery.event.remove( elem, type ); + + // This is a shortcut to avoid jQuery.event.remove's overhead + } else { + jQuery.removeEvent( elem, type, data.handle ); + } + } + } + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataPriv.expando ] = undefined; + } + if ( elem[ dataUser.expando ] ) { + + // Support: Chrome <=35 - 45+ + // Assign undefined instead of using delete, see Data#remove + elem[ dataUser.expando ] = undefined; + } + } + } + } +} ); + +jQuery.fn.extend( { + detach: function( selector ) { + return remove( this, selector, true ); + }, + + remove: function( selector ) { + return remove( this, selector ); + }, + + text: function( value ) { + return access( this, function( value ) { + return value === undefined ? + jQuery.text( this ) : + this.empty().each( function() { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + this.textContent = value; + } + } ); + }, null, value, arguments.length ); + }, + + append: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.appendChild( elem ); + } + } ); + }, + + prepend: function() { + return domManip( this, arguments, function( elem ) { + if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { + var target = manipulationTarget( this, elem ); + target.insertBefore( elem, target.firstChild ); + } + } ); + }, + + before: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this ); + } + } ); + }, + + after: function() { + return domManip( this, arguments, function( elem ) { + if ( this.parentNode ) { + this.parentNode.insertBefore( elem, this.nextSibling ); + } + } ); + }, + + empty: function() { + var elem, + i = 0; + + for ( ; ( elem = this[ i ] ) != null; i++ ) { + if ( elem.nodeType === 1 ) { + + // Prevent memory leaks + jQuery.cleanData( getAll( elem, false ) ); + + // Remove any remaining nodes + elem.textContent = ""; + } + } + + return this; + }, + + clone: function( dataAndEvents, deepDataAndEvents ) { + dataAndEvents = dataAndEvents == null ? false : dataAndEvents; + deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; + + return this.map( function() { + return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); + } ); + }, + + html: function( value ) { + return access( this, function( value ) { + var elem = this[ 0 ] || {}, + i = 0, + l = this.length; + + if ( value === undefined && elem.nodeType === 1 ) { + return elem.innerHTML; + } + + // See if we can take a shortcut and just use innerHTML + if ( typeof value === "string" && !rnoInnerhtml.test( value ) && + !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { + + value = jQuery.htmlPrefilter( value ); + + try { + for ( ; i < l; i++ ) { + elem = this[ i ] || {}; + + // Remove element nodes and prevent memory leaks + if ( elem.nodeType === 1 ) { + jQuery.cleanData( getAll( elem, false ) ); + elem.innerHTML = value; + } + } + + elem = 0; + + // If using innerHTML throws an exception, use the fallback method + } catch ( e ) {} + } + + if ( elem ) { + this.empty().append( value ); + } + }, null, value, arguments.length ); + }, + + replaceWith: function() { + var ignored = []; + + // Make the changes, replacing each non-ignored context element with the new content + return domManip( this, arguments, function( elem ) { + var parent = this.parentNode; + + if ( jQuery.inArray( this, ignored ) < 0 ) { + jQuery.cleanData( getAll( this ) ); + if ( parent ) { + parent.replaceChild( elem, this ); + } + } + + // Force callback invocation + }, ignored ); + } +} ); + +jQuery.each( { + appendTo: "append", + prependTo: "prepend", + insertBefore: "before", + insertAfter: "after", + replaceAll: "replaceWith" +}, function( name, original ) { + jQuery.fn[ name ] = function( selector ) { + var elems, + ret = [], + insert = jQuery( selector ), + last = insert.length - 1, + i = 0; + + for ( ; i <= last; i++ ) { + elems = i === last ? this : this.clone( true ); + jQuery( insert[ i ] )[ original ]( elems ); + + // Support: Android <=4.0 only, PhantomJS 1 only + // .get() because push.apply(_, arraylike) throws on ancient WebKit + push.apply( ret, elems.get() ); + } + + return this.pushStack( ret ); + }; +} ); +var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); + +var getStyles = function( elem ) { + + // Support: IE <=11 only, Firefox <=30 (#15098, #14150) + // IE throws on elements created in popups + // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" + var view = elem.ownerDocument.defaultView; + + if ( !view || !view.opener ) { + view = window; + } + + return view.getComputedStyle( elem ); + }; + +var swap = function( elem, options, callback ) { + var ret, name, + old = {}; + + // Remember the old values, and insert the new ones + for ( name in options ) { + old[ name ] = elem.style[ name ]; + elem.style[ name ] = options[ name ]; + } + + ret = callback.call( elem ); + + // Revert the old values + for ( name in options ) { + elem.style[ name ] = old[ name ]; + } + + return ret; +}; + + +var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); + + + +( function() { + + // Executing both pixelPosition & boxSizingReliable tests require only one layout + // so they're executed at the same time to save the second computation. + function computeStyleTests() { + + // This is a singleton, we need to execute it only once + if ( !div ) { + return; + } + + container.style.cssText = "position:absolute;left:-11111px;width:60px;" + + "margin-top:1px;padding:0;border:0"; + div.style.cssText = + "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + + "margin:auto;border:1px;padding:1px;" + + "width:60%;top:1%"; + documentElement.appendChild( container ).appendChild( div ); + + var divStyle = window.getComputedStyle( div ); + pixelPositionVal = divStyle.top !== "1%"; + + // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 + reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; + + // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 + // Some styles come back with percentage values, even though they shouldn't + div.style.right = "60%"; + pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; + + // Support: IE 9 - 11 only + // Detect misreporting of content dimensions for box-sizing:border-box elements + boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; + + // Support: IE 9 only + // Detect overflow:scroll screwiness (gh-3699) + // Support: Chrome <=64 + // Don't get tricked when zoom affects offsetWidth (gh-4029) + div.style.position = "absolute"; + scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; + + documentElement.removeChild( container ); + + // Nullify the div so it wouldn't be stored in the memory and + // it will also be a sign that checks already performed + div = null; + } + + function roundPixelMeasures( measure ) { + return Math.round( parseFloat( measure ) ); + } + + var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, + reliableTrDimensionsVal, reliableMarginLeftVal, + container = document.createElement( "div" ), + div = document.createElement( "div" ); + + // Finish early in limited (non-browser) environments + if ( !div.style ) { + return; + } + + // Support: IE <=9 - 11 only + // Style of cloned element affects source element cloned (#8908) + div.style.backgroundClip = "content-box"; + div.cloneNode( true ).style.backgroundClip = ""; + support.clearCloneStyle = div.style.backgroundClip === "content-box"; + + jQuery.extend( support, { + boxSizingReliable: function() { + computeStyleTests(); + return boxSizingReliableVal; + }, + pixelBoxStyles: function() { + computeStyleTests(); + return pixelBoxStylesVal; + }, + pixelPosition: function() { + computeStyleTests(); + return pixelPositionVal; + }, + reliableMarginLeft: function() { + computeStyleTests(); + return reliableMarginLeftVal; + }, + scrollboxSize: function() { + computeStyleTests(); + return scrollboxSizeVal; + }, + + // Support: IE 9 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Behavior in IE 9 is more subtle than in newer versions & it passes + // some versions of this test; make sure not to make it pass there! + // + // Support: Firefox 70+ + // Only Firefox includes border widths + // in computed dimensions. (gh-4529) + reliableTrDimensions: function() { + var table, tr, trChild, trStyle; + if ( reliableTrDimensionsVal == null ) { + table = document.createElement( "table" ); + tr = document.createElement( "tr" ); + trChild = document.createElement( "div" ); + + table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; + tr.style.cssText = "border:1px solid"; + + // Support: Chrome 86+ + // Height set through cssText does not get applied. + // Computed height then comes back as 0. + tr.style.height = "1px"; + trChild.style.height = "9px"; + + // Support: Android 8 Chrome 86+ + // In our bodyBackground.html iframe, + // display for all div elements is set to "inline", + // which causes a problem only in Android 8 Chrome 86. + // Ensuring the div is display: block + // gets around this issue. + trChild.style.display = "block"; + + documentElement + .appendChild( table ) + .appendChild( tr ) + .appendChild( trChild ); + + trStyle = window.getComputedStyle( tr ); + reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + + parseInt( trStyle.borderTopWidth, 10 ) + + parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; + + documentElement.removeChild( table ); + } + return reliableTrDimensionsVal; + } + } ); +} )(); + + +function curCSS( elem, name, computed ) { + var width, minWidth, maxWidth, ret, + + // Support: Firefox 51+ + // Retrieving style before computed somehow + // fixes an issue with getting wrong values + // on detached elements + style = elem.style; + + computed = computed || getStyles( elem ); + + // getPropertyValue is needed for: + // .css('filter') (IE 9 only, #12537) + // .css('--customProperty) (#3144) + if ( computed ) { + ret = computed.getPropertyValue( name ) || computed[ name ]; + + if ( ret === "" && !isAttached( elem ) ) { + ret = jQuery.style( elem, name ); + } + + // A tribute to the "awesome hack by Dean Edwards" + // Android Browser returns percentage for some values, + // but width seems to be reliably pixels. + // This is against the CSSOM draft spec: + // https://drafts.csswg.org/cssom/#resolved-values + if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { + + // Remember the original values + width = style.width; + minWidth = style.minWidth; + maxWidth = style.maxWidth; + + // Put in the new values to get a computed value out + style.minWidth = style.maxWidth = style.width = ret; + ret = computed.width; + + // Revert the changed values + style.width = width; + style.minWidth = minWidth; + style.maxWidth = maxWidth; + } + } + + return ret !== undefined ? + + // Support: IE <=9 - 11 only + // IE returns zIndex value as an integer. + ret + "" : + ret; +} + + +function addGetHookIf( conditionFn, hookFn ) { + + // Define the hook, we'll check on the first run if it's really needed. + return { + get: function() { + if ( conditionFn() ) { + + // Hook not needed (or it's not possible to use it due + // to missing dependency), remove it. + delete this.get; + return; + } + + // Hook needed; redefine it so that the support test is not executed again. + return ( this.get = hookFn ).apply( this, arguments ); + } + }; +} + + +var cssPrefixes = [ "Webkit", "Moz", "ms" ], + emptyStyle = document.createElement( "div" ).style, + vendorProps = {}; + +// Return a vendor-prefixed property or undefined +function vendorPropName( name ) { + + // Check for vendor prefixed names + var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), + i = cssPrefixes.length; + + while ( i-- ) { + name = cssPrefixes[ i ] + capName; + if ( name in emptyStyle ) { + return name; + } + } +} + +// Return a potentially-mapped jQuery.cssProps or vendor prefixed property +function finalPropName( name ) { + var final = jQuery.cssProps[ name ] || vendorProps[ name ]; + + if ( final ) { + return final; + } + if ( name in emptyStyle ) { + return name; + } + return vendorProps[ name ] = vendorPropName( name ) || name; +} + + +var + + // Swappable if display is none or starts with table + // except "table", "table-cell", or "table-caption" + // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display + rdisplayswap = /^(none|table(?!-c[ea]).+)/, + rcustomProp = /^--/, + cssShow = { position: "absolute", visibility: "hidden", display: "block" }, + cssNormalTransform = { + letterSpacing: "0", + fontWeight: "400" + }; + +function setPositiveNumber( _elem, value, subtract ) { + + // Any relative (+/-) values have already been + // normalized at this point + var matches = rcssNum.exec( value ); + return matches ? + + // Guard against undefined "subtract", e.g., when used as in cssHooks + Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : + value; +} + +function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { + var i = dimension === "width" ? 1 : 0, + extra = 0, + delta = 0; + + // Adjustment may not be necessary + if ( box === ( isBorderBox ? "border" : "content" ) ) { + return 0; + } + + for ( ; i < 4; i += 2 ) { + + // Both box models exclude margin + if ( box === "margin" ) { + delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); + } + + // If we get here with a content-box, we're seeking "padding" or "border" or "margin" + if ( !isBorderBox ) { + + // Add padding + delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + + // For "border" or "margin", add border + if ( box !== "padding" ) { + delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + + // But still keep track of it otherwise + } else { + extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + + // If we get here with a border-box (content + padding + border), we're seeking "content" or + // "padding" or "margin" + } else { + + // For "content", subtract padding + if ( box === "content" ) { + delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); + } + + // For "content" or "padding", subtract border + if ( box !== "margin" ) { + delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); + } + } + } + + // Account for positive content-box scroll gutter when requested by providing computedVal + if ( !isBorderBox && computedVal >= 0 ) { + + // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border + // Assuming integer scroll gutter, subtract the rest and round down + delta += Math.max( 0, Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + computedVal - + delta - + extra - + 0.5 + + // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter + // Use an explicit zero to avoid NaN (gh-3964) + ) ) || 0; + } + + return delta; +} + +function getWidthOrHeight( elem, dimension, extra ) { + + // Start with computed style + var styles = getStyles( elem ), + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). + // Fake content-box until we know it's needed to know the true value. + boxSizingNeeded = !support.boxSizingReliable() || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + valueIsBorderBox = isBorderBox, + + val = curCSS( elem, dimension, styles ), + offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); + + // Support: Firefox <=54 + // Return a confounding non-pixel value or feign ignorance, as appropriate. + if ( rnumnonpx.test( val ) ) { + if ( !extra ) { + return val; + } + val = "auto"; + } + + + // Support: IE 9 - 11 only + // Use offsetWidth/offsetHeight for when box sizing is unreliable. + // In those cases, the computed value can be trusted to be border-box. + if ( ( !support.boxSizingReliable() && isBorderBox || + + // Support: IE 10 - 11+, Edge 15 - 18+ + // IE/Edge misreport `getComputedStyle` of table rows with width/height + // set in CSS while `offset*` properties report correct values. + // Interestingly, in some cases IE 9 doesn't suffer from this issue. + !support.reliableTrDimensions() && nodeName( elem, "tr" ) || + + // Fall back to offsetWidth/offsetHeight when value is "auto" + // This happens for inline elements with no explicit setting (gh-3571) + val === "auto" || + + // Support: Android <=4.1 - 4.3 only + // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) + !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && + + // Make sure the element is visible & connected + elem.getClientRects().length ) { + + isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; + + // Where available, offsetWidth/offsetHeight approximate border box dimensions. + // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the + // retrieved value as a content box dimension. + valueIsBorderBox = offsetProp in elem; + if ( valueIsBorderBox ) { + val = elem[ offsetProp ]; + } + } + + // Normalize "" and auto + val = parseFloat( val ) || 0; + + // Adjust for the element's box model + return ( val + + boxModelAdjustment( + elem, + dimension, + extra || ( isBorderBox ? "border" : "content" ), + valueIsBorderBox, + styles, + + // Provide the current computed size to request scroll gutter calculation (gh-3589) + val + ) + ) + "px"; +} + +jQuery.extend( { + + // Add in style property hooks for overriding the default + // behavior of getting and setting a style property + cssHooks: { + opacity: { + get: function( elem, computed ) { + if ( computed ) { + + // We should always get a number back from opacity + var ret = curCSS( elem, "opacity" ); + return ret === "" ? "1" : ret; + } + } + } + }, + + // Don't automatically add "px" to these possibly-unitless properties + cssNumber: { + "animationIterationCount": true, + "columnCount": true, + "fillOpacity": true, + "flexGrow": true, + "flexShrink": true, + "fontWeight": true, + "gridArea": true, + "gridColumn": true, + "gridColumnEnd": true, + "gridColumnStart": true, + "gridRow": true, + "gridRowEnd": true, + "gridRowStart": true, + "lineHeight": true, + "opacity": true, + "order": true, + "orphans": true, + "widows": true, + "zIndex": true, + "zoom": true + }, + + // Add in properties whose names you wish to fix before + // setting or getting the value + cssProps: {}, + + // Get and set the style property on a DOM Node + style: function( elem, name, value, extra ) { + + // Don't set styles on text and comment nodes + if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { + return; + } + + // Make sure that we're working with the right name + var ret, type, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ), + style = elem.style; + + // Make sure that we're working with the right name. We don't + // want to query the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Gets hook for the prefixed version, then unprefixed version + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // Check if we're setting a value + if ( value !== undefined ) { + type = typeof value; + + // Convert "+=" or "-=" to relative numbers (#7345) + if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { + value = adjustCSS( elem, name, ret ); + + // Fixes bug #9237 + type = "number"; + } + + // Make sure that null and NaN values aren't set (#7116) + if ( value == null || value !== value ) { + return; + } + + // If a number was passed in, add the unit (except for certain CSS properties) + // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append + // "px" to a few hardcoded values. + if ( type === "number" && !isCustomProp ) { + value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); + } + + // background-* props affect original clone's values + if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { + style[ name ] = "inherit"; + } + + // If a hook was provided, use that value, otherwise just set the specified value + if ( !hooks || !( "set" in hooks ) || + ( value = hooks.set( elem, value, extra ) ) !== undefined ) { + + if ( isCustomProp ) { + style.setProperty( name, value ); + } else { + style[ name ] = value; + } + } + + } else { + + // If a hook was provided get the non-computed value from there + if ( hooks && "get" in hooks && + ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { + + return ret; + } + + // Otherwise just get the value from the style object + return style[ name ]; + } + }, + + css: function( elem, name, extra, styles ) { + var val, num, hooks, + origName = camelCase( name ), + isCustomProp = rcustomProp.test( name ); + + // Make sure that we're working with the right name. We don't + // want to modify the value if it is a CSS custom property + // since they are user-defined. + if ( !isCustomProp ) { + name = finalPropName( origName ); + } + + // Try prefixed name followed by the unprefixed name + hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; + + // If a hook was provided get the computed value from there + if ( hooks && "get" in hooks ) { + val = hooks.get( elem, true, extra ); + } + + // Otherwise, if a way to get the computed value exists, use that + if ( val === undefined ) { + val = curCSS( elem, name, styles ); + } + + // Convert "normal" to computed value + if ( val === "normal" && name in cssNormalTransform ) { + val = cssNormalTransform[ name ]; + } + + // Make numeric if forced or a qualifier was provided and val looks numeric + if ( extra === "" || extra ) { + num = parseFloat( val ); + return extra === true || isFinite( num ) ? num || 0 : val; + } + + return val; + } +} ); + +jQuery.each( [ "height", "width" ], function( _i, dimension ) { + jQuery.cssHooks[ dimension ] = { + get: function( elem, computed, extra ) { + if ( computed ) { + + // Certain elements can have dimension info if we invisibly show them + // but it must have a current display style that would benefit + return rdisplayswap.test( jQuery.css( elem, "display" ) ) && + + // Support: Safari 8+ + // Table columns in Safari have non-zero offsetWidth & zero + // getBoundingClientRect().width unless display is changed. + // Support: IE <=11 only + // Running getBoundingClientRect on a disconnected node + // in IE throws an error. + ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? + swap( elem, cssShow, function() { + return getWidthOrHeight( elem, dimension, extra ); + } ) : + getWidthOrHeight( elem, dimension, extra ); + } + }, + + set: function( elem, value, extra ) { + var matches, + styles = getStyles( elem ), + + // Only read styles.position if the test has a chance to fail + // to avoid forcing a reflow. + scrollboxSizeBuggy = !support.scrollboxSize() && + styles.position === "absolute", + + // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) + boxSizingNeeded = scrollboxSizeBuggy || extra, + isBorderBox = boxSizingNeeded && + jQuery.css( elem, "boxSizing", false, styles ) === "border-box", + subtract = extra ? + boxModelAdjustment( + elem, + dimension, + extra, + isBorderBox, + styles + ) : + 0; + + // Account for unreliable border-box dimensions by comparing offset* to computed and + // faking a content-box to get border and padding (gh-3699) + if ( isBorderBox && scrollboxSizeBuggy ) { + subtract -= Math.ceil( + elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - + parseFloat( styles[ dimension ] ) - + boxModelAdjustment( elem, dimension, "border", false, styles ) - + 0.5 + ); + } + + // Convert to pixels if value adjustment is needed + if ( subtract && ( matches = rcssNum.exec( value ) ) && + ( matches[ 3 ] || "px" ) !== "px" ) { + + elem.style[ dimension ] = value; + value = jQuery.css( elem, dimension ); + } + + return setPositiveNumber( elem, value, subtract ); + } + }; +} ); + +jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, + function( elem, computed ) { + if ( computed ) { + return ( parseFloat( curCSS( elem, "marginLeft" ) ) || + elem.getBoundingClientRect().left - + swap( elem, { marginLeft: 0 }, function() { + return elem.getBoundingClientRect().left; + } ) + ) + "px"; + } + } +); + +// These hooks are used by animate to expand properties +jQuery.each( { + margin: "", + padding: "", + border: "Width" +}, function( prefix, suffix ) { + jQuery.cssHooks[ prefix + suffix ] = { + expand: function( value ) { + var i = 0, + expanded = {}, + + // Assumes a single number if not a string + parts = typeof value === "string" ? value.split( " " ) : [ value ]; + + for ( ; i < 4; i++ ) { + expanded[ prefix + cssExpand[ i ] + suffix ] = + parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; + } + + return expanded; + } + }; + + if ( prefix !== "margin" ) { + jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; + } +} ); + +jQuery.fn.extend( { + css: function( name, value ) { + return access( this, function( elem, name, value ) { + var styles, len, + map = {}, + i = 0; + + if ( Array.isArray( name ) ) { + styles = getStyles( elem ); + len = name.length; + + for ( ; i < len; i++ ) { + map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); + } + + return map; + } + + return value !== undefined ? + jQuery.style( elem, name, value ) : + jQuery.css( elem, name ); + }, name, value, arguments.length > 1 ); + } +} ); + + +function Tween( elem, options, prop, end, easing ) { + return new Tween.prototype.init( elem, options, prop, end, easing ); +} +jQuery.Tween = Tween; + +Tween.prototype = { + constructor: Tween, + init: function( elem, options, prop, end, easing, unit ) { + this.elem = elem; + this.prop = prop; + this.easing = easing || jQuery.easing._default; + this.options = options; + this.start = this.now = this.cur(); + this.end = end; + this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); + }, + cur: function() { + var hooks = Tween.propHooks[ this.prop ]; + + return hooks && hooks.get ? + hooks.get( this ) : + Tween.propHooks._default.get( this ); + }, + run: function( percent ) { + var eased, + hooks = Tween.propHooks[ this.prop ]; + + if ( this.options.duration ) { + this.pos = eased = jQuery.easing[ this.easing ]( + percent, this.options.duration * percent, 0, 1, this.options.duration + ); + } else { + this.pos = eased = percent; + } + this.now = ( this.end - this.start ) * eased + this.start; + + if ( this.options.step ) { + this.options.step.call( this.elem, this.now, this ); + } + + if ( hooks && hooks.set ) { + hooks.set( this ); + } else { + Tween.propHooks._default.set( this ); + } + return this; + } +}; + +Tween.prototype.init.prototype = Tween.prototype; + +Tween.propHooks = { + _default: { + get: function( tween ) { + var result; + + // Use a property on the element directly when it is not a DOM element, + // or when there is no matching style property that exists. + if ( tween.elem.nodeType !== 1 || + tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { + return tween.elem[ tween.prop ]; + } + + // Passing an empty string as a 3rd parameter to .css will automatically + // attempt a parseFloat and fallback to a string if the parse fails. + // Simple values such as "10px" are parsed to Float; + // complex values such as "rotate(1rad)" are returned as-is. + result = jQuery.css( tween.elem, tween.prop, "" ); + + // Empty strings, null, undefined and "auto" are converted to 0. + return !result || result === "auto" ? 0 : result; + }, + set: function( tween ) { + + // Use step hook for back compat. + // Use cssHook if its there. + // Use .style if available and use plain properties where available. + if ( jQuery.fx.step[ tween.prop ] ) { + jQuery.fx.step[ tween.prop ]( tween ); + } else if ( tween.elem.nodeType === 1 && ( + jQuery.cssHooks[ tween.prop ] || + tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { + jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); + } else { + tween.elem[ tween.prop ] = tween.now; + } + } + } +}; + +// Support: IE <=9 only +// Panic based approach to setting things on disconnected nodes +Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { + set: function( tween ) { + if ( tween.elem.nodeType && tween.elem.parentNode ) { + tween.elem[ tween.prop ] = tween.now; + } + } +}; + +jQuery.easing = { + linear: function( p ) { + return p; + }, + swing: function( p ) { + return 0.5 - Math.cos( p * Math.PI ) / 2; + }, + _default: "swing" +}; + +jQuery.fx = Tween.prototype.init; + +// Back compat <1.8 extension point +jQuery.fx.step = {}; + + + + +var + fxNow, inProgress, + rfxtypes = /^(?:toggle|show|hide)$/, + rrun = /queueHooks$/; + +function schedule() { + if ( inProgress ) { + if ( document.hidden === false && window.requestAnimationFrame ) { + window.requestAnimationFrame( schedule ); + } else { + window.setTimeout( schedule, jQuery.fx.interval ); + } + + jQuery.fx.tick(); + } +} + +// Animations created synchronously will run synchronously +function createFxNow() { + window.setTimeout( function() { + fxNow = undefined; + } ); + return ( fxNow = Date.now() ); +} + +// Generate parameters to create a standard animation +function genFx( type, includeWidth ) { + var which, + i = 0, + attrs = { height: type }; + + // If we include width, step value is 1 to do all cssExpand values, + // otherwise step value is 2 to skip over Left and Right + includeWidth = includeWidth ? 1 : 0; + for ( ; i < 4; i += 2 - includeWidth ) { + which = cssExpand[ i ]; + attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; + } + + if ( includeWidth ) { + attrs.opacity = attrs.width = type; + } + + return attrs; +} + +function createTween( value, prop, animation ) { + var tween, + collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), + index = 0, + length = collection.length; + for ( ; index < length; index++ ) { + if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { + + // We're done with this property + return tween; + } + } +} + +function defaultPrefilter( elem, props, opts ) { + var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, + isBox = "width" in props || "height" in props, + anim = this, + orig = {}, + style = elem.style, + hidden = elem.nodeType && isHiddenWithinTree( elem ), + dataShow = dataPriv.get( elem, "fxshow" ); + + // Queue-skipping animations hijack the fx hooks + if ( !opts.queue ) { + hooks = jQuery._queueHooks( elem, "fx" ); + if ( hooks.unqueued == null ) { + hooks.unqueued = 0; + oldfire = hooks.empty.fire; + hooks.empty.fire = function() { + if ( !hooks.unqueued ) { + oldfire(); + } + }; + } + hooks.unqueued++; + + anim.always( function() { + + // Ensure the complete handler is called before this completes + anim.always( function() { + hooks.unqueued--; + if ( !jQuery.queue( elem, "fx" ).length ) { + hooks.empty.fire(); + } + } ); + } ); + } + + // Detect show/hide animations + for ( prop in props ) { + value = props[ prop ]; + if ( rfxtypes.test( value ) ) { + delete props[ prop ]; + toggle = toggle || value === "toggle"; + if ( value === ( hidden ? "hide" : "show" ) ) { + + // Pretend to be hidden if this is a "show" and + // there is still data from a stopped show/hide + if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { + hidden = true; + + // Ignore all other no-op show/hide data + } else { + continue; + } + } + orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); + } + } + + // Bail out if this is a no-op like .hide().hide() + propTween = !jQuery.isEmptyObject( props ); + if ( !propTween && jQuery.isEmptyObject( orig ) ) { + return; + } + + // Restrict "overflow" and "display" styles during box animations + if ( isBox && elem.nodeType === 1 ) { + + // Support: IE <=9 - 11, Edge 12 - 15 + // Record all 3 overflow attributes because IE does not infer the shorthand + // from identically-valued overflowX and overflowY and Edge just mirrors + // the overflowX value there. + opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; + + // Identify a display type, preferring old show/hide data over the CSS cascade + restoreDisplay = dataShow && dataShow.display; + if ( restoreDisplay == null ) { + restoreDisplay = dataPriv.get( elem, "display" ); + } + display = jQuery.css( elem, "display" ); + if ( display === "none" ) { + if ( restoreDisplay ) { + display = restoreDisplay; + } else { + + // Get nonempty value(s) by temporarily forcing visibility + showHide( [ elem ], true ); + restoreDisplay = elem.style.display || restoreDisplay; + display = jQuery.css( elem, "display" ); + showHide( [ elem ] ); + } + } + + // Animate inline elements as inline-block + if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { + if ( jQuery.css( elem, "float" ) === "none" ) { + + // Restore the original display value at the end of pure show/hide animations + if ( !propTween ) { + anim.done( function() { + style.display = restoreDisplay; + } ); + if ( restoreDisplay == null ) { + display = style.display; + restoreDisplay = display === "none" ? "" : display; + } + } + style.display = "inline-block"; + } + } + } + + if ( opts.overflow ) { + style.overflow = "hidden"; + anim.always( function() { + style.overflow = opts.overflow[ 0 ]; + style.overflowX = opts.overflow[ 1 ]; + style.overflowY = opts.overflow[ 2 ]; + } ); + } + + // Implement show/hide animations + propTween = false; + for ( prop in orig ) { + + // General show/hide setup for this element animation + if ( !propTween ) { + if ( dataShow ) { + if ( "hidden" in dataShow ) { + hidden = dataShow.hidden; + } + } else { + dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); + } + + // Store hidden/visible for toggle so `.stop().toggle()` "reverses" + if ( toggle ) { + dataShow.hidden = !hidden; + } + + // Show elements before animating them + if ( hidden ) { + showHide( [ elem ], true ); + } + + /* eslint-disable no-loop-func */ + + anim.done( function() { + + /* eslint-enable no-loop-func */ + + // The final step of a "hide" animation is actually hiding the element + if ( !hidden ) { + showHide( [ elem ] ); + } + dataPriv.remove( elem, "fxshow" ); + for ( prop in orig ) { + jQuery.style( elem, prop, orig[ prop ] ); + } + } ); + } + + // Per-property setup + propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); + if ( !( prop in dataShow ) ) { + dataShow[ prop ] = propTween.start; + if ( hidden ) { + propTween.end = propTween.start; + propTween.start = 0; + } + } + } +} + +function propFilter( props, specialEasing ) { + var index, name, easing, value, hooks; + + // camelCase, specialEasing and expand cssHook pass + for ( index in props ) { + name = camelCase( index ); + easing = specialEasing[ name ]; + value = props[ index ]; + if ( Array.isArray( value ) ) { + easing = value[ 1 ]; + value = props[ index ] = value[ 0 ]; + } + + if ( index !== name ) { + props[ name ] = value; + delete props[ index ]; + } + + hooks = jQuery.cssHooks[ name ]; + if ( hooks && "expand" in hooks ) { + value = hooks.expand( value ); + delete props[ name ]; + + // Not quite $.extend, this won't overwrite existing keys. + // Reusing 'index' because we have the correct "name" + for ( index in value ) { + if ( !( index in props ) ) { + props[ index ] = value[ index ]; + specialEasing[ index ] = easing; + } + } + } else { + specialEasing[ name ] = easing; + } + } +} + +function Animation( elem, properties, options ) { + var result, + stopped, + index = 0, + length = Animation.prefilters.length, + deferred = jQuery.Deferred().always( function() { + + // Don't match elem in the :animated selector + delete tick.elem; + } ), + tick = function() { + if ( stopped ) { + return false; + } + var currentTime = fxNow || createFxNow(), + remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), + + // Support: Android 2.3 only + // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) + temp = remaining / animation.duration || 0, + percent = 1 - temp, + index = 0, + length = animation.tweens.length; + + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( percent ); + } + + deferred.notifyWith( elem, [ animation, percent, remaining ] ); + + // If there's more to do, yield + if ( percent < 1 && length ) { + return remaining; + } + + // If this was an empty animation, synthesize a final progress notification + if ( !length ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + } + + // Resolve the animation and report its conclusion + deferred.resolveWith( elem, [ animation ] ); + return false; + }, + animation = deferred.promise( { + elem: elem, + props: jQuery.extend( {}, properties ), + opts: jQuery.extend( true, { + specialEasing: {}, + easing: jQuery.easing._default + }, options ), + originalProperties: properties, + originalOptions: options, + startTime: fxNow || createFxNow(), + duration: options.duration, + tweens: [], + createTween: function( prop, end ) { + var tween = jQuery.Tween( elem, animation.opts, prop, end, + animation.opts.specialEasing[ prop ] || animation.opts.easing ); + animation.tweens.push( tween ); + return tween; + }, + stop: function( gotoEnd ) { + var index = 0, + + // If we are going to the end, we want to run all the tweens + // otherwise we skip this part + length = gotoEnd ? animation.tweens.length : 0; + if ( stopped ) { + return this; + } + stopped = true; + for ( ; index < length; index++ ) { + animation.tweens[ index ].run( 1 ); + } + + // Resolve when we played the last frame; otherwise, reject + if ( gotoEnd ) { + deferred.notifyWith( elem, [ animation, 1, 0 ] ); + deferred.resolveWith( elem, [ animation, gotoEnd ] ); + } else { + deferred.rejectWith( elem, [ animation, gotoEnd ] ); + } + return this; + } + } ), + props = animation.props; + + propFilter( props, animation.opts.specialEasing ); + + for ( ; index < length; index++ ) { + result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); + if ( result ) { + if ( isFunction( result.stop ) ) { + jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = + result.stop.bind( result ); + } + return result; + } + } + + jQuery.map( props, createTween, animation ); + + if ( isFunction( animation.opts.start ) ) { + animation.opts.start.call( elem, animation ); + } + + // Attach callbacks from options + animation + .progress( animation.opts.progress ) + .done( animation.opts.done, animation.opts.complete ) + .fail( animation.opts.fail ) + .always( animation.opts.always ); + + jQuery.fx.timer( + jQuery.extend( tick, { + elem: elem, + anim: animation, + queue: animation.opts.queue + } ) + ); + + return animation; +} + +jQuery.Animation = jQuery.extend( Animation, { + + tweeners: { + "*": [ function( prop, value ) { + var tween = this.createTween( prop, value ); + adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); + return tween; + } ] + }, + + tweener: function( props, callback ) { + if ( isFunction( props ) ) { + callback = props; + props = [ "*" ]; + } else { + props = props.match( rnothtmlwhite ); + } + + var prop, + index = 0, + length = props.length; + + for ( ; index < length; index++ ) { + prop = props[ index ]; + Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; + Animation.tweeners[ prop ].unshift( callback ); + } + }, + + prefilters: [ defaultPrefilter ], + + prefilter: function( callback, prepend ) { + if ( prepend ) { + Animation.prefilters.unshift( callback ); + } else { + Animation.prefilters.push( callback ); + } + } +} ); + +jQuery.speed = function( speed, easing, fn ) { + var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { + complete: fn || !fn && easing || + isFunction( speed ) && speed, + duration: speed, + easing: fn && easing || easing && !isFunction( easing ) && easing + }; + + // Go to the end state if fx are off + if ( jQuery.fx.off ) { + opt.duration = 0; + + } else { + if ( typeof opt.duration !== "number" ) { + if ( opt.duration in jQuery.fx.speeds ) { + opt.duration = jQuery.fx.speeds[ opt.duration ]; + + } else { + opt.duration = jQuery.fx.speeds._default; + } + } + } + + // Normalize opt.queue - true/undefined/null -> "fx" + if ( opt.queue == null || opt.queue === true ) { + opt.queue = "fx"; + } + + // Queueing + opt.old = opt.complete; + + opt.complete = function() { + if ( isFunction( opt.old ) ) { + opt.old.call( this ); + } + + if ( opt.queue ) { + jQuery.dequeue( this, opt.queue ); + } + }; + + return opt; +}; + +jQuery.fn.extend( { + fadeTo: function( speed, to, easing, callback ) { + + // Show any hidden elements after setting opacity to 0 + return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() + + // Animate to the value specified + .end().animate( { opacity: to }, speed, easing, callback ); + }, + animate: function( prop, speed, easing, callback ) { + var empty = jQuery.isEmptyObject( prop ), + optall = jQuery.speed( speed, easing, callback ), + doAnimation = function() { + + // Operate on a copy of prop so per-property easing won't be lost + var anim = Animation( this, jQuery.extend( {}, prop ), optall ); + + // Empty animations, or finishing resolves immediately + if ( empty || dataPriv.get( this, "finish" ) ) { + anim.stop( true ); + } + }; + + doAnimation.finish = doAnimation; + + return empty || optall.queue === false ? + this.each( doAnimation ) : + this.queue( optall.queue, doAnimation ); + }, + stop: function( type, clearQueue, gotoEnd ) { + var stopQueue = function( hooks ) { + var stop = hooks.stop; + delete hooks.stop; + stop( gotoEnd ); + }; + + if ( typeof type !== "string" ) { + gotoEnd = clearQueue; + clearQueue = type; + type = undefined; + } + if ( clearQueue ) { + this.queue( type || "fx", [] ); + } + + return this.each( function() { + var dequeue = true, + index = type != null && type + "queueHooks", + timers = jQuery.timers, + data = dataPriv.get( this ); + + if ( index ) { + if ( data[ index ] && data[ index ].stop ) { + stopQueue( data[ index ] ); + } + } else { + for ( index in data ) { + if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { + stopQueue( data[ index ] ); + } + } + } + + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && + ( type == null || timers[ index ].queue === type ) ) { + + timers[ index ].anim.stop( gotoEnd ); + dequeue = false; + timers.splice( index, 1 ); + } + } + + // Start the next in the queue if the last step wasn't forced. + // Timers currently will call their complete callbacks, which + // will dequeue but only if they were gotoEnd. + if ( dequeue || !gotoEnd ) { + jQuery.dequeue( this, type ); + } + } ); + }, + finish: function( type ) { + if ( type !== false ) { + type = type || "fx"; + } + return this.each( function() { + var index, + data = dataPriv.get( this ), + queue = data[ type + "queue" ], + hooks = data[ type + "queueHooks" ], + timers = jQuery.timers, + length = queue ? queue.length : 0; + + // Enable finishing flag on private data + data.finish = true; + + // Empty the queue first + jQuery.queue( this, type, [] ); + + if ( hooks && hooks.stop ) { + hooks.stop.call( this, true ); + } + + // Look for any active animations, and finish them + for ( index = timers.length; index--; ) { + if ( timers[ index ].elem === this && timers[ index ].queue === type ) { + timers[ index ].anim.stop( true ); + timers.splice( index, 1 ); + } + } + + // Look for any animations in the old queue and finish them + for ( index = 0; index < length; index++ ) { + if ( queue[ index ] && queue[ index ].finish ) { + queue[ index ].finish.call( this ); + } + } + + // Turn off finishing flag + delete data.finish; + } ); + } +} ); + +jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { + var cssFn = jQuery.fn[ name ]; + jQuery.fn[ name ] = function( speed, easing, callback ) { + return speed == null || typeof speed === "boolean" ? + cssFn.apply( this, arguments ) : + this.animate( genFx( name, true ), speed, easing, callback ); + }; +} ); + +// Generate shortcuts for custom animations +jQuery.each( { + slideDown: genFx( "show" ), + slideUp: genFx( "hide" ), + slideToggle: genFx( "toggle" ), + fadeIn: { opacity: "show" }, + fadeOut: { opacity: "hide" }, + fadeToggle: { opacity: "toggle" } +}, function( name, props ) { + jQuery.fn[ name ] = function( speed, easing, callback ) { + return this.animate( props, speed, easing, callback ); + }; +} ); + +jQuery.timers = []; +jQuery.fx.tick = function() { + var timer, + i = 0, + timers = jQuery.timers; + + fxNow = Date.now(); + + for ( ; i < timers.length; i++ ) { + timer = timers[ i ]; + + // Run the timer and safely remove it when done (allowing for external removal) + if ( !timer() && timers[ i ] === timer ) { + timers.splice( i--, 1 ); + } + } + + if ( !timers.length ) { + jQuery.fx.stop(); + } + fxNow = undefined; +}; + +jQuery.fx.timer = function( timer ) { + jQuery.timers.push( timer ); + jQuery.fx.start(); +}; + +jQuery.fx.interval = 13; +jQuery.fx.start = function() { + if ( inProgress ) { + return; + } + + inProgress = true; + schedule(); +}; + +jQuery.fx.stop = function() { + inProgress = null; +}; + +jQuery.fx.speeds = { + slow: 600, + fast: 200, + + // Default speed + _default: 400 +}; + + +// Based off of the plugin by Clint Helfers, with permission. +// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ +jQuery.fn.delay = function( time, type ) { + time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; + type = type || "fx"; + + return this.queue( type, function( next, hooks ) { + var timeout = window.setTimeout( next, time ); + hooks.stop = function() { + window.clearTimeout( timeout ); + }; + } ); +}; + + +( function() { + var input = document.createElement( "input" ), + select = document.createElement( "select" ), + opt = select.appendChild( document.createElement( "option" ) ); + + input.type = "checkbox"; + + // Support: Android <=4.3 only + // Default value for a checkbox should be "on" + support.checkOn = input.value !== ""; + + // Support: IE <=11 only + // Must access selectedIndex to make default options select + support.optSelected = opt.selected; + + // Support: IE <=11 only + // An input loses its value after becoming a radio + input = document.createElement( "input" ); + input.value = "t"; + input.type = "radio"; + support.radioValue = input.value === "t"; +} )(); + + +var boolHook, + attrHandle = jQuery.expr.attrHandle; + +jQuery.fn.extend( { + attr: function( name, value ) { + return access( this, jQuery.attr, name, value, arguments.length > 1 ); + }, + + removeAttr: function( name ) { + return this.each( function() { + jQuery.removeAttr( this, name ); + } ); + } +} ); + +jQuery.extend( { + attr: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set attributes on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + // Fallback to prop when attributes are not supported + if ( typeof elem.getAttribute === "undefined" ) { + return jQuery.prop( elem, name, value ); + } + + // Attribute hooks are determined by the lowercase version + // Grab necessary hook if one is defined + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + hooks = jQuery.attrHooks[ name.toLowerCase() ] || + ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); + } + + if ( value !== undefined ) { + if ( value === null ) { + jQuery.removeAttr( elem, name ); + return; + } + + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + elem.setAttribute( name, value + "" ); + return value; + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + ret = jQuery.find.attr( elem, name ); + + // Non-existent attributes return null, we normalize to undefined + return ret == null ? undefined : ret; + }, + + attrHooks: { + type: { + set: function( elem, value ) { + if ( !support.radioValue && value === "radio" && + nodeName( elem, "input" ) ) { + var val = elem.value; + elem.setAttribute( "type", value ); + if ( val ) { + elem.value = val; + } + return value; + } + } + } + }, + + removeAttr: function( elem, value ) { + var name, + i = 0, + + // Attribute names can contain non-HTML whitespace characters + // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 + attrNames = value && value.match( rnothtmlwhite ); + + if ( attrNames && elem.nodeType === 1 ) { + while ( ( name = attrNames[ i++ ] ) ) { + elem.removeAttribute( name ); + } + } + } +} ); + +// Hooks for boolean attributes +boolHook = { + set: function( elem, value, name ) { + if ( value === false ) { + + // Remove boolean attributes when set to false + jQuery.removeAttr( elem, name ); + } else { + elem.setAttribute( name, name ); + } + return name; + } +}; + +jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { + var getter = attrHandle[ name ] || jQuery.find.attr; + + attrHandle[ name ] = function( elem, name, isXML ) { + var ret, handle, + lowercaseName = name.toLowerCase(); + + if ( !isXML ) { + + // Avoid an infinite loop by temporarily removing this function from the getter + handle = attrHandle[ lowercaseName ]; + attrHandle[ lowercaseName ] = ret; + ret = getter( elem, name, isXML ) != null ? + lowercaseName : + null; + attrHandle[ lowercaseName ] = handle; + } + return ret; + }; +} ); + + + + +var rfocusable = /^(?:input|select|textarea|button)$/i, + rclickable = /^(?:a|area)$/i; + +jQuery.fn.extend( { + prop: function( name, value ) { + return access( this, jQuery.prop, name, value, arguments.length > 1 ); + }, + + removeProp: function( name ) { + return this.each( function() { + delete this[ jQuery.propFix[ name ] || name ]; + } ); + } +} ); + +jQuery.extend( { + prop: function( elem, name, value ) { + var ret, hooks, + nType = elem.nodeType; + + // Don't get/set properties on text, comment and attribute nodes + if ( nType === 3 || nType === 8 || nType === 2 ) { + return; + } + + if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { + + // Fix name and attach hooks + name = jQuery.propFix[ name ] || name; + hooks = jQuery.propHooks[ name ]; + } + + if ( value !== undefined ) { + if ( hooks && "set" in hooks && + ( ret = hooks.set( elem, value, name ) ) !== undefined ) { + return ret; + } + + return ( elem[ name ] = value ); + } + + if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { + return ret; + } + + return elem[ name ]; + }, + + propHooks: { + tabIndex: { + get: function( elem ) { + + // Support: IE <=9 - 11 only + // elem.tabIndex doesn't always return the + // correct value when it hasn't been explicitly set + // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ + // Use proper attribute retrieval(#12072) + var tabindex = jQuery.find.attr( elem, "tabindex" ); + + if ( tabindex ) { + return parseInt( tabindex, 10 ); + } + + if ( + rfocusable.test( elem.nodeName ) || + rclickable.test( elem.nodeName ) && + elem.href + ) { + return 0; + } + + return -1; + } + } + }, + + propFix: { + "for": "htmlFor", + "class": "className" + } +} ); + +// Support: IE <=11 only +// Accessing the selectedIndex property +// forces the browser to respect setting selected +// on the option +// The getter ensures a default option is selected +// when in an optgroup +// eslint rule "no-unused-expressions" is disabled for this code +// since it considers such accessions noop +if ( !support.optSelected ) { + jQuery.propHooks.selected = { + get: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent && parent.parentNode ) { + parent.parentNode.selectedIndex; + } + return null; + }, + set: function( elem ) { + + /* eslint no-unused-expressions: "off" */ + + var parent = elem.parentNode; + if ( parent ) { + parent.selectedIndex; + + if ( parent.parentNode ) { + parent.parentNode.selectedIndex; + } + } + } + }; +} + +jQuery.each( [ + "tabIndex", + "readOnly", + "maxLength", + "cellSpacing", + "cellPadding", + "rowSpan", + "colSpan", + "useMap", + "frameBorder", + "contentEditable" +], function() { + jQuery.propFix[ this.toLowerCase() ] = this; +} ); + + + + + // Strip and collapse whitespace according to HTML spec + // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace + function stripAndCollapse( value ) { + var tokens = value.match( rnothtmlwhite ) || []; + return tokens.join( " " ); + } + + +function getClass( elem ) { + return elem.getAttribute && elem.getAttribute( "class" ) || ""; +} + +function classesToArray( value ) { + if ( Array.isArray( value ) ) { + return value; + } + if ( typeof value === "string" ) { + return value.match( rnothtmlwhite ) || []; + } + return []; +} + +jQuery.fn.extend( { + addClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + classes = classesToArray( value ); + + if ( classes.length ) { + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + if ( cur.indexOf( " " + clazz + " " ) < 0 ) { + cur += clazz + " "; + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + removeClass: function( value ) { + var classes, elem, cur, curValue, clazz, j, finalValue, + i = 0; + + if ( isFunction( value ) ) { + return this.each( function( j ) { + jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); + } ); + } + + if ( !arguments.length ) { + return this.attr( "class", "" ); + } + + classes = classesToArray( value ); + + if ( classes.length ) { + while ( ( elem = this[ i++ ] ) ) { + curValue = getClass( elem ); + + // This expression is here for better compressibility (see addClass) + cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); + + if ( cur ) { + j = 0; + while ( ( clazz = classes[ j++ ] ) ) { + + // Remove *all* instances + while ( cur.indexOf( " " + clazz + " " ) > -1 ) { + cur = cur.replace( " " + clazz + " ", " " ); + } + } + + // Only assign if different to avoid unneeded rendering. + finalValue = stripAndCollapse( cur ); + if ( curValue !== finalValue ) { + elem.setAttribute( "class", finalValue ); + } + } + } + } + + return this; + }, + + toggleClass: function( value, stateVal ) { + var type = typeof value, + isValidValue = type === "string" || Array.isArray( value ); + + if ( typeof stateVal === "boolean" && isValidValue ) { + return stateVal ? this.addClass( value ) : this.removeClass( value ); + } + + if ( isFunction( value ) ) { + return this.each( function( i ) { + jQuery( this ).toggleClass( + value.call( this, i, getClass( this ), stateVal ), + stateVal + ); + } ); + } + + return this.each( function() { + var className, i, self, classNames; + + if ( isValidValue ) { + + // Toggle individual class names + i = 0; + self = jQuery( this ); + classNames = classesToArray( value ); + + while ( ( className = classNames[ i++ ] ) ) { + + // Check each className given, space separated list + if ( self.hasClass( className ) ) { + self.removeClass( className ); + } else { + self.addClass( className ); + } + } + + // Toggle whole class name + } else if ( value === undefined || type === "boolean" ) { + className = getClass( this ); + if ( className ) { + + // Store className if set + dataPriv.set( this, "__className__", className ); + } + + // If the element has a class name or if we're passed `false`, + // then remove the whole classname (if there was one, the above saved it). + // Otherwise bring back whatever was previously saved (if anything), + // falling back to the empty string if nothing was stored. + if ( this.setAttribute ) { + this.setAttribute( "class", + className || value === false ? + "" : + dataPriv.get( this, "__className__" ) || "" + ); + } + } + } ); + }, + + hasClass: function( selector ) { + var className, elem, + i = 0; + + className = " " + selector + " "; + while ( ( elem = this[ i++ ] ) ) { + if ( elem.nodeType === 1 && + ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { + return true; + } + } + + return false; + } +} ); + + + + +var rreturn = /\r/g; + +jQuery.fn.extend( { + val: function( value ) { + var hooks, ret, valueIsFunction, + elem = this[ 0 ]; + + if ( !arguments.length ) { + if ( elem ) { + hooks = jQuery.valHooks[ elem.type ] || + jQuery.valHooks[ elem.nodeName.toLowerCase() ]; + + if ( hooks && + "get" in hooks && + ( ret = hooks.get( elem, "value" ) ) !== undefined + ) { + return ret; + } + + ret = elem.value; + + // Handle most common string cases + if ( typeof ret === "string" ) { + return ret.replace( rreturn, "" ); + } + + // Handle cases where value is null/undef or number + return ret == null ? "" : ret; + } + + return; + } + + valueIsFunction = isFunction( value ); + + return this.each( function( i ) { + var val; + + if ( this.nodeType !== 1 ) { + return; + } + + if ( valueIsFunction ) { + val = value.call( this, i, jQuery( this ).val() ); + } else { + val = value; + } + + // Treat null/undefined as ""; convert numbers to string + if ( val == null ) { + val = ""; + + } else if ( typeof val === "number" ) { + val += ""; + + } else if ( Array.isArray( val ) ) { + val = jQuery.map( val, function( value ) { + return value == null ? "" : value + ""; + } ); + } + + hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; + + // If set returns undefined, fall back to normal setting + if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { + this.value = val; + } + } ); + } +} ); + +jQuery.extend( { + valHooks: { + option: { + get: function( elem ) { + + var val = jQuery.find.attr( elem, "value" ); + return val != null ? + val : + + // Support: IE <=10 - 11 only + // option.text throws exceptions (#14686, #14858) + // Strip and collapse whitespace + // https://html.spec.whatwg.org/#strip-and-collapse-whitespace + stripAndCollapse( jQuery.text( elem ) ); + } + }, + select: { + get: function( elem ) { + var value, option, i, + options = elem.options, + index = elem.selectedIndex, + one = elem.type === "select-one", + values = one ? null : [], + max = one ? index + 1 : options.length; + + if ( index < 0 ) { + i = max; + + } else { + i = one ? index : 0; + } + + // Loop through all the selected options + for ( ; i < max; i++ ) { + option = options[ i ]; + + // Support: IE <=9 only + // IE8-9 doesn't update selected after form reset (#2551) + if ( ( option.selected || i === index ) && + + // Don't return options that are disabled or in a disabled optgroup + !option.disabled && + ( !option.parentNode.disabled || + !nodeName( option.parentNode, "optgroup" ) ) ) { + + // Get the specific value for the option + value = jQuery( option ).val(); + + // We don't need an array for one selects + if ( one ) { + return value; + } + + // Multi-Selects return an array + values.push( value ); + } + } + + return values; + }, + + set: function( elem, value ) { + var optionSet, option, + options = elem.options, + values = jQuery.makeArray( value ), + i = options.length; + + while ( i-- ) { + option = options[ i ]; + + /* eslint-disable no-cond-assign */ + + if ( option.selected = + jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 + ) { + optionSet = true; + } + + /* eslint-enable no-cond-assign */ + } + + // Force browsers to behave consistently when non-matching value is set + if ( !optionSet ) { + elem.selectedIndex = -1; + } + return values; + } + } + } +} ); + +// Radios and checkboxes getter/setter +jQuery.each( [ "radio", "checkbox" ], function() { + jQuery.valHooks[ this ] = { + set: function( elem, value ) { + if ( Array.isArray( value ) ) { + return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); + } + } + }; + if ( !support.checkOn ) { + jQuery.valHooks[ this ].get = function( elem ) { + return elem.getAttribute( "value" ) === null ? "on" : elem.value; + }; + } +} ); + + + + +// Return jQuery for attributes-only inclusion + + +support.focusin = "onfocusin" in window; + + +var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, + stopPropagationCallback = function( e ) { + e.stopPropagation(); + }; + +jQuery.extend( jQuery.event, { + + trigger: function( event, data, elem, onlyHandlers ) { + + var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, + eventPath = [ elem || document ], + type = hasOwn.call( event, "type" ) ? event.type : event, + namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; + + cur = lastElement = tmp = elem = elem || document; + + // Don't do events on text and comment nodes + if ( elem.nodeType === 3 || elem.nodeType === 8 ) { + return; + } + + // focus/blur morphs to focusin/out; ensure we're not firing them right now + if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { + return; + } + + if ( type.indexOf( "." ) > -1 ) { + + // Namespaced trigger; create a regexp to match event type in handle() + namespaces = type.split( "." ); + type = namespaces.shift(); + namespaces.sort(); + } + ontype = type.indexOf( ":" ) < 0 && "on" + type; + + // Caller can pass in a jQuery.Event object, Object, or just an event type string + event = event[ jQuery.expando ] ? + event : + new jQuery.Event( type, typeof event === "object" && event ); + + // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) + event.isTrigger = onlyHandlers ? 2 : 3; + event.namespace = namespaces.join( "." ); + event.rnamespace = event.namespace ? + new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : + null; + + // Clean up the event in case it is being reused + event.result = undefined; + if ( !event.target ) { + event.target = elem; + } + + // Clone any incoming data and prepend the event, creating the handler arg list + data = data == null ? + [ event ] : + jQuery.makeArray( data, [ event ] ); + + // Allow special events to draw outside the lines + special = jQuery.event.special[ type ] || {}; + if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { + return; + } + + // Determine event propagation path in advance, per W3C events spec (#9951) + // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) + if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { + + bubbleType = special.delegateType || type; + if ( !rfocusMorph.test( bubbleType + type ) ) { + cur = cur.parentNode; + } + for ( ; cur; cur = cur.parentNode ) { + eventPath.push( cur ); + tmp = cur; + } + + // Only add window if we got to document (e.g., not plain obj or detached DOM) + if ( tmp === ( elem.ownerDocument || document ) ) { + eventPath.push( tmp.defaultView || tmp.parentWindow || window ); + } + } + + // Fire handlers on the event path + i = 0; + while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { + lastElement = cur; + event.type = i > 1 ? + bubbleType : + special.bindType || type; + + // jQuery handler + handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && + dataPriv.get( cur, "handle" ); + if ( handle ) { + handle.apply( cur, data ); + } + + // Native handler + handle = ontype && cur[ ontype ]; + if ( handle && handle.apply && acceptData( cur ) ) { + event.result = handle.apply( cur, data ); + if ( event.result === false ) { + event.preventDefault(); + } + } + } + event.type = type; + + // If nobody prevented the default action, do it now + if ( !onlyHandlers && !event.isDefaultPrevented() ) { + + if ( ( !special._default || + special._default.apply( eventPath.pop(), data ) === false ) && + acceptData( elem ) ) { + + // Call a native DOM method on the target with the same name as the event. + // Don't do default actions on window, that's where global variables be (#6170) + if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { + + // Don't re-trigger an onFOO event when we call its FOO() method + tmp = elem[ ontype ]; + + if ( tmp ) { + elem[ ontype ] = null; + } + + // Prevent re-triggering of the same event, since we already bubbled it above + jQuery.event.triggered = type; + + if ( event.isPropagationStopped() ) { + lastElement.addEventListener( type, stopPropagationCallback ); + } + + elem[ type ](); + + if ( event.isPropagationStopped() ) { + lastElement.removeEventListener( type, stopPropagationCallback ); + } + + jQuery.event.triggered = undefined; + + if ( tmp ) { + elem[ ontype ] = tmp; + } + } + } + } + + return event.result; + }, + + // Piggyback on a donor event to simulate a different one + // Used only for `focus(in | out)` events + simulate: function( type, elem, event ) { + var e = jQuery.extend( + new jQuery.Event(), + event, + { + type: type, + isSimulated: true + } + ); + + jQuery.event.trigger( e, null, elem ); + } + +} ); + +jQuery.fn.extend( { + + trigger: function( type, data ) { + return this.each( function() { + jQuery.event.trigger( type, data, this ); + } ); + }, + triggerHandler: function( type, data ) { + var elem = this[ 0 ]; + if ( elem ) { + return jQuery.event.trigger( type, data, elem, true ); + } + } +} ); + + +// Support: Firefox <=44 +// Firefox doesn't have focus(in | out) events +// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 +// +// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 +// focus(in | out) events fire after focus & blur events, +// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order +// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 +if ( !support.focusin ) { + jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { + + // Attach a single capturing handler on the document while someone wants focusin/focusout + var handler = function( event ) { + jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); + }; + + jQuery.event.special[ fix ] = { + setup: function() { + + // Handle: regular nodes (via `this.ownerDocument`), window + // (via `this.document`) & document (via `this`). + var doc = this.ownerDocument || this.document || this, + attaches = dataPriv.access( doc, fix ); + + if ( !attaches ) { + doc.addEventListener( orig, handler, true ); + } + dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); + }, + teardown: function() { + var doc = this.ownerDocument || this.document || this, + attaches = dataPriv.access( doc, fix ) - 1; + + if ( !attaches ) { + doc.removeEventListener( orig, handler, true ); + dataPriv.remove( doc, fix ); + + } else { + dataPriv.access( doc, fix, attaches ); + } + } + }; + } ); +} +var location = window.location; + +var nonce = { guid: Date.now() }; + +var rquery = ( /\?/ ); + + + +// Cross-browser xml parsing +jQuery.parseXML = function( data ) { + var xml, parserErrorElem; + if ( !data || typeof data !== "string" ) { + return null; + } + + // Support: IE 9 - 11 only + // IE throws on parseFromString with invalid input. + try { + xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); + } catch ( e ) {} + + parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; + if ( !xml || parserErrorElem ) { + jQuery.error( "Invalid XML: " + ( + parserErrorElem ? + jQuery.map( parserErrorElem.childNodes, function( el ) { + return el.textContent; + } ).join( "\n" ) : + data + ) ); + } + return xml; +}; + + +var + rbracket = /\[\]$/, + rCRLF = /\r?\n/g, + rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, + rsubmittable = /^(?:input|select|textarea|keygen)/i; + +function buildParams( prefix, obj, traditional, add ) { + var name; + + if ( Array.isArray( obj ) ) { + + // Serialize array item. + jQuery.each( obj, function( i, v ) { + if ( traditional || rbracket.test( prefix ) ) { + + // Treat each array item as a scalar. + add( prefix, v ); + + } else { + + // Item is non-scalar (array or object), encode its numeric index. + buildParams( + prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", + v, + traditional, + add + ); + } + } ); + + } else if ( !traditional && toType( obj ) === "object" ) { + + // Serialize object item. + for ( name in obj ) { + buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); + } + + } else { + + // Serialize scalar item. + add( prefix, obj ); + } +} + +// Serialize an array of form elements or a set of +// key/values into a query string +jQuery.param = function( a, traditional ) { + var prefix, + s = [], + add = function( key, valueOrFunction ) { + + // If value is a function, invoke it and use its return value + var value = isFunction( valueOrFunction ) ? + valueOrFunction() : + valueOrFunction; + + s[ s.length ] = encodeURIComponent( key ) + "=" + + encodeURIComponent( value == null ? "" : value ); + }; + + if ( a == null ) { + return ""; + } + + // If an array was passed in, assume that it is an array of form elements. + if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { + + // Serialize the form elements + jQuery.each( a, function() { + add( this.name, this.value ); + } ); + + } else { + + // If traditional, encode the "old" way (the way 1.3.2 or older + // did it), otherwise encode params recursively. + for ( prefix in a ) { + buildParams( prefix, a[ prefix ], traditional, add ); + } + } + + // Return the resulting serialization + return s.join( "&" ); +}; + +jQuery.fn.extend( { + serialize: function() { + return jQuery.param( this.serializeArray() ); + }, + serializeArray: function() { + return this.map( function() { + + // Can add propHook for "elements" to filter or add form elements + var elements = jQuery.prop( this, "elements" ); + return elements ? jQuery.makeArray( elements ) : this; + } ).filter( function() { + var type = this.type; + + // Use .is( ":disabled" ) so that fieldset[disabled] works + return this.name && !jQuery( this ).is( ":disabled" ) && + rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && + ( this.checked || !rcheckableType.test( type ) ); + } ).map( function( _i, elem ) { + var val = jQuery( this ).val(); + + if ( val == null ) { + return null; + } + + if ( Array.isArray( val ) ) { + return jQuery.map( val, function( val ) { + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ); + } + + return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; + } ).get(); + } +} ); + + +var + r20 = /%20/g, + rhash = /#.*$/, + rantiCache = /([?&])_=[^&]*/, + rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, + + // #7653, #8125, #8152: local protocol detection + rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, + rnoContent = /^(?:GET|HEAD)$/, + rprotocol = /^\/\//, + + /* Prefilters + * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) + * 2) These are called: + * - BEFORE asking for a transport + * - AFTER param serialization (s.data is a string if s.processData is true) + * 3) key is the dataType + * 4) the catchall symbol "*" can be used + * 5) execution will start with transport dataType and THEN continue down to "*" if needed + */ + prefilters = {}, + + /* Transports bindings + * 1) key is the dataType + * 2) the catchall symbol "*" can be used + * 3) selection will start with transport dataType and THEN go to "*" if needed + */ + transports = {}, + + // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression + allTypes = "*/".concat( "*" ), + + // Anchor tag for parsing the document origin + originAnchor = document.createElement( "a" ); + +originAnchor.href = location.href; + +// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport +function addToPrefiltersOrTransports( structure ) { + + // dataTypeExpression is optional and defaults to "*" + return function( dataTypeExpression, func ) { + + if ( typeof dataTypeExpression !== "string" ) { + func = dataTypeExpression; + dataTypeExpression = "*"; + } + + var dataType, + i = 0, + dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; + + if ( isFunction( func ) ) { + + // For each dataType in the dataTypeExpression + while ( ( dataType = dataTypes[ i++ ] ) ) { + + // Prepend if requested + if ( dataType[ 0 ] === "+" ) { + dataType = dataType.slice( 1 ) || "*"; + ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); + + // Otherwise append + } else { + ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); + } + } + } + }; +} + +// Base inspection function for prefilters and transports +function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { + + var inspected = {}, + seekingTransport = ( structure === transports ); + + function inspect( dataType ) { + var selected; + inspected[ dataType ] = true; + jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { + var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); + if ( typeof dataTypeOrTransport === "string" && + !seekingTransport && !inspected[ dataTypeOrTransport ] ) { + + options.dataTypes.unshift( dataTypeOrTransport ); + inspect( dataTypeOrTransport ); + return false; + } else if ( seekingTransport ) { + return !( selected = dataTypeOrTransport ); + } + } ); + return selected; + } + + return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); +} + +// A special extend for ajax options +// that takes "flat" options (not to be deep extended) +// Fixes #9887 +function ajaxExtend( target, src ) { + var key, deep, + flatOptions = jQuery.ajaxSettings.flatOptions || {}; + + for ( key in src ) { + if ( src[ key ] !== undefined ) { + ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; + } + } + if ( deep ) { + jQuery.extend( true, target, deep ); + } + + return target; +} + +/* Handles responses to an ajax request: + * - finds the right dataType (mediates between content-type and expected dataType) + * - returns the corresponding response + */ +function ajaxHandleResponses( s, jqXHR, responses ) { + + var ct, type, finalDataType, firstDataType, + contents = s.contents, + dataTypes = s.dataTypes; + + // Remove auto dataType and get content-type in the process + while ( dataTypes[ 0 ] === "*" ) { + dataTypes.shift(); + if ( ct === undefined ) { + ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); + } + } + + // Check if we're dealing with a known content-type + if ( ct ) { + for ( type in contents ) { + if ( contents[ type ] && contents[ type ].test( ct ) ) { + dataTypes.unshift( type ); + break; + } + } + } + + // Check to see if we have a response for the expected dataType + if ( dataTypes[ 0 ] in responses ) { + finalDataType = dataTypes[ 0 ]; + } else { + + // Try convertible dataTypes + for ( type in responses ) { + if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { + finalDataType = type; + break; + } + if ( !firstDataType ) { + firstDataType = type; + } + } + + // Or just use first one + finalDataType = finalDataType || firstDataType; + } + + // If we found a dataType + // We add the dataType to the list if needed + // and return the corresponding response + if ( finalDataType ) { + if ( finalDataType !== dataTypes[ 0 ] ) { + dataTypes.unshift( finalDataType ); + } + return responses[ finalDataType ]; + } +} + +/* Chain conversions given the request and the original response + * Also sets the responseXXX fields on the jqXHR instance + */ +function ajaxConvert( s, response, jqXHR, isSuccess ) { + var conv2, current, conv, tmp, prev, + converters = {}, + + // Work with a copy of dataTypes in case we need to modify it for conversion + dataTypes = s.dataTypes.slice(); + + // Create converters map with lowercased keys + if ( dataTypes[ 1 ] ) { + for ( conv in s.converters ) { + converters[ conv.toLowerCase() ] = s.converters[ conv ]; + } + } + + current = dataTypes.shift(); + + // Convert to each sequential dataType + while ( current ) { + + if ( s.responseFields[ current ] ) { + jqXHR[ s.responseFields[ current ] ] = response; + } + + // Apply the dataFilter if provided + if ( !prev && isSuccess && s.dataFilter ) { + response = s.dataFilter( response, s.dataType ); + } + + prev = current; + current = dataTypes.shift(); + + if ( current ) { + + // There's only work to do if current dataType is non-auto + if ( current === "*" ) { + + current = prev; + + // Convert response if prev dataType is non-auto and differs from current + } else if ( prev !== "*" && prev !== current ) { + + // Seek a direct converter + conv = converters[ prev + " " + current ] || converters[ "* " + current ]; + + // If none found, seek a pair + if ( !conv ) { + for ( conv2 in converters ) { + + // If conv2 outputs current + tmp = conv2.split( " " ); + if ( tmp[ 1 ] === current ) { + + // If prev can be converted to accepted input + conv = converters[ prev + " " + tmp[ 0 ] ] || + converters[ "* " + tmp[ 0 ] ]; + if ( conv ) { + + // Condense equivalence converters + if ( conv === true ) { + conv = converters[ conv2 ]; + + // Otherwise, insert the intermediate dataType + } else if ( converters[ conv2 ] !== true ) { + current = tmp[ 0 ]; + dataTypes.unshift( tmp[ 1 ] ); + } + break; + } + } + } + } + + // Apply converter (if not an equivalence) + if ( conv !== true ) { + + // Unless errors are allowed to bubble, catch and return them + if ( conv && s.throws ) { + response = conv( response ); + } else { + try { + response = conv( response ); + } catch ( e ) { + return { + state: "parsererror", + error: conv ? e : "No conversion from " + prev + " to " + current + }; + } + } + } + } + } + } + + return { state: "success", data: response }; +} + +jQuery.extend( { + + // Counter for holding the number of active queries + active: 0, + + // Last-Modified header cache for next request + lastModified: {}, + etag: {}, + + ajaxSettings: { + url: location.href, + type: "GET", + isLocal: rlocalProtocol.test( location.protocol ), + global: true, + processData: true, + async: true, + contentType: "application/x-www-form-urlencoded; charset=UTF-8", + + /* + timeout: 0, + data: null, + dataType: null, + username: null, + password: null, + cache: null, + throws: false, + traditional: false, + headers: {}, + */ + + accepts: { + "*": allTypes, + text: "text/plain", + html: "text/html", + xml: "application/xml, text/xml", + json: "application/json, text/javascript" + }, + + contents: { + xml: /\bxml\b/, + html: /\bhtml/, + json: /\bjson\b/ + }, + + responseFields: { + xml: "responseXML", + text: "responseText", + json: "responseJSON" + }, + + // Data converters + // Keys separate source (or catchall "*") and destination types with a single space + converters: { + + // Convert anything to text + "* text": String, + + // Text to html (true = no transformation) + "text html": true, + + // Evaluate text as a json expression + "text json": JSON.parse, + + // Parse text as xml + "text xml": jQuery.parseXML + }, + + // For options that shouldn't be deep extended: + // you can add your own custom options here if + // and when you create one that shouldn't be + // deep extended (see ajaxExtend) + flatOptions: { + url: true, + context: true + } + }, + + // Creates a full fledged settings object into target + // with both ajaxSettings and settings fields. + // If target is omitted, writes into ajaxSettings. + ajaxSetup: function( target, settings ) { + return settings ? + + // Building a settings object + ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : + + // Extending ajaxSettings + ajaxExtend( jQuery.ajaxSettings, target ); + }, + + ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), + ajaxTransport: addToPrefiltersOrTransports( transports ), + + // Main method + ajax: function( url, options ) { + + // If url is an object, simulate pre-1.5 signature + if ( typeof url === "object" ) { + options = url; + url = undefined; + } + + // Force options to be an object + options = options || {}; + + var transport, + + // URL without anti-cache param + cacheURL, + + // Response headers + responseHeadersString, + responseHeaders, + + // timeout handle + timeoutTimer, + + // Url cleanup var + urlAnchor, + + // Request state (becomes false upon send and true upon completion) + completed, + + // To know if global events are to be dispatched + fireGlobals, + + // Loop variable + i, + + // uncached part of the url + uncached, + + // Create the final options object + s = jQuery.ajaxSetup( {}, options ), + + // Callbacks context + callbackContext = s.context || s, + + // Context for global events is callbackContext if it is a DOM node or jQuery collection + globalEventContext = s.context && + ( callbackContext.nodeType || callbackContext.jquery ) ? + jQuery( callbackContext ) : + jQuery.event, + + // Deferreds + deferred = jQuery.Deferred(), + completeDeferred = jQuery.Callbacks( "once memory" ), + + // Status-dependent callbacks + statusCode = s.statusCode || {}, + + // Headers (they are sent all at once) + requestHeaders = {}, + requestHeadersNames = {}, + + // Default abort message + strAbort = "canceled", + + // Fake xhr + jqXHR = { + readyState: 0, + + // Builds headers hashtable if needed + getResponseHeader: function( key ) { + var match; + if ( completed ) { + if ( !responseHeaders ) { + responseHeaders = {}; + while ( ( match = rheaders.exec( responseHeadersString ) ) ) { + responseHeaders[ match[ 1 ].toLowerCase() + " " ] = + ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) + .concat( match[ 2 ] ); + } + } + match = responseHeaders[ key.toLowerCase() + " " ]; + } + return match == null ? null : match.join( ", " ); + }, + + // Raw string + getAllResponseHeaders: function() { + return completed ? responseHeadersString : null; + }, + + // Caches the header + setRequestHeader: function( name, value ) { + if ( completed == null ) { + name = requestHeadersNames[ name.toLowerCase() ] = + requestHeadersNames[ name.toLowerCase() ] || name; + requestHeaders[ name ] = value; + } + return this; + }, + + // Overrides response content-type header + overrideMimeType: function( type ) { + if ( completed == null ) { + s.mimeType = type; + } + return this; + }, + + // Status-dependent callbacks + statusCode: function( map ) { + var code; + if ( map ) { + if ( completed ) { + + // Execute the appropriate callbacks + jqXHR.always( map[ jqXHR.status ] ); + } else { + + // Lazy-add the new callbacks in a way that preserves old ones + for ( code in map ) { + statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; + } + } + } + return this; + }, + + // Cancel the request + abort: function( statusText ) { + var finalText = statusText || strAbort; + if ( transport ) { + transport.abort( finalText ); + } + done( 0, finalText ); + return this; + } + }; + + // Attach deferreds + deferred.promise( jqXHR ); + + // Add protocol if not provided (prefilters might expect it) + // Handle falsy url in the settings object (#10093: consistency with old signature) + // We also use the url parameter if available + s.url = ( ( url || s.url || location.href ) + "" ) + .replace( rprotocol, location.protocol + "//" ); + + // Alias method option to type as per ticket #12004 + s.type = options.method || options.type || s.method || s.type; + + // Extract dataTypes list + s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; + + // A cross-domain request is in order when the origin doesn't match the current origin. + if ( s.crossDomain == null ) { + urlAnchor = document.createElement( "a" ); + + // Support: IE <=8 - 11, Edge 12 - 15 + // IE throws exception on accessing the href property if url is malformed, + // e.g. http://example.com:80x/ + try { + urlAnchor.href = s.url; + + // Support: IE <=8 - 11 only + // Anchor's host property isn't correctly set when s.url is relative + urlAnchor.href = urlAnchor.href; + s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== + urlAnchor.protocol + "//" + urlAnchor.host; + } catch ( e ) { + + // If there is an error parsing the URL, assume it is crossDomain, + // it can be rejected by the transport if it is invalid + s.crossDomain = true; + } + } + + // Convert data if not already a string + if ( s.data && s.processData && typeof s.data !== "string" ) { + s.data = jQuery.param( s.data, s.traditional ); + } + + // Apply prefilters + inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); + + // If request was aborted inside a prefilter, stop there + if ( completed ) { + return jqXHR; + } + + // We can fire global events as of now if asked to + // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) + fireGlobals = jQuery.event && s.global; + + // Watch for a new set of requests + if ( fireGlobals && jQuery.active++ === 0 ) { + jQuery.event.trigger( "ajaxStart" ); + } + + // Uppercase the type + s.type = s.type.toUpperCase(); + + // Determine if request has content + s.hasContent = !rnoContent.test( s.type ); + + // Save the URL in case we're toying with the If-Modified-Since + // and/or If-None-Match header later on + // Remove hash to simplify url manipulation + cacheURL = s.url.replace( rhash, "" ); + + // More options handling for requests with no content + if ( !s.hasContent ) { + + // Remember the hash so we can put it back + uncached = s.url.slice( cacheURL.length ); + + // If data is available and should be processed, append data to url + if ( s.data && ( s.processData || typeof s.data === "string" ) ) { + cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; + + // #9682: remove data so that it's not used in an eventual retry + delete s.data; + } + + // Add or update anti-cache param if needed + if ( s.cache === false ) { + cacheURL = cacheURL.replace( rantiCache, "$1" ); + uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + + uncached; + } + + // Put hash and anti-cache on the URL that will be requested (gh-1732) + s.url = cacheURL + uncached; + + // Change '%20' to '+' if this is encoded form body content (gh-2658) + } else if ( s.data && s.processData && + ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { + s.data = s.data.replace( r20, "+" ); + } + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + if ( jQuery.lastModified[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); + } + if ( jQuery.etag[ cacheURL ] ) { + jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); + } + } + + // Set the correct header, if data is being sent + if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { + jqXHR.setRequestHeader( "Content-Type", s.contentType ); + } + + // Set the Accepts header for the server, depending on the dataType + jqXHR.setRequestHeader( + "Accept", + s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? + s.accepts[ s.dataTypes[ 0 ] ] + + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : + s.accepts[ "*" ] + ); + + // Check for headers option + for ( i in s.headers ) { + jqXHR.setRequestHeader( i, s.headers[ i ] ); + } + + // Allow custom headers/mimetypes and early abort + if ( s.beforeSend && + ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { + + // Abort if not done already and return + return jqXHR.abort(); + } + + // Aborting is no longer a cancellation + strAbort = "abort"; + + // Install callbacks on deferreds + completeDeferred.add( s.complete ); + jqXHR.done( s.success ); + jqXHR.fail( s.error ); + + // Get transport + transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); + + // If no transport, we auto-abort + if ( !transport ) { + done( -1, "No Transport" ); + } else { + jqXHR.readyState = 1; + + // Send global event + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); + } + + // If request was aborted inside ajaxSend, stop there + if ( completed ) { + return jqXHR; + } + + // Timeout + if ( s.async && s.timeout > 0 ) { + timeoutTimer = window.setTimeout( function() { + jqXHR.abort( "timeout" ); + }, s.timeout ); + } + + try { + completed = false; + transport.send( requestHeaders, done ); + } catch ( e ) { + + // Rethrow post-completion exceptions + if ( completed ) { + throw e; + } + + // Propagate others as results + done( -1, e ); + } + } + + // Callback for when everything is done + function done( status, nativeStatusText, responses, headers ) { + var isSuccess, success, error, response, modified, + statusText = nativeStatusText; + + // Ignore repeat invocations + if ( completed ) { + return; + } + + completed = true; + + // Clear timeout if it exists + if ( timeoutTimer ) { + window.clearTimeout( timeoutTimer ); + } + + // Dereference transport for early garbage collection + // (no matter how long the jqXHR object will be used) + transport = undefined; + + // Cache response headers + responseHeadersString = headers || ""; + + // Set readyState + jqXHR.readyState = status > 0 ? 4 : 0; + + // Determine if successful + isSuccess = status >= 200 && status < 300 || status === 304; + + // Get response data + if ( responses ) { + response = ajaxHandleResponses( s, jqXHR, responses ); + } + + // Use a noop converter for missing script but not if jsonp + if ( !isSuccess && + jQuery.inArray( "script", s.dataTypes ) > -1 && + jQuery.inArray( "json", s.dataTypes ) < 0 ) { + s.converters[ "text script" ] = function() {}; + } + + // Convert no matter what (that way responseXXX fields are always set) + response = ajaxConvert( s, response, jqXHR, isSuccess ); + + // If successful, handle type chaining + if ( isSuccess ) { + + // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. + if ( s.ifModified ) { + modified = jqXHR.getResponseHeader( "Last-Modified" ); + if ( modified ) { + jQuery.lastModified[ cacheURL ] = modified; + } + modified = jqXHR.getResponseHeader( "etag" ); + if ( modified ) { + jQuery.etag[ cacheURL ] = modified; + } + } + + // if no content + if ( status === 204 || s.type === "HEAD" ) { + statusText = "nocontent"; + + // if not modified + } else if ( status === 304 ) { + statusText = "notmodified"; + + // If we have data, let's convert it + } else { + statusText = response.state; + success = response.data; + error = response.error; + isSuccess = !error; + } + } else { + + // Extract error from statusText and normalize for non-aborts + error = statusText; + if ( status || !statusText ) { + statusText = "error"; + if ( status < 0 ) { + status = 0; + } + } + } + + // Set data for the fake xhr object + jqXHR.status = status; + jqXHR.statusText = ( nativeStatusText || statusText ) + ""; + + // Success/Error + if ( isSuccess ) { + deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); + } else { + deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); + } + + // Status-dependent callbacks + jqXHR.statusCode( statusCode ); + statusCode = undefined; + + if ( fireGlobals ) { + globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", + [ jqXHR, s, isSuccess ? success : error ] ); + } + + // Complete + completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); + + if ( fireGlobals ) { + globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); + + // Handle the global AJAX counter + if ( !( --jQuery.active ) ) { + jQuery.event.trigger( "ajaxStop" ); + } + } + } + + return jqXHR; + }, + + getJSON: function( url, data, callback ) { + return jQuery.get( url, data, callback, "json" ); + }, + + getScript: function( url, callback ) { + return jQuery.get( url, undefined, callback, "script" ); + } +} ); + +jQuery.each( [ "get", "post" ], function( _i, method ) { + jQuery[ method ] = function( url, data, callback, type ) { + + // Shift arguments if data argument was omitted + if ( isFunction( data ) ) { + type = type || callback; + callback = data; + data = undefined; + } + + // The url can be an options object (which then must have .url) + return jQuery.ajax( jQuery.extend( { + url: url, + type: method, + dataType: type, + data: data, + success: callback + }, jQuery.isPlainObject( url ) && url ) ); + }; +} ); + +jQuery.ajaxPrefilter( function( s ) { + var i; + for ( i in s.headers ) { + if ( i.toLowerCase() === "content-type" ) { + s.contentType = s.headers[ i ] || ""; + } + } +} ); + + +jQuery._evalUrl = function( url, options, doc ) { + return jQuery.ajax( { + url: url, + + // Make this explicit, since user can override this through ajaxSetup (#11264) + type: "GET", + dataType: "script", + cache: true, + async: false, + global: false, + + // Only evaluate the response if it is successful (gh-4126) + // dataFilter is not invoked for failure responses, so using it instead + // of the default converter is kludgy but it works. + converters: { + "text script": function() {} + }, + dataFilter: function( response ) { + jQuery.globalEval( response, options, doc ); + } + } ); +}; + + +jQuery.fn.extend( { + wrapAll: function( html ) { + var wrap; + + if ( this[ 0 ] ) { + if ( isFunction( html ) ) { + html = html.call( this[ 0 ] ); + } + + // The elements to wrap the target around + wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); + + if ( this[ 0 ].parentNode ) { + wrap.insertBefore( this[ 0 ] ); + } + + wrap.map( function() { + var elem = this; + + while ( elem.firstElementChild ) { + elem = elem.firstElementChild; + } + + return elem; + } ).append( this ); + } + + return this; + }, + + wrapInner: function( html ) { + if ( isFunction( html ) ) { + return this.each( function( i ) { + jQuery( this ).wrapInner( html.call( this, i ) ); + } ); + } + + return this.each( function() { + var self = jQuery( this ), + contents = self.contents(); + + if ( contents.length ) { + contents.wrapAll( html ); + + } else { + self.append( html ); + } + } ); + }, + + wrap: function( html ) { + var htmlIsFunction = isFunction( html ); + + return this.each( function( i ) { + jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); + } ); + }, + + unwrap: function( selector ) { + this.parent( selector ).not( "body" ).each( function() { + jQuery( this ).replaceWith( this.childNodes ); + } ); + return this; + } +} ); + + +jQuery.expr.pseudos.hidden = function( elem ) { + return !jQuery.expr.pseudos.visible( elem ); +}; +jQuery.expr.pseudos.visible = function( elem ) { + return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); +}; + + + + +jQuery.ajaxSettings.xhr = function() { + try { + return new window.XMLHttpRequest(); + } catch ( e ) {} +}; + +var xhrSuccessStatus = { + + // File protocol always yields status code 0, assume 200 + 0: 200, + + // Support: IE <=9 only + // #1450: sometimes IE returns 1223 when it should be 204 + 1223: 204 + }, + xhrSupported = jQuery.ajaxSettings.xhr(); + +support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); +support.ajax = xhrSupported = !!xhrSupported; + +jQuery.ajaxTransport( function( options ) { + var callback, errorCallback; + + // Cross domain only allowed if supported through XMLHttpRequest + if ( support.cors || xhrSupported && !options.crossDomain ) { + return { + send: function( headers, complete ) { + var i, + xhr = options.xhr(); + + xhr.open( + options.type, + options.url, + options.async, + options.username, + options.password + ); + + // Apply custom fields if provided + if ( options.xhrFields ) { + for ( i in options.xhrFields ) { + xhr[ i ] = options.xhrFields[ i ]; + } + } + + // Override mime type if needed + if ( options.mimeType && xhr.overrideMimeType ) { + xhr.overrideMimeType( options.mimeType ); + } + + // X-Requested-With header + // For cross-domain requests, seeing as conditions for a preflight are + // akin to a jigsaw puzzle, we simply never set it to be sure. + // (it can always be set on a per-request basis or even using ajaxSetup) + // For same-domain requests, won't change header if already provided. + if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { + headers[ "X-Requested-With" ] = "XMLHttpRequest"; + } + + // Set headers + for ( i in headers ) { + xhr.setRequestHeader( i, headers[ i ] ); + } + + // Callback + callback = function( type ) { + return function() { + if ( callback ) { + callback = errorCallback = xhr.onload = + xhr.onerror = xhr.onabort = xhr.ontimeout = + xhr.onreadystatechange = null; + + if ( type === "abort" ) { + xhr.abort(); + } else if ( type === "error" ) { + + // Support: IE <=9 only + // On a manual native abort, IE9 throws + // errors on any property access that is not readyState + if ( typeof xhr.status !== "number" ) { + complete( 0, "error" ); + } else { + complete( + + // File: protocol always yields status 0; see #8605, #14207 + xhr.status, + xhr.statusText + ); + } + } else { + complete( + xhrSuccessStatus[ xhr.status ] || xhr.status, + xhr.statusText, + + // Support: IE <=9 only + // IE9 has no XHR2 but throws on binary (trac-11426) + // For XHR2 non-text, let the caller handle it (gh-2498) + ( xhr.responseType || "text" ) !== "text" || + typeof xhr.responseText !== "string" ? + { binary: xhr.response } : + { text: xhr.responseText }, + xhr.getAllResponseHeaders() + ); + } + } + }; + }; + + // Listen to events + xhr.onload = callback(); + errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); + + // Support: IE 9 only + // Use onreadystatechange to replace onabort + // to handle uncaught aborts + if ( xhr.onabort !== undefined ) { + xhr.onabort = errorCallback; + } else { + xhr.onreadystatechange = function() { + + // Check readyState before timeout as it changes + if ( xhr.readyState === 4 ) { + + // Allow onerror to be called first, + // but that will not handle a native abort + // Also, save errorCallback to a variable + // as xhr.onerror cannot be accessed + window.setTimeout( function() { + if ( callback ) { + errorCallback(); + } + } ); + } + }; + } + + // Create the abort callback + callback = callback( "abort" ); + + try { + + // Do send the request (this may raise an exception) + xhr.send( options.hasContent && options.data || null ); + } catch ( e ) { + + // #14683: Only rethrow if this hasn't been notified as an error yet + if ( callback ) { + throw e; + } + } + }, + + abort: function() { + if ( callback ) { + callback(); + } + } + }; + } +} ); + + + + +// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) +jQuery.ajaxPrefilter( function( s ) { + if ( s.crossDomain ) { + s.contents.script = false; + } +} ); + +// Install script dataType +jQuery.ajaxSetup( { + accepts: { + script: "text/javascript, application/javascript, " + + "application/ecmascript, application/x-ecmascript" + }, + contents: { + script: /\b(?:java|ecma)script\b/ + }, + converters: { + "text script": function( text ) { + jQuery.globalEval( text ); + return text; + } + } +} ); + +// Handle cache's special case and crossDomain +jQuery.ajaxPrefilter( "script", function( s ) { + if ( s.cache === undefined ) { + s.cache = false; + } + if ( s.crossDomain ) { + s.type = "GET"; + } +} ); + +// Bind script tag hack transport +jQuery.ajaxTransport( "script", function( s ) { + + // This transport only deals with cross domain or forced-by-attrs requests + if ( s.crossDomain || s.scriptAttrs ) { + var script, callback; + return { + send: function( _, complete ) { + script = jQuery( " + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Alignments Pipeline

+

A flexible Nextflow automated pipeline +used for producing the +enrichment data +from PhIP-Seq data when provided the demultiplexed +fastq files, +as well as annotation files for both the experimental +samples and +peptides in the phage library being used.

+
+directed acyclic graph +
+

Directed Acyclic Graph (DAG) +defining the execution order and dependencies of each individual +processes. The major steps of the pipeline can be summarized as: +(1) Build a Bowtie index from the relevant peptide oligos +(2) Align each of the samples to the library reference using +Bowtie end-to-end alignment allowing for up to N mismatches (default 2). +The user specifies the size of both the reads and peptide, +the low-quality end of the read are then trimmed to match +the reference length before alignment. +(3) Peptide counts for each sample alignment are obtained +using samtools-idxstats (Li et al., 2009) in parallel +to computing the common alignment stats such as +raw total sequences, reads_mapped, error_rate, and average_quality, by default. +(4) The resulting dataset containing the enrichment matrix, +sample metadata, and peptide metadata are organized +using the xarray +package (Hamman and Hoyer, 2017). +(5) Optionally, summary statistics such as counts per million, +size factors, fold enrichment, as well as model fits for estimates +of significance are computed. +(6) By default, the pipeline outputs all results +computed above as a pickle dump binary of the xarray object +with all combined results, as well as individual csv’s for each statistic computed. +You may also export the results in PhIPData (Chen et al 2022) format +via RDS file, and even tall CSV formats.

+
+
+
+
+

Input files

+
+

Sample table

+

A CSV where one of the columns must be fastq_filename listing +all samples to be run through the pipeline. +By default, the pipeline assumes the reads are relative to +the project directory where the pipeline is being executed.

+
+

Note

+

If there is some other prefix for the filepaths, +you may check out the --reads_prefix parameter.

+
+

As an example, let’s assume there’s some directory ngs/* containing all the +fastq files for a project. To organize these files (excluding barcode files) +into a minimal sample table describing each of their relative paths, we might +use the following command.

+
(echo "fastq_filepath" && ls ngs/*R1*.gz)  > sample_table.csv
+
+
+
+

See also

+

An example of a simple sample table can be found +here.

+
+

In addition to the file paths provided for each sample, +you may include as many colorful annotations as you would +like so long as the CSV stays tidy. +One caveat is that you should not include a column named sample_id, +this feature name is reserved for integer id’s +which are added to both the sample and peptide annotation tables +for internal and user organization of the annotations with +enrichment tables. +Many of the phippery API utilities, +are generalized to help you index, and otherwise +manipulate the data to your liking using any combination +of these annotations, so go wild with annotations!

+

Internally, data types are handled through conversion to pandas data types +- so it’s best to keep data types consistent +between the columns provided. For missing data, +we recommend empty strings, “”, +but “NaN” and “N/A” also work (hopefully) as expected.

+
+

Note

+

Some of the optional workflows +have additional required annotations, so keep an eye for those.

+
+
+

Note

+

The fastq files pointed to by the sample table described above +are assumed to have uniform (trimmed) read lengths. +During alignment, this is enforced by reads being +trimmed on the 3’ end to match the length specified +by the --oligo_tile_length parameter.

+
+

See pipeline parameters for more.

+
+
+

Peptide table

+

A CSV where one of the columns must be “oligo” which +contains the oligonucleotide sequence encoding a peptide in +the phage library. +Adapters are assumed to be encoded by lower case nucleotides +and are ultimately tossed from the output of the pipeline. +Conversely, the oligonucleotide encoding of the expressed peptide +should be upper case. +Similar to the sample annotation table, you may include any +annotations you like to the peptides (e.g. “Virus”, “Strain”, “Loci” etc) +except an annotation named peptide_id which is again reserved for +the pipeline execution.

+
+

See also

+

An example of a simple peptide table can be found +here.

+
+
+
+
+

Pipeline results

+

The primary use of this pipeline is to process raw sequencing data, +produce the peptide counts table, apply statistical methods +(such as the EdgeR), then combine and organize +the results from these workflows for the user to analyze however they wish. +By default the pipeline will produce the following outputs

+
results
+├── pickle_data
+│   └── data.phip
+├── rds_data
+│   └── PhIPData.rds
+└── wide_data
+    ├── data_counts.csv.gz
+    ├── data_cpm.csv.gz
+    ├── data_edgeR_hits.csv.gz
+    ├── data_edgeR_logfc.csv.gz
+    ├── data_edgeR_logpval.csv.gz
+    ├── data_peptide_annotation_table.csv.gz
+    ├── data_sample_annotation_table.csv.gz
+    └── data_size_factors.csv.gz
+
+4 directories, 11 files
+
+
+

see the example page +for a more detailed explanation of these outputs.

+
+
+

Parameters

+

Below, we describe each of the possible parameters that may be passed to the pipeline. +Parameters with a “*” next to the name must be provided values +explicitly in the nextflow run, command unless +you wish to be using the default values described below. +Otherwise, the parameter value is only required for relevant the +optional workflow.

+

--sample_table

+
    +
  • help: Table describing each input sample, minimally containing the column ‘fastq_filepath’ with the name of each file to be analyzed. Control samples are indicated with a value of ‘beads_only’ in the column ‘control_status’.

  • +
  • wb_type: file

  • +
  • required: True

  • +
+

--reads_prefix

+
    +
  • help: Folder which contains the files listed in the sample table

  • +
  • wb_type: folder

  • +
  • required: True

  • +
+

--read_length

+ +

--fastq_stream_func

+
    +
  • help: Set this as ‘cat’ if fastq files not g’zipped

  • +
  • wb_type: string

  • +
  • default: zcat

  • +
+

--peptide_table

+
    +
  • help: Table describing each peptide in the library, minimally containing the column ‘oligo’ with the sequence used for each peptide

  • +
  • wb_type: file

  • +
  • required: True

  • +
+

--oligo_tile_length

+
    +
  • help: length of oligonucleotide sequence encoding any given peptide in the library. See alignment approach section for more.

  • +
  • wb_type: integer

  • +
  • default: 117

  • +
+

--dataset_prefix

+
    +
  • help: String which is prepended to all output files

  • +
  • wb_type: string

  • +
  • default: data

  • +
+

--output_pickle_xarray

+
    +
  • help: Generate output files in xarray pickle format

  • +
  • wb_type: bool

  • +
  • default: True

  • +
+

--output_tall_csv

+
    +
  • help: Generate output files in tall CSV format

  • +
  • wb_type: bool

  • +
  • default: True

  • +
+

--output_wide_csv

+
    +
  • help: Generate output files in wide CSV format

  • +
  • wb_type: bool

  • +
  • default: True

  • +
+

--n_mismatches

+
    +
  • help: Number of mismatches allowed

  • +
  • wb_type: integer

  • +
  • default: 2

  • +
+

--bowtie_optional_args

+
    +
  • help: Other bowtie options

  • +
  • wb_type: string

  • +
  • default: –tryhard –nomaqround –norc –best –sam –quiet

  • +
+

--replicate_sequence_counts

+
    +
  • help: Flag for replicating counts for replicate sequences

  • +
  • wb_type: bool

  • +
  • default: True

  • +
+
+
+

Optional Parameters

+

We provide a popular (at least for us) +selection of the features found in the +phippery python API as optional during pipeline +execution. To run any one of these +optional workflows, you’ll set the relevant +boolean flag parameter to true. +Additionally, you may need to provide +certain annotation features +and factor levels in the sample or peptide +table.

+

Our example pan-CoV dataset +includes library enrichment samples that +are appropriately annotated in the +sample table, meaning we could +run the cpm enrichment workflow like so:

+
(base) ubuntu phippery/phip-flow ‹V1.04*› » nextflow run main.nf -profile docker --run_cpm_enr_workflow true
+N E X T F L O W  ~  version 21.04.3
+Launching `main.nf` [distracted_banach] - revision: 9ea43df075
+P H I P - F L O W!
+Matsen, Overbaugh, and Minot Labs
+Fred Hutchinson CRC, Seattle WA
+================================
+sample_table    : /home/jared/MatsenGroup/Projects/phippery/phip-flow/data/pan-cov-example/sample_table.csv
+peptide_table   : /home/jared/MatsenGroup/Projects/phippery/phip-flow/data/pan-cov-example/peptide_table.csv
+results         : /home/jared/MatsenGroup/Projects/phippery/phip-flow/results/
+
+
+executor >  local (29)
+[2c/30601d] process > ALIGN:validate_sample_table (1)    [100%] 1 of 1 ✔
+[1d/073399] process > ALIGN:validate_peptide_table (1)   [100%] 1 of 1 ✔
+[37/6937e7] process > ALIGN:generate_fasta_reference (1) [100%] 1 of 1 ✔
+[61/a636a9] process > ALIGN:generate_index (1)           [100%] 1 of 1 ✔
+[1d/454757] process > ALIGN:short_read_alignment (1)     [100%] 6 of 6 ✔
+[0d/320a4d] process > ALIGN:sam_to_counts (6)            [100%] 6 of 6 ✔
+[f4/687d71] process > ALIGN:sam_to_stats (6)             [100%] 6 of 6 ✔
+[c6/036a15] process > ALIGN:collect_phip_data (1)        [100%] 1 of 1 ✔
+[c0/3eb016] process > ALIGN:replicate_counts (1)         [100%] 1 of 1 ✔
+[e8/fae63a] process > STATS:counts_per_million (1)       [100%] 1 of 1 ✔
+[a9/81d0b7] process > STATS:size_factors (1)             [100%] 1 of 1 ✔
+[11/031d9e] process > STATS:cpm_fold_enrichment (1)      [100%] 1 of 1 ✔
+[-        ] process > STATS:fit_predict_neg_binom        -
+[-        ] process > STATS:fit_predict_zscore           -
+[7e/df19de] process > STATS:merge_binary_datasets        [100%] 1 of 1 ✔
+[c0/5b1faf] process > DSOUT:dump_binary                  [100%] 1 of 1 ✔
+[-        ] process > DSOUT:dump_wide_csv                -
+[-        ] process > DSOUT:dump_tall_csv                -
+[-        ] process > AGG:split_samples                  -
+[-        ] process > AGG:aggregate_organisms            -
+[-        ] process > AGG:join_organisms                 -
+
+
+

We can then use the phippery.utils to read in the data to take a look at the results.

+
>>> import phippery
+>>> ds = phippery.load("results/pickle_data/data.phip")
+>>> ds
+<xarray.Dataset>
+Dimensions:           (sample_id: 6, peptide_id: 10047, sample_metadata: 9,
+                       peptide_metadata: 7)
+Coordinates:
+  * sample_id         (sample_id) int64 0 1 2 3 4 5
+  * peptide_id        (peptide_id) int64 0 1 2 3 4 ... 10043 10044 10045 10046
+  * sample_metadata   (sample_metadata) object 'library_batch' ... 'average_q...'
+  * peptide_metadata  (peptide_metadata) object 'Virus' ... 'Prot_Start'
+Data variables:
+    counts            (peptide_id, sample_id) int64 0 1 0 3 0 3 ... 0 1 0 0 2 1
+    sample_table      (sample_id, sample_metadata) object 'MEGSUB' ... 37.3
+    peptide_table     (peptide_id, peptide_metadata) object 'OC43' ... 4052
+    size_factors      (peptide_id, sample_id) float64 0.0 1.0 0.0 ... 2.29 1.0
+    cpm               (peptide_id, sample_id) float64 0.0 94.85 ... 560.2 245.6
+    enrichment        (peptide_id, sample_id) float64 0.02065 1.979 ... 5.093
+>>> ds.counts.to_pandas()
+sample_id   0  1  2  3  4  5
+peptide_id
+0           0  1  0  3  0  3
+1           7  2  3  0  5  1
+2           2  1  0  0  0  0
+3           0  2  0  0  0  0
+4           0  0  0  0  0  0
+...        .. .. .. .. .. ..
+10042       0  1  0  0  0  0
+10043       1  2  0  0  0  0
+10044       0  1  0  0  0  0
+10045       8  0  0  0  1  0
+10046       0  1  0  0  2  1
+
+[10047 rows x 6 columns]
+>>> ds.enrichment.to_pandas()
+sample_id          0         1         2          3          4          5
+peptide_id
+0           0.020650  1.979353  0.020651  34.805577   0.020651  15.238485
+1           1.552418  0.447580  4.091275   0.002347   3.289535   0.578875
+2           1.328661  0.671337  0.007004   0.007004   0.007004   0.007004
+3           0.010433  1.989571  0.010433   0.010433   0.010433   0.010433
+4           1.000000  1.000000  1.000000   1.000000   1.000000   1.000000
+...              ...       ...       ...        ...        ...        ...
+10042       0.020650  1.979353  0.020651   0.020651   0.020651   0.020651
+10043       0.666665  1.333336  0.006992   0.006992   0.006992   0.006992
+10044       0.020650  1.979353  0.020651   0.020651   0.020651   0.020651
+10045       1.997354  0.002643  0.002643   0.002643   0.742907   0.002643
+10046       0.020650  1.979353  0.020651   0.020651  11.589568   5.093262
+
+[10047 rows x 6 columns]
+
+
+
+

BEER

+
+

Warning

+

This workflow has not been fully tested and may be very slow. +For errors which may arise from the BEER workflow, we recommend +that you direct questions to the BEER developers. +If you would like to run BEER outside of the pipeline, note that +by default the pipeline runs EdgeR and outputs +those results into the +PhIPData +object file which can be directly loaded and used with the BEER library.

+
+

--run_BEER

+
    +
  • help: Flag for running edgeR and BEER using the infrastructure in the +BEER pipeline. See the +R Vignettes +and BEER Paper +for more on this method. +Enrichments, EdgeR hits, and Annotations are +tied into a PhIPData +object and exported to an RDS binary object file. +The object file is then saved in the params.results directory +below the rds_data/ sub-directory. +Additionally, these results will be tied back into the +xarray object used by the Python phippery API, +as well as any CSV outputs (wide & tall).

  • +
  • wb_type: bool

  • +
  • default: False

  • +
+
+
+

CPM Enrichment

+

--run_cpm_enr_workflow

+
    +
  • +
    help: Flag for running the enrichment workflow using counts

    per million as a pre-processing step to fold enrichment +of empricial IP samples over library abundance controls. +If True, we require that the sample annotation table +provides a column “control_status” for which a subset of samples +is labeled as “library” indicating the sample is a control +For a description of how this function works in more detail, +see phippery.normalize.enrichment().

    +
    +
    +
  • +
  • wb_type: bool

  • +
  • default: False

  • +
+
+
+

Z-Score

+

--run_zscore_fit_predict

+ +
+
+

VirScan Organism Summary

+

This workflow will summarize the hits to epitopes (peptides) +across the groups across the proteome specified in the peptide annotation +table input to the pipeline.

+

Note that this analysis workflow was created with the Virscan +peptide library in mind, but could be used for any peptide assay being +analyzed. For example, you could run this workflow on the example data like so:

+
nextflow run matsengrp/phip-flow -r V1.12 \
+        -profile docker \
+        --summarize_by_organism true \
+        --peptide_seq_col "Prot" \
+        --peptide_org_col "Virus" \
+        --results "$(date -I)"
+
+
+

--summarize_by_organism

+
    +
  • +
    help: Flag used to control the summary of results by organism

    Requires that the peptide table includes information regarding +the source organism for each epitope. It is possible to annotate +an epitope as being contained in multiple organisms by including +multiple lines with the same peptide. +When this flag is enabled, an additional output table will be +produced (aggregated_data/organism.summary.csv.gz) which summarizes +the number of epitopes with Z-scores above the threshold +(--zscore_threshold, described below) for each organism. +The sequence of each peptide is taken into account to filter out +overlapping peptide hits. +For any pair of peptides which overlap by more than the allowed +number of amino acids (--max_overlap), only the higher-scoring +peptide (in terms of Z-score) will be retained. +Overlaps between peptides are determined by exact k-mer matching. +A peptide is marked as a ‘hit’ when it is above the threshold in +all replicates of that sample. When it is only above the threshold +in a subset of replicates, it is marked as ‘discordant’. +The Epitope Binding Score (EBS) is also calculated for each peptide +as the mean Z-score across all replicates from the same sample. +At the organism level, the max and mean EBS is reported. +Finally, all of those results are reported for the subset of +epitopes which are marked as ‘public’ (using --public_epitopes_csv), +which indicates that there is independent experimental evidence supporting +the presence of binding antibodies in a human population.

    +
    +
    +
  • +
  • wb_type: bool

  • +
  • default: False

  • +
+

--peptide_org_col

+
    +
  • help: Column in the peptide table indicating the organism for each peptide

  • +
  • wb_type: string

  • +
  • default: organism

  • +
+

--peptide_seq_col

+
    +
  • help: Column in the peptide table containing the peptide sequence (used to match against public epitopes provided with --public_epitopes_csv)

  • +
  • wb_type: string

  • +
  • default: seq

  • +
+

--max_overlap

+
    +
  • help: Maximum allowed overlap between detected peptides

  • +
  • wb_type: integer

  • +
  • default: 7

  • +
+

--zscore_threshold

+
    +
  • help: Minimum Z-score threshold

  • +
  • wb_type: float

  • +
  • default: 2.5

  • +
+

--sample_grouping_col

+
    +
  • help: Column in the sample table used for mapping replicates to samples

  • +
  • wb_type: string

  • +
  • default:

  • +
+

--public_epitopes_csv

+
    +
  • help: Optional, a CSV containing public epitopes

  • +
  • wb_type: file

  • +
+

--public_epitopes_col

+
    +
  • help: In the public epitopes CSV, the column containing the translated amino acid sequence

  • +
  • wb_type: string

  • +
  • default: peptide_translate

  • +
+

--nxf_profile

+
    +
  • help: Profile used for resource allocation (options: standard / docker / cluster)

  • +
  • wb_env: PROFILE

  • +
  • wb_type: string

  • +
  • default: standard

  • +
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/bkg-model.html b/bkg-model.html new file mode 100644 index 0000000..1440291 --- /dev/null +++ b/bkg-model.html @@ -0,0 +1,216 @@ + + + + + + + Background Modeling — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Background Modeling

+
+

Introduction

+

In addition to running the alignments and computing the counts, phippery also provides workflows +to model the background with mock-IP samples and compute non-specific peptide enrichments. +By default the phip-flow pipeline will run the +edgeR [1] workflow as described in the +Chen et al. 2022 [2] paper. +Optionally, we also provide a simpler Z-score method to evaluate the significance of peptide enrichment relative to +background that was used in Mina et al. 2019 [3]. +Each is described in greater detail below. +Note that these workflows are not mutually exclusive, (i.e. do not overwrite the counts, cpm, or any other default/optional outputs from the pipeline). +You may run none or all of the workflows in tandem, then do with the combined results as you wish.

+
+
+

edgeR/BEER Method

+

Chen et al. 2022 adapts the edgeR tool to compute +fold-change with respect to mock-IP samples and p-values of peptide enrichment. +This is run by default. +Optionally, you may run the +BEER (Bayesian Estimation Enrichment in R) method, +which is statistically more powerful and may be better at identifying significantly enriched peptides with lower fold-changes. +The trade-off for using the BEER method is longer run-time. +By default, the phip-flow pipeline runs EdgeR, but not BEER. +see Optional Parameters in the pipeline documentation for more.

+
+
+

Z-score Method (optional)

+

phippery can also optionally run the Z-score method to compute the significance of peptide enrichment relative to background. +This Z-score method used in Mina et al. 2019 is described in detail in their +supplementary document. The method takes the mock-IP +samples to bin together peptide species of similar abundance under the beads-only condition. Here, abundance can be represented in any form of normalized counts and +CPM is the default in phippery. Note that the mock-IP samples are used only to determine binning.

+

To compute the Z-score for a peptide species in an empirical sample, identify the bin it belongs to and compute the mean and standard deviation CPM among the peptide +species in that bin. To reduce the influence of outliers, such as signal from epitope-specific binding, the highest 5% and lowest 5% of CPM values are discarded when +computing the mean \(\mu\) and standard deviation \(\sigma\). Formally, for a peptide species, \(p\), with CPM value, \(n_p\), belonging to bin \(i\), +the Z-score is:

+
+\[Z_p = \frac{n_p - \mu_i}{\sigma_i} .\]
+
+
+

References

+ +
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/command-line-interface.html b/command-line-interface.html new file mode 100644 index 0000000..ee59381 --- /dev/null +++ b/command-line-interface.html @@ -0,0 +1,238 @@ + + + + + + + Command Line Interface — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Command Line Interface

+

The CLI is written using the +Click +library, and thus both phippery -h, and phippery COMMAND -h will provide +the same information provided below.

+

With the binary dataset output (default) +and an installation of +the phippery CLI tools, +we can run the some useful queries on the dataset to learn a little +about the dataset.

+
$ phippery about output/Pan-CoV-example.phip
+
+
+

The about command will print information about +the three primary aspects of a single dataset; Samples, Peptides, and Enrichment +Layers. For more about how the data is structured, +see the under the hood page. +Primarily, it tells you what information is available in terms of the +Samples Table, +Peptide Table, +and Enrichment Layers.

+
Sample Table:
+-------------
+<class 'pandas.core.frame.DataFrame'>
+Int64Index: 6 entries, 124 to 540
+Data columns (total 10 columns):
+ #   Column               Non-Null Count  Dtype
+---  ------               --------------  -----
+ 0   seq_dir              6 non-null      string
+ 1   library_batch        6 non-null      string
+ 2   control_status       6 non-null      string
+ 3   participant_ID       4 non-null      string
+ 4   patient_status       4 non-null      string
+ 5   fastq_filename       6 non-null      string
+ 6   raw-total-sequences  6 non-null      Int64
+ 7   reads-mapped         6 non-null      Int64
+ 8   error-rate           6 non-null      Float64
+ 9   average-quality      6 non-null      Float64
+dtypes: Float64(2), Int64(2), string(6)
+memory usage: 552.0 bytes
+
+
+

Above we see our example dataset sample table. +The information about +annotation feature data types, and missing information (NA) counts +is provided by default.

+

As displayed, this dataset contains 6 samples, +each with the annotations we fed to the pipeline +along with some alignment statistics. +While maybe not immediately useful, it’s nice to know +which information you have available at any given time – +especially after we start slicing or grouping datasets.

+

Further, you may want to know more detail about one of the annotation columns +at a time. The about-feature will give you a useful description +of the feature level distributions (categorical or numeric features), as well +as a few example queries for help indexing the dataset by this annotation feature. +Let’s take a look at our +reads mapped +annotation feature:

+
reads-mapped: Integer Feature:
+---------------------------
+
+distribution of numerical feature:
+
+count         6.000000
+mean     359803.000000
+std      283811.764886
+min      122878.000000
+25%      147733.250000
+50%      234885.500000
+75%      597263.000000
+max      729431.000000
+Name: reads-mapped, dtype: float64
+
+
+Some example query statements:
+------------------------------
+
+> "reads-mapped >= 359803"
+
+> "reads-mapped <= 359803"
+
+> "(reads-mapped >= 147733) and (reads-mapped <= 234885)"
+
+
+
+

Tip

+

run phippery -h for a list of possible commands. Additionally, you can run phippery COMMAND -h +for option descriptions for a specific command.

+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/esc-prof.html b/esc-prof.html new file mode 100644 index 0000000..53d0284 --- /dev/null +++ b/esc-prof.html @@ -0,0 +1,344 @@ + + + + + + + Comparing Escape Profiles — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Comparing Escape Profiles

+
+

Introduction

+

Phage-DMS [1] is an application of PhIP-Seq for deep mutational scanning (DMS). +In Phage-DMS, the peptide library catalogs possible mutations in the viral protein. Of +particular concern are mutations that cause significant loss of antibody binding, +potentially allowing the virus to escape the immune response. When considering only +mutations that cause single amino acid substitutions, the results can be summarized in +an escape profile [2] showing the impact on binding for every possible +substitution at each site. This can be visualized in a logo plot where the scaled +differential selection [1] of each amino acid substitution is reflected by the +height of its one-letter symbol,

+logo plot visualization of an escape profile +

There are two aspects of interest at each site:

+
    +
  • the sum over all substitutions reflecting the total potential for change in binding,

  • +
  • the pattern of amino acid contributions, i.e. the relative contribution of each substitution to change in binding.

  • +
+

Naturally, one would like to compare escape profiles of different samples, and a +quantitative approach would allow for systematic analysis of many profiles. This page +describes a scoring method for comparing two escape profiles. The main steps are:

+
    +
  1. assigning an escape similarity score to each site by comparing the pattern of amino acid contributions,

  2. +
  3. computing a weighted sum of escape similarity scores across the sites of interest to obtain a single score for the region.

  4. +
+
+
+

Escape similarity score at a site

+

Given two patterns of contributions, we want an approach that accounts for the degree +of similarity between any two amino acids, instead of only comparing contributions +from matching amino acids. For this purpose, we use the BLOSUM62 substitution matrix +[3], which assigns an integer score between two amino acids based on how often +their substitution is observed in empirical data. We then map the problem of comparing +amino acid patterns to the problem of comparing distributions in the framework of +optimal transport.

+

In brief, an optimal transport problem involves two distributions and a specification of +cost to transport “contents” between them, and the objective is to determine how to +transform one distribution into the other while minimizing the total cost. This minimum +cost reflects the level of similarity between the two distributions; the lower the cost, +the more similar they are.

+

Each pattern is represented as a binned distribution. There are 20 amino acids +but a mutation could result in negative or positive differential selection, corresponding to +loss or gain in binding respectively, which are two different effects. Therefore, two bins are +associated with each amino acid, one for negative differential selection and one for +positive differential selection, resulting in a 40-bin distribution. The bin contents +are the relative contribution to the total absolute differential selection at the site. +For any amino acid pattern, at most 19 bins are non-zero because an amino acid substitution +cannot contribute negative and positive differential selection simultaneously, and the +wild type amino acid contributes zero by definition.

+Diagram for conversion of logo pattern to binned distribution +

The cost matrix is based on the BLOSUM62 matrix. Denote the entries of the BLOSUM62 matrix +by \(M_{ij}\), which quantifies an overall similarity between amino acids \(i\) and +\(j\). For transport between same-sign differential selection “contents” +(e.g. negative with negative) of \(i\) and \(j\), the cost is given by,

+
+\[C_{ij} = \exp\left(-M_{ij}/7\right).\]
+

The exponentiation is applied so that cost values are positive. Higher values in the BLOSUM62 +matrix corresponds to higher similarity between amino acids, and vice versa, so the negative +sign is applied to assign the corresponding cost. The factor of 7 is included so that the +range of cost values lie within a factor of 10, to avoid a single site from overwhelming +the scores of all other sites when we aggregate across a region.

+

For transport between opposite-sign differential selection, we disregard similarity between +amino acids and simply assign a fixed cost of \(C_{\scriptsize \mbox{max}} = \exp\left(4/7\right)\), +which is the maximum cost possible because the BLOSUM62 matrix has the minimum entry of \(-4\).

+

Putting this altogether, the complete cost function is a \(40\times40\) matrix that can +be expressed in blocks of \(20\times20\) sub-matrices as the following:

+
+\[\begin{split}\begin{bmatrix} + C_{ij} & C_{\scriptsize \mbox{max}} \\ + C_{\scriptsize \mbox{max}} & C_{ij} +\end{bmatrix},\end{split}\]
+

where the off-diagonal blocks are sub-matrices with \(C_{\scriptsize \mbox{max}}\) for all entries.

+

To solve the optimal transport problem, we use the +Python Optimal Transport package [4]. +The obtained minimum cost is inversely related to how similar the two escape profiles +are, so we define the escape similarity score to be the reciprocal of this cost value. We do this because +our interest leans more towards identifying escape profiles that are consistent, and working with +similarity score rather than cost makes the interpretation a little easier when we aggregate +scores across sites in a region. We attribute a high regional escape similarity score to +having several sites with high similarity, in contrast to a low regional cost due to lacking +sites with high cost. Of course, the conclusions don’t change either way – cost and similarity +are just two sides of the same coin.

+

The diagram below summarizes the procedure for comparing patterns of amino acid contributions at a site. +For brevity, the site in the example contains only negative differential selection in both profiles so +we illustrate the distributions with just 20 bins.

+Diagram of similarity score calculation with optimal transport. +

In phippery, the example illustrated by the diagram above translates to the following,

+
from phippery.escprof import *
+
+profile1 = [
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  1,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+]
+
+profile2 = [
+        0,  0,  0,  0.5,0,  0,  0,  0,  0,  0,
+        0.2,0,  0,  0,  0,  0,  0.3,0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+        0,  0,  0,  0,  0,  0,  0,  0,  0,  0
+]
+
+cost_matrix = get_cost_matrix()
+
+compute_sim_score(profile1, profile2, cost_matrix)
+
+"""
+0.9744633979128656
+"""
+
+
+

The escape similarity score for the site is approximately 0.97. The get_cost_matrix() +function provides the cost matrix based on BLOSUM62 as described above. Note that an +ordering of amino acids is assumed, which is ARNDCQEGHILKMFPSTWYV; hence, the first 20 +bins correspond to negative differential selection contributions for amino acids in that order, +and the last 20 bins likewise correspond to positive differential selection contributions. +The get_aa_ordered_list() function returns a list with this ordering,

+
from phippery.escprof import *
+aa_list = get_aa_ordered_list()
+print(aa_list)
+
+"""
+['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V']
+"""
+
+
+
+
+

Escape similarity score for a region

+

Having defined and computed the escape similarity score for each site, a score for the +comparison across a region is calculated by a weighted sum of site scores. The weights +are assigned so that sites contributing larger scaled differential selection in both +profiles are given higher importance.

+

First, compute the relative contribution of each site to the profile. This is the summed +absolute scaled differential selection at a site divided by the sum over all sites in the +region. Denote these relative contributions by \(\left\{\alpha_k\right\}\) and +\(\left\{\beta_k\right\}\) for the two profiles, where \(k\) runs over the sites. +Then for each site, we choose the minimum,

+
+\[\mu_k = \min\left(\alpha_k,\,\beta_k\right).\]
+

The motivation to take the minimum (as oppose to the average) is because we wish to lower +the importance of the score at sites that have very different relative contributions +in the two profiles (i.e. very high in one and very low in the other). Therefore, we are +considering such sites to be rather dissimilar regardless of how concordant their amino acid +patterns may be.

+

Finally, we normalize such that the sum of weights is 1,

+
+\[w_k = \frac{\mu_k}{\sum_k \mu_k}.\]
+

Given the set of scores across the sites, \(\left\{s_k\right\}\), the escape similarity +score for the region is,

+
+\[S = \sum_k w_k s_k\]
+

The left and right plots shown below each illustrate a comparison of a pair of escape +profiles. In each plot, the top two panels are the logo plots of the profiles under comparison. +The third panel is the bar plot of the per site weights, \(\{w_k\}\). The bottom panel shows +the weighted per site escape similarity scores, \(\{w_k s_k\}\). The region escape similarity +scores are shown at the top of the plot, indicating that the pair of profiles on the right are more +concordant than the pair on the left.

+

esc_comp1 esc_comp2

+

In phippery, the region escape similarity score can be computed with region_sim_score().

+
+
+

References

+ +
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/examples.html b/examples.html new file mode 100644 index 0000000..984b880 --- /dev/null +++ b/examples.html @@ -0,0 +1,539 @@ + + + + + + + Examples — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Examples

+

There are a few primary steps to PhIP-Seq analysis after the sequencing and +demultiplexing of samples. To address each of these, we provide +a flexible Nextflow automated pipeline +used for producing the +enrichment data when provided +Next Generation Sequencing (demultiplexed fastq files) data, +as well as coupled sample and peptide library annotation files, as input. +Below, we’ll give a brief overview of using the pipeline on some example data, +followed by a typical approach for running on some new data.

+
+

Pan-CoV example dataset

+

The dataset provided with this pipeline +is derived from a pre-COVID-19 healthy adult serum +sample, along with serum from a SARS-CoV-2 infected convalescent individual, +both run in duplicate across two separate batches of the Pan-Human CoV full +proteome library. +Huge thanks to the authors of +Stoddard et al. 2021 and the wonderful folks at the +Overbaugh Lab for obtaining this data and allowing us to use it here.

+

The example data is included and run by default unless specified otherwise. +This input includes the next generation +sequencing files for each of the six samples described +in the sample table: +the replicates of the samples described above, as well as two replicates of the input phage library. +We’ll begin by aligning the fastq files to the oligo library described by the +oligonucleotide coding sequences in the +peptide table.

+
+

Running locally

+

To run the following example, you must first have installed +docker, +and Nextflow. +For our approach to easy installation, see the installation page.

+

To run the pipeline, we can use the +nextflow run, +git-aware command. This will run the specified version (-r V1.12) of the pipeline in the current working directory. +We recommend using the latest version which can be seen in the release section of the repository. +Note that no cloning of the repository is necessary if we’re simply running the pipeline and +we do not wish to modify the source code.

+

Simply:

+
$ nextflow run matsengrp/phip-flow -r V1.12 -profile docker --output_tall_csv true
+
+
+

Here we specified three parameters: two that are native to Nextflow +(denoted with a single ‘-’ prefix) and one that is specific to +PhIP-Flow (double minus ‘- -’ symbols). +Here, we did not specify a sample table or peptide table, so the pipeline +will run on the default example data. +Additionally, we did not specify a results directory, so the pipeline will +,by default, write to results/: +(1) a pickled binary +xarray DataSet object +(as it is the primary data structure for using the Python CLI) +in addition to +(2) an RDS file for the respective PhIPData Object. +The options --output_tall_csv (default false) and --output_wide_csv (default true) each specifies one +of two optional output formats: a tall CSV and a collection of wide CSVs.

+
+

See also

+

For more on the parameters that specify pipeline behavior, see the +alignments pipeline parameters section.

+
+
+

Note

+

For more on these CSV formats see this +great blog post +on the topic.

+
+

By default, this command ran the pipeline on the example dataset +described above. The files can be viewed in the +phip-flow git repo. +In short, the workflow +(1) used bowtie to align all the reads described in the +sample annotation table to the reference phage library described in the +peptide table, +(2) computed some useful statistics on raw counts +(such as the edgeR log fold enrichment), and +(3) formatted the data +into a single coherent dataset. +For more detail about the exact steps that were run, +see the nextflow pipeline page.

+
+
+

Running on HPC (cluster)

+

Above, we specified -profile docker as a parameter option, +which will assume you are running +this locally with Docker and Nextflow installed. +For high performance computing systems, we can also specify +the -profile cluster option for running the default configurations +on a slurm cluster. +This option assumes the cluster has loaded modules or installs for +Singularity and Nextflow. Here’s an example script we might execute to run +the pipeline on the Fred Hutch Rhino machines:

+
#!/bin/bash
+
+set -e
+source /app/lmod/lmod/init/profile
+
+module load nextflow
+module load Singularity
+export PATH=$SINGULARITYROOT/bin/:$PATH
+
+nextflow run matsengrp/phip-flow -r V1.12 \
+        --read_length 125 \
+        --oligo_tile_length 117 \
+        --output_tall_csv true \
+        --results "$(date -I)" \
+        -profile cluster \
+        -resume
+
+
+

Here, we specified a few more parameters, --read_length and --oligo_tile_length that define our input data for alignment purposes. +See the Creating and running your own data section for more details on these.

+
+
+

Example results (tall CSV)

+

Now, let’s take a quick +look at the results from the Pan-CoV example dataset that was run. +By default, the pipeline runs the Pan-CoV example data, +and writes the results out to a directory, “results/”. +The pickled binary +xarray +object is output by default, and we additionally specified that a tall style data (“data-tall.csv”) as well +as a collection of wide style data matrices be output. +Let’s take a quick look.

+
results
+├── pickle_data
+│   └── data.phip
+├── rds_data
+│   └── PhIPData.rds
+├── tall_data
+│   └── data-tall.csv.gz
+└── wide_data
+    ├── data_counts.csv.gz
+    ├── data_cpm.csv.gz
+    ├── data_edgeR_hits.csv.gz
+    ├── data_edgeR_logfc.csv.gz
+    ├── data_edgeR_logpval.csv.gz
+    ├── data_peptide_annotation_table.csv.gz
+    ├── data_sample_annotation_table.csv.gz
+    └── data_size_factors.csv.gz
+
+4 directories, 11 files
+
+
+

Note the csv outputs are gzipped, so we’ll need to unzip them before +moving forward. The following command unzip’s all the csv files in the +results directory.

+
gunzip results/**/*.csv.gz
+
+
+

Let’s take a look at how you might use ggplot +to visualize the data found in the tall formatted CSV. +We’ll start by plotting the individual sample enrichments, colored by +infection status.

+
library(ggplot2)
+library(dplyr)
+library(viridis)
+
+phip_data <- read.table(
+      "results/tall_data/data-tall.csv", # gunzip first
+      header=TRUE, sep= ","
+  ) %>%
+  filter(Protein == "spike") %>%
+  filter(Virus == "SARSCoV2")
+
+# Plot
+p <- phip_data %>%
+ggplot(aes(
+      x=Prot_Start, y=counts,
+      group=factor(sample_id),
+      color=factor(patient_status))
+  ) +
+  theme_bw() +
+  geom_line() +
+  ggtitle("Sars-CoV-2 Spike Protein Enrichments") +
+  labs(y="# peptide alignments", x="Locus", color="infection status")
+
+
+
+example results +
+

Example data counts plotted as a function of location on Spike +protein of SARS-CoV-2, and colored by infection status of the +sample.

+
+
+
+
+

Example results (wide CSV)

+

Looking at the files in the wide format sub directory, we are given back the +peptide and sample annotation tables, both +with an index (i.e. first) column “peptide_id” and “sample_id”. +These indices can simply be mapped back to the rows and columns +of each of the output enrichment matrices. +By default, the phip-flow pipeline outputs the raw counts as well as +counts per million and size factor normalizations +(Anders and Huber, 2010) +of the matrix. +Let’s use matplotlib’s implot to plot the same sample’s binding to OC43 as a heatmap.

+
import pandas as pd
+import seaborn as sns
+import matplotlib.pyplot as plt
+
+cpm = pd.read_csv("results/wide_data/data_cpm.csv", index_col=0, header=0)
+cpm.columns = cpm.columns.astype(int)
+sample_table = pd.read_csv("results/wide_data/data_sample_annotation_table.csv")
+peptide_table = pd.read_csv("results/wide_data/data_peptide_annotation_table.csv")
+
+OC43_spike = peptide_table.query("Full_name == 'OC43_SC0776_spike'")
+non_null_samples = sample_table.query("patient_status.notnull()")
+cpm_OC43_spike = cpm.loc[OC43_spike.index, non_null_samples.index]
+
+fig, ax = plt.subplots(figsize=[7, 3])
+sns.heatmap(
+      cpm_OC43_spike.transpose(),
+      yticklabels=non_null_samples["patient_status"],
+      xticklabels=OC43_spike["Prot_Start"],
+      cbar_kws={'label': 'binding counts per million'},
+      ax=ax, cmap="YlGnBu",
+      vmax = 2000
+  )
+
+for label in ax.xaxis.get_ticklabels()[::2]:
+  label.set_visible(False)
+
+ax.set_title("OC43 Spike Binding - \n Strain: SC0776")
+ax.set_xlabel("Locus")
+plt.tight_layout()
+
+
+
+example heatmap results +
+

A heatmap of peptide alignment counts per million across the OC43 +Spike protein. Each row corresponds to a sample replicate.

+
+
+
+
+
+

Creating and running your own data

+
+

Alignment approach

+

We designed this pipeline to work well with the common protocol for PhIP-Seq +experiments; which is to use a single read, shotgun sequencing of the phage library +after the antibody immunoprecipitation step. +We expect the input reads to be trimmed to a uniform length +(specified with the --read_length parameter), which should be +longer than, or equal to, the oligonucleotide sequence encoding any given peptide in the provided library +(specified with the --oligo_tile_length parameter). +Additionally, we assume that your peptide library is comprised of +uniform-length oligonucleotide sequences (tiles), and that sequencing adapters are +designed such that the 5’ (high-quality) end of the read is +where alignment should begin.

+

Concretely, we perform alignment of reads to the peptide-encoding oligo sequences +via bowtie (-n mode). +This means alignments may have no more than --n_mismatches mismatches +(where --n_mismatches is a number 0-3, with a default of 2) +in the first --oligo_tile_length bases +(where --oligo_tile_length is a number 5 or greater, with a default of 117) +on the high-quality (left) end of the read. +Additional parameters for alignment can be specified by the --bowtie_optional_args parameter, +which by default is --tryhard --nomaqround --norc --best --sam --quiet. +This specifies that the aligner should not be looking at the reverse compliment +of the oligo sequences, and that it should report only the best alignment for each read. +This can be modified as you see fit. +It’s worth noting that while we only report a single alignment per read, +if there are identical oligo sequences in the peptide table (described below) +then the parameter --replicate_sequence_counts (default True) will ensure that +that the resulting alignment counts for all replicate sequences are reported as the sum +of alignments across each.

+

Ideally, the --read_length is the same as the length specified by the +--oligo_tile_length parameter. +If the read_length is greater than the oligo_tile_length, +we use bowtie’s --trim3 parameter to trim the reads on the 3’ +end to match the --oligo_tile_length. +If for some reason reads are shorter than the --oligo_tile_length, +or variable in length, then we recommend setting the --read_length to 0, +and potentially allowing for more --n_mismatches +such that reads are not trimmed before alignment, and partial reads still have a chance +at being reported.

+

If you would like to modify the behavior of the alignment approach +outside the scope of the --bowtie_optional_args parameters described above +or even the alignment tool itself, +and you have experience with Nextflow, +it should be relatively straightforward to modify the +alignment template script, it’s +respective parameters, +and the +associated process definition.

+
+
+

Input file requirements

+

Input to the pipeline is dependent upon the following:

+
    +
  • NGS files: Single-read, demultiplexed fastq files for each of the samples. +We do not currently support paired-end reads.

  • +
  • sample annotation table: a CSV containing a column fastq_filepath, +where each row contains a path relative from where the pipeline is run +to where the respective fastq file resides.

  • +
  • peptide annotation table: a CSV containing a column oligo, +where each row contains a single peptide from the complete library +used in the antibody immunoprecipitation step. This will be generated into an index for all samples +to be aligned to.

  • +
+

As an example, let’s assume there’s some directory ngs/ containing all the +fastq files for a project. To organize these files (excluding barcode files) +into a minimal sample table describing each of their relative paths, we might +use the following command.

+
(echo "fastq_filepath" && ls ngs/*R1*.gz)  > sample_table.csv
+
+
+

Now, we must have a peptide annotation file which will describe the phage library +being used in this particular study. Usually, we expect something of this +nature has been created prior to synthesizing the library during the +phage library design. For the sake of this pipeline, we must have +a column denoting the oligonucleotide sequence. Here’s an peek +at what a +phage-dms +peptide annotation might look like:

+
Virus,Protein,Loc,aa_sub,Loc_Rel,is_wt,oligo
+BG505,gp120,1,G,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGGTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,E,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGAAGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,D,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGACGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,V,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGTTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,A,30,TRUE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTGCTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,R,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTCGTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,S,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTTCTGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,K,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTAAAGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+BG505,gp120,1,N,30,FALSE,aggaattctacgctgagtGGAGGAGGTGGTTCTGGTGGTGGAGGTTCAGGTGGTGGTGGAAGTAACGAGAACCTGTGGGTGACCGTGTATTACGGCGTTCCTGTCTGGAAAtgatagcaagcttgcc
+
+
+
+

Warning

+

Currently, only upper case oligonucleotides will be included as +part of the reference index when aligning the reads. Historically, we have +encoded the barcodes with lower case letters.

+
+

With these, we can simply use the same command as shown above, however, now +we will specify the --sample_table and --peptide_table parameters +to the run command:

+
#!/bin/bash
+
+set -e
+source /app/lmod/lmod/init/profile
+
+module load nextflow
+module load Singularity
+export PATH=$SINGULARITYROOT/bin/:$PATH
+
+nextflow run matsengrp/phip-flow -r main \
+        --sample_table sample_table.csv \
+        --peptide_table peptide_table.csv \
+        --output_tall_csv true \
+        --output_wide_csv true \
+        --results "$(date -I)" \
+        -profile cluster \
+        -resume
+
+
+

Note that while here we specified nothing but the fastq filepaths +in the sample table, we could have populated the CSV with +any number of useful annotations pertaining to the fastq files in each +of the rows. Any of the annotations added here will be tied in correctly +to all output formats for more organized downstream analysis and plotting.

+

If you want to run some of the more advanced analysis available through +this pipeline such as fold enrichment, +differential selection, or model fitting for estimates of significance, +you will need to include special annotations +in either of the annotation tables. +The requirements and descriptions of +these columns can be found in the +optional workflows section of the documentation.

+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/genindex.html b/genindex.html new file mode 100644 index 0000000..3b29193 --- /dev/null +++ b/genindex.html @@ -0,0 +1,383 @@ + + + + + + Index — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

Index

+ +
+ A + | C + | D + | E + | G + | I + | L + | M + | P + | R + | S + | T + | Y + | Z + +
+

A

+ + +
+ +

C

+ + + +
+ +

D

+ + + +
+ +

E

+ + + +
+ +

G

+ + + +
+ +

I

+ + + +
+ +

L

+ + + +
+ +

M

+ + +
+ +

P

+ + + +
    +
  • + phippery.eigen + +
  • +
  • + phippery.escprof + +
  • +
  • + phippery.modeling + +
  • +
    +
  • + phippery.normalize + +
  • +
  • + phippery.utils + +
  • +
+ +

R

+ + + +
+ +

S

+ + + +
+ +

T

+ + + +
+ +

Y

+ + +
+ +

Z

+ + +
+ + + +
+
+
+ +
+ +
+

© Copyright 2024, Jared G. Galloway, Kevin Sung.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..6072c48 --- /dev/null +++ b/index.html @@ -0,0 +1,245 @@ + + + + + + + Welcome to phippery’s documentation! — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/installation.html b/installation.html new file mode 100644 index 0000000..d47b3ce --- /dev/null +++ b/installation.html @@ -0,0 +1,226 @@ + + + + + + + Installation — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Installation

+
+

Python API

+

Installation of the phippery python package is available through

+
» pip install phippery
+
+
+
+

See also

+

for more information about how to contribute +please see the Development page.

+
+
+
+

Alignments Pipeline

+

For running the Nextflow alignments pipeline, +we maintain a +Dockerfile, +and host a pre-built +public image +on quay.io for convenience.

+
+

Note

+

Note that the quay image is pointed to by default +in the pipeline configuration file – +meaning if you have both Docker and Nextflow +installed, you have everything you need to run the pipeline +with --profile docker specified after the nextflow run +command. The other option would be to pull, +or build the image yourself, then run the pipeline +within that container.

+
+

To install +docker desktop +(Desktop is just fine), +on most unix OS:

+
» curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh
+
+
+

To test the Docker install:

+
» docker -v
+Docker version 20.10.1, build 831ebea
+» docker run docker/whalesay cowsay boo
+
+
+

To install +Nextflow +on most Unix OS:

+
» curl -s https://get.nextflow.io | bash
+
+
+

To test the Nextflow install:

+
» nextflow -v
+nextflow version 20.04.1.5335
+
+
+
+
+

Streamlit App

+

We reccomend running streamlit through the +quay public image +we maintain.

+

Simply navigate to a directory where you have some .phip +binary datasets and run

+
» docker run -p 8501:8501 -v $PWD:/app/data/ quay.io/matsengrp/phip-viz
+
+
+

for local installation

+
» git clone https://github.com/matsengrp/phip-viz.git
+» (cd phip-viz && pip install -r requirements.txt)
+
+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/introduction.html b/introduction.html new file mode 100644 index 0000000..62814f3 --- /dev/null +++ b/introduction.html @@ -0,0 +1,298 @@ + + + + + + + Introduction — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Introduction

+

Welcome to the documentation for phippery. +We present a software suite of data analysis tools for +Phage Immunoprecipitation Sequencing (PhIP-Seq) [1], +a high-throughput phage-display sequencing technique. +All the tools presented here are +designed for flexibility and general purpose, suitable for +either commonly used (e.g. Virscan) +or highly customized phage-display libraries +(e.g. Phage-DMS).

+

We encourage bug reporting and all other +helpful feedback – +the source code for phippery can be found at +https://github.com/matsengrp/phippery. For more +on contributing, see the +contributing page.

+

If you find these tools useful for your own research studies please cite our manuscript, +phippery: a software suite for PhIP-Seq data analysis.

+
+
+phippery suite schematic +
+

Software tools schematic: A cartoon flow +chart description of the workflow using +each of the tools of phippery. +(A) Inputs from the experimentalist feed into +the alignment pipeline. The inputs are: the list +of demultiplexed files (fastq) for the samples +under study, along with an annotation table of +relevant sample-specific information; a peptide +table listing all peptides in the phage library +and descriptors of interest (oligo sequence to +align sequencing reads to, virus, protein, +locus, etc) +(B) A python API to perform tasks such as +data wrangling or model fitting. +Most operations result in “layering” +specific transformations onto the primary data +structure. For more details on code structure and the +available CLI, see under the hood. +(C) An interactive browser-based application presents +the layered data, allowing users to aggregate +and visualize data by selecting on sample and peptide +annotation features. The export functionality provides +image files (of the visualization) or the +underlying raw data (in tall or wide formats) for +plotting with any of your favorite packages.

+
+
+
+
+

Getting Started

+
    +
  • Head over to the Installation +page to get installation instructions for each of the three tools described above.

  • +
  • To get a feel for running each of the three related tools pictured above, +we suggest following a walk through of running the +alignments pipeline on some empirical data from Stoddard et al. 2021 [2].

  • +
  • Check out the running your own data section for a bare minimum +approach to getting enrichment values from your own NGS data.

  • +
  • Take a look at the Nextflow pipeline page for a better description +of the pipeline and its features for downstream analysis.

  • +
+
+
+

Background

+

The advent of modern oligonucleotide synthesis allows researchers to generate +highly multiplexed assays such as PhIP-Seq, which is used to investigate +antibody-antigen interactions with comprehensive phage-display libraries. +The library used in VirScan [3], a general purpose application of PhIP-Seq, +comprises \(\mathcal{O}(10^5)\) peptides spanning over 1000 individual +strains across 206 species of virus. There are also specialized library designs, +such as in deep mutational scanning, for estimating the impact that mutations to +a viral protein may have on antibody binding [4].

+

Despite the growing use of the protocol, there is not yet an established set of +software tools for bioinformatics and computational tasks with PhIP-Seq data. +Much of the published code is specific to the authors’ experiment, thus new researchers +are either piecing together snippets from others or developing scripts from scratch. +A goal of phippery is to provide some efficient and unit-tested general infrastructure +for computing enrichment, data formatting/storing/transforming, and other common analysis +functions. Each of the tools presented here can be used separately or in +conjunction for the rapid exploration of PhIP-Seq data.

+

Here we focus most heavily on the Nextflow pipeline as it provides a framework +for creating, modeling, and computing statistics on a PhIP-Seq dataset. +The pipeline inputs +are demultiplexed fastq files for each of the sample IP’s, +as well as annotation tables +for samples and peptides – CSV files with only a single column requirement each. +The default workflow then performs all of the major steps in processing the raw data and +obtaining an enrichment dataset (along with some other optional statistical goodies). +The pipeline will output a pickled binary of the +xarray.DataSet +as described in under the hood +, and/or optionally two common CSV formats +(tall & wide) +such that the user may query with their own favorite analysis tools.

+
+
+

References

+ +
+
+

Licensing and Acknowledgement

+

This work is provided by members of the +Matsen and +Overbaugh groups at the +Fred Hutchinson Cancer Research Center. +The software is publicly available licenced under the +MIT License. +The work presented is funded by the NIH, NSF, and HHMI.

+

For questions or concerns about these using tools, +feel free to email jgallowa (at) fredhutch +If you find these tools useful for your own research studies, please cite <X>

+
+

Note

+

for questions and/or suggestions, please +open an issue

+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/objects.inv b/objects.inv new file mode 100644 index 0000000..ae369a2 Binary files /dev/null and b/objects.inv differ diff --git a/phippery.eigen.html b/phippery.eigen.html new file mode 100644 index 0000000..de5c2b1 --- /dev/null +++ b/phippery.eigen.html @@ -0,0 +1,197 @@ + + + + + + + Eigen — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Eigen

+

A method for MDS via Singular Value Decomposition +on phip-seq datasets.

+
+
+
+phippery.eigen.eigenassay_projections(ds, data_table='counts', compute_correlations=False, return_raw_decomposition=False, n_eigenvectors=None)[source]
+

Compute the Singular Value Decomposition +of the enrichment data before projecting each +sample into the first n eigenvectors (“eigenassays”) +in the dataset.

+

Concretely, given a Matrix of, \(X\) enrichments in the +phippery dataset with shape (peptides, samples). We compute +the decomposition \(X = USV^{T}\)

+

The principal axes in feature space are then represented by the columns of +\(V\) and represent the direction of maximum variance in the data. +The sample projections into this space are then computed and tied to the +sample annotation in the returned dictionary.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to perform eigen-decomposition on.

  • +
  • data_table (str) – The name of the enrichment layer in the phippery dataset to perform +the operation on.

  • +
  • compute_correlations (bool) – If true, compute the correlation of a sample’s true binding enrichments to +the n’th principal axes. These will be added in the same fashion as the sample +scores that are appended to the sample table.

  • +
  • return_raw_decomposition (bool) – If true, include the raw \(USV^{T}\) decomposition of the enrichment +matrix specified

  • +
  • n_eigenvectors (int) – the number of projections “eigenassay dimensions” to include.

  • +
+
+
Returns:
+

    +
  1. +
    The eigenassay projects tied with the appended to sample annotations

    included in ds.

    +
    +
    +
  2. +
  3. (optional) The raw “economy” SVD decomposition matrices.

  4. +
+

+
+
Return type:
+

dict

+
+
+
+ + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/phippery.escprof.html b/phippery.escprof.html new file mode 100644 index 0000000..72deb01 --- /dev/null +++ b/phippery.escprof.html @@ -0,0 +1,272 @@ + + + + + + + Escape Profile — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Escape Profile

+

Use +optimal transport method +to compare +phage-dms +escape profiles. +See the escape profile description and examples.

+
+
+
+phippery.escprof.compute_sim_score(a, b, cost_matrix)[source]
+

Returns the similarity score given +two distributions and the cost matrix.

+
+
Parameters:
+
    +
  • a (list) – A distribution of relative contribution for each amino acid to scaled differential selection.

  • +
  • b (list) – Another distribution of relative contribution for each amino acid to scaled differential selection.

  • +
  • cost_matrix (list) – The cost matrix to evaluate optimal transport from a to b.

  • +
+
+
Returns:
+

The similarity score (reciprocal of the optimal transport cost).

+
+
Return type:
+

float

+
+
+
+ +
+
+phippery.escprof.get_cost_matrix()[source]
+

Returns the default 40x40 cost matrix based on BLOSUM62 +and assigns maximum cost to transport between +opposite signed differential selection contributions.

+
+
Returns:
+

40x40 matrix (as a list of lists)

+
+
Return type:
+

list

+
+
+
+ +
+
+phippery.escprof.get_loc_esc_distr(ds, metric, sample_factor, sfact_val, loc)[source]
+

Returns the normalized distribution represented as a list +for the amino acid pattern of scaled differential +selection for a specified individual and amino acid site.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset containing the sample of interest.

  • +
  • metric (str) – The name of the scaled differential selection data in ds.

  • +
  • sample_factor (str) – The sample annotation label to identify the individual sample (e.g. ‘sample_ID’).

  • +
  • sfact_val (str) – The sample_factor value to identify the sample of interest.

  • +
  • loc (int) – The location number for the amino acid site of interest.

  • +
+
+
Returns:
+

The relative contributions to the total absolute scaled differential selection at the site. +The first 20 entries are contributions to negative selection (binding loss). +The last 20 entries are contributions to positive selection (binding gain).

+
+
Return type:
+

list

+
+
+
+ +
+
+phippery.escprof.loc_sim_score(ds, metric, cost_matrix, sample_factor, sfact_val1, sfact_val2, loc)[source]
+

Returns the similarity score for comparison at a site between two samples.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset containing the sample of interest.

  • +
  • metric (str) – The name of the scaled differential selection data in ds.

  • +
  • cost_matrix (list) – The cost matrix to evaluate optimal transport between two distributions.

  • +
  • sample_factor (str) – The sample annotation label to identify the samples (e.g. ‘sample_ID’).

  • +
  • sfact_val1 (str) – The sample_factor value to identify sample 1.

  • +
  • sfact_val2 (str) – The sample_factor value to identify sample 2.

  • +
  • loc (int) – The location number for the amino acid site of interest.

  • +
+
+
Returns:
+

The similarity score at the amino acid site.

+
+
Return type:
+

float

+
+
+
+ +
+
+phippery.escprof.region_sim_score(ds, metric, cost_matrix, sample_factor, sfact_val1, sfact_val2, loc_start, loc_end)[source]
+

Returns the similarity score for comparison in the +region [loc_start, loc_end].

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset containing the sample of interest

  • +
  • metric (str) – The name of the scaled differential selection data in ds.

  • +
  • cost_matrix (list) – The cost matrix to evaluate optimal transport between two distributions.

  • +
  • sample_factor (str) – The sample annotation label to identify the samples (e.g. ‘sample_ID’).

  • +
  • sfact_val1 (str) – The sample_factor value to identify sample 1.

  • +
  • sfact_val2 (str) – The sample_factor value to identify sample 2.

  • +
  • loc_start (int) – The location number for the first amino acid site in the region of interest.

  • +
  • loc_end (int) – The location number for the last amino acid site in the region of interest.

  • +
+
+
Returns:
+

The similarity score for the region.

+
+
Return type:
+

float

+
+
+
+ + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/phippery.modeling.html b/phippery.modeling.html new file mode 100644 index 0000000..9ff7494 --- /dev/null +++ b/phippery.modeling.html @@ -0,0 +1,243 @@ + + + + + + + Modeling — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Modeling

+

A collection of interfaces for modeling binding enrichments, +and estimating significance.

+
+
+
+phippery.modeling.gamma_poisson_model(ds, starting_alpha=0.8, starting_beta=0.1, trim_percentile=99.9, data_table='size_factors', inplace=True, new_table_name='gamma_poisson_mlxp')[source]
+

Fit a Gamma distribution to determine Poisson rates +per peptide for the non-specific binding background and estimate the +\(-\log_{10}(p)\) value, or mlxp, +for each sample-peptide enrichment in the dataset provided. +We use the following parameterization of the Gamma distribution:

+
+\[f(x) = \frac{\beta^\alpha}{\Gamma(\alpha)}x^{\alpha-1}e^{-\beta x}\]
+

The fit is performed on the distribution of peptide average counts to +obtain \(\alpha\) and \(\beta\). If there are \(n\) +samples involved in the fit, and for a given peptide with counts +\(x_1, x_2, \ldots, x_n\), the background Poisson distribution +is determined by the rate,

+
+\[\lambda = \frac{\alpha + \sum^n_{k=1} x_k}{\beta + n}\]
+
+

Note

+

much of this source code is derived from +https://github.com/lasersonlab/phip-stat +and written by Uri Laserson.

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to.

  • +
  • starting_alpha (float) – Initial value for the shape parameter of the Gamma distribution.

  • +
  • starting_beta (float) – Initial value for the rate parameter of the Gamma distribution.

  • +
  • trim_percentile (float) – The percentile cutoff for removing peptides with very high counts. +(e.g. a value of 98 means peptides in the highest 2% in counts +would be removed from the fit) +This parameter is used to remove potential signal peptides that +would bias the fit.

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

the alpha, and beta values of the fit. If inplace is false, a copy of the new dataset +is returned first.

+
+
Return type:
+

tuple

+
+
+
+ +
+
+phippery.modeling.zscore(ds, beads_ds, data_table='cpm', min_Npeptides_per_bin=300, lower_quantile_limit=0.05, upper_quantile_limit=0.95, inplace=True, new_table_name='zscore')[source]
+

Calculate a Z-score of empirical enrichment relative to +expected background mean CPM (\(\mu\)) and stddev CPM (\(\sigma\)) +from beads-only samples, +for each sample-peptide enrichment in the dataset provided. +For a peptide with CPM \(n\), the Z-score is,

+
+\[z = \frac{n - \mu}{\sigma}\]
+
+

Note

+

This implementation follows the method described in the +supplement to DOI:10.1126/science.aay6485.

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset containing samples to estimate significance on.

  • +
  • beads_ds (xarray.DataSet) – The dataset containing beads only control samples to estimate +background means and stddevs.

  • +
  • min_Npeptides_per_bin (int) – Minimum number of peptides per bin.

  • +
  • lower_quantile_limit (float) – Counts below this quantile are ignored for computing background mean and stddev.

  • +
  • upper_quantile_limit (float) – Counts above this quantile are ignored for computing background mean and stddev.

  • +
  • data_table (str) – The name of the enrichment layer from which you would like to compute Z-scores.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is false, a copy of the new dataset is returned.

+
+
Return type:
+

None, xarray.DataSet

+
+
+
+ + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/phippery.normalize.html b/phippery.normalize.html new file mode 100644 index 0000000..9d1528c --- /dev/null +++ b/phippery.normalize.html @@ -0,0 +1,599 @@ + + + + + + + Normalize — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Normalize

+

A set of useful functions for normalizing enrichments +in a phippery dataset.

+
+
+
+phippery.normalize.counts_per_million(ds, inplace=True, new_table_name='cpm', per_sample=True, data_table='counts')[source]
+

Compute counts per million.

+

Concretely, given a Matrix of enrichments, \(X\), in the +phippery dataset with shape P peptides and S samples, +we compute the \(i^{th}\) peptide and \(j^{th}\) sample position like so:

+
+\[\begin{split}\text{cpm}(X,i,j) = \left\{ + \begin{array}{@{}ll@{}} + X_{i,j}/\sum_{p\in P} X_{p,j} \times 10^6, & \text{if per_sample is True} \\[10pt] + X_{i,j}/\sum_{p\in P}\sum_{s\in S} X_{p,s} \times 10^6, & \text{if per_sample is False} + \end{array} + \right.\end{split}\]
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • per_sample (bool) – If True, compute counts per million separately for each sample. +Otherwise, frequencies are computed as a ratio of each count to the sum of +all counts in the dataset.

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+

Example

+
>>> ds.counts.values
+array([[8, 8, 3, 1],
+       [1, 3, 7, 4],
+       [9, 0, 5, 1],
+       [5, 2, 4, 4],
+       [1, 4, 1, 3],
+       [3, 4, 4, 0],
+       [4, 8, 2, 7],
+       [4, 3, 6, 5],
+       [0, 2, 9, 1],
+       [0, 5, 6, 5]])
+>>> from phippery.normalize import counts_per_million
+>>> counts_per_million(ds, new_table_name="cpm", inplace=True)
+>>> ds.cpm.values
+array([[228571.43, 205128.21,  63829.79,  32258.06],
+       [ 28571.43,  76923.08, 148936.17, 129032.26],
+       [257142.86,      0.  , 106382.98,  32258.06],
+       [142857.14,  51282.05,  85106.38, 129032.26],
+       [ 28571.43, 102564.1 ,  21276.6 ,  96774.19],
+       [ 85714.29, 102564.1 ,  85106.38,      0.  ],
+       [114285.71, 205128.21,  42553.19, 225806.45],
+       [114285.71,  76923.08, 127659.57, 161290.32],
+       [     0.  ,  51282.05, 191489.36,  32258.06],
+       [     0.  , 128205.13, 127659.57, 161290.32]])
+
+
+
+ +
+
+phippery.normalize.differential_selection_sample_groups(ds, sample_feature='library_batch', is_equal_to='batch_a', data_table='counts', aggregate_function=<function mean>, inplace=True, new_table_name='sample_group_differential_selection')[source]
+

This function computes differential selection +between groups of samples.

+
+

Note

+

This function is still experimental.

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.normalize.differential_selection_wt_mut(ds, data_table='enrichment', scaled_by_wt=False, smoothing_flank_size=0, groupby=['Protein'], loc_column='Loc', is_wt_column='is_wt', inplace=True, new_table_name='wt_mutant_differential_selection', relu_bias=None, skip_samples={})[source]
+

A generalized function to compute differential selection +of amino acid variants in relation to the wildtype sequence. +The function computed log fold change between enrichments +of a wildtype and mutation at any given site.

+

Concretely, given some site, \(s\) (defined by loc_column +feature in the peptide table) in the enrichment +matrix, \(X\), +the differential selection of any mutation with enrichment, \(m\), +at a site with wildtype enrichment, \(wt\), is \(\log_{2}(m/wt)\).

+
+

Note

+

This function is meant to be used specifically with phage-dms data +where the peptide table includes a “loc” column, and an “aa_sub_col” +which specifies the amino acid at that location.

+
+
+

Note

+

This calculation of differential selection +is derived from the Bloom Lab’s formulated from +https://jbloomlab.github.io/dms_tools2/diffsel.html#id5

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • scaled_by_wt (bool) – A boolean flag indicating whether or not you would like to multiply the +differential selection value by the wildtype enrichment

  • +
  • smoothing_flank_size (int) – This parameter should only be used if scaled_by_wt is true. +By specifying an integer greater than 0, you are scaling the differential +selection value by enrichment values of the wildtype peptides surrounding +, in both directions, a given site. The integer specified here then +determines how many peptides are used for the scaling in both directions.

  • +
  • groupby (list[str]) – This will specify which peptide feature groups such that site-mutation +combinations are unique.

  • +
  • loc_column (str) – The peptide table feature which specifies the site that a particular peptide +is centered at.

  • +
  • is_wt_column (str) – The column specifying which peptides are wildtype.

  • +
  • relu_bias (int) – If an integer is specified, then enrichment values less than +1 are replaced by the specified value before computing differential +selection.

  • +
  • skip_samples (set) – sample id’s which you do not want to calculate the differential selection on, +such as controls. This function has many nested loops, so avoid computing +on unnecessary samples.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.normalize.enrichment(ds, lib_ds, data_table='counts', inplace=True, new_table_name='enrichment')[source]
+

This function computes fold enrichment in the same fashion as +the standardized_enrichment, but does not subtract beads only controls

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • lib_ds (xarray.DataSet) – The dataset of phage library control samples used in normalization

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.normalize.rank_data(ds, data_table='counts', inplace=True, per_sample=False, new_table_name='rank')[source]
+

Compute the rank of specified enrichment layer. +The rank is descending

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • per_sample (bool) – If True, compute rank separately for each sample. +Otherwise, frequencies are computed as a ratio of each count to the sum of +all counts in the dataset.

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+

Example

+
>>> ds["counts"].values
+array([[533, 734, 399, 588],
+       [563, 947, 814, 156],
+       [ 47, 705, 750, 685],
+       [675, 118, 897, 290],
+       [405, 880, 772, 570],
+       [629, 961, 530,  63],
+       [633, 931, 268, 115],
+       [833, 290, 164, 184],
+       [ 18, 704, 359,  33],
+       [143, 486, 371, 415]])
+>>> rank_data(ds, data_table="counts", per_sample=True)
+>>> ds["rank"].values
+array([[4, 5, 4, 8],
+       [5, 8, 8, 3],
+       [1, 4, 6, 9],
+       [8, 0, 9, 5],
+       [3, 6, 7, 7],
+       [6, 9, 5, 1],
+       [7, 7, 1, 2],
+       [9, 1, 0, 4],
+       [0, 3, 2, 0],
+       [2, 2, 3, 6]])
+
+
+
+ +
+
+phippery.normalize.size_factors(ds, inplace=True, data_table='counts', new_table_name='size_factors')[source]
+
+

Warning

+

This method is deprecated. It is currently maintained only for reproducibility of previous results.

+
+

Compute size factors from +Anders and Huber 2010.

+

Concretely, given a Matrix of enrichments, \(X_{i,j}\), in the +phippery dataset with shape (peptides, samples). Consider a pseudo-reference sample +where the count of each peptide is the geometric mean of counts for that peptide across +the samples in the dataset. For a sample to be normalized, calculate for each peptide +the ratio of peptide count in the sample to the peptide count in the pseudo-reference +sample. The median of this ratio, \(\hat S_{j}\), is the size factor to normalize +all counts in sample \(j\),

+
+\[\hat S_{j} = {median \atop i} \frac{X_{i,j}}{(\prod_{v=1}^{m}{X_{i,v}})^{1/m}}\]
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.normalize.standardized_enrichment(ds, lib_ds, beads_ds, data_table='counts', inplace=True, new_table_name='std_enrichment')[source]
+

Compute standardized enrichment of sample counts. +This is the fold enrichment of each sample’s frequency +compared to the library average frequency, minus the mock IP +(beads only control) frequency.

+
+

Note

+

Psuedo counts and exact calculation are +derived from the Bloom Lab’s formulated normalization +heuristic for differential selection. See +https://jbloomlab.github.io/dms_tools2/diffsel.html#id5

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • lib_ds (xarray.DataSet) – The dataset of phage library control samples used in normalization

  • +
  • beads_ds (xarray.DataSet) – The dataset of beads only control samples used in normalization

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+

Example

+

Given a dataset, ds, with the following samples and +counts across 10 peptides:

+
>>> phippery.get_annotation_table(ds, "sample")
+sample_metadata  fastq_filename reference seq_dir sample_type
+sample_id
+0                sample_0.fastq      refa    expa  beads_only
+1                sample_1.fastq      refa    expa  beads_only
+2                sample_2.fastq      refa    expa     library
+3                sample_3.fastq      refa    expa     library
+4                sample_4.fastq      refa    expa          IP
+5                sample_5.fastq      refa    expa          IP
+6                sample_6.fastq      refa    expa          IP
+7                sample_7.fastq      refa    expa          IP
+8                sample_8.fastq      refa    expa          IP
+9                sample_9.fastq      refa    expa          IP
+>>> ds.counts
+<xarray.DataArray 'counts' (peptide_id: 5, sample_id: 10)>
+array([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
+       [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
+       [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
+       [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
+       [1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]])
+Coordinates:
+  * sample_id   (sample_id) int64 0 1 2 3 4 5 6 7 8 9
+  * peptide_id  (peptide_id) int64 0 1 2 3 4
+
+
+

First, separate the dataset into it’s various samples types using +phippery.utils.ds_query()

+
>>> ip_ds = ds_query(ds, "sample_type == 'IP'")
+>>> lib_ds = ds_query(ds, "sample_type == 'library'")
+>>> mockip_ds = ds_query(ds, "sample_type == 'beads_only'")
+
+
+

We can then compute standardized fold enrichment like so:

+
>>> phippery.normalize.standardized_enrichment(ip_ds, lib_ds, mockip_ds)
+
+
+

which will modify the ip_ds dataset inplace to include a new table

+
>>> ip_ds.std_enrichment
+<xarray.DataArray 'std_enrichment' (peptide_id: 5, sample_id: 6)>
+array([[0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0.],
+       [0., 0., 0., 0., 0., 0.]])
+Coordinates:
+  * sample_id   (sample_id) int64 4 5 6 7 8 9
+  * peptide_id  (peptide_id) int64 0 1 2 3 4
+
+
+

Note that we expect the result to be all zeros because +a 1-to-1 fold enrichment for ip’s to library samples minus +1-to-1 beads to library

+
+ +
+
+phippery.normalize.svd_aa_loc(ds, rank=1, data_table='enrichment', protein_name_column='Protein', location_col='Loc', aa_sub_col='aa_sub', inplace=True, new_table_name='svd_rr')[source]
+

Compute singular value decomposition rank reduction +on the aa / loc matrix by pivoting before computing decomposition +and re-shaping to add to the dataset.

+
+

Note

+

This function is meant to be used specifically with phage-dms data +where the peptide table includes a “loc” column, and an “aa_sub_col” +which specifies the amino acid at that location.

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • protein_name_column (str) – The peptide table feature which specifies which protein a specific peptide +derives from.

  • +
  • location_col (str) – The peptide table feature which specifies the site that a particular peptide +is centered at.

  • +
  • aa_sub_col (str) – The peptide table feature which specifies the amino acid at a given site.

  • +
+
+
+
+
new_table_namestr

The name of the new layer you would like to append to the dataset.

+
+
inplacebool

If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

+
+
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.normalize.svd_rank_reduction(ds, rank=1, data_table='enrichment', inplace=True, new_table_name='svd_rr')[source]
+

This function computes the singular value decomposition, +then recomputes the enrichment matrix up to the rank specified.

+

Concretely, given a Matrix of, \(X\) enrichments in the +phippery dataset with shape (peptides, samples). We compute +the decomposition \(X = USV^{T}\), then return the +recomposition using the first +rank eigenvectors and eigenvalues.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to fit to

  • +
  • rank (int) – The number of ranks to include in the reconstruction.

  • +
  • data_table (str) – The name of the enrichment layer you would like to fit mlxp to.

  • +
  • new_table_name (str) – The name of the new layer you would like to append to the dataset.

  • +
  • inplace (bool) – If True, then this function +appends a dataArray to ds which is indexed with the same coordinate dimensions as +‘data_table’. If False, a copy of ds is returned with the appended dataArray

  • +
+
+
Returns:
+

If inplace is False, return a new DataSet object which has +the enrichment values appended

+
+
Return type:
+

xarray.DataSet

+
+
+
+ + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/phippery.utils.html b/phippery.utils.html new file mode 100644 index 0000000..a0ee561 --- /dev/null +++ b/phippery.utils.html @@ -0,0 +1,651 @@ + + + + + + + Utils — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Utils

+

Utilities for building, indexing, and manipulating +and xarray dataset topology +specific to most phippery functions provided in this package

+
+
+
+phippery.utils.add_enrichment_layer_from_array(ds, enrichment, new_table_name=None, inplace=True)[source]
+

Append an enrichment layer to the dataset.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The phippery dataset to append to.

  • +
  • enrichment (np.array) – The enrichment matrix to append to the phippery dataset. +The number of rows should be the same length as ds.peptide_id +and the number of columns should be the same length as ds.sample_id

  • +
  • new_table_name (str) – What you would like to name the enrichment layer.

  • +
  • inplace (bool) – Determines whether to modify the passed dataset, or return an augmented +copy

  • +
+
+
Returns:
+

The augmented phippery dataset copy is returned if inplace is True

+
+
Return type:
+

None | xarray.DataSet

+
+
+
+ +
+
+phippery.utils.collapse_groups(ds, by, collapse_dim='sample', agg_func=<function mean>, compute_pw_cc=False, **kwargs)[source]
+

Collapse an xarray dataset along one of the annotation axis +by applying the agg_function to annotation groups of ‘by’.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The phippery dataset to append to.

  • +
  • by (list) – The name of the annotation feature you would like to collapse.

  • +
  • collapse_dim (str) – The dimension you’s like to collapse. “sample” or “peptide”

  • +
  • compute_pw_cc (bool) – Whether or not to compute the mean pairwise correlation +of all values within any feature group that is being +collapsed.

  • +
  • agg_func (function) – This function must take a one-dimensional array and aggregate +all values to a single number, agg_func(list[float | int]) -> float | int

  • +
+
+
Returns:
+

The collapsed phippery dataset.

+
+
Return type:
+

xarray.DataSet

+
+
+

Example

+
>>> get_annotation_table(ds, dim="sample")
+sample_metadata  fastq_filename reference seq_dir sample_type
+sample_id
+0                sample_0.fastq      refa    expa  beads_only
+1                sample_1.fastq      refa    expa  beads_only
+2                sample_2.fastq      refa    expa     library
+3                sample_3.fastq      refa    expa     library
+4                sample_4.fastq      refa    expa          IP
+5                sample_5.fastq      refa    expa          IP
+>>> ds["counts"].to_pandas()
+sample_id   0  1  2  3  4  5
+peptide_id
+0           7  0  3  2  3  2
+1           6  3  1  0  7  5
+2           9  1  7  8  4  7
+>>> mean_sample_type_ds = collapse_groups(ds, by=["sample_type"])
+>>> get_annotation_table(mean_sample_type_ds, dim="sample")
+sample_metadata reference seq_dir sample_type
+sample_id
+0                    refa    expa          IP
+1                    refa    expa  beads_only
+2                    refa    expa     library
+>>> mean_sample_type_ds["counts"].to_pandas()
+sample_id     0    1    2
+peptide_id
+0           2.5  3.5  2.5
+1           6.0  4.5  0.5
+2           5.5  5.0  7.5
+
+
+
+ +
+
+phippery.utils.collapse_peptide_groups(*args, **kwargs)[source]
+

wrap for peptide collapse

+
+ +
+
+phippery.utils.collapse_sample_groups(*args, **kwargs)[source]
+

wrap for sample collapse

+
+ +
+
+phippery.utils.collect_counts(counts)[source]
+

merge individual tsv files from individual samples alignments +into a counts matrix.

+
+
Parameters:
+

counts (list[str]) –

A list a filepaths relative to current working directory to read in. +The filepaths should point to tab-separated files for each sample +which contains two columns (without headers):

+
+
    +
  1. peptide ids - the integer peptide identifiers

  2. +
  3. enrichments - the respective enrichments for any peptide id

  4. +
+
+

+
+
Returns:
+

The merged enrichments with peptides as the index, and filenames as column names.

+
+
Return type:
+

pd.DataFrame

+
+
+
+ +
+
+phippery.utils.dataset_from_csv(peptide_table_filename, sample_table_filename, counts_table_filename)[source]
+

Load a dataset from individual comma separated +files containing the counts matrix, as well as +sample and peptide annotation tables.

+
+

Note

+

This is the inverse operation of the +to_wide_csv() utility function. +Generally speaking these functions are used for +long term storage in common formats when pickle +dumped binaries are not ideal. +For now, this function only supports +a single enrichment table to be added with the +variable name “counts” to the dataset. +If you would like to add other transformation of the +enrichment table (i.e. cpm, mlxp, etc), you can +load the csv’s via pandas and add to the dataset +using the add_enrichment_layer_from_array function

+
+
+
Parameters:
+
    +
  • counts_table_filename (str) – The glob filepath to csv file(s) containing the enrichments. +All files should have the first column be indices which match the +given peptide table index column. +The first row then should have column headers that match the +index of the sample table.

  • +
  • peptide_table_filename (str) – The relative filepath to the peptide annotation table.

  • +
  • sample_table_filename (str) – The relative filepath to the sample annotation table.

  • +
+
+
Returns:
+

The combined tables in a phippery dataset.

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.utils.ds_query(ds, query, dim='sample')[source]
+

Apply a sample or peptide query statement to the +entire dataset.

+
+

Note

+

For more on pandas queries, see +the pandas documentation

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to query.

  • +
  • query (str) – pandas query expression

  • +
  • dim (str) – The dimension to to apply the expression

  • +
+
+
Returns:
+

reference to the dataset slice from the given expression.

+
+
Return type:
+

xarray.DataSet

+
+
+

Example

+
>>> phippery.get_annotation_table(ds, "peptide")
+peptide_metadata Oligo   virus
+peptide_id
+0                 ATCG    zika
+1                 ATCG    zika
+2                 ATCG    zika
+3                 ATCG    zika
+4                 ATCG  dengue
+5                 ATCG  dengue
+6                 ATCG  dengue
+7                 ATCG  dengue
+>>> zka_ds = ds_query(ds, "virus == 'zika'", dim="peptide")
+>>> zka_ds["counts"].to_pandas()
+sample_id     0    1    2    3    4    5    6    7    8    9
+peptide_id
+0           110  829  872  475  716  815  308  647  216  791
+1           604  987  776  923  858  985  396  539   32  600
+2           865  161  413  760  422  297  639  786  857  878
+3           992  354  825  535  440  416  572  988  763  841
+
+
+
+ +
+
+phippery.utils.dump(ds, path)[source]
+

simple wrapper for dumping xarray datasets to pickle binary

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to write to disk.

  • +
  • path (str) – The relative path you would like to write to.

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+phippery.utils.get_annotation_table(ds, dim='sample')[source]
+

return a copy of the peptide table after converting all +the data types applying the pandas NaN heuristic

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset to extract an annotation from.

  • +
  • dim (str) – The annotation table to grab: “sample” or “peptide”.

  • +
+
+
Returns:
+

The annotation table.

+
+
Return type:
+

pd.DataFrame

+
+
+
+ +
+
+phippery.utils.id_coordinate_from_query_df(ds, query_df)[source]
+

Given a dataframe with pandas query statements +for both samples and peptides, return the relevant sample +and peptide id’s after applying the logical AND of all queries.

+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to query.

  • +
  • query_df (pd.DataFrame) –

    A dataframe with must have two columns (including headers):

    +
    +
      +
    1. ”dimension” - either “sample” or “peptide” to specify expression dimension

    2. +
    3. ”expression” - The pandas query expression to apply.

    4. +
    +
    +

  • +
+
+
Returns:
+

tuple – Return a tuple of sample id’s and peptide id’s

+
+
Return type:
+

list, list

+
+
+
+ +
+
+phippery.utils.id_query(ds, query, dim='sample')[source]
+

Apply a sample or peptide query statement to the +entire dataset and retrieve the respective indices.

+ +
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset you would like to query.

  • +
  • query (str) – pandas query expression

  • +
  • dim (str) –

  • +
+
+
Returns:
+

The list of integer identifiers that apply to a given expression +for the respective dimension.

+
+
Return type:
+

list[int]

+
+
+
+ +
+
+phippery.utils.iter_groups(ds, by, dim='sample')[source]
+

This function returns an iterator +yielding subsets of the provided dataset, +grouped by items in the metadata of either of the +dimensions specified.

+
+
Parameters:
+

ds (xarray.DataSet) – The dataset to iterate over.

+
+
Returns:
+

Returns subsets of the original dataset sliced by +either sample or peptide table groups.

+
+
Return type:
+

generator

+
+
+

Example

+
>>> phippery.get_annotation_table(ds, "sample")
+sample_metadata  fastq_filename reference seq_dir sample_type
+sample_id
+0                sample_0.fastq      refa    expa  beads_only
+1                sample_1.fastq      refa    expa  beads_only
+2                sample_2.fastq      refa    expa     library
+3                sample_3.fastq      refa    expa     library
+>>> ds["counts"].values
+array([[458, 204, 897, 419],
+       [599, 292, 436, 186],
+       [ 75,  90, 978, 471],
+       [872,  33, 108, 505],
+       [206, 107, 981, 208]])
+>>> sample_groups = iter_groups(ds, by="sample_type")
+>>> for group, phip_dataset in sample_groups:
+...     print(group)
+...     print(phip_dataset["counts"].values)
+...
+beads_only
+[[458 204]
+ [599 292]
+ [ 75  90]
+ [872  33]
+ [206 107]]
+library
+[[897 419]
+ [436 186]
+ [978 471]
+ [108 505]
+ [981 208]]
+
+
+
+ +
+
+phippery.utils.load(path)[source]
+

simple wrapper for loading +xarray datasets from pickle binary

+
+
Parameters:
+

path (str) – Relative path of binary phippery dataset

+
+
Returns:
+

phippery dataset

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.utils.stitch_dataset(counts, peptide_table, sample_table)[source]
+

Build an phippery xarray dataset from individual +tables.

+
+

Note

+

If the counts matrix that you’re passing has the shape +(M x N) for M peptides, and N samples, the +sample table should have a len of N, +and peptide table should have len M

+
+
+
Parameters:
+
    +
  • counts (numpy.ndarray) – The counts matrix for sample peptide enrichments.

  • +
  • sample_table (pd.DataFrame) – The sample annotations corresponding to the columns of +the counts matrix.

  • +
  • peptide_table (pd.DataFrame) – The peptide annotations corresponding to the rows of +the counts matrix.

  • +
+
+
Returns:
+

The formatted phippery xarray dataset used by most of the phippery functionality.

+
+
Return type:
+

xarray.DataSet

+
+
+
+ +
+
+phippery.utils.to_tall(ds: Dataset)[source]
+

Melt a phippery xarray dataset into a single long-formatted +dataframe that has a unique sample peptide interaction on each +row. Ideal for ggplotting.

+
+
Parameters:
+

ds (xarray.DataSet) – The dataset to extract an annotation from.

+
+
Returns:
+

The tall formatted dataset.

+
+
Return type:
+

pd.DataFrame

+
+
+

Example

+
>>> ds["counts"].to_pandas()
+sample_id     0    1
+peptide_id
+0           453  393
+1           456  532
+2           609  145
+>>> to_tall(ds)[["sample_id", "peptide_id", "counts"]]
+  sample_id  peptide_id  counts
+0         0           0     453
+1         0           1     456
+2         0           2     609
+3         1           0     393
+4         1           1     532
+5         1           2     145
+
+
+
+ +
+
+phippery.utils.to_wide(ds)[source]
+

Take a phippery dataset and split it into +its separate components in a dictionary.

+
+
Parameters:
+

ds (xarray.DataSet) – The dataset to separate.

+
+
Returns:
+

The dictionary of annotation tables and enrichment matrices.

+
+
Return type:
+

dict

+
+
+
+ +
+
+phippery.utils.to_wide_csv(ds, file_prefix)[source]
+

Take a phippery dataset and split it into +its separate components at writes each into a +comma separated file.

+
+

Note

+

This is the inverse operation of the +dataset_from_csv() utility function. +Generally speaking these functions are used for +long term storage in common formats when pickle +dumped binaries are not ideal.

+
+
+
Parameters:
+
    +
  • ds (xarray.DataSet) – The dataset to extract an annotation from.

  • +
  • file_prefix (str) – The file prefix relative to the current working directory +where the files should be written.

  • +
+
+
Return type:
+

None

+
+
+
+ +
+
+phippery.utils.yield_tall(ds: Dataset)[source]
+

For each sample, yield a tall DataFrame.

+
+ + + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/py-modindex.html b/py-modindex.html new file mode 100644 index 0000000..0752366 --- /dev/null +++ b/py-modindex.html @@ -0,0 +1,185 @@ + + + + + + Python Module Index — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + +

Python Module Index

+ +
+ p +
+ + + + + + + + + + + + + + + + + + + + + + +
 
+ p
+ phippery +
    + phippery.eigen +
    + phippery.escprof +
    + phippery.modeling +
    + phippery.normalize +
    + phippery.utils +
+ + +
+
+
+ +
+ +
+

© Copyright 2024, Jared G. Galloway, Kevin Sung.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/search.html b/search.html new file mode 100644 index 0000000..a5a6ef9 --- /dev/null +++ b/search.html @@ -0,0 +1,160 @@ + + + + + + Search — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • + +
  • +
  • +
+
+
+
+
+ + + + +
+ +
+ +
+
+
+ +
+ +
+

© Copyright 2024, Jared G. Galloway, Kevin Sung.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/searchindex.js b/searchindex.js new file mode 100644 index 0000000..45e11dd --- /dev/null +++ b/searchindex.js @@ -0,0 +1 @@ +Search.setIndex({"docnames": ["alignments-pipeline", "bkg-model", "command-line-interface", "esc-prof", "examples", "index", "installation", "introduction", "phippery.eigen", "phippery.escprof", "phippery.modeling", "phippery.normalize", "phippery.utils", "streamlit-app", "the-rest-of-it"], "filenames": ["alignments-pipeline.rst", "bkg-model.rst", "command-line-interface.rst", "esc-prof.rst", "examples.rst", "index.rst", "installation.rst", "introduction.rst", "phippery.eigen.rst", "phippery.escprof.rst", "phippery.modeling.rst", "phippery.normalize.rst", "phippery.utils.rst", "streamlit-app.rst", "the-rest-of-it.rst"], "titles": ["Alignments Pipeline", "Background Modeling", "Command Line Interface", "Comparing Escape Profiles", "Examples", "Welcome to phippery\u2019s documentation!", "Installation", "Introduction", "Eigen", "Escape Profile", "Modeling", "Normalize", "Utils", "Streamlit Viz App", "Gotchas"], "terms": {"A": [0, 1, 3, 4, 7, 8, 9, 10, 11, 12, 14], "flexibl": [0, 4, 7], "nextflow": [0, 4, 6, 7], "autom": [0, 4], "us": [0, 1, 2, 3, 4, 7, 9, 10, 11, 12, 13, 14], "produc": [0, 4], "data": [0, 1, 2, 3, 5, 6, 7, 8, 9, 11, 12, 13], "from": [0, 1, 3, 4, 7, 9, 10, 11, 12, 13, 14], "phip": [0, 1, 2, 3, 4, 6, 7, 8, 10, 13, 14], "seq": [0, 1, 3, 4, 7, 8, 14], "when": [0, 1, 3, 4, 12, 14], "provid": [0, 1, 2, 3, 4, 7, 10, 12], "demultiplex": [0, 4, 7, 14], "fastq": [0, 4, 7, 11, 12], "well": [0, 2, 4, 7, 12, 13, 14], "annot": [0, 2, 4, 5, 7, 8, 9, 12, 13], "both": [0, 2, 3, 4, 6, 11, 12], "experiment": [0, 11], "phage": [0, 3, 4, 7, 9, 11, 14], "librari": [0, 2, 3, 4, 7, 11, 12, 14], "being": [0, 4, 12], "direct": [0, 8, 11], "acycl": 0, "graph": 0, "dag": 0, "defin": [0, 3, 4, 11], "execut": [0, 4], "order": [0, 3], "depend": [0, 4, 13], "each": [0, 1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 14], "individu": [0, 4, 7, 9, 12], "process": [0, 4, 7, 14], "The": [0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13], "major": [0, 7, 14], "step": [0, 3, 4, 7, 14], "can": [0, 1, 2, 3, 4, 7, 11, 12, 13, 14], "summar": [0, 3], "1": [0, 1, 2, 3, 4, 6, 7, 9, 10, 11, 12, 14], "build": [0, 5, 6, 12], "bowti": [0, 4], "index": [0, 2, 4, 5, 10, 11, 12, 14], "relev": [0, 7, 12], "oligo": [0, 4, 7, 12], "2": [0, 1, 2, 3, 4, 7, 9, 10, 11, 12, 13], "refer": [0, 4, 5, 11, 12, 13, 14], "end": [0, 3, 4, 11], "allow": [0, 3, 4, 7, 13, 14], "up": [0, 11], "n": [0, 3, 4, 8, 10, 12, 13, 14], "mismatch": [0, 4], "default": [0, 1, 2, 4, 6, 7, 9, 13], "user": [0, 7], "specifi": [0, 4, 6, 8, 9, 11, 12], "size": [0, 4, 11, 13, 14], "read": [0, 2, 4, 7, 12, 14], "low": [0, 3], "qualiti": [0, 2, 4], "ar": [0, 1, 3, 4, 7, 8, 9, 10, 11, 12, 14], "trim": [0, 4], "match": [0, 3, 4, 12], "length": [0, 4, 12], "befor": [0, 4, 8, 11, 14], "3": [0, 1, 2, 3, 4, 7, 11, 12], "count": [0, 1, 2, 4, 8, 10, 11, 12, 13, 14], "obtain": [0, 3, 4, 7, 10], "samtool": 0, "idxstat": 0, "li": 0, "et": [0, 1, 3, 4, 7], "al": [0, 1, 3, 4, 7], "2009": 0, "parallel": 0, "comput": [0, 1, 3, 4, 7, 8, 10, 11, 12], "common": [0, 4, 7, 12], "stat": [0, 10], "raw": [0, 2, 4, 7, 8, 13], "total": [0, 2, 3, 9], "sequenc": [0, 2, 4, 7, 11, 14], "reads_map": 0, "error_r": 0, "average_qu": 0, "4": [0, 2, 3, 4, 7, 11, 12], "dataset": [0, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "contain": [0, 2, 3, 4, 6, 9, 10, 12], "matrix": [0, 3, 4, 8, 9, 11, 12, 14], "metadata": [0, 12], "xarrai": [0, 4, 7, 8, 9, 10, 11, 12, 13, 14], "packag": [0, 1, 3, 6, 7, 12], "hamman": 0, "hoyer": 0, "2017": 0, "5": [0, 1, 2, 3, 4, 7, 11, 12], "statist": [0, 1, 2, 4, 7], "per": [0, 3, 4, 10, 11, 13], "million": [0, 4, 11, 13], "factor": [0, 3, 4, 11, 13], "fold": [0, 1, 4, 11, 13], "model": [0, 4, 5, 7, 14], "fit": [0, 4, 7, 10, 11, 14], "estim": [0, 1, 4, 7, 10], "signific": [0, 1, 3, 4, 10, 13], "6": [0, 2, 11, 12, 14], "By": [0, 1, 4, 11], "output": [0, 1, 2, 4, 7, 13, 14], "all": [0, 1, 3, 4, 7, 11, 12, 14], "abov": [0, 2, 3, 4, 7, 10], "pickl": [0, 4, 7, 12], "dump": [0, 12], "binari": [0, 2, 4, 6, 7, 12], "object": [0, 3, 4, 11], "combin": [0, 1, 11, 12], "csv": [0, 7, 12], "": [0, 2, 3, 4, 6, 7, 8, 11, 12, 13], "you": [0, 1, 2, 4, 6, 7, 8, 10, 11, 12, 13, 14], "mai": [0, 1, 2, 3, 4, 7, 13], "also": [0, 1, 4, 7], "export": [0, 4, 7], "phipdata": [0, 4], "chen": [0, 1], "2022": [0, 1], "format": [0, 4, 7, 12, 14], "via": [0, 4, 8, 12, 13], "rd": [0, 4], "even": [0, 4], "tall": [0, 7, 12, 14], "where": [0, 3, 4, 6, 11, 12], "one": [0, 2, 3, 4, 12, 14], "column": [0, 2, 4, 7, 8, 11, 12, 14], "must": [0, 4, 12], "fastq_filenam": [0, 2, 11, 12], "list": [0, 2, 3, 7, 9, 11, 12], "run": [0, 1, 2, 3, 5, 6, 7, 13, 14], "through": [0, 4, 6, 7], "assum": [0, 3, 4], "rel": [0, 1, 3, 4, 9, 10, 12], "project": [0, 4, 8, 14], "directori": [0, 4, 6, 12], "i": [0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13], "If": [0, 4, 7, 8, 10, 11, 12], "some": [0, 2, 4, 6, 7, 11, 13], "other": [0, 1, 3, 6, 7, 12, 13], "prefix": [0, 4, 12], "filepath": [0, 4, 12], "check": [0, 7, 14], "out": [0, 4, 7], "reads_prefix": 0, "As": [0, 2, 4, 13], "an": [0, 1, 2, 3, 4, 7, 11, 12, 14], "exampl": [0, 2, 3, 5, 9, 11, 12, 13], "let": [0, 2, 4], "ng": [0, 4, 7], "To": [0, 1, 3, 4, 6, 7, 13, 14], "exclud": [0, 4], "barcod": [0, 4], "minim": [0, 3, 4], "describ": [0, 1, 3, 4, 7, 10, 14], "path": [0, 4, 12], "we": [0, 1, 2, 3, 4, 6, 7, 8, 10, 11, 13, 14], "might": [0, 4], "follow": [0, 3, 4, 7, 10, 11, 13, 14], "command": [0, 4, 6], "echo": [0, 4], "fastq_filepath": [0, 4], "l": [0, 3, 4], "r1": [0, 4], "gz": [0, 4], "sample_t": [0, 4, 12], "simpl": [0, 12, 13], "found": [0, 4, 7], "here": [0, 1, 4, 7, 11, 14], "In": [0, 1, 3, 4], "addit": [0, 1, 4], "includ": [0, 3, 4, 8, 11, 12], "mani": [0, 3, 11, 14], "color": [0, 4], "would": [0, 3, 4, 6, 8, 10, 11, 12], "like": [0, 3, 4, 8, 10, 11, 12, 13, 14], "so": [0, 3, 4, 11], "long": [0, 12], "stai": [0, 14], "tidi": 0, "One": 0, "caveat": 0, "should": [0, 4, 11, 12], "name": [0, 2, 8, 9, 10, 11, 12], "sample_id": [0, 4, 9, 11, 12], "thi": [0, 1, 2, 3, 4, 7, 8, 10, 11, 12, 13, 14], "featur": [0, 2, 7, 8, 11, 12, 13, 14], "reserv": 0, "integ": [0, 2, 3, 11, 12, 14], "id": [0, 11, 12], "which": [0, 1, 2, 3, 4, 7, 10, 11, 12, 14], "ad": [0, 4, 8, 12, 13], "intern": 0, "phipperi": [0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13], "api": [0, 7, 12], "util": [0, 5, 11], "gener": [0, 4, 7, 11, 12], "help": [0, 2, 7, 13], "otherwis": [0, 4, 11], "manipul": [0, 12], "your": [0, 5, 7, 13], "ani": [0, 1, 2, 3, 4, 7, 11, 12, 14], "go": 0, "wild": [0, 3], "type": [0, 2, 3, 8, 9, 10, 11, 12, 13, 14], "handl": [0, 14], "convers": 0, "panda": [0, 2, 4, 12], "best": [0, 4, 14], "keep": 0, "consist": [0, 3, 14], "between": [0, 3, 9, 11], "For": [0, 2, 3, 4, 6, 7, 10, 11, 12, 13, 14], "miss": [0, 2, 5], "recommend": [0, 4, 14], "empti": 0, "string": [0, 2, 14], "nan": [0, 5, 12], "work": [0, 3, 4, 7, 12, 13, 14], "hopefulli": 0, "expect": [0, 4, 10, 11], "workflow": [0, 1, 4, 7, 14], "have": [0, 2, 3, 4, 6, 7, 12, 13, 14], "requir": [0, 6, 7, 14], "ey": 0, "those": 0, "point": [0, 6, 12], "uniform": [0, 4], "dure": [0, 4], "enforc": 0, "oligo_tile_length": [0, 4], "see": [0, 1, 2, 4, 6, 7, 9, 11, 12, 13], "more": [0, 1, 2, 3, 4, 6, 7, 12, 13], "oligonucleotid": [0, 4, 7, 14], "encod": [0, 4, 7], "adapt": [0, 1, 4], "lower": [0, 1, 3, 4], "case": [0, 4], "nucleotid": 0, "ultim": 0, "toss": 0, "express": [0, 1, 3, 12], "upper": [0, 4], "similar": [0, 1, 5, 9], "e": [0, 1, 3, 4, 5, 7, 9, 10, 12, 13], "g": [0, 1, 3, 4, 7, 9, 10], "viru": [0, 1, 3, 4, 7, 12, 13, 14], "strain": [0, 4, 7], "loci": 0, "etc": [0, 7, 12], "except": 0, "peptide_id": [0, 4, 11, 12], "again": 0, "primari": [0, 2, 4, 7, 14], "appli": [0, 3, 12, 13], "method": [0, 3, 7, 8, 9, 10, 11], "edger": [0, 4, 5, 13], "analyz": 0, "howev": [0, 4], "thei": [0, 3], "wish": [0, 1, 3, 4], "pickle_data": [0, 4], "rds_data": [0, 4], "wide_data": [0, 4], "data_count": [0, 4], "data_cpm": [0, 4], "data_edger_hit": [0, 4], "data_edger_logfc": [0, 4], "data_edger_logpv": [0, 4], "data_peptide_annotation_t": [0, 4], "data_sample_annotation_t": [0, 4], "data_size_factor": [0, 4], "11": [0, 3, 4], "page": [0, 2, 3, 4, 5, 6, 7], "detail": [0, 1, 2, 4, 7], "explan": 0, "below": [0, 1, 2, 3, 4, 10, 14], "possibl": [0, 2, 3], "pass": [0, 12], "next": [0, 4, 13, 14], "valu": [0, 1, 3, 7, 8, 9, 10, 11, 12, 13, 14], "explicitli": 0, "unless": [0, 4], "onli": [0, 1, 3, 4, 7, 10, 11, 12, 13], "control": [0, 10, 11], "indic": [0, 3, 4, 11, 12], "beads_onli": [0, 11, 12], "control_statu": [0, 2], "wb_type": 0, "true": [0, 4, 8, 10, 11, 12], "folder": 0, "read_length": [0, 4], "approach": [0, 3, 7, 14], "section": [0, 4, 7, 13], "125": [0, 4], "fastq_stream_func": 0, "set": [0, 3, 4, 7, 11], "cat": 0, "zip": 0, "zcat": 0, "peptide_t": [0, 4, 12], "given": [0, 2, 3, 4, 8, 9, 10, 11, 12], "117": [0, 4], "dataset_prefix": 0, "prepend": 0, "output_pickle_xarrai": 0, "bool": [0, 8, 10, 11, 12], "output_tall_csv": [0, 4], "output_wide_csv": [0, 4], "wide": [0, 7], "n_mismatch": [0, 4], "number": [0, 4, 8, 9, 10, 11, 12, 14], "bowtie_optional_arg": [0, 4], "tryhard": [0, 4], "nomaqround": [0, 4], "norc": [0, 4], "sam": [0, 4], "quiet": [0, 4], "replicate_sequence_count": [0, 4], "flag": [0, 11], "replic": [0, 4], "popular": 0, "least": 0, "u": [0, 4, 13, 14], "select": [0, 3, 4, 7, 9, 11, 14], "python": [0, 3, 4, 7, 14], "ll": [0, 4, 11, 13], "boolean": [0, 11], "addition": [0, 2, 4, 14], "need": [0, 4, 6], "certain": 0, "level": [0, 2, 3], "our": [0, 2, 3, 4, 7, 13], "pan": [0, 2, 5, 13], "cov": [0, 2, 3, 5, 7, 13], "appropri": 0, "mean": [0, 1, 2, 4, 6, 10, 11, 12], "could": [0, 3, 4], "base": [0, 3, 4, 7, 9, 13], "ubuntu": 0, "flow": [0, 1, 4, 7], "v1": [0, 4], "04": [0, 6], "main": [0, 3, 4, 14], "nf": 0, "profil": [0, 4, 5, 6, 7], "docker": [0, 4, 6, 13], "run_cpm_enr_workflow": 0, "x": [0, 4, 7, 8, 10, 11, 12, 14], "t": [0, 3, 8, 11], "f": [0, 3, 10], "o": [0, 6, 7], "w": [0, 3], "version": [0, 4, 6, 14], "21": [0, 11], "launch": 0, "distracted_banach": 0, "revis": 0, "9ea43df075": 0, "p": [0, 1, 3, 4, 6, 7, 10, 11, 13], "h": [0, 2, 3], "matsen": [0, 7], "overbaugh": [0, 4, 7], "minot": 0, "lab": [0, 4, 11], "fred": [0, 4, 7], "hutchinson": [0, 7], "crc": 0, "seattl": 0, "wa": [0, 1, 4, 13, 14], "home": 0, "jare": 0, "matsengroup": 0, "executor": 0, "local": [0, 6, 14], "29": [0, 11], "2c": 0, "30601d": 0, "validate_sample_t": 0, "100": 0, "1d": 0, "073399": 0, "validate_peptide_t": 0, "37": 0, "6937e7": 0, "generate_fasta_refer": 0, "61": 0, "a636a9": 0, "generate_index": 0, "454757": 0, "short_read_align": 0, "0d": 0, "320a4d": 0, "sam_to_count": 0, "f4": 0, "687d71": 0, "sam_to_stat": 0, "c6": 0, "036a15": 0, "collect_phip_data": 0, "c0": 0, "3eb016": 0, "replicate_count": 0, "e8": 0, "fae63a": 0, "counts_per_million": [0, 11], "a9": 0, "81d0b7": 0, "size_factor": [0, 10, 11, 13], "031d9e": 0, "cpm_fold_enrich": 0, "fit_predict_neg_binom": 0, "fit_predict_zscor": 0, "7e": 0, "df19de": 0, "merge_binary_dataset": 0, "5b1faf": 0, "dsout": 0, "dump_binari": 0, "dump_wide_csv": 0, "dump_tall_csv": 0, "agg": 0, "split_sampl": 0, "aggregate_organ": 0, "join_organ": 0, "take": [0, 1, 2, 3, 4, 7, 12, 14], "look": [0, 2, 4, 7, 13], "import": [0, 3, 4, 11, 14], "d": [0, 1, 3, 4, 7, 8, 9, 10, 11, 12], "load": [0, 4, 12], "dimens": [0, 8, 10, 11, 12, 14], "10047": 0, "sample_metadata": [0, 11, 12], "9": [0, 2, 10, 11, 12], "peptide_metadata": [0, 12], "7": [0, 2, 3, 4, 11, 12, 14], "coordin": [0, 10, 11, 14], "int64": [0, 2, 11], "0": [0, 2, 3, 4, 10, 11, 12, 13], "10043": 0, "10044": 0, "10045": 0, "10046": 0, "library_batch": [0, 2, 11], "average_q": 0, "prot_start": [0, 4], "variabl": [0, 4, 12], "megsub": 0, "oc43": [0, 4], "4052": 0, "float64": [0, 2], "94": 0, "85": 0, "560": 0, "245": 0, "02065": 0, "979": 0, "093": 0, "to_panda": [0, 12], "10042": 0, "8": [0, 2, 3, 7, 10, 11, 12], "row": [0, 4, 12, 14], "020650": 0, "979353": 0, "020651": 0, "34": 0, "805577": 0, "15": 0, "238485": 0, "552418": 0, "447580": 0, "091275": 0, "002347": 0, "289535": 0, "578875": 0, "328661": 0, "671337": 0, "007004": 0, "010433": 0, "989571": 0, "000000": [0, 2], "666665": 0, "333336": 0, "006992": 0, "997354": 0, "002643": 0, "742907": 0, "589568": 0, "093262": 0, "ha": [0, 3, 4, 11, 12, 13, 14], "been": [0, 4, 14], "fulli": 0, "test": [0, 6, 7, 14], "veri": [0, 3, 10], "slow": 0, "error": [0, 2, 14], "aris": 0, "question": [0, 7], "develop": [0, 5, 6, 7], "outsid": [0, 4, 14], "note": [0, 1, 3, 4, 6, 11], "directli": 0, "run_beer": 0, "infrastructur": [0, 7], "r": [0, 1, 3, 4, 6, 14], "vignett": 0, "paper": [0, 1], "hit": [0, 13], "ti": [0, 4, 8], "save": [0, 13], "param": 0, "sub": [0, 3, 4], "back": [0, 4], "fals": [0, 4, 8, 10, 11, 12], "pre": [0, 4, 6], "emprici": 0, "ip": [0, 1, 7, 11, 12], "over": [0, 3, 7, 12], "abund": [0, 1], "subset": [0, 12, 13], "label": [0, 4, 9, 13], "descript": [0, 2, 4, 7, 9], "how": [0, 2, 3, 4, 6, 11], "function": [0, 3, 4, 7, 10, 11, 12, 14], "normal": [0, 1, 3, 4, 5, 9, 13, 14], "run_zscore_fit_predict": 0, "analysi": [0, 1, 3, 4, 7, 14], "mock": [0, 1, 11], "bead": [0, 1, 10, 11], "thu": [0, 2, 7], "mark": 0, "zscore": [0, 10], "background": [0, 5, 10], "document": [0, 1, 4, 7, 12], "epitop": [0, 1, 3, 7], "across": [0, 3, 4, 7, 11, 14], "group": [0, 2, 4, 7, 11, 12, 14], "proteom": [0, 4], "creat": [0, 5, 7, 13], "mind": 0, "assai": [0, 7], "matsengrp": [0, 4, 6, 7, 13, 14], "12": [0, 4], "summarize_by_organ": 0, "peptide_seq_col": 0, "prot": 0, "peptide_org_col": 0, "date": [0, 4], "inform": [0, 2, 6, 7, 14], "regard": 0, "sourc": [0, 4, 7, 8, 9, 10, 11, 12], "It": [0, 4, 11, 14], "multipl": 0, "line": 0, "same": [0, 2, 3, 4, 8, 10, 11, 12, 14], "enabl": 0, "aggregated_data": 0, "threshold": 0, "zscore_threshold": 0, "taken": 0, "account": [0, 3], "filter": [0, 4], "overlap": 0, "pair": [0, 3, 4], "than": [0, 3, 4, 11], "amino": [0, 3, 9, 11], "acid": [0, 3, 9, 11], "max_overlap": 0, "higher": [0, 3], "term": [0, 2, 12], "retain": 0, "determin": [0, 1, 3, 10, 11, 12], "exact": [0, 4, 11], "k": [0, 1, 3, 4, 10], "mer": 0, "discord": 0, "bind": [0, 1, 3, 4, 7, 8, 9, 10], "eb": 0, "calcul": [0, 3, 10, 11], "At": 0, "max": [0, 2, 3], "report": [0, 4, 7], "final": [0, 3], "public": [0, 6], "public_epitopes_csv": 0, "independ": 0, "evid": 0, "support": [0, 4, 12], "presenc": 0, "antibodi": [0, 1, 3, 4, 7], "human": [0, 4, 7], "popul": [0, 4, 7, 13], "against": 0, "maximum": [0, 3, 8, 9], "detect": [0, 1], "minimum": [0, 3, 7, 10], "float": [0, 9, 10, 12, 14], "sample_grouping_col": 0, "map": [0, 2, 3, 4, 7, 13], "public_epitopes_col": 0, "translat": [0, 3], "peptide_transl": 0, "nxf_profil": 0, "resourc": 0, "alloc": 0, "standard": [0, 1, 11], "cluster": 0, "wb_env": 0, "align": [1, 2, 5, 7, 12, 13, 14], "sampl": [1, 2, 3, 4, 7, 8, 9, 10, 11, 12, 13, 14], "non": [1, 2, 3, 10], "specif": [1, 2, 3, 4, 7, 10, 11, 12], "peptid": [1, 2, 3, 4, 7, 8, 10, 11, 12, 13, 14], "enrich": [1, 2, 4, 7, 8, 10, 11, 12, 13, 14], "pipelin": [1, 2, 4, 7, 13, 14], "simpler": 1, "evalu": [1, 9], "mina": 1, "2019": 1, "greater": [1, 4, 11], "mutual": 1, "exclus": 1, "do": [1, 3, 4, 11, 13, 14], "overwrit": 1, "cpm": [1, 4, 10, 11, 12, 13], "none": [1, 8, 10, 11, 12], "tandem": 1, "result": [1, 3, 5, 7, 11, 14], "tool": [1, 2, 4, 7], "chang": [1, 3, 11, 13, 14], "respect": [1, 3, 4, 12, 14], "bayesian": 1, "power": [1, 14], "better": [1, 7], "identifi": [1, 3, 9, 12], "significantli": 1, "trade": 1, "off": [1, 3], "longer": [1, 4], "time": [1, 2, 11], "paramet": [1, 4, 5, 8, 9, 10, 11, 12], "supplementari": 1, "bin": [1, 3, 4, 10], "togeth": [1, 7], "speci": [1, 7], "under": [1, 2, 3, 7, 13], "condit": [1, 13], "repres": [1, 3, 8, 9, 14], "form": 1, "empir": [1, 3, 7, 10], "belong": 1, "deviat": 1, "among": 1, "reduc": 1, "influenc": 1, "outlier": 1, "signal": [1, 10], "highest": [1, 10], "lowest": 1, "discard": 1, "mu": [1, 10], "sigma": [1, 10], "formal": 1, "n_p": 1, "z_p": 1, "frac": [1, 3, 10, 11], "mu_i": 1, "sigma_i": 1, "robinson": 1, "m": [1, 3, 7, 11, 12, 14], "mccarthi": 1, "j": [1, 3, 7, 11, 14], "smyth": 1, "bioconductor": 1, "differenti": [1, 3, 4, 9, 11, 14], "digit": 1, "gene": 1, "bioinformat": [1, 7], "2010": [1, 4, 11], "26": [1, 11], "139": 1, "140": 1, "quantifi": [1, 3], "reactiv": [1, 7], "38": [1, 11], "19": [1, 3, 4, 11], "4647": 1, "4649": 1, "measl": 1, "infect": [1, 4, 7], "diminish": 1, "preexist": 1, "offer": 1, "protect": 1, "pathogen": 1, "scienc": [1, 7, 10], "366": 1, "6465": 1, "599": [1, 12], "606": 1, "cli": [2, 4, 7], "written": [2, 10, 12], "click": [2, 13], "With": [2, 4], "instal": [2, 4, 5, 7], "queri": [2, 4, 7, 12, 13], "learn": 2, "littl": [2, 3], "about": [2, 4, 6, 7], "print": [2, 3, 12], "three": [2, 4, 7], "aspect": [2, 3], "singl": [2, 3, 4, 7, 12], "layer": [2, 7, 8, 10, 11, 12], "structur": [2, 4, 5, 7], "hood": [2, 7], "primarili": 2, "tell": 2, "what": [2, 4, 12], "avail": [2, 4, 6, 7, 13], "tabl": [2, 4, 7, 8, 11, 12, 13, 14], "class": 2, "core": 2, "frame": 2, "datafram": [2, 12, 14], "int64index": 2, "entri": [2, 3, 9, 13], "124": 2, "540": 2, "10": [2, 3, 6, 7, 10, 11], "null": [2, 14], "dtype": 2, "seq_dir": [2, 11, 12], "participant_id": 2, "patient_statu": [2, 4], "rate": [2, 10], "averag": [2, 3, 10, 11], "memori": 2, "usag": 2, "552": 2, "byte": 2, "na": [2, 14], "displai": [2, 7, 14], "fed": 2, "along": [2, 4, 7, 12, 14], "while": [2, 3, 4, 14], "mayb": 2, "immedi": 2, "nice": 2, "know": 2, "especi": 2, "after": [2, 4, 6, 12, 14], "start": [2, 4, 5, 13], "slice": [2, 12], "further": 2, "want": [2, 3, 4, 11], "give": [2, 4, 13], "distribut": [2, 3, 9, 10], "categor": 2, "numer": 2, "few": [2, 4], "359803": 2, "std": 2, "283811": 2, "764886": 2, "min": [2, 3], "122878": 2, "25": 2, "147733": 2, "250000": 2, "50": 2, "234885": 2, "500000": 2, "75": [2, 12], "597263": 2, "729431": 2, "statement": [2, 12], "option": [2, 4, 5, 6, 7, 8, 13, 14], "dm": [3, 4, 7, 9, 11], "applic": [3, 7, 13], "deep": [3, 7], "mutat": [3, 7, 11], "scan": [3, 7], "catalog": 3, "viral": [3, 7], "protein": [3, 4, 7, 11, 13, 14], "Of": 3, "particular": [3, 4, 11], "concern": [3, 7], "caus": 3, "loss": [3, 9], "potenti": [3, 4, 10], "immun": [3, 7], "respons": [3, 7], "consid": [3, 11], "substitut": 3, "show": [3, 13], "impact": [3, 7], "everi": 3, "visual": [3, 4, 7, 13], "logo": 3, "plot": [3, 4, 7], "scale": [3, 9, 11, 14], "reflect": 3, "height": 3, "its": [3, 7, 12], "letter": [3, 4], "symbol": [3, 4], "There": [3, 4, 7], "two": [3, 4, 7, 9, 12], "interest": [3, 7, 9], "sum": [3, 4, 10, 11], "pattern": [3, 9], "contribut": [3, 5, 6, 7, 9], "natur": [3, 4, 7], "differ": 3, "quantit": 3, "systemat": 3, "assign": [3, 9], "weight": 3, "degre": 3, "instead": 3, "purpos": [3, 4, 7], "blosum62": [3, 9], "often": 3, "observ": [3, 14], "problem": 3, "framework": [3, 7], "optim": [3, 9], "transport": [3, 9], "brief": [3, 4, 13], "involv": [3, 10], "cost": [3, 9], "content": 3, "them": [3, 4], "transform": [3, 7, 12, 13], "20": [3, 6, 9], "neg": [3, 9], "posit": [3, 9, 11], "correspond": [3, 4, 12], "gain": [3, 9], "effect": 3, "therefor": 3, "associ": [3, 4], "40": 3, "absolut": [3, 9], "most": [3, 6, 7, 12, 14], "zero": [3, 11], "becaus": [3, 11], "cannot": 3, "simultan": 3, "definit": [3, 4], "denot": [3, 4, 13], "m_": 3, "ij": 3, "overal": 3, "sign": [3, 9], "c_": 3, "exp": 3, "left": [3, 4, 11], "right": [3, 11, 13], "exponenti": 3, "vice": 3, "versa": 3, "rang": 3, "lie": 3, "within": [3, 6, 12], "avoid": [3, 11], "overwhelm": 3, "aggreg": [3, 7, 12, 13], "opposit": [3, 9], "disregard": 3, "simpli": [3, 4, 6, 14], "fix": 3, "scriptsiz": 3, "mbox": 3, "put": 3, "altogeth": 3, "complet": [3, 4], "times40": 3, "block": 3, "times20": 3, "matric": [3, 4, 8, 12], "begin": [3, 4, 11], "bmatrix": 3, "diagon": 3, "solv": 3, "invers": [3, 12], "relat": [3, 7, 11], "reciproc": [3, 9], "lean": 3, "toward": 3, "rather": 3, "make": [3, 14], "interpret": [3, 14], "easier": 3, "attribut": 3, "high": [3, 4, 7, 10], "sever": 3, "contrast": 3, "due": 3, "lack": 3, "cours": 3, "conclus": 3, "don": 3, "either": [3, 4, 7, 12], "wai": 3, "just": [3, 6], "side": [3, 13], "coin": 3, "diagram": 3, "procedur": 3, "breviti": 3, "illustr": 3, "escprof": [3, 9], "profile1": 3, "profile2": 3, "cost_matrix": [3, 9], "get_cost_matrix": [3, 9], "compute_sim_scor": [3, 9], "9744633979128656": 3, "approxim": 3, "97": 3, "arndcqeghilkmfpstwyv": 3, "henc": 3, "first": [3, 4, 8, 9, 10, 11, 12], "last": [3, 9], "likewis": 3, "get_aa_ordered_list": 3, "return": [3, 8, 9, 10, 11, 12], "aa_list": 3, "c": [3, 7], "q": [3, 13], "y": [3, 4], "v": [3, 4, 6, 8, 11, 13], "comparison": [3, 9, 14], "larger": 3, "divid": 3, "alpha_k": 3, "beta_k": 3, "Then": [3, 14], "choos": 3, "mu_k": 3, "motiv": 3, "oppos": 3, "dissimilar": 3, "regardless": 3, "concord": 3, "w_k": 3, "sum_k": 3, "s_k": 3, "shown": [3, 4], "top": 3, "panel": 3, "third": 3, "bar": [3, 13], "bottom": 3, "region_sim_scor": [3, 9], "garrett": [3, 7], "comprehens": [3, 7], "fine": [3, 6, 7], "iscienc": [3, 7], "2020": [3, 7], "23": [3, 7], "101622": [3, 7], "resolut": 3, "pathwai": 3, "sar": [3, 4, 7, 13], "spike": [3, 4, 13], "cell": [3, 7], "2021": [3, 4, 7], "184": [3, 11], "2927": 3, "2938": 3, "henikoff": 3, "pna": 3, "1992": 3, "89": 3, "22": 3, "10915": 3, "10919": 3, "flamari": 3, "pot": 3, "jmlr": 3, "78": 3, "address": 4, "coupl": 4, "overview": [4, 13], "typic": 4, "new": [4, 7, 10, 11], "deriv": [4, 10, 11], "covid": 4, "healthi": 4, "adult": 4, "serum": [4, 7], "convalesc": 4, "duplic": 4, "separ": [4, 7, 11, 12, 14], "batch": 4, "full": 4, "huge": 4, "thank": 4, "author": [4, 7], "stoddard": [4, 7], "wonder": 4, "folk": 4, "six": 4, "code": [4, 7, 10], "easi": 4, "git": [4, 6, 14], "awar": 4, "current": [4, 11, 12], "latest": 4, "seen": [4, 14], "releas": 4, "repositori": 4, "clone": [4, 6, 14], "necessari": 4, "re": [4, 11, 12], "modifi": [4, 11, 12], "nativ": 4, "doubl": 4, "minu": [4, 11], "did": 4, "write": [4, 12], "collect": [4, 10], "behavior": 4, "great": 4, "blog": 4, "post": 4, "topic": 4, "ran": 4, "view": [4, 13], "repo": 4, "short": 4, "log": [4, 11], "coher": 4, "were": [4, 13], "perform": [4, 7, 8, 10, 14], "system": 4, "configur": [4, 6], "slurm": 4, "modul": [4, 5], "singular": [4, 8, 11], "script": [4, 7], "hutch": 4, "rhino": 4, "machin": 4, "bash": [4, 6], "app": 4, "lmod": 4, "init": 4, "singularityroot": 4, "resum": 4, "now": [4, 12, 13], "quick": [4, 13], "style": 4, "tall_data": 4, "gzip": 4, "unzip": 4, "move": 4, "forward": 4, "gunzip": 4, "ggplot": [4, 12], "statu": 4, "ggplot2": 4, "dplyr": 4, "viridi": 4, "phip_data": 4, "header": [4, 12], "sep": 4, "sarscov2": 4, "ae": 4, "theme_bw": 4, "geom_lin": 4, "ggtitl": 4, "locu": [4, 7, 13], "locat": [4, 9, 11], "These": [4, 8], "ander": [4, 11], "huber": [4, 11], "matplotlib": 4, "implot": 4, "heatmap": [4, 13], "pd": [4, 12, 14], "seaborn": 4, "sn": 4, "pyplot": 4, "plt": 4, "read_csv": 4, "index_col": 4, "astyp": 4, "int": [4, 8, 9, 10, 11, 12], "oc43_spik": 4, "full_nam": 4, "oc43_sc0776_spik": 4, "non_null_sampl": 4, "notnul": 4, "cpm_oc43_spik": 4, "loc": [4, 9, 11], "fig": 4, "ax": [4, 8], "subplot": 4, "figsiz": 4, "transpos": 4, "yticklabel": 4, "xticklabel": 4, "cbar_kw": 4, "cmap": 4, "ylgnbu": 4, "vmax": 4, "2000": 4, "xaxi": 4, "get_ticklabel": 4, "set_vis": 4, "set_titl": 4, "sc0776": 4, "set_xlabel": 4, "tight_layout": 4, "design": [4, 7], "protocol": [4, 7], "experi": [4, 7, 14], "shotgun": 4, "immunoprecipit": [4, 7], "equal": 4, "compris": [4, 7], "tile": 4, "concret": [4, 8, 11, 14], "mode": 4, "revers": 4, "compliment": 4, "worth": 4, "ident": 4, "ensur": 4, "ideal": [4, 12], "trim3": 4, "reason": 4, "shorter": 4, "partial": 4, "still": [4, 11], "chanc": 4, "scope": [4, 13], "itself": 4, "straightforward": 4, "templat": 4, "upon": [4, 13], "resid": 4, "organ": [4, 14], "studi": [4, 7], "usual": 4, "someth": [4, 13], "prior": 4, "synthes": 4, "sake": 4, "peek": 4, "aa_sub": [4, 11], "loc_rel": 4, "is_wt": [4, 11], "bg505": 4, "gp120": 4, "30": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtggtgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtgaagagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtgacgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtgttgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtgctgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtcgtgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagttctgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtaaagagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "aggaattctacgctgagtggaggaggtggttctggtggtggaggttcaggtggtggtggaagtaacgagaacctgtgggtgaccgtgtattacggcgttcctgtctggaaatgatagcaagcttgcc": 4, "part": 4, "histor": 4, "noth": 4, "pertain": 4, "correctli": [4, 14], "downstream": [4, 7], "advanc": 4, "special": [4, 7], "introduct": 5, "get": [5, 6], "licens": 5, "acknowledg": 5, "own": [5, 7], "input": [5, 7, 13], "file": [5, 6, 7, 12, 13, 14], "eigen": 5, "escap": 5, "compar": [5, 9, 11], "score": [5, 8, 9, 10], "site": [5, 9, 11], "region": [5, 9], "beer": 5, "z": [5, 10], "gotcha": 5, "pypi": 5, "search": 5, "pip": [6, 14], "pleas": [6, 7], "maintain": [6, 11, 14], "dockerfil": 6, "host": 6, "built": [6, 14], "imag": [6, 7, 13], "quai": [6, 13], "io": [6, 11, 13], "conveni": [6, 13], "everyth": [6, 14], "pull": [6, 14], "yourself": 6, "desktop": 6, "unix": 6, "curl": 6, "fssl": 6, "http": [6, 7, 10, 11, 12, 13, 14], "com": [6, 7, 10, 14], "sh": 6, "sudo": 6, "831ebea": 6, "whalesai": 6, "cowsai": 6, "boo": 6, "5335": 6, "reccomend": 6, "navig": 6, "8501": [6, 13], "pwd": [6, 13], "viz": 6, "github": [6, 7, 10, 11, 14], "cd": [6, 14], "txt": 6, "welcom": [7, 14], "present": 7, "softwar": 7, "suit": 7, "throughput": 7, "techniqu": 7, "suitabl": 7, "commonli": [7, 14], "virscan": 7, "highli": [7, 14], "custom": 7, "encourag": [7, 14], "bug": 7, "feedback": 7, "find": 7, "research": 7, "cite": 7, "manuscript": 7, "schemat": 7, "cartoon": [7, 14], "chart": 7, "experimentalist": 7, "feed": 7, "descriptor": 7, "b": [7, 9], "task": [7, 14], "wrangl": 7, "oper": [7, 8, 12], "onto": 7, "interact": [7, 12], "browser": [7, 13, 14], "underli": 7, "favorit": 7, "head": 7, "instruct": [7, 14], "feel": 7, "pictur": 7, "suggest": [7, 13], "walk": 7, "bare": 7, "advent": 7, "modern": 7, "synthesi": 7, "multiplex": 7, "investig": 7, "antigen": 7, "mathcal": [7, 14], "span": 7, "1000": 7, "206": [7, 12], "despit": 7, "grow": 7, "yet": 7, "establish": 7, "much": [7, 10], "publish": 7, "piec": 7, "snippet": 7, "scratch": 7, "goal": 7, "effici": 7, "unit": 7, "store": [7, 13, 14], "conjunct": 7, "rapid": 7, "explor": [7, 13], "focu": 7, "heavili": 7, "goodi": 7, "mohan": 7, "character": 7, "peptidom": 7, "nat": 7, "protoc": 7, "2018": 7, "13": [7, 11], "1958": 7, "1978": 7, "reveal": 7, "signatur": 7, "cross": [7, 14], "endem": 7, "35": 7, "109164": 7, "xu": 7, "serolog": 7, "synthet": 7, "virom": 7, "2015": 7, "348": 7, "6239": 7, "aaa0698": 7, "member": 7, "cancer": 7, "center": [7, 11], "publicli": 7, "licenc": 7, "mit": 7, "fund": 7, "nih": 7, "nsf": 7, "hhmi": 7, "free": 7, "email": 7, "jgallowa": 7, "fredhutch": 7, "open": [7, 13, 14], "issu": 7, "md": 8, "decomposit": [8, 11], "eigenassay_project": 8, "data_t": [8, 10, 11], "compute_correl": 8, "return_raw_decomposit": 8, "n_eigenvector": 8, "eigenvector": [8, 11], "eigenassai": 8, "shape": [8, 10, 11, 12], "usv": [8, 11], "princip": 8, "space": 8, "varianc": 8, "dictionari": [8, 12], "str": [8, 9, 10, 11, 12], "correl": [8, 12], "th": [8, 11], "fashion": [8, 11], "append": [8, 10, 11, 12], "economi": 8, "svd": 8, "dict": [8, 12], "anoth": 9, "40x40": 9, "get_loc_esc_distr": 9, "metric": 9, "sample_factor": 9, "sfact_val": 9, "loc_sim_scor": 9, "sfact_val1": 9, "sfact_val2": 9, "loc_start": 9, "loc_end": 9, "interfac": 10, "gamma_poisson_model": 10, "starting_alpha": 10, "starting_beta": 10, "trim_percentil": 10, "99": 10, "inplac": [10, 11, 12], "new_table_nam": [10, 11, 12], "gamma_poisson_mlxp": 10, "gamma": 10, "poisson": 10, "log_": [10, 11], "mlxp": [10, 11, 12], "parameter": 10, "beta": 10, "alpha": 10, "x_1": 10, "x_2": 10, "ldot": 10, "x_n": 10, "lambda": 10, "n_": 10, "x_k": 10, "lasersonlab": 10, "uri": 10, "laserson": 10, "initi": 10, "percentil": 10, "cutoff": 10, "remov": 10, "98": [10, 11], "bia": 10, "dataarrai": [10, 11], "copi": [10, 11, 12], "tupl": [10, 12], "beads_d": [10, 11], "min_npeptides_per_bin": 10, "300": 10, "lower_quantile_limit": 10, "05": [10, 11], "upper_quantile_limit": 10, "95": 10, "stddev": 10, "implement": 10, "supplement": 10, "doi": 10, "1126": 10, "aay6485": 10, "quantil": 10, "ignor": 10, "per_sampl": 11, "text": 11, "arrai": [11, 12], "x_": 11, "sum_": 11, "10pt": 11, "frequenc": 11, "ratio": 11, "228571": 11, "43": 11, "205128": 11, "63829": 11, "79": 11, "32258": 11, "06": 11, "28571": 11, "76923": 11, "08": 11, "148936": 11, "17": 11, "129032": 11, "257142": 11, "86": 11, "106382": 11, "142857": 11, "14": 11, "51282": 11, "85106": 11, "102564": 11, "21276": 11, "96774": 11, "85714": 11, "114285": 11, "71": 11, "42553": 11, "225806": 11, "45": 11, "127659": 11, "57": 11, "161290": 11, "32": [11, 12], "191489": 11, "36": 11, "128205": 11, "differential_selection_sample_group": 11, "sample_featur": 11, "is_equal_to": 11, "batch_a": 11, "aggregate_funct": 11, "sample_group_differential_select": 11, "differential_selection_wt_mut": 11, "scaled_by_wt": 11, "smoothing_flank_s": 11, "groupbi": 11, "loc_column": 11, "is_wt_column": 11, "wt_mutant_differential_select": 11, "relu_bia": 11, "skip_sampl": 11, "variant": 11, "wildtyp": 11, "wt": 11, "meant": 11, "aa_sub_col": 11, "bloom": 11, "formul": 11, "jbloomlab": 11, "dms_tools2": 11, "diffsel": 11, "html": [11, 12, 14], "id5": 11, "whether": [11, 12], "multipli": 11, "surround": 11, "uniqu": [11, 12, 13], "less": 11, "replac": 11, "nest": 11, "loop": 11, "unnecessari": 11, "lib_d": 11, "standardized_enrich": 11, "doe": 11, "subtract": 11, "rank_data": 11, "rank": 11, "descend": 11, "533": 11, "734": 11, "399": 11, "588": 11, "563": 11, "947": 11, "814": 11, "156": 11, "47": 11, "705": 11, "750": 11, "685": 11, "675": 11, "118": 11, "897": [11, 12], "290": 11, "405": 11, "880": 11, "772": 11, "570": 11, "629": 11, "961": 11, "530": 11, "63": 11, "633": 11, "931": 11, "268": 11, "115": 11, "833": 11, "164": 11, "18": 11, "704": 11, "359": 11, "33": [11, 12], "143": 11, "486": 11, "371": 11, "415": 11, "deprec": 11, "reproduc": 11, "previou": 11, "pseudo": 11, "geometr": 11, "median": 11, "hat": 11, "s_": 11, "atop": 11, "prod_": 11, "std_enrich": 11, "psuedo": 11, "heurist": [11, 12], "get_annotation_t": [11, 12], "sample_typ": [11, 12], "sample_0": [11, 12], "refa": [11, 12], "expa": [11, 12], "sample_1": [11, 12], "sample_2": [11, 12], "sample_3": [11, 12], "sample_4": [11, 12], "sample_5": [11, 12], "sample_6": 11, "sample_7": 11, "sample_8": 11, "sample_9": 11, "variou": [11, 13], "ds_queri": [11, 12], "ip_d": 11, "mockip_d": 11, "svd_aa_loc": 11, "protein_name_column": 11, "location_col": 11, "svd_rr": 11, "reduct": 11, "aa": 11, "pivot": 11, "add": [11, 12, 13], "svd_rank_reduct": 11, "recomput": 11, "recomposit": 11, "eigenvalu": 11, "reconstruct": 11, "topologi": 12, "add_enrichment_layer_from_arrai": 12, "np": 12, "augment": 12, "collapse_group": 12, "collapse_dim": 12, "agg_func": 12, "compute_pw_cc": 12, "kwarg": 12, "collaps": 12, "axi": 12, "agg_funct": 12, "pairwis": 12, "dimension": 12, "dim": 12, "mean_sample_type_d": 12, "collapse_peptide_group": 12, "arg": 12, "wrap": 12, "collapse_sample_group": 12, "collect_count": 12, "merg": [12, 14], "tsv": 12, "tab": 12, "without": [12, 14], "filenam": 12, "dataset_from_csv": 12, "peptide_table_filenam": 12, "sample_table_filenam": 12, "counts_table_filenam": 12, "comma": 12, "to_wide_csv": 12, "speak": 12, "storag": [12, 14], "glob": 12, "entir": [12, 14], "atcg": 12, "zika": 12, "dengu": 12, "zka_d": 12, "110": 12, "829": 12, "872": 12, "475": 12, "716": 12, "815": 12, "308": 12, "647": 12, "216": 12, "791": 12, "604": 12, "987": 12, "776": 12, "923": 12, "858": 12, "985": 12, "396": 12, "539": 12, "600": 12, "865": 12, "161": 12, "413": 12, "760": 12, "422": 12, "297": 12, "639": 12, "786": 12, "857": 12, "878": 12, "992": 12, "354": 12, "825": 12, "535": 12, "440": 12, "416": 12, "572": 12, "988": 12, "763": 12, "841": 12, "wrapper": 12, "disk": 12, "convert": 12, "extract": 12, "grab": 12, "id_coordinate_from_query_df": 12, "query_df": 12, "logic": 12, "AND": 12, "id_queri": 12, "retriev": 12, "pydata": 12, "org": 12, "doc": [12, 14], "iter_group": 12, "iter": 12, "yield": 12, "item": 12, "origin": 12, "458": 12, "204": 12, "419": 12, "292": 12, "436": 12, "186": 12, "90": 12, "978": 12, "471": 12, "108": 12, "505": 12, "107": 12, "981": 12, "208": 12, "sample_group": 12, "phip_dataset": 12, "stitch_dataset": 12, "len": 12, "numpi": 12, "ndarrai": 12, "to_tal": 12, "melt": 12, "453": 12, "393": 12, "456": 12, "532": 12, "609": 12, "145": 12, "to_wid": 12, "split": 12, "compon": 12, "file_prefix": 12, "yield_tal": 12, "altair": 13, "expand": 13, "drop": 13, "narrow": 13, "smaller": 13, "notic": 13, "229e": 13, "virus": 13, "box": 13, "enter": 13, "kei": 13, "summari": 13, "accordingli": 13, "scroll": 13, "down": 13, "heat": 13, "chosen": 13, "menu": 13, "edger_hit": 13, "lod": 13, "edger_logfc": 13, "And": 13, "upload": [13, 14], "deal": 14, "convert_dtyp": 14, "integr": 14, "infer": 14, "datatyp": 14, "try": 14, "mix": 14, "hello_world": 14, "ind": 14, "qnan": 14, "tskit": 14, "submit": 14, "request": 14, "activ": 14, "insid": 14, "virtual": 14, "environ": 14, "equival": 14, "dev": 14, "sure": 14, "properli": 14, "pytest": 14, "vv": 14, "pr": 14, "approv": 14, "updat": 14, "bumpver": 14, "patch": 14, "small": 14, "minor": 14, "wheel": 14, "twine": 14, "dist": 14, "testpypi": 14, "verbos": 14, "edit": 14, "rst": 14, "subdirectori": 14, "onc": 14, "render": 14, "clean": 14, "_build": 14, "choic": 14, "inspect": 14, "branch": 14, "automat": 14, "deploi": 14, "crucial": 14, "larg": 14, "difficult": 14, "advantag": 14, "four": 14, "tie": 14, "prone": 14, "represent": 14, "_": 14}, "objects": {"phippery": [[8, 0, 0, "-", "eigen"], [9, 0, 0, "-", "escprof"], [10, 0, 0, "-", "modeling"], [11, 0, 0, "-", "normalize"], [12, 0, 0, "-", "utils"]], "phippery.eigen": [[8, 1, 1, "", "eigenassay_projections"]], "phippery.escprof": [[9, 1, 1, "", "compute_sim_score"], [9, 1, 1, "", "get_cost_matrix"], [9, 1, 1, "", "get_loc_esc_distr"], [9, 1, 1, "", "loc_sim_score"], [9, 1, 1, "", "region_sim_score"]], "phippery.modeling": [[10, 1, 1, "", "gamma_poisson_model"], [10, 1, 1, "", "zscore"]], "phippery.normalize": [[11, 1, 1, "", "counts_per_million"], [11, 1, 1, "", "differential_selection_sample_groups"], [11, 1, 1, "", "differential_selection_wt_mut"], [11, 1, 1, "", "enrichment"], [11, 1, 1, "", "rank_data"], [11, 1, 1, "", "size_factors"], [11, 1, 1, "", "standardized_enrichment"], [11, 1, 1, "", "svd_aa_loc"], [11, 1, 1, "", "svd_rank_reduction"]], "phippery.utils": [[12, 1, 1, "", "add_enrichment_layer_from_array"], [12, 1, 1, "", "collapse_groups"], [12, 1, 1, "", "collapse_peptide_groups"], [12, 1, 1, "", "collapse_sample_groups"], [12, 1, 1, "", "collect_counts"], [12, 1, 1, "", "dataset_from_csv"], [12, 1, 1, "", "ds_query"], [12, 1, 1, "", "dump"], [12, 1, 1, "", "get_annotation_table"], [12, 1, 1, "", "id_coordinate_from_query_df"], [12, 1, 1, "", "id_query"], [12, 1, 1, "", "iter_groups"], [12, 1, 1, "", "load"], [12, 1, 1, "", "stitch_dataset"], [12, 1, 1, "", "to_tall"], [12, 1, 1, "", "to_wide"], [12, 1, 1, "", "to_wide_csv"], [12, 1, 1, "", "yield_tall"]]}, "objtypes": {"0": "py:module", "1": "py:function"}, "objnames": {"0": ["py", "module", "Python module"], "1": ["py", "function", "Python function"]}, "titleterms": {"align": [0, 4, 6], "pipelin": [0, 5, 6], "input": [0, 4], "file": [0, 4], "sampl": 0, "tabl": [0, 5], "peptid": 0, "result": [0, 4], "paramet": 0, "option": [0, 1], "beer": [0, 1], "cpm": 0, "enrich": 0, "z": [0, 1], "score": [0, 1, 3], "virscan": 0, "organ": 0, "summari": 0, "background": [1, 7], "model": [1, 10], "introduct": [1, 3, 7], "edger": 1, "method": [1, 5], "refer": [1, 3, 7], "command": [2, 5], "line": [2, 5], "interfac": [2, 5], "compar": 3, "escap": [3, 9], "profil": [3, 9], "similar": 3, "site": 3, "region": 3, "exampl": 4, "pan": 4, "cov": 4, "dataset": 4, "run": 4, "local": 4, "hpc": 4, "cluster": 4, "tall": 4, "csv": 4, "wide": 4, "creat": 4, "your": 4, "own": 4, "data": [4, 14], "approach": 4, "requir": 4, "welcom": 5, "phipperi": [5, 14], "": [5, 14], "document": [5, 14], "overview": 5, "nextflow": 5, "python": [5, 6], "api": [5, 6], "streamlit": [5, 6, 13], "viz": [5, 13], "app": [5, 6, 13], "descript": 5, "The": [5, 14], "rest": 5, "It": 5, "indic": 5, "instal": [6, 14], "get": 7, "start": 7, "licens": 7, "acknowledg": 7, "eigen": 8, "normal": 11, "util": 12, "gotcha": 14, "miss": 14, "annot": 14, "i": 14, "e": 14, "nan": 14, "contribut": 14, "develop": 14, "pypi": 14, "build": 14, "structur": 14}, "envversion": {"sphinx.domains.c": 2, "sphinx.domains.changeset": 1, "sphinx.domains.citation": 1, "sphinx.domains.cpp": 8, "sphinx.domains.index": 1, "sphinx.domains.javascript": 2, "sphinx.domains.math": 2, "sphinx.domains.python": 3, "sphinx.domains.rst": 2, "sphinx.domains.std": 2, "sphinx.ext.todo": 2, "sphinx.ext.viewcode": 1, "sphinx": 57}, "alltitles": {"Alignments Pipeline": [[0, "alignments-pipeline"], [6, "alignments-pipeline"]], "Input files": [[0, "input-files"]], "Sample table": [[0, "sample-table"]], "Peptide table": [[0, "peptide-table"]], "Pipeline results": [[0, "pipeline-results"]], "Parameters": [[0, "parameters"]], "Optional Parameters": [[0, "optional-parameters"]], "BEER": [[0, "beer"]], "CPM Enrichment": [[0, "cpm-enrichment"]], "Z-Score": [[0, "z-score"]], "VirScan Organism Summary": [[0, "virscan-organism-summary"]], "Background Modeling": [[1, "background-modeling"]], "Introduction": [[1, "introduction"], [3, "introduction"], [7, "introduction"]], "edgeR/BEER Method": [[1, "edger-beer-method"]], "Z-score Method (optional)": [[1, "z-score-method-optional"]], "References": [[1, "references"], [3, "references"], [7, "references"]], "Command Line Interface": [[2, "command-line-interface"]], "Comparing Escape Profiles": [[3, "comparing-escape-profiles"]], "Escape similarity score at a site": [[3, "escape-similarity-score-at-a-site"]], "Escape similarity score for a region": [[3, "escape-similarity-score-for-a-region"]], "Examples": [[4, "examples"]], "Pan-CoV example dataset": [[4, "pan-cov-example-dataset"]], "Running locally": [[4, "running-locally"]], "Running on HPC (cluster)": [[4, "running-on-hpc-cluster"]], "Example results (tall CSV)": [[4, "example-results-tall-csv"]], "Example results (wide CSV)": [[4, "example-results-wide-csv"]], "Creating and running your own data": [[4, "creating-and-running-your-own-data"]], "Alignment approach": [[4, "alignment-approach"]], "Input file requirements": [[4, "input-file-requirements"]], "Welcome to phippery\u2019s documentation!": [[5, "welcome-to-phippery-s-documentation"]], "Overview:": [[5, null]], "Nextflow Pipeline:": [[5, null]], "Python API:": [[5, null]], "Command Line Interface:": [[5, null]], "Streamlit Viz App": [[5, null], [13, "streamlit-viz-app"]], "Methods Descriptions": [[5, null]], "The Rest of It": [[5, null]], "Indices and tables": [[5, "indices-and-tables"]], "Installation": [[6, "installation"]], "Python API": [[6, "python-api"]], "Streamlit App": [[6, "streamlit-app"]], "Getting Started": [[7, "getting-started"]], "Background": [[7, "background"]], "Licensing and Acknowledgement": [[7, "licensing-and-acknowledgement"]], "Eigen": [[8, "eigen"]], "Escape Profile": [[9, "escape-profile"]], "Modeling": [[10, "modeling"]], "Normalize": [[11, "normalize"]], "Utils": [[12, "utils"]], "Gotchas": [[14, "gotchas"]], "Missing Annotations (i.e. NaN\u2019s)": [[14, "missing-annotations-i-e-nan-s"]], "Contributing": [[14, "contributing"]], "Phippery Development Install": [[14, "phippery-development-install"]], "PyPI": [[14, "pypi"]], "Building Documentation": [[14, "building-documentation"]], "The Data Structure": [[14, "the-data-structure"]]}, "indexentries": {"eigenassay_projections() (in module phippery.eigen)": [[8, "phippery.eigen.eigenassay_projections"]], "module": [[8, "module-phippery.eigen"], [9, "module-phippery.escprof"], [10, "module-phippery.modeling"], [11, "module-phippery.normalize"], [12, "module-phippery.utils"]], "phippery.eigen": [[8, "module-phippery.eigen"]], "compute_sim_score() (in module phippery.escprof)": [[9, "phippery.escprof.compute_sim_score"]], "get_cost_matrix() (in module phippery.escprof)": [[9, "phippery.escprof.get_cost_matrix"]], "get_loc_esc_distr() (in module phippery.escprof)": [[9, "phippery.escprof.get_loc_esc_distr"]], "loc_sim_score() (in module phippery.escprof)": [[9, "phippery.escprof.loc_sim_score"]], "phippery.escprof": [[9, "module-phippery.escprof"]], "region_sim_score() (in module phippery.escprof)": [[9, "phippery.escprof.region_sim_score"]], "gamma_poisson_model() (in module phippery.modeling)": [[10, "phippery.modeling.gamma_poisson_model"]], "phippery.modeling": [[10, "module-phippery.modeling"]], "zscore() (in module phippery.modeling)": [[10, "phippery.modeling.zscore"]], "counts_per_million() (in module phippery.normalize)": [[11, "phippery.normalize.counts_per_million"]], "differential_selection_sample_groups() (in module phippery.normalize)": [[11, "phippery.normalize.differential_selection_sample_groups"]], "differential_selection_wt_mut() (in module phippery.normalize)": [[11, "phippery.normalize.differential_selection_wt_mut"]], "enrichment() (in module phippery.normalize)": [[11, "phippery.normalize.enrichment"]], "phippery.normalize": [[11, "module-phippery.normalize"]], "rank_data() (in module phippery.normalize)": [[11, "phippery.normalize.rank_data"]], "size_factors() (in module phippery.normalize)": [[11, "phippery.normalize.size_factors"]], "standardized_enrichment() (in module phippery.normalize)": [[11, "phippery.normalize.standardized_enrichment"]], "svd_aa_loc() (in module phippery.normalize)": [[11, "phippery.normalize.svd_aa_loc"]], "svd_rank_reduction() (in module phippery.normalize)": [[11, "phippery.normalize.svd_rank_reduction"]], "add_enrichment_layer_from_array() (in module phippery.utils)": [[12, "phippery.utils.add_enrichment_layer_from_array"]], "collapse_groups() (in module phippery.utils)": [[12, "phippery.utils.collapse_groups"]], "collapse_peptide_groups() (in module phippery.utils)": [[12, "phippery.utils.collapse_peptide_groups"]], "collapse_sample_groups() (in module phippery.utils)": [[12, "phippery.utils.collapse_sample_groups"]], "collect_counts() (in module phippery.utils)": [[12, "phippery.utils.collect_counts"]], "dataset_from_csv() (in module phippery.utils)": [[12, "phippery.utils.dataset_from_csv"]], "ds_query() (in module phippery.utils)": [[12, "phippery.utils.ds_query"]], "dump() (in module phippery.utils)": [[12, "phippery.utils.dump"]], "get_annotation_table() (in module phippery.utils)": [[12, "phippery.utils.get_annotation_table"]], "id_coordinate_from_query_df() (in module phippery.utils)": [[12, "phippery.utils.id_coordinate_from_query_df"]], "id_query() (in module phippery.utils)": [[12, "phippery.utils.id_query"]], "iter_groups() (in module phippery.utils)": [[12, "phippery.utils.iter_groups"]], "load() (in module phippery.utils)": [[12, "phippery.utils.load"]], "phippery.utils": [[12, "module-phippery.utils"]], "stitch_dataset() (in module phippery.utils)": [[12, "phippery.utils.stitch_dataset"]], "to_tall() (in module phippery.utils)": [[12, "phippery.utils.to_tall"]], "to_wide() (in module phippery.utils)": [[12, "phippery.utils.to_wide"]], "to_wide_csv() (in module phippery.utils)": [[12, "phippery.utils.to_wide_csv"]], "yield_tall() (in module phippery.utils)": [[12, "phippery.utils.yield_tall"]]}}) \ No newline at end of file diff --git a/streamlit-app.html b/streamlit-app.html new file mode 100644 index 0000000..4750105 --- /dev/null +++ b/streamlit-app.html @@ -0,0 +1,196 @@ + + + + + + + Streamlit Viz App — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Streamlit Viz App

+

For convenience, we have created a simple +streamlit application for viewing a phippery +dataset (i.e. “data.phip”) as +altair heatmaps. +The application allows you to subset you data based upon annotations that +were in the sample or peptide tables (see pipeline inputs).

+

To use the application on the example Pan-CoV dataset,

+
» docker run -p 8501:8501 -v $PWD:/app/data/ quay.io/matsengrp/phip-viz
+
+
+

Your default browser will then open the application and look something like this +at http://0.0.0.0:8501

+
+example results +
+

As a quick example, click on the expander drop bar on the right side, labeled +“Working Peptides” under Peptide table, +This will show us a brief overview of the peptides in our dataset for reference, or to +add queries that will narrow the scope of our visualizations to a smaller subset. +Notice that the application gives some helpful suggestions based upon the data available.

+

We’ll start by looking at only peptides from the spike protein of SARS-CoV-2 and 229E +viruses. To do this, type (Virus in ['SARS', '229E']) & (Protein == 'spike') in the entry box +denoted Peptide Query Condition, and hit the <Enter> key. You’ll +notice the query and it’s unique key (denoted starting with “q<n>”) +was added to the table. The query was applied to the working +dataset and you can now see the summary of peptides has changes accordingly.

+
+example results +
+

Next, well scroll down to the Visualize Enrichment Heatmap section to look at our data. +Enter the following options to view the enrichments aggregated by sample type and locus. +The values used to populate the heat map may be conveniently chosen +via a drop-down menu, under “Normalization”. +The options available depend on the transformations stored in the input xarray (.phip) +file. For example, if using the .phip as output by the +alignments pipeline, +then you’ll have the option to visualize; +raw counts (“counts”), +counts per million (“cpm”), +significant edgeR hits (“edgeR_hits), +edgeR lod fold change values (“edgeR_logfc”), +or size factors (“size_factors”) normalization.

+
+example results +
+

And that’s it! For other features such as saving images, uploading query tables, and more, +click on and of the ? boxes to explore the various options.

+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file diff --git a/the-rest-of-it.html b/the-rest-of-it.html new file mode 100644 index 0000000..9c97219 --- /dev/null +++ b/the-rest-of-it.html @@ -0,0 +1,267 @@ + + + + + + + Gotchas — phippery 0.1.0 documentation + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+ +
+
+
+
+ +
+

Gotchas

+
+

Missing Annotations (i.e. NaN’s)

+

When dealing with missing values in the annotation tables, we use the +pd.convert_dtypes +function to best allow for missing annotations, while maintaining the integrity of +the inferred datatype. It is highly recommended you stay consistent with datatype for feature annotations, +i.e. try not to mix values like 1 (integer), 6.7 (float), and hello_world (string) in any one of the columns. +For missing data of any type, +The following values will be interpreted as NaN:

+
‘’, ‘#N/A’, ‘#N/A N/A’,
+‘#NA’, ‘-1.#IND’, ‘-1.#QNAN’, ‘-NaN’, ‘-nan’, ‘1.#IND’, ‘1.#QNAN’, ‘<NA>’,
+‘N/A’, ‘NA’, ‘NULL’, ‘NaN’, ‘n/a’, ‘nan’, ‘null’.
+
+
+
+
+
+

Contributing

+

We welcome and encourage contributions to the pipeline. +We recommend following the same instructions +as tskit +for submitting a pull request.

+
+

Phippery Development Install

+

For activate development, and documentation, we recommend using the following +instructions inside of a virtual environment or equivalent.

+
» git clone https://github.com/matsengrp/phippery.git
+» (cd phippery && pip install -e ".[dev]")
+
+
+

Next, run the tests to make sure everything is working properly.

+
» (cd phippery && pytest -vv)
+
+
+
+
+

PyPI

+

This process will most likely be handled by the +maintainers of the project after a PR has been approved +and merged into main.

+

Update the version:

+
bumpver update --patch
+
+
+
For small changes, use ``--patch``
+For minor changes, use ``--minor``
+For major changes, use ``--major``
+
+
+

Build the wheel

+
python -m build
+
+
+

Use Twine to check

+
twine check dist/*
+
+
+

Optionally, Use Twine to upload to testpypi

+
twine upload -r testpypi --verbose dist/*
+
+
+
+
+

Building Documentation

+

To edit the documentation seen here, +simply edit the respective .rst file +(following the git workflow described below) +in the docs/ subdirectory. Once edited, you can check +the edits are rendered correctly by building the docs locally

+
» cd docs/
+» make clean && make html
+
+
+

Then open the index file built at _build/html/index.html +with a browser of choice to inspect changes.

+

Once the changes have been approved and merged into the main branch +the documentation will automatically build and deploy.

+
+
+

The Data Structure

+

The primary data structure resulting from PhIP-Seq experiments is an enrichment matrix, +X, with i rows and j columns. +Commonly, row index represents a peptide that is displayed on a phage, +and each column represents a sample that was mixed with the entire phage library. +After sequencing and demultiplexing each sample, we align the reads to the +oligonucleotide reference library to observe a +count of aligned reads to each peptide.

+

Outside of the enrichment matrix, each sample in an experiment as well as each peptide +in the phage library used have number of important annotations required when +performing analysis tasks like model fitting, normalizing, and differential selection. +Additionally, the comparison across groups of virus proteins and +sample types is crucial in many experiments. For large sample size experiments, +it can be difficult to cross reference each of these groups before and +after analysis.

+

Here, we take advantage of the powerful +xarray +approach to organizing all the Phip-Seq data along four primary coordinate +dimensions which tie all sample/peptide enrichments to the respective annotations. +Doing this allows us to store all the information without the error prone +step of cross-checking separate dataframes, and without the +large storage scaling of using “Tall” dataframes.

+
+phippery xarray format +
+

Xarray Dataset Format A cartoon representation +of the format output by the pipeline for +we require for using phippery functions. +Concretely, for a matrix, mathcal{M}_{i}{j}

+
+
+
+
+ + +
+
+ +
+
+
+
+ + + + \ No newline at end of file