Source code for biocutils.match
-from typing import Sequence, Union
-
+from typing import Sequence, Union, Optional
import numpy
from .map_to_index import DUPLICATE_METHOD, map_to_index
@@ -255,6 +254,7 @@ Source code for biocutils.match
x: Sequence,
targets: Union[dict, Sequence],
duplicate_method: DUPLICATE_METHOD = "first",
+ dtype: Optional[numpy.ndarray] = None,
) -> numpy.ndarray:
"""Find a matching value of each element of ``x`` in ``target``.
@@ -270,6 +270,11 @@ Source code for biocutils.match
How to handle duplicate entries in ``targets``. Matches can
be reported to the first or last occurrence of duplicates.
+ dtype:
+ NumPy type of the output array. This should be an integer type; if
+ missing values are expected, the type should be a signed integer.
+ If None, a suitable type is automatically determined.
+
Returns:
Array of length equal to ``x``, containing the integer position of each
entry of ``x`` inside ``target``; or -1, if the entry of ``x`` is
@@ -278,9 +283,10 @@ Source code for biocutils.match
if not isinstance(targets, dict):
targets = map_to_index(targets, duplicate_method=duplicate_method)
- indices = numpy.zeros(
- len(x), dtype=numpy.min_scalar_type(-len(targets))
- ) # get a signed type
+ if dtype is None:
+ dtype = numpy.min_scalar_type(-len(targets)) # get a signed type
+ indices = numpy.zeros(len(x), dtype=dtype)
+
for i, y in enumerate(x):
if y not in targets:
indices[i] = -1
@@ -321,7 +327,7 @@ Source code for biocutils.match
-
+
diff --git a/_modules/biocutils/normalize_subscript.html b/_modules/biocutils/normalize_subscript.html
index 42331d0..7289870 100644
--- a/_modules/biocutils/normalize_subscript.html
+++ b/_modules/biocutils/normalize_subscript.html
@@ -5,7 +5,7 @@
- biocutils.normalize_subscript - biocutils 0.1.6 documentation
+ biocutils.normalize_subscript - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/package_utils.html b/_modules/biocutils/package_utils.html
index c2112bd..66357ae 100644
--- a/_modules/biocutils/package_utils.html
+++ b/_modules/biocutils/package_utils.html
@@ -5,7 +5,7 @@
-
+biocutils.package_utils - biocutils 0.1.6 documentation
+ biocutils.package_utils - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/print_truncated.html b/_modules/biocutils/print_truncated.html
index d7c2310..60452ee 100644
--- a/_modules/biocutils/print_truncated.html
+++ b/_modules/biocutils/print_truncated.html
@@ -5,7 +5,7 @@
-
+biocutils.print_truncated - biocutils 0.1.6 documentation
+ biocutils.print_truncated - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/print_wrapped_table.html b/_modules/biocutils/print_wrapped_table.html
index b0ba6e1..014e280 100644
--- a/_modules/biocutils/print_wrapped_table.html
+++ b/_modules/biocutils/print_wrapped_table.html
@@ -5,7 +5,7 @@
-
+biocutils.print_wrapped_table - biocutils 0.1.6 documentation
+ biocutils.print_wrapped_table - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/relaxed_combine_columns.html b/_modules/biocutils/relaxed_combine_columns.html
index 61d2ec2..a993a09 100644
--- a/_modules/biocutils/relaxed_combine_columns.html
+++ b/_modules/biocutils/relaxed_combine_columns.html
@@ -5,7 +5,7 @@
-
+biocutils.relaxed_combine_columns - biocutils 0.1.6 documentation
+ biocutils.relaxed_combine_columns - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/relaxed_combine_rows.html b/_modules/biocutils/relaxed_combine_rows.html
index c5a16ad..8634644 100644
--- a/_modules/biocutils/relaxed_combine_rows.html
+++ b/_modules/biocutils/relaxed_combine_rows.html
@@ -5,7 +5,7 @@
-
+biocutils.relaxed_combine_rows - biocutils 0.1.6 documentation
+ biocutils.relaxed_combine_rows - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/reverse_index.html b/_modules/biocutils/reverse_index.html
index c8d188f..b4eef2f 100644
--- a/_modules/biocutils/reverse_index.html
+++ b/_modules/biocutils/reverse_index.html
@@ -5,7 +5,7 @@
-
+biocutils.reverse_index - biocutils 0.1.6 documentation
+ biocutils.reverse_index - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/show_as_cell.html b/_modules/biocutils/show_as_cell.html
index b071775..1b07fad 100644
--- a/_modules/biocutils/show_as_cell.html
+++ b/_modules/biocutils/show_as_cell.html
@@ -5,7 +5,7 @@
-
+biocutils.show_as_cell - biocutils 0.1.6 documentation
+ biocutils.show_as_cell - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/subset.html b/_modules/biocutils/subset.html
index 94ad479..56853ed 100644
--- a/_modules/biocutils/subset.html
+++ b/_modules/biocutils/subset.html
@@ -5,7 +5,7 @@
-
+biocutils.subset - biocutils 0.1.6 documentation
+ biocutils.subset - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/subset_rows.html b/_modules/biocutils/subset_rows.html
index f874443..926cf65 100644
--- a/_modules/biocutils/subset_rows.html
+++ b/_modules/biocutils/subset_rows.html
@@ -5,7 +5,7 @@
-
+biocutils.subset_rows - biocutils 0.1.6 documentation
+ biocutils.subset_rows - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/subset_sequence.html b/_modules/biocutils/subset_sequence.html
index e2d1b4a..2f5a7c0 100644
--- a/_modules/biocutils/subset_sequence.html
+++ b/_modules/biocutils/subset_sequence.html
@@ -5,7 +5,7 @@
-
+biocutils.subset_sequence - biocutils 0.1.6 documentation
+ biocutils.subset_sequence - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/biocutils/union.html b/_modules/biocutils/union.html
index f663815..0e031ca 100644
--- a/_modules/biocutils/union.html
+++ b/_modules/biocutils/union.html
@@ -5,7 +5,7 @@
-
+biocutils.union - biocutils 0.1.6 documentation
+ biocutils.union - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
diff --git a/_modules/index.html b/_modules/index.html
index 0d14fa7..d8921d0 100644
--- a/_modules/index.html
+++ b/_modules/index.html
@@ -5,7 +5,7 @@
-
+Overview: module code - biocutils 0.1.6 documentation
+ Overview: module code - biocutils 0.1.7 documentation
@@ -165,7 +165,7 @@
@@ -189,7 +189,7 @@
+
-
diff --git a/_static/documentation_options.js b/_static/documentation_options.js
index 462d975..8d5909e 100644
--- a/_static/documentation_options.js
+++ b/_static/documentation_options.js
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
- VERSION: '0.1.6',
+ VERSION: '0.1.7',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
diff --git a/api/biocutils.html b/api/biocutils.html
index e636a30..9c7aaff 100644
--- a/api/biocutils.html
+++ b/api/biocutils.html
@@ -6,7 +6,7 @@
- biocutils package - biocutils 0.1.6 documentation
+ biocutils package - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
@@ -190,7 +190,7 @@
biocutils - biocutils 0.1.6 documentation
+ biocutils - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
diff --git a/api/modules.html b/api/modules.html
index 4f591e7..fba6168 100644
--- a/api/modules.html
+++ b/api/modules.html
@@ -6,7 +6,7 @@
-
@@ -190,7 +190,7 @@
Contributors - biocutils 0.1.6 documentation
+ Contributors - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
diff --git a/authors.html b/authors.html
index ff4ff4b..75ab3a7 100644
--- a/authors.html
+++ b/authors.html
@@ -6,7 +6,7 @@
-
@@ -190,7 +190,7 @@
Changelog - biocutils 0.1.6 documentation
+ Changelog - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
diff --git a/changelog.html b/changelog.html
index e96d7c6..441bdb0 100644
--- a/changelog.html
+++ b/changelog.html
@@ -6,7 +6,7 @@
-
@@ -190,7 +190,7 @@
Contributing - biocutils 0.1.6 documentation
+ Contributing - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
diff --git a/contributing.html b/contributing.html
index 6294d57..6b21333 100644
--- a/contributing.html
+++ b/contributing.html
@@ -6,7 +6,7 @@
-
@@ -190,7 +190,7 @@
+
-
@@ -188,7 +188,7 @@
+
-
@@ -190,7 +190,7 @@
License - biocutils 0.1.6 documentation
+ License - biocutils 0.1.7 documentation
@@ -166,7 +166,7 @@
diff --git a/license.html b/license.html
index 6edf7d4..49ab9f5 100644
--- a/license.html
+++ b/license.html
@@ -6,7 +6,7 @@
-
@@ -190,7 +190,7 @@
+
-
@@ -188,7 +188,7 @@
+
-
@@ -190,7 +190,7 @@
+
-
@@ -190,7 +190,7 @@
+
-