diff --git a/hail/python/hail/docs/_templates/_autosummary/class2.rst b/hail/python/hail/docs/_templates/_autosummary/class2.rst index f94feb4d780f..828082e6ab3f 100644 --- a/hail/python/hail/docs/_templates/_autosummary/class2.rst +++ b/hail/python/hail/docs/_templates/_autosummary/class2.rst @@ -4,7 +4,6 @@ .. autoclass:: {{ objname }}() :members: - :show-inheritance: :special-members: :inherited-members: :no-undoc-members: diff --git a/hail/python/hail/docs/api.rst b/hail/python/hail/docs/api.rst index c442398d9c96..a86987044848 100644 --- a/hail/python/hail/docs/api.rst +++ b/hail/python/hail/docs/api.rst @@ -46,6 +46,8 @@ Top-Level Functions ~~~~~~~~~~~~~~~~~~~ .. autofunction:: hail.init +.. autofunction:: hail.asc +.. autofunction:: hail.desc .. autofunction:: hail.stop .. autofunction:: hail.spark_context .. autofunction:: hail.default_reference diff --git a/hail/python/hail/docs/conf.py b/hail/python/hail/docs/conf.py index fecd871e632f..515d18d33ab9 100644 --- a/hail/python/hail/docs/conf.py +++ b/hail/python/hail/docs/conf.py @@ -29,7 +29,7 @@ # -- General configuration ------------------------------------------------ -# nitpicky = True +nitpicky = True # If your documentation needs a minimal Sphinx version, state it here. # @@ -90,6 +90,7 @@ ] # autoclass_content = "both" autodoc_default_flags = ['members', 'undoc-members'] +autodoc_typehints = 'none' napoleon_use_rtype = False napoleon_use_param = False @@ -99,6 +100,7 @@ 'PySpark': ('https://spark.apache.org/docs/latest/api/python/', None), 'Bokeh': ('https://docs.bokeh.org/en/1.2.0/', None), 'numpy': ('https://numpy.org/doc/stable/', None), + 'scipy': ('https://docs.scipy.org/doc/scipy-1.3.3/reference', None), 'pandas': ('https://pandas.pydata.org/docs/', None)} # Add any paths that contain templates here, relative to this directory. diff --git a/hail/python/hail/docs/experimental/vcf_combiner.rst b/hail/python/hail/docs/experimental/vcf_combiner.rst index a9f83a9f1340..06fae7761093 100644 --- a/hail/python/hail/docs/experimental/vcf_combiner.rst +++ b/hail/python/hail/docs/experimental/vcf_combiner.rst @@ -195,7 +195,7 @@ Functions ~~~~~~~~~ There are a number of functions for working with sparse data. Of particular -importance is :func:`densify`, which transforms a sparse matrix table to a dense +importance is :func:`~.densify`, which transforms a sparse matrix table to a dense project-VCF-like matrix table on the fly. While computationally expensive, this operation is necessary for many downstream analyses, and should be thought of as roughly costing as much as reading a matrix table created by importing a dense diff --git a/hail/python/hail/docs/functions/core.rst b/hail/python/hail/docs/functions/core.rst index fa2a38b6c668..d36bb6967066 100644 --- a/hail/python/hail/docs/functions/core.rst +++ b/hail/python/hail/docs/functions/core.rst @@ -39,5 +39,10 @@ Core language functions .. currentmodule:: hail.expr.builders -.. autoclass:: CaseBuilder -.. autoclass:: SwitchBuilder +.. autosummary:: + :nosignatures: + :toctree: ./ + :template: class.rst + + CaseBuilder + SwitchBuilder diff --git a/hail/python/hail/docs/guides/api.rst b/hail/python/hail/docs/guides/api.rst index 285694993db8..491d06b93749 100644 --- a/hail/python/hail/docs/guides/api.rst +++ b/hail/python/hail/docs/guides/api.rst @@ -16,4 +16,4 @@ Writing output of :meth:`.Table.show` to log file >>> ht.show(handler=lambda x: logging.info(x)) # doctest: +SKIP -:**dependencies**: :func:`.Table.show`, :meth:`.Expression.show` \ No newline at end of file +:**dependencies**: :meth:`.Table.show`, :meth:`.Expression.show` diff --git a/hail/python/hail/docs/nd/index.rst b/hail/python/hail/docs/nd/index.rst index 4c14d23dc8a2..fcbc2cb9f72b 100644 --- a/hail/python/hail/docs/nd/index.rst +++ b/hail/python/hail/docs/nd/index.rst @@ -21,6 +21,7 @@ As much as possible, we try to mimic the numpy array interface. full zeros ones + diagonal qr svd inv @@ -35,6 +36,7 @@ As much as possible, we try to mimic the numpy array interface. .. autofunction:: full .. autofunction:: zeros .. autofunction:: ones +.. autofunction:: diagonal .. autofunction:: qr .. autofunction:: svd .. autofunction:: inv diff --git a/hail/python/hail/docs/overview/expressions.rst b/hail/python/hail/docs/overview/expressions.rst index 05cf2003b662..811a7cf5f219 100644 --- a/hail/python/hail/docs/overview/expressions.rst +++ b/hail/python/hail/docs/overview/expressions.rst @@ -58,9 +58,8 @@ an expression representing the computation of ``x + y``, but not the actual value. To peek at the value of this computation, there are two options: -:meth:`.Expression.eval`, which returns a Python value, and -:meth:`.Expression.show`, which prints a human-readable representation of an -expression. +:func:`~hail.expr.eval`, which returns a Python value, and :meth:`.Expression.show`, +which prints a human-readable representation of an expression. >>> hl.eval(z) 11 @@ -154,7 +153,7 @@ and ``~``. >>> ~s1 -Remember that you can use :meth:`.Expression.eval` to evaluate the expression. +Remember that you can use :func:`~hail.expr.eval`: to evaluate the expression. >>> hl.eval(~s1) True @@ -215,12 +214,12 @@ For example, we might want to return ``1`` if ``x < -1``, ``2`` if ... .or_missing()) -Notice that this expression ends with a call to :meth:`.CaseBuilder.or_missing`, +Notice that this expression ends with a call to :meth:`~hail.expr.builders.CaseBuilder.or_missing`, which means that if none of the conditions are met, a missing value is returned. Cases started with :func:`.case` can end with a call to -:meth:`.CaseBuilder.or_missing`, :meth:`.CaseBuilder.default`, or -:meth:`.CaseBuilder.or_error`, depending on what you want to happen if none +:meth:`~hail.expr.builders.CaseBuilder.or_missing`, :meth:`~hail.expr.builders.CaseBuilder.default`, or +:meth:`~hail.expr.builders.CaseBuilder.or_error`, depending on what you want to happen if none of the *when* clauses are met. It's important to note that missingness propagates up in Hail, so if the value @@ -241,8 +240,8 @@ Finally, Hail has the :func:`.switch` function to build a conditional tree based on the value of an expression. In the example below, ``csq`` is a :class:`.StringExpression` representing the functional consequence of a mutation. If ``csq`` does not match one of the cases specified by -:meth:`.SwitchBuilder.when`, it is set to missing with -:meth:`.SwitchBuilder.or_missing`. Other switch statements are documented in the +:meth:`~hail.expr.builders.SwitchBuilder.when`, it is set to missing with +:meth:`~hail.expr.builders.SwitchBuilder.or_missing`. Other switch statements are documented in the :class:`.SwitchBuilder` class. >>> csq = hl.str('nonsense') @@ -279,7 +278,7 @@ don't satisfy a condition: The Python representation of a missing value is ``None``. For example, if -we define ``cnull`` to be a missing value with type :class:`.tcall`, calling +we define ``cnull`` to be a missing value with type :obj:`.tcall`, calling the method `is_het` will return ``None`` and not ``False``. >>> cnull = hl.null('call') @@ -293,4 +292,4 @@ In addition to the methods exposed on each :class:`.Expression`, Hail also has numerous functions that can be applied to expressions, which also return an expression. -Take a look at the :ref:`sec-functions` page for full documentation. \ No newline at end of file +Take a look at the :ref:`sec-functions` page for full documentation. diff --git a/hail/python/hail/docs/overview/matrix_table.rst b/hail/python/hail/docs/overview/matrix_table.rst index efd40e1a6524..ae96294c32ee 100644 --- a/hail/python/hail/docs/overview/matrix_table.rst +++ b/hail/python/hail/docs/overview/matrix_table.rst @@ -394,10 +394,10 @@ Interacting with Matrix Tables Locally Some useful methods to interact with matrix tables locally are :meth:`.MatrixTable.describe`, :meth:`.MatrixTable.head`, and -:meth:`.MatrixTable.sample`. `describe` prints out the schema for all row +:meth:`.MatrixTable.sample_rows`. `describe` prints out the schema for all row fields, column fields, entry fields, and global fields as well as the row keys and column keys. `head` returns a new matrix table with only the first N rows. -`sample` returns a new matrix table where the rows are randomly sampled with +`sample_rows` returns a new matrix table where the rows are randomly sampled with frequency `p`. diff --git a/hail/python/hail/docs/scans.rst b/hail/python/hail/docs/scans.rst index d1a1bc59f056..517c87cee1d5 100644 --- a/hail/python/hail/docs/scans.rst +++ b/hail/python/hail/docs/scans.rst @@ -64,7 +64,7 @@ Scans over column fields can be done in a similar manner. .. DANGER:: Computing the result of certain aggregators, such as - :func:`.agg.hardy_weinberg_test`, can be very expensive when done + :func:`~.aggregators.hardy_weinberg_test`, can be very expensive when done for every row in a scan." See the :ref:`sec-aggregators` module for documentation on the behavior diff --git a/hail/python/hail/docs/types.rst b/hail/python/hail/docs/types.rst index 902877db4a12..8ee23d3164d6 100644 --- a/hail/python/hail/docs/types.rst +++ b/hail/python/hail/docs/types.rst @@ -1,3 +1,5 @@ +.. _hail_types: + Types ===== @@ -66,5 +68,9 @@ a :class:`.tstruct` with each option: .. autoclass:: tstruct .. autoclass:: ttuple .. autodata:: hail.expr.types.tcall + .. autoclass:: tlocus + + .. autoattribute:: reference_genome + .. autoclass:: tinterval diff --git a/hail/python/hail/experimental/expressions.py b/hail/python/hail/experimental/expressions.py index c6c037f121e6..c6feeda7ad74 100644 --- a/hail/python/hail/experimental/expressions.py +++ b/hail/python/hail/experimental/expressions.py @@ -22,7 +22,7 @@ def write_expression(expr, path, overwrite=False): Parameters ---------- - expr : :class:`Expression` + expr : :class:`~.Expression` Expression to write. path : :class:`str` Path to which to write expression. @@ -44,7 +44,7 @@ def write_expression(expr, path, overwrite=False): @typecheck(path=str) def read_expression(path): - """Read an :class:`Expression` written with :meth:`.experimental.write_expression`. + """Read an :class:`~.Expression` written with :func:`.experimental.write_expression`. Example ------- @@ -60,6 +60,6 @@ def read_expression(path): Returns ------- - :class:`Expression` + :class:`~.Expression` """ return hl.read_table(path).index_globals().expr diff --git a/hail/python/hail/experimental/ld_score_regression.py b/hail/python/hail/experimental/ld_score_regression.py index 5f5bb00563aa..3b280ffd97e4 100644 --- a/hail/python/hail/experimental/ld_score_regression.py +++ b/hail/python/hail/experimental/ld_score_regression.py @@ -91,13 +91,13 @@ def ld_score_regression(weight_expr, Notes ----- The ``exprs`` provided as arguments to :func:`.ld_score_regression` - must all be from the same object, either a :class:`Table` or a - :class:`MatrixTable`. + must all be from the same object, either a :class:`~.Table` or a + :class:`~.MatrixTable`. **If the arguments originate from a table:** * The table must be keyed by fields ``locus`` of type - :class:`.tlocus` and ``alleles``, a :py:data:`.tarray` of + :class:`.tlocus` and ``alleles``, a :class:`.tarray` of :py:data:`.tstr` elements. * ``weight_expr``, ``ld_score_expr``, ``chi_sq_exprs``, and ``n_samples_exprs`` are must be row-indexed fields. @@ -119,7 +119,7 @@ def ld_score_regression(weight_expr, (rows) by phenotypes (columns). * The rows of the matrix table must be keyed by fields ``locus`` of type :class:`.tlocus` and ``alleles``, - a :py:data:`.tarray` of :py:data:`.tstr` elements. + a :class:`.tarray` of :py:data:`.tstr` elements. * The columns of the matrix table must be keyed by a field of type :py:data:`.tstr` that uniquely identifies phenotypes represented in the matrix table. The column key must be a single @@ -134,7 +134,7 @@ def ld_score_regression(weight_expr, :func:`.ld_score_regression` will have values corresponding to the column keys of the input matrix table. - This function returns a :class:`Table` with one row per set of summary + This function returns a :class:`~.Table` with one row per set of summary statistics passed to the ``chi_sq_exprs`` argument. The following row-indexed fields are included in the table: @@ -197,7 +197,7 @@ def ld_score_regression(weight_expr, Returns ------- - :class:`.Table` + :class:`~.Table` Table keyed by ``phenotype`` with intercept and heritability estimates for each phenotype passed to the function.""" diff --git a/hail/python/hail/experimental/phase_by_transmission.py b/hail/python/hail/experimental/phase_by_transmission.py index 3601b96df62f..47a7b5269c3d 100644 --- a/hail/python/hail/experimental/phase_by_transmission.py +++ b/hail/python/hail/experimental/phase_by_transmission.py @@ -42,7 +42,7 @@ def phase_by_transmission( Note ---- - :meth:`.experimental.phase_trio_matrix_by_transmission` provides a convenience wrapper for phasing a trio matrix. + :func:`~.phase_trio_matrix_by_transmission` provides a convenience wrapper for phasing a trio matrix. Parameters ---------- @@ -304,7 +304,7 @@ def explode_trio_matrix(tm: hl.MatrixTable, col_keys: List[str] = ['s'], keep_tr Note ---- This assumes that the input MatrixTable is a trio MatrixTable (similar to - the result of :meth:`.methods.trio_matrix`) Its entry schema has to contain + the result of :func:`~.trio_matrix`) Its entry schema has to contain 'proband_entry`, `father_entry` and `mother_entry` all with the same type. Its column schema has to contain 'proband`, `father` and `mother` all with the same type. diff --git a/hail/python/hail/experimental/plots.py b/hail/python/hail/experimental/plots.py index 23ed9a012ee8..3764629c8979 100644 --- a/hail/python/hail/experimental/plots.py +++ b/hail/python/hail/experimental/plots.py @@ -39,7 +39,7 @@ def plot_roc_curve(ht, scores, tp_label='tp', fp_label='fp', colors=None, title= Returns ------- - :obj:`tuple` of :class:`bokeh.plotting.Figure` and :obj:`list` of :class:`str` + :obj:`tuple` of :class:`bokeh.plotting.figure.Figure` and :obj:`list` of :class:`str` Figure, and list of AUCs corresponding to scores. """ if colors is None: @@ -91,7 +91,7 @@ def hail_metadata(t_path): Returns ------- - :class:`bokeh.plotting.Figure` or :class:`bokeh.models.layouts.Column` + :class:`bokeh.plotting.figure.Figure` or :class:`bokeh.models.layouts.Column` """ def get_rows_data(rows_files): file_sizes = [] diff --git a/hail/python/hail/experimental/time.py b/hail/python/hail/experimental/time.py index 688cd24101f6..62e31520eb79 100644 --- a/hail/python/hail/experimental/time.py +++ b/hail/python/hail/experimental/time.py @@ -45,7 +45,7 @@ def strftime(format, time, zone_id): Returns ------- - :class:`StringExpression` + :class:`~.StringExpression` A string of the specified format based on the requested time. """ return _func("strftime", hl.tstr, format, time, zone_id) @@ -92,7 +92,7 @@ def strptime(time, format, zone_id): Returns ------- - :class:`Int64Expression` + :class:`~.Int64Expression` The Unix timestamp associated with the given time string. """ return _func("strptime", hl.tint64, time, format, zone_id) diff --git a/hail/python/hail/experimental/vcf_combiner/sparse_split_multi.py b/hail/python/hail/experimental/vcf_combiner/sparse_split_multi.py index dc6745a9d8da..dadb95a4b8fa 100644 --- a/hail/python/hail/experimental/vcf_combiner/sparse_split_multi.py +++ b/hail/python/hail/experimental/vcf_combiner/sparse_split_multi.py @@ -7,7 +7,7 @@ def sparse_split_multi(sparse_mt, *, filter_changed_loci=False): Analogous to :func:`.split_multi_hts` (splits entry fields) for sparse representations. - Takes a dataset formatted like the output of :func:`.vcf_combiner`. The + Takes a dataset formatted like the output of :func:`.run_combiner`. The splitting will add `was_split` and `a_index` fields, as :func:`.split_multi` does. This function drops the `LA` (local alleles) field, as it re-computes entry fields based on the new, split globals alleles. @@ -59,7 +59,7 @@ def sparse_split_multi(sparse_mt, *, filter_changed_loci=False): - `PL` array elements are calculated from the minimum `LPL` value for all allele pairs that downcode to the desired one. (This logic is identical to - the `PL` logic in :func:`.split_mult_hts`.) If a row has an alternate + the `PL` logic in :func:`~.split_multi_hts`.) If a row has an alternate allele but it is not present in `LA`, the `PL` field is set to missing. The `PL` for `ref/` in that case can be drawn from `RGQ`. diff --git a/hail/python/hail/expr/aggregators/aggregators.py b/hail/python/hail/expr/aggregators/aggregators.py index b8e3234f369c..75d9748b3ac8 100644 --- a/hail/python/hail/expr/aggregators/aggregators.py +++ b/hail/python/hail/expr/aggregators/aggregators.py @@ -2,19 +2,19 @@ from functools import wraps, update_wrapper import hail as hl -from hail.expr.expressions import ExpressionException, Expression, \ - ArrayExpression, SetExpression, BooleanExpression, Int64Expression, \ - NumericExpression, DictExpression, StructExpression, Float64Expression, \ - StringExpression, NDArrayNumericExpression, \ - expr_any, expr_oneof, expr_array, expr_set, expr_bool, expr_numeric, \ - expr_int32, expr_int64, expr_float64, expr_call, expr_str, expr_ndarray, \ - unify_all, construct_expr, Indices, Aggregation, to_expr -from hail.expr.types import hail_type, tint32, tint64, tfloat32, tfloat64, \ - tbool, tcall, tset, tarray, tstruct, tdict, ttuple, tstr +from hail.expr import (ExpressionException, Expression, ArrayExpression, + SetExpression, BooleanExpression, Int64Expression, NumericExpression, + DictExpression, StructExpression, Float64Expression, StringExpression, + NDArrayNumericExpression, expr_any, expr_oneof, expr_array, expr_set, + expr_bool, expr_numeric, expr_int32, expr_int64, expr_float64, expr_call, + expr_str, expr_ndarray, unify_all, construct_expr, Indices, Aggregation, + to_expr) +from hail.expr.types import (hail_type, tint32, tint64, tfloat32, tfloat64, + tbool, tcall, tset, tarray, tstruct, tdict, ttuple, tstr) from hail.expr.functions import rbind, float32, _quantile_from_cdf import hail.ir as ir -from hail.typecheck import TypeChecker, typecheck_method, typecheck, \ - sequenceof, func_spec, identity, nullable, oneof +from hail.typecheck import (TypeChecker, typecheck_method, typecheck, + sequenceof, func_spec, identity, nullable, oneof) from hail.utils import wrap_to_list from hail.utils.java import Env diff --git a/hail/python/hail/expr/builders.py b/hail/python/hail/expr/builders.py index 8008b4f527dd..07287adcb819 100644 --- a/hail/python/hail/expr/builders.py +++ b/hail/python/hail/expr/builders.py @@ -42,8 +42,9 @@ class SwitchBuilder(ConditionalBuilder): Notes ----- All expressions appearing as the `then` parameters to - :meth:`~.SwitchBuilder.when` or :meth:`~.SwitchBuilder.default` method - calls must be the same type. + :meth:`~hail.expr.builders.SwitchBuilder.when` or + :meth:`~hail.expr.builders.SwitchBuilder.default` method calls must be the + same type. See Also -------- @@ -193,8 +194,9 @@ class CaseBuilder(ConditionalBuilder): Notes ----- All expressions appearing as the `then` parameters to - :meth:`~.CaseBuilder.when` or :meth:`~.CaseBuilder.default` method calls - must be the same type. + :meth:`~hail.expr.builders.CaseBuilder.when` or + :meth:`~hail.expr.builders.CaseBuilder.default` method calls must be the + same type. Parameters ---------- @@ -299,7 +301,7 @@ def or_error(self, message): Parameters ---------- - message : :class:`.Expression` of type :data:`tstr` + message : :class:`.Expression` of type :obj:`.tstr` Returns ------- diff --git a/hail/python/hail/expr/expressions/typed_expressions.py b/hail/python/hail/expr/expressions/typed_expressions.py index dfaa1d8ddacf..7b77d7655489 100644 --- a/hail/python/hail/expr/expressions/typed_expressions.py +++ b/hail/python/hail/expr/expressions/typed_expressions.py @@ -1602,6 +1602,13 @@ def __hash__(self): return object.__hash__(self) def __eq__(self, other): + """Check each field for equality. + + Parameters + ---------- + other : :class:`.Expression` + An expression of the same type. + """ return Expression.__eq__(self, other) def __ne__(self, other): @@ -1796,6 +1803,7 @@ def drop(self, *fields): return self.select(*to_keep) def flatten(self): + """Recursively eliminate struct fields by adding their fields to this struct.""" def _flatten(prefix, s): if isinstance(s, StructExpression): return [(k, v) for (f, e) in s.items() for (k, v) in _flatten(prefix + '.' + f, e)] @@ -1810,6 +1818,22 @@ def _nested_summary(self, agg_result, top): def _summary_aggs(self): return hl.struct(**{k: f._all_summary_aggs() for k, f in self.items()}) + def get(self, k, default=None): + """See :meth:`StructExpression.__getitem__`""" + return super().get(k, default) + + def items(self): + """A list of pairs of field name and expression for said field.""" + return super().items() + + def keys(self): + """The list of field names.""" + return super().keys() + + def values(self): + """A list of expressions for each field.""" + return super().values() + class TupleExpression(Expression, Sequence): """Expression of type :class:`.ttuple`. @@ -1874,6 +1898,22 @@ def _nested_summary(self, agg_result, top): def _summary_aggs(self): return hl.tuple([self[i]._all_summary_aggs() for i in range(len(self))]) + def count(self, value): + """Do not use this method. + + This only exists for compatibility with the Python Sequence abstract + base class. + """ + return super().count() + + def index(self, value, start=0, stop=None): + """Do not use this method. + + This only exists for compatibility with the Python Sequence abstract + base class. + """ + return super().index() + class NumericExpression(Expression): """Expression of numeric type. @@ -3093,7 +3133,7 @@ def one_hot_alleles(self, alleles): Returns ------- - :class:`.ArrayExpression` of :obj:`tint32` + :class:`.ArrayExpression` of :obj:`.tint32` An array of summed one-hot encodings of allele indices. """ @@ -3475,7 +3515,7 @@ def overlaps(self, interval): Parameters ---------- - interval : :class:`.Expression` with type :py:data:`.tinterval` + interval : :class:`.Expression` with type :class:`.tinterval` Interval object with the same point type. Returns @@ -3591,7 +3631,7 @@ def T(self): a[i_0, ..., i_n-1, i_n] = a.T[i_n, i_n-1, ..., i_0]. Same as `self.transpose()`. - See also :func:`.transpose`. + See also :meth:`.transpose`. Returns ------- diff --git a/hail/python/hail/expr/functions.py b/hail/python/hail/expr/functions.py index 80e4d53e1f55..f6582f10b974 100644 --- a/hail/python/hail/expr/functions.py +++ b/hail/python/hail/expr/functions.py @@ -1053,7 +1053,7 @@ def gp_dosage(gp) -> Float64Expression: Parameters ---------- - gp : :class:`.ArrayFloat64Expression` + gp : :class:`.Expression` of type :class:`.tarray` of :obj:`.tfloat64` Length 3 array of bi-allelic genotype probabilities Returns @@ -1464,7 +1464,7 @@ def is_nan(x) -> BooleanExpression: Notes ----- - Note that :meth:`.is_missing` will return ``False`` on ``nan`` since ``nan`` + Note that :func:`~.is_missing` will return ``False`` on ``nan`` since ``nan`` is a defined value. Additionally, this method will return missing if `x` is missing. @@ -2017,7 +2017,7 @@ def ppois(x, lamb, lower_tail=True, log_p=False) -> Float64Expression: @typecheck(p=expr_float64, df=expr_float64) def qchisqtail(p, df) -> Float64Expression: - """Inverts :meth:`.pchisqtail`. + """Inverts :func:`~.pchisqtail`. Examples -------- @@ -2046,7 +2046,7 @@ def qchisqtail(p, df) -> Float64Expression: @typecheck(p=expr_float64) def qnorm(p) -> Float64Expression: - """Inverts :meth:`.pnorm`. + """Inverts :func:`~.pnorm`. Examples -------- @@ -2073,7 +2073,7 @@ def qnorm(p) -> Float64Expression: @typecheck(p=expr_float64, lamb=expr_float64, lower_tail=expr_bool, log_p=expr_bool) def qpois(p, lamb, lower_tail=True, log_p=False) -> Float64Expression: - r"""Inverts :meth:`.ppois`. + r"""Inverts :func:`~.ppois`. Examples -------- @@ -2092,7 +2092,7 @@ def qpois(p, lamb, lower_tail=True, log_p=False) -> Float64Expression: lamb : float or :class:`.Expression` of type :py:data:`.tfloat64` Rate parameter of Poisson distribution. lower_tail : bool or :class:`.BooleanExpression` - Corresponds to `lower_tail` parameter in inverse :meth:`.ppois`. + Corresponds to `lower_tail` parameter in inverse :func:`.ppois`. log_p : bool or :class:`.BooleanExpression` Exponentiate `p` before testing. @@ -2137,7 +2137,7 @@ def range(start, stop=None, step=1) -> ArrayNumericExpression: Returns ------- - :class:`.ArrayInt32Expression` + :class:`.ArrayNumericExpression` """ if stop is None: stop = start @@ -3030,7 +3030,7 @@ def gq_from_pl(pl) -> Int32Expression: Parameters ---------- - pl : :class:`.ArrayInt32Expression` + pl : :class:`.Expression` of type :class:`.tarray` of :obj:`.tint32`. Returns ------- @@ -3476,7 +3476,7 @@ def map(f: Callable, collection): Returns ------- - :class:`.ArrayExpression` or :class:`SetExpression`. + :class:`.ArrayExpression` or :class:`.SetExpression`. Collection where each element has been transformed by `f`. """ return collection.map(f) @@ -4037,7 +4037,7 @@ def tuple(iterable: Iterable) -> TupleExpression: Parameters ---------- - args : :obj:`Iterable` of :class:`.Expression` + iterable : an iterable of :class:`.Expression` Tuple elements. Returns @@ -5248,7 +5248,7 @@ def liftover(x, dest_reference_genome, min_match=0.95, include_strand=False): Parameters ---------- - x : :class:`.Expression` of type :py:data:`.tlocus` or :py:data:`.tinterval` of :py:data:`.tlocus` + x : :class:`.Expression` of type :class:`.tlocus` or :class:`.tinterval` of :class:`.tlocus` Locus or locus interval to lift over. dest_reference_genome : :class:`str` or :class:`.ReferenceGenome` Reference genome to convert to. diff --git a/hail/python/hail/genetics/pedigree.py b/hail/python/hail/genetics/pedigree.py index 97f098911e1e..616a188d2a85 100644 --- a/hail/python/hail/genetics/pedigree.py +++ b/hail/python/hail/genetics/pedigree.py @@ -264,10 +264,14 @@ def filter_to(self, samples): - If the father is not in the list of samples provided, `pat_id` is set to ``None``. - If the mother is not in the list of samples provided, `mat_id` is set to ``None``. - :param samples: list of sample IDs to keep - :type samples: list of str + Parameters + ---------- + samples: :obj:`list` [:obj:`str`] + Sample IDs to keep. - :rtype: :class:`.Pedigree` + Returns + ------- + :class:`.Pedigree` """ sample_set = set(samples) @@ -294,10 +298,10 @@ def write(self, path): .. caution:: - Phenotype information is not preserved in the Pedigree data structure in Hail. - Reading and writing a PLINK .fam file will result in loss of this information. - Use the key table method :meth:`~hail.KeyTable.import_fam` to manipulate this - information. + Phenotype information is not preserved in the Pedigree data + structure in Hail. Reading and writing a PLINK .fam file will + result in loss of this information. Use the key table method + :func:`~.import_fam` to manipulate this information. :param path: output path :type path: str diff --git a/hail/python/hail/genetics/reference_genome.py b/hail/python/hail/genetics/reference_genome.py index 6a281d3e5b08..35ca90e83782 100644 --- a/hail/python/hail/genetics/reference_genome.py +++ b/hail/python/hail/genetics/reference_genome.py @@ -297,7 +297,7 @@ def write(self, output): Notes ----- - Use :meth:`~hail.ReferenceGenome.read` to reimport the exported + Use :meth:`~hail.genetics.ReferenceGenome.read` to reimport the exported reference genome in a new HailContext session. Parameters diff --git a/hail/python/hail/linalg/blockmatrix.py b/hail/python/hail/linalg/blockmatrix.py index 6f791f8ae2d5..fdb83ac95245 100644 --- a/hail/python/hail/linalg/blockmatrix.py +++ b/hail/python/hail/linalg/blockmatrix.py @@ -511,6 +511,7 @@ def default_block_size(): @property def element_type(self): + """The type of the elements""" return self._bmir.typ.element_type @property @@ -1889,7 +1890,7 @@ def export(path_in, path_out, delimiter='\t', header=None, add_index=False, para partition_size: :obj:`int`, optional Number of rows to group per partition for export. Default given by block size of the block matrix. - entries: :class:`str + entries: :class:`str` Describes which entries to export. One of: ``'full'``, ``'lower'``, ``'strict_lower'``, ``'upper'``, ``'strict_upper'``. """ diff --git a/hail/python/hail/linalg/utils/misc.py b/hail/python/hail/linalg/utils/misc.py index 1f8a175fca82..a8d3d15c2e2c 100644 --- a/hail/python/hail/linalg/utils/misc.py +++ b/hail/python/hail/linalg/utils/misc.py @@ -40,7 +40,7 @@ def array_windows(a, radius): Returns ------- - (:class:`numpy.ndarray` of :obj:`int`, :class:`np.ndarray` of :obj:`int`) + (:class:`numpy.ndarray` of :obj:`int`, :class:`numpy.ndarray` of :obj:`int`) Tuple of start indices array and stop indices array. """ if radius < 0: @@ -161,7 +161,7 @@ def locus_windows(locus_expr, radius, coord_expr=None, _localize=True): Returns ------- - (:class:`numpy.ndarray` of :obj:`int`, :class:`np.ndarray` of :obj:`int`) + (:class:`numpy.ndarray` of :obj:`int`, :class:`numpy.ndarray` of :obj:`int`) Tuple of start indices array and stop indices array. """ if radius < 0: diff --git a/hail/python/hail/matrixtable.py b/hail/python/hail/matrixtable.py index 724dd41accbb..79f508bbdec8 100644 --- a/hail/python/hail/matrixtable.py +++ b/hail/python/hail/matrixtable.py @@ -916,8 +916,8 @@ def annotate_rows(self, **named_exprs) -> 'MatrixTable': ... hl.agg.call_stats(dataset.GT, dataset.alleles)) >>> dataset_result = dataset.annotate_rows(call_stats = high_quality_calls) - Add functional annotations from a :class:`.Table` keyed by :class:`.TVariant`:, and another - :class:`.MatrixTable`. + Add functional annotations from a :class:`.Table`, `v_metadata`, and a + :class:`.MatrixTable`, `dataset2_AF`, both keyed by locus and alleles. >>> dataset_result = dataset.annotate_rows(consequence = v_metadata[dataset.locus, dataset.alleles].consequence, ... dataset2_AF = dataset2.index_rows(dataset.row_key).info.AF) @@ -1774,11 +1774,11 @@ def compute_entry_filter_stats(self, row_field='entry_stats_row', col_field='ent Adds a new row field, `row_field`, and a new column field, `col_field`, each of which are structs with the following fields: - - *n_filtered* (:data:`.int64`) - Number of filtered entries per row + - *n_filtered* (:data:`.tint64`) - Number of filtered entries per row or column. - - *n_remaining* (:data:`.int64`) - Number of entries not filtered per + - *n_remaining* (:data:`.tint64`) - Number of entries not filtered per row or column. - - *fraction_filtered* (:data:`.float32`) - Number of filtered entries + - *fraction_filtered* (:data:`.tfloat32`) - Number of filtered entries divided by the total number of filtered and remaining entries. See Also @@ -2765,7 +2765,7 @@ def index_rows(self, *exprs, all_matches=False) -> 'Expression': Notes ----- - :meth:`index_rows(exprs)` is equivalent to ``rows().index(exprs)`` + ``index_rows(exprs)`` is equivalent to ``rows().index(exprs)`` or ``rows()[exprs]``. The type of the resulting struct is the same as the type of @@ -2804,7 +2804,7 @@ def index_cols(self, *exprs, all_matches=False) -> 'Expression': Notes ----- - :meth:`index_cols(exprs)` is equivalent to ``cols().index(exprs)`` + ``index_cols(cols)`` is equivalent to ``cols().index(exprs)`` or ``cols()[exprs]``. The type of the resulting struct is the same as the type of @@ -3994,7 +3994,7 @@ def make_table(self, separator='.') -> Table: 'alleles': array and three sample IDs: `A`, `B` and `C`. Then the result of - :func:`.make_table`: + :meth:`.make_table`: >>> ht = mt.make_table() # doctest: +SKIP diff --git a/hail/python/hail/methods/family_methods.py b/hail/python/hail/methods/family_methods.py index a8831df4bd6c..7409e7df7543 100644 --- a/hail/python/hail/methods/family_methods.py +++ b/hail/python/hail/methods/family_methods.py @@ -198,7 +198,7 @@ def mendel_errors(call, pedigree) -> Tuple[Table, Table, Table, Table]: as follows, where PAR is the `pseudoautosomal region `__ (PAR) of X and Y defined by the reference genome and the autosome is defined by - :meth:`~hail.genetics.Locus.in_autosome`. + :meth:`~.LocusExpression.in_autosome`. - Auto -- in autosome or in PAR or female child - HemiX -- in non-PAR of X and male child @@ -386,7 +386,7 @@ def transmission_disequilibrium_test(dataset, pedigree) -> Table: :func:`transmission_disequilibrium_test` only considers complete trios (two parents and a proband with defined sex) and only returns results for the - autosome, as defined by :meth:`~hail.genetics.Locus.in_autosome`, and + autosome, as defined by :meth:`~.LocusExpression.in_autosome`, and chromosome X. Transmissions and non-transmissions are counted only for the configurations of genotypes and copy state in the table below, in order to filter out Mendel errors and configurations where transmission is @@ -435,7 +435,7 @@ def transmission_disequilibrium_test(dataset, pedigree) -> Table: | HomVar | HomVar | Het | HemiX | 1 | 0 | +--------+--------+--------+------------+---+---+ - :func:`tdt` produces a table with the following columns: + :func:`.transmission_disequilibrium_test` produces a table with the following columns: - `locus` (:class:`.tlocus`) -- Locus. - `alleles` (:class:`.tarray` of :py:data:`.tstr`) -- Alleles. diff --git a/hail/python/hail/methods/impex.py b/hail/python/hail/methods/impex.py index 0cc50576d9b4..4deda591f700 100644 --- a/hail/python/hail/methods/impex.py +++ b/hail/python/hail/methods/impex.py @@ -84,7 +84,7 @@ def export_gen(dataset, output, precision=4, gp=None, id1=None, id2=None, Number of digits to write after the decimal point. gp : :class:`.ArrayExpression` of type :py:data:`.tfloat64`, optional Expression for the genotype probabilities to output. If ``None``, the - entry field `GP` is used if defined and is of type :py:data:`.tarray` + entry field `GP` is used if defined and is of type :class:`.tarray` with element type :py:data:`.tfloat64`. The array length must be 3. The values at indices 0, 1, and 2 are exported as the probabilities of homozygous reference, heterozygous, and homozygous variant, @@ -182,7 +182,7 @@ def export_bgen(mt, output, gp=None, varid=None, rsid=None, parallel=None): gp : :class:`.ArrayExpression` of type :py:data:`.tfloat64`, optional Expression for genotype probabilities. If ``None``, entry field `GP` is used if it exists and is of type - :py:data:`.tarray` with element type :py:data:`.tfloat64`. + :class:`.tarray` with element type :py:data:`.tfloat64`. varid : :class:`.StringExpression`, optional Expression for the variant ID. If ``None``, the row field `varid` is used if defined and is of type :py:data:`.tstr`. @@ -488,7 +488,7 @@ def export_vcf(dataset, output, append_to_header=None, parallel=None, metadata=N ``'separate_header'``, return a separate VCF header file and a set of VCF files (one per partition) without the header. If ``None``, concatenate the header and all partitions into one VCF file. - metadata : :obj:`dict[str, dict[str, dict[str, str]]]`, optional + metadata : :obj:`dict` [:obj:`str`, :obj:`dict` [:obj:`str`, obj:`dict` [obj:`str`, obj:`str`]]]`, optional Dictionary with information to fill in the VCF header. See :func:`get_vcf_metadata` for how this dictionary should be structured. @@ -563,7 +563,7 @@ def import_locus_intervals(path, `reference_genome` is defined, the point type of the interval will be :class:`.tlocus` parameterized by the `reference_genome`. Otherwise, the point type is a :class:`.tstruct` with two fields: `contig` with - type :py:data:`.tstr` and `position` with type :py:data:`.tint32`. + type :obj:`.tstr` and `position` with type :py:data:`.tint32`. A file in the third format (with a "target" column) produces a table with two fields: @@ -1099,9 +1099,9 @@ def import_bgen(path, Variants to filter to. The underlying type of the input (row key in the case of a :class:`.Table`) must be either a :class:`.tlocus`, a struct with one field `locus`, or a struct with two fields: `locus` and `alleles`. The type of `locus` can either be a :class:`.tlocus` or a :class:`.tstruct` - with two fields: `contig` of type :class:`.tstr` and `position` of type :class:`.tint`. If the + with two fields: `contig` of type :obj:`.tstr` and `position` of type :obj:`.tint`. If the type of `locus` is :class:`.tlocus`, the reference genome must match that used to index the BGEN - file(s). The type of `alleles` is a :class:`.tarray` of :class:`.tstr`. + file(s). The type of `alleles` is a :class:`.tarray` of :obj:`.tstr`. _row_fields : :obj:`list` of :class:`str` List of non-key row fields to create. Options: ``'varid'``, ``'rsid'`` @@ -1481,7 +1481,7 @@ def import_table(paths, comment characters or patterns should be passed as a list. delimiter : :class:`str` Field delimiter regex. - missing : :class:`str` or :obj:`List[str]` + missing : :class:`str` or :obj:`list` [:obj:`str`] Identifier(s) to be treated as missing. types : :obj:`dict` mapping :class:`str` to :class:`.HailType` Dictionary defining field types. diff --git a/hail/python/hail/methods/misc.py b/hail/python/hail/methods/misc.py index c1231d62acef..2f3d914edadb 100644 --- a/hail/python/hail/methods/misc.py +++ b/hail/python/hail/methods/misc.py @@ -77,8 +77,8 @@ def maximal_independent_set(i, j, keep=True, tie_breaker=None, keyed=True) -> Ta be perfectly maximal. `tie_breaker` is a Python function taking two arguments---say `l` and - `r`---each of which is an :class:`Expression` of the same type as `i` and - `j`. `tie_breaker` returns a :class:`NumericExpression`, which defines an + `r`---each of which is an :class:`~.Expression` of the same type as `i` and + `j`. `tie_breaker` returns a :class:`~.NumericExpression`, which defines an ordering on nodes. A pair of nodes can be ordered in one of three ways, and `tie_breaker` must encode the relationship as follows: @@ -320,7 +320,7 @@ def filter_intervals(ds, intervals, keep=True) -> Union[Table, MatrixTable]: ---------- ds : :class:`.MatrixTable` or :class:`.Table` Dataset to filter. - intervals : :class:`.ArrayExpression` of type :py:data:`.tinterval` + intervals : :class:`.ArrayExpression` of type :class:`.tinterval` Intervals to filter on. The point type of the interval must be a prefix of the key or equal to the first field of the key. keep : :obj:`bool` diff --git a/hail/python/hail/methods/qc.py b/hail/python/hail/methods/qc.py index 3a4852dfc7a3..3f26197fad27 100644 --- a/hail/python/hail/methods/qc.py +++ b/hail/python/hail/methods/qc.py @@ -1106,10 +1106,10 @@ def summarize_variants(mt: Union[MatrixTable, MatrixTable], show=True, *, handle five fields: - `n_variants` (:obj:`int`): Number of variants present in the matrix table. - - `allele_types` (:obj:`Dict[str, int]`): Number of alternate alleles in + - `allele_types` (:obj:`dict` [:obj:`str`, :obj:`int`]): Number of alternate alleles in each allele allele category. - - `contigs` (:obj:`Dict[str, int]`): Number of variants on each contig. - - `allele_counts` (:obj:`Dict[int, int]`): Number of variants broken down + - `contigs` (:obj:`dict` [:obj:`str`, :obj:`int`]): Number of variants on each contig. + - `allele_counts` (:obj:`dict` [:obj:`int`, :obj:`int`]): Number of variants broken down by number of alleles (biallelic is 2, for example). - `r_ti_tv` (:obj:`float`): Ratio of transition alternate alleles to transversion alternate alleles. diff --git a/hail/python/hail/methods/relatedness/king.py b/hail/python/hail/methods/relatedness/king.py index be5f38aee50c..191d9da94f4e 100644 --- a/hail/python/hail/methods/relatedness/king.py +++ b/hail/python/hail/methods/relatedness/king.py @@ -47,7 +47,7 @@ def king(call_expr, *, block_size=None): :math:`s`. Homozygous-reference genotypes are represented as 0, heterozygous genotypes are represented as 1, and homozygous-alternate genotypes are represented as 2. :math:`X_{i,s}` is calculated by invoking - :meth:`CallExpression.n_alt_alleles` on the `call_expr`. + :meth:`~.CallExpression.n_alt_alleles` on the `call_expr`. The three counts above, :math:`N^{Aa}`, :math:`N^{Aa,Aa}`, and :math:`N^{AA,aa}`, exclude variants where one or both individuals have diff --git a/hail/python/hail/methods/statgen.py b/hail/python/hail/methods/statgen.py index f1b145795ebe..49bcf69c3163 100644 --- a/hail/python/hail/methods/statgen.py +++ b/hail/python/hail/methods/statgen.py @@ -64,7 +64,7 @@ def impute_sex(call, aaf_threshold=0.0, include_par=False, female_threshold=0.2, `__. Let `gr` be the the reference genome of the type of the `locus` key (as - given by :meth:`.TLocus.reference_genome`) + given by :attr:`.tlocus.reference_genome`) 1. Filter the dataset to loci on the X contig defined by `gr`. @@ -111,7 +111,7 @@ def impute_sex(call, aaf_threshold=0.0, include_par=False, female_threshold=0.2, call : :class:`.CallExpression` A genotype call for each row and column. The source dataset's row keys must be [[locus], alleles] with types :class:`.tlocus` and - :class:`.ArrayStringExpression`. Moreover, the alleles array must have + :class:`.tarray` of :obj:`.tstr`. Moreover, the alleles array must have exactly two elements (i.e. the variant must be biallelic). aaf_threshold : :obj:`float` Minimum alternate allele frequency threshold. @@ -248,7 +248,7 @@ def linear_regression_rows(y, x, covariates, block_size=16, pass_through=()) -> - **p_value** (:py:data:`.tfloat64`) -- :math:`p`-value. If `y` is a list of expressions, then the last five fields instead have type - :py:data:`.tarray` of :py:data:`.tfloat64`, with corresponding indexing of + :class:`.tarray` of :py:data:`.tfloat64`, with corresponding indexing of the list and each array. If `y` is a list of lists of expressions, then `n` and `sum_x` are of type @@ -921,7 +921,7 @@ def linear_mixed_model(y, If `k` is set, the model is full-rank. For correct results, the indices of `k` **must be aligned** with columns of the source of `y`. - Set `p_path` if you plan to use the model in :meth:`.linear_mixed_regression_rows`. + Set `p_path` if you plan to use the model in :func:`.linear_mixed_regression_rows`. `k` must be positive semi-definite; symmetry is not checked as only the lower triangle is used. See :meth:`.LinearMixedModel.from_kinship` for more details. @@ -2002,7 +2002,7 @@ def row_correlation(entry_expr, block_size=None) -> BlockMatrix: defined by `entry_expr` and missing values mean-imputed per row. The ``(i, j)`` element of the resulting block matrix is the correlation between rows ``i`` and ``j`` (as 0-indexed by order in the matrix table; - see :meth:`add_row_index`). + see :meth:`~hail.MatrixTable.add_row_index`). The correlation of two vectors is defined as the `Pearson correlation coeffecient `__ @@ -2012,7 +2012,7 @@ def row_correlation(entry_expr, block_size=None) -> BlockMatrix: This method has two stages: - writing the row-normalized block matrix to a temporary file on persistent - disk with :meth:`BlockMatrix.from_entry_expr`. The parallelism is + disk with :meth:`.BlockMatrix.from_entry_expr`. The parallelism is ``n_rows / block_size``. - reading and multiplying this block matrix by its transpose. The @@ -2020,10 +2020,10 @@ def row_correlation(entry_expr, block_size=None) -> BlockMatrix: Warning ------- - See all warnings on :meth:`BlockMatrix.from_entry_expr`. In particular, + See all warnings on :meth:`.BlockMatrix.from_entry_expr`. In particular, for large matrices, it may be preferable to run the two stages separately, saving the row-normalized block matrix to a file on external storage with - :meth:`BlockMatrix.write_from_entry_expr`. + :meth:`.BlockMatrix.write_from_entry_expr`. The resulting number of matrix elements is the square of the number of rows in the matrix table, so computing the full matrix may be infeasible. For @@ -2126,7 +2126,7 @@ def ld_matrix(entry_expr, locus_expr, radius, coord_expr=None, block_size=None) without windowing. More precisely, variants are 0-indexed by their order in the matrix table - (see :meth:`add_row_index`). Each variant is regarded as a vector of + (see :meth:`~hail.MatrixTable.add_row_index`). Each variant is regarded as a vector of elements defined by `entry_expr`, typically the number of alternate alleles or genotype dosage. Missing values are mean-imputed within variant. @@ -2509,7 +2509,7 @@ def filter_alleles(mt: MatrixTable, mt : :class:`.MatrixTable` Dataset. f : callable - Function from (allele: :class:`StringExpression`, allele_index: + Function from (allele: :class:`.StringExpression`, allele_index: :class:`.Int32Expression`) to :class:`.BooleanExpression` Returns @@ -2717,7 +2717,7 @@ def filter_alleles_hts(mt: MatrixTable, ---------- mt : :class:`.MatrixTable` f : callable - Function from (allele: :class:`StringExpression`, allele_index: + Function from (allele: :class:`.StringExpression`, allele_index: :class:`.Int32Expression`) to :class:`.BooleanExpression` subset : :obj:`.bool` Subset PL field if ``True``, otherwise downcode PL field. The diff --git a/hail/python/hail/plot/plots.py b/hail/python/hail/plot/plots.py index bb62be146aa6..466df3df6133 100644 --- a/hail/python/hail/plot/plots.py +++ b/hail/python/hail/plot/plots.py @@ -31,7 +31,7 @@ def output_notebook(): """Configure the Bokeh output state to generate output in notebook - cells when :func:`show` is called. Calls + cells when :func:`bokeh.io.show` is called. Calls :func:`bokeh.io.output_notebook`. """ @@ -64,7 +64,7 @@ def cdf(data, k=350, legend=None, title=None, normalize=True, log=False): data : :class:`.Struct` or :class:`.Float64Expression` Sequence of data to plot. k : int - Accuracy parameter (passed to :func:`approx_cdf`). + Accuracy parameter (passed to :func:`~.approx_cdf`). legend : str Label of data on the x-axis. title : str @@ -293,7 +293,7 @@ def smoothed_pdf(data, k=350, smoothing=.5, legend=None, title=None, log=False, log : bool Plot the log10 of the bin counts. interactive : bool - If `True`, return a handle to pass to :func:`.show`. + If `True`, return a handle to pass to :func:`bokeh.io.show`. Returns ------- @@ -362,8 +362,8 @@ def histogram(data, range=None, bins=50, legend=None, title=None, log=False, int Notes ----- - `data` can be a :class:`.Float64Expression`, or the result of the :func:`.agg.hist` - or :func:`.agg.approx_cdf` aggregators. + `data` can be a :class:`.Float64Expression`, or the result of the :func:`~.aggregators.hist` + or :func:`~.aggregators.approx_cdf` aggregators. Parameters ---------- @@ -858,8 +858,8 @@ def scatter( - a tuple (str, :class:`.NumericExpression`) from the same :class:`.Table`. If passed as a tuple the first element is used as the hover label. If no label or a single label is provided, then returns :class:`bokeh.plotting.figure.Figure` - Otherwise returns a :class:`bokeh.plotting.figure.Column` containing: - - a :class:`bokeh.models.widgets.Select` dropdown selection widget for labels + Otherwise returns a :class:`bokeh.models.layouts.Column` containing: + - a :class:`bokeh.models.widgets.inputs.Select` dropdown selection widget for labels - a :class:`bokeh.plotting.figure.Figure` containing the interactive scatter plot Points will be colored by one of the labels defined in the ``label`` using the color scheme defined in @@ -915,7 +915,7 @@ def scatter( Returns ------- - :class:`bokeh.plotting.figure.Figure` if no label or a single label was given, otherwise :class:`bokeh.plotting.figure.Column` + :class:`bokeh.plotting.figure.Figure` if no label or a single label was given, otherwise :class:`bokeh.models.layouts.Column` """ hover_fields = {} if hover_fields is None else hover_fields label = {} if label is None else {'label': label} if isinstance(label, Expression) else label @@ -1006,7 +1006,7 @@ def joint_plot( - a :class:`.NumericExpression` from the same :class:`.Table`. - a tuple (str, :class:`.NumericExpression`) from the same :class:`.Table`. If passed as a tuple the first element is used as the hover label. - This function returns a :class:`bokeh.plotting.figure.Column` containing two :class:`bokeh.plotting.figure.Row`: + This function returns a :class:`bokeh.models.layouts.Column` containing two :class:`bokeh.plotting.figure.Row`: - The first row contains the X-axis marginal density and a selection widget if multiple entries are specified in the ``label`` - The second row contains the scatter plot and the y-axis marginal density @@ -1065,7 +1065,7 @@ def joint_plot( Returns ------- - :class:`bokeh.plotting.figure.Column` + :class:`bokeh.models.layouts.Column` """ # Collect data hover_fields = {} if hover_fields is None else hover_fields @@ -1233,8 +1233,8 @@ def qq( - a tuple (str, :class:`.NumericExpression`). If passed as a tuple the first element is used as the hover label. If no label or a single label is provided, then returns :class:`bokeh.plotting.figure.Figure` - Otherwise returns a :class:`bokeh.plotting.figure.Column` containing: - - a :class:`bokeh.models.widgets.Select` dropdown selection widget for labels + Otherwise returns a :class:`bokeh.models.layouts.Column` containing: + - a :class:`bokeh.models.widgets.inputs.Select` dropdown selection widget for labels - a :class:`bokeh.plotting.figure.Figure` containing the interactive qq plot Points will be colored by one of the labels defined in the ``label`` using the color scheme defined in @@ -1288,7 +1288,7 @@ def qq( Returns ------- - :class:`bokeh.plotting.figure.Figure` if no label or a single label was given, otherwise :class:`bokeh.plotting.figure.Column` + :class:`bokeh.plotting.figure.Figure` if no label or a single label was given, otherwise :class:`bokeh.models.layouts.Column` """ hover_fields = {} if hover_fields is None else hover_fields label = {} if label is None else {'label': label} if isinstance(label, Expression) else label diff --git a/hail/python/hail/table.py b/hail/python/hail/table.py index 8a74089fd076..a054ba81dace 100644 --- a/hail/python/hail/table.py +++ b/hail/python/hail/table.py @@ -470,7 +470,7 @@ def parallelize(cls, rows, schema=None, key=None, n_partitions=None) -> 'Table': ---------- rows List of row values, or expression of type ``array``. - schema : str or :class:`.HailType:`, optional + schema : str or a hail type (see :ref:`hail_types`), optional Value type. key : Union[str, List[str]]], optional Key field(s). @@ -2705,7 +2705,7 @@ def order_by(self, *exprs) -> 'Table': Parameters ---------- - exprs : varargs of :class:`.Ascending` or :class:`.Descending` or :class:`.Expression` or :class:`str` + exprs : varargs of :func:`~.asc`, :func:`.desc`, :class:`.Expression`, or :class:`str` Fields to sort by. Returns diff --git a/hail/python/hail/utils/hadoop_utils.py b/hail/python/hail/utils/hadoop_utils.py index 9c786f4617ee..1a7742377dab 100644 --- a/hail/python/hail/utils/hadoop_utils.py +++ b/hail/python/hail/utils/hadoop_utils.py @@ -178,7 +178,7 @@ def hadoop_stat(path: str) -> Dict: Returns ------- - :obj:`Dict` + :obj:`dict` """ return Env.fs().stat(path) @@ -209,7 +209,7 @@ def hadoop_ls(path: str) -> List[Dict]: Returns ------- - :obj:`List[Dict]` + :obj:`list` [:obj:`dict`] """ return Env.fs().ls(path)