Use DataLocator consistently on backend (#1208)

* allow DataLocator to accept another locator as init param

* migrate to DataLocator

* migrate to DataLocator

* lint

* migrate to DataLocator

* add check for erroroneous use of remote path and annotations

* lint

* revert default data location - now back go CWD

* remove unused import
This commit is contained in:
Bruce Martin
2020-03-10 19:12:49 -07:00
committed by GitHub
parent 234f25b782
commit 8beeb57c96
6 changed files with 46 additions and 30 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ import threading
import time
from server.data_common.rwlock import RWLock
from server.common.errors import DatasetAccessError
from server.common.data_locator import DataLocator
from contextlib import contextmanager
@@ -136,7 +137,8 @@ class MatrixDataType(Enum):
class MatrixDataLoader(object):
def __init__(self, location, etype=None):
self.location = location
""" location can be a string or DataLocator """
self.location = DataLocator(location)
if etype is None:
self.etype = self.matrix_data_type()
else:
@@ -152,9 +154,9 @@ class MatrixDataLoader(object):
self.matrix_type = CxgAdaptor
def matrix_data_type(self):
if self.location.endswith(".h5ad"):
if self.location.path.endswith(".h5ad"):
return MatrixDataType.H5AD
elif ".cxg" in self.location:
elif ".cxg" in self.location.path:
return MatrixDataType.CXG
else:
return MatrixDataType.UNKNOWN