|
19 | 19 |
|
20 | 20 |
|
21 | 21 | class EHRData(AnnData): |
22 | | - """EHRData object. |
| 22 | + """Model two and three dimensional electronic health record data. |
23 | 23 |
|
24 | | - Inherits `__init__` parameters, methods, and properties from :class:`~anndata.AnnData`. |
| 24 | + Extends :class:`~anndata.AnnData` to further support regular and irregular time-series data. |
25 | 25 |
|
26 | | - Parameters |
27 | | - ---------- |
28 | | - X |
29 | | - A #observations × #variables data matrix. A view of the data is used if the |
| 26 | + Args: |
| 27 | + X: A #observations × #variables data matrix. A view of the data is used if the |
30 | 28 | data type matches, otherwise, a copy is made. |
31 | | - r |
32 | | - A #observations × #variables × #timesteps data array. A view of the data is used if the |
33 | | - data type matches, otherwise, a copy is made. |
34 | | - obs |
35 | | - Key-indexed one-dimensional observations annotation of length #observations. |
36 | | - var |
37 | | - Key-indexed one-dimensional variables annotation of length #variables. |
38 | | - t |
39 | | - Key-indexed one-dimensional time annotation of length #timesteps. |
40 | | - uns |
41 | | - Key-indexed unstructured annotation. |
42 | | - obsm |
43 | | - Key-indexed multi-dimensional observations annotation of length #observations. |
44 | | - If passing a :class:`~numpy.ndarray`, it needs to have a structured datatype. |
45 | | - varm |
46 | | - Key-indexed multi-dimensional variables annotation of length #variables. |
47 | | - If passing a :class:`~numpy.ndarray`, it needs to have a structured datatype. |
48 | | - layers |
49 | | - Key-indexed multi-dimensional arrays aligned to dimensions of `X`. |
50 | | - shape |
51 | | - Shape tuple (#observations, #variables). Can only be provided if `X` is `None`. |
52 | | - filename |
53 | | - Name of backing file. See :class:`h5py.File`. |
54 | | - filemode |
55 | | - Open mode of backing file. See :class:`h5py.File`. |
| 29 | + r: A #observations × #variables × #timesteps data array. A view of the data is used if |
| 30 | + the data type matches, otherwise, a copy is made. |
| 31 | + obs: Key-indexed one-dimensional observations annotation of length #observations. |
| 32 | + var: Key-indexed one-dimensional variables annotation of length #variables. |
| 33 | + t: Key-indexed one-dimensional time annotation of length #timesteps. |
| 34 | + uns: Key-indexed unstructured annotation. |
| 35 | + obsm: Key-indexed multi-dimensional observations annotation of length #observations. |
| 36 | + If passing a :class:`numpy.ndarray`, it needs to have a structured datatype. |
| 37 | + varm: Key-indexed multi-dimensional variables annotation of length #variables. |
| 38 | + If passing a :class:`numpy.ndarray`, it needs to have a structured datatype. |
| 39 | + layers: Key-indexed multi-dimensional arrays aligned to dimensions of `X`. |
| 40 | + shape: Shape tuple (#observations, #variables). Can only be provided if `X` is None. |
| 41 | + filename: Name of backing file. See :class:`h5py.File`. |
| 42 | + filemode: Open mode of backing file. See :class:`h5py.File`. |
56 | 43 | """ |
57 | 44 |
|
58 | 45 | _t: pd.DataFrame | None |
@@ -174,20 +161,14 @@ def from_adata( |
174 | 161 | ) -> EHRData: |
175 | 162 | """Create an EHRData object from an AnnData object. |
176 | 163 |
|
177 | | - Parameters |
178 | | - ---------- |
179 | | - adata |
180 | | - Annotated data object. |
181 | | - r |
182 | | - 3-Dimensional tensor, see :attr:`r`. |
183 | | - t |
184 | | - Time dataframe for describing third axis, see :attr:`t`. |
185 | | - tidx |
186 | | - A slice for the 3rd dimension :attr:`r`. Usually, this will be None here. |
187 | | -
|
188 | | - Returns |
189 | | - ------- |
190 | | - An EHRData object. |
| 164 | + Args: |
| 165 | + adata: Annotated data object. |
| 166 | + r: 3-Dimensional tensor, see r attribute. |
| 167 | + t: Time dataframe for describing third axis, see t attribute. |
| 168 | + tidx: A slice for the 3rd dimension r. Usually, this will be None here. |
| 169 | +
|
| 170 | + Returns: |
| 171 | + An EHRData object extending the AnnData object. |
191 | 172 | """ |
192 | 173 | instance = cls(shape=adata.shape) |
193 | 174 |
|
@@ -371,14 +352,11 @@ def __repr__(self) -> str: |
371 | 352 | def __getitem__(self, index: Index | None) -> EHRData: |
372 | 353 | """Slice the EHRData object along 1–3 axes. |
373 | 354 |
|
374 | | - Parameters |
375 | | - ---------- |
376 | | - index |
377 | | - 1D, 2D, or 3D index. |
| 355 | + Args: |
| 356 | + index: 1D, 2D, or 3D index. |
378 | 357 |
|
379 | | - Returns |
380 | | - ------- |
381 | | - An EHRData view object. |
| 358 | + Returns: |
| 359 | + An EHRData view object. |
382 | 360 | """ |
383 | 361 | oidx, vidx, tidx = self._unpack_index(index) |
384 | 362 | adata_sliced = super().__getitem__((oidx, vidx)) |
|
0 commit comments