Skip to content

Commit

Permalink
UnimodalDataView.copy() returns MultimodalData by default
Browse files Browse the repository at this point in the history
  • Loading branch information
yihming committed Jan 20, 2024
1 parent 4a849ed commit 6aea4e3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pegasusio/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,15 @@ def _copy_matrices(self) -> Dict[str, csr_matrix]:
self.matrices[key] = X[self.barcode_index][:,self.feature_index] # X[self.barcode_index.reshape(-1, 1), self.feature_index] if self._all_arrays else X[self.barcode_index, self.feature_index]
return self.matrices

def copy(self) -> "UnimodalData":
def copy(
self,
to_unidata: bool = False,
) -> Union["MultimodalData", "UnimodalData"]:
""" After copy, this View object becomes invalid """
data = self.parent._copy_view(self)
if not to_unidata:
from pegasusio import MultimodalData
data = MultimodalData(data)

self.parent = None
self.barcode_index = self.feature_index = None
Expand Down

0 comments on commit 6aea4e3

Please sign in to comment.