def __init__( self, file_path: str, study_id: ObjectId, study_file_id: ObjectId, name: str, *, domain_ranges: Dict = None, **kwargs, ): Annotations.__init__(self, file_path, self.ALLOWED_FILE_TYPES, study_id, study_file_id) # Lowercase coordinate headers, expected for df merge for i, header in enumerate(self.headers): if header in ["X", "Y", "Z"]: self.headers[i] = self.headers[i].lower() self.preprocess() self.determine_coordinates_and_cell_names() self.source_file_type = "cluster" self.cluster_type = ("3d" if ("z" in self.coordinates_and_cell_headers or "Z" in self.coordinates_and_cell_headers) else "2d") self.name = name # Check if domain_ranges is an empty dictionary self.domain_ranges = domain_ranges if not (not domain_ranges) else None
def __init__(self, cluster_file, cell_metadata_file=None): Annotations.__init__(self, cluster_file, self.ALLOWED_FILE_TYPES) self.preprocess() self.determine_coordinates_and_cell_names() if cell_metadata_file is not None: self.cell_metadata = Annotations(cell_metadata_file, CellMetadata.ALLOWED_FILE_TYPES)
def __init__( self, file_path: str, study_id: ObjectId, study_file_id: ObjectId, *args, **kwargs, ): self.study_accession = kwargs.pop("study_accession") Annotations.__init__(self, file_path, self.ALLOWED_FILE_TYPES, study_id, study_file_id) self.cell_names = [] # lambda below initializes new key with nested dictionary as value and avoids KeyError self.issues = defaultdict( lambda: defaultdict(lambda: defaultdict(list))) self.ontology = defaultdict(lambda: defaultdict(list)) self.ontology_label = dict() self.cells = [] self.numeric_array_columns = {}