pegasusio/multimodal_data.py
def concat_data(self, modality: str = "rna"):
        """ Used for raw data, Ignore multiarrays/multigraphs and only consider one matrix per unidata """
        genomes = []
        unidata_arr = []

        for key in list(self.data):
            unidata = self.data.pop(key)
            assert unidata.get_modality() == modality
            genomes.append(unidata.get_genome())
            unidata_arr.append(unidata)

        unikey = None
        if len(genomes) == 1:
            unikey = unidata_arr[0].get_uid()
            self.data[unikey] = unidata_arr[0]
        else:
            genome = ",".join(genomes)
            feature_metadata = pd.concat([unidata.feature_metadata for unidata in unidata_arr], axis = 0)
            feature_metadata.reset_index(inplace = True)
            feature_metadata.fillna(value = "N/A", inplace = True)
            X = hstack([unidata.matrices["X"] for unidata in unidata_arr], format = "csr")
            unidata = UnimodalData(unidata_arr[0].barcode_metadata, feature_metadata, {"X": X}, {"genome": genome, "modality": "rna"})
            unikey = unidata.get_uid()
            self.data[unikey] = unidata
            del unidata_arr
            gc.collect()

        self._selected = unikey
        self._unidata = self.data[unikey]
 Used for raw data, Ignore multiarrays/multigraphs and only consider one matrix per unidata 
Used for raw data, Ignore multiarrays/multigraphs and only consider one matrix per unidata
Used for raw data Ignore multiarrays / multigraphs and only consider one matrix per unidata
def concat_data(self, modality: str = "rna"):
        genomes = []
        unidata_arr = []
        for key in list(self.data):
            unidata = self.data.pop(key)
            assert unidata.get_modality() == modality
            genomes.append(unidata.get_genome())
            unidata_arr.append(unidata)
        unikey = None
        if len(genomes) == 1:
            unikey = unidata_arr[0].get_uid()
            self.data[unikey] = unidata_arr[0]
        else:
            genome = ",".join(genomes)
            feature_metadata = pd.concat([unidata.feature_metadata for unidata in unidata_arr], axis = 0)
            feature_metadata.reset_index(inplace = True)
            feature_metadata.fillna(value = "N/A", inplace = True)
            X = hstack([unidata.matrices["X"] for unidata in unidata_arr], format = "csr")
            unidata = UnimodalData(unidata_arr[0].barcode_metadata, feature_metadata, {"X": X}, {"genome": genome, "modality": "rna"})
            unikey = unidata.get_uid()
            self.data[unikey] = unidata
            del unidata_arr
            gc.collect()
        self._selected = unikey
        self._unidata = self.data[unikey]
def concat_data ( self , modality : str = "rna" ) : genomes = [ ] unidata_arr = [ ] for key in list ( self . data ) : unidata = self . data . pop ( key ) assert unidata . get_modality ( ) == modality genomes . append ( unidata . get_genome ( ) ) unidata_arr . append ( unidata ) unikey = None if len ( genomes ) == 1 : unikey = unidata_arr [ 0 ] . get_uid ( ) self . data [ unikey ] = unidata_arr [ 0 ] else : genome = "," . join ( genomes ) feature_metadata = pd . concat ( [ unidata . feature_metadata for unidata in unidata_arr ] , axis = 0 ) feature_metadata . reset_index ( inplace = True ) feature_metadata . fillna ( value = "N/A" , inplace = True ) X = hstack ( [ unidata . matrices [ "X" ] for unidata in unidata_arr ] , format = "csr" ) unidata = UnimodalData ( unidata_arr [ 0 ] . barcode_metadata , feature_metadata , { "X" : X } , { "genome" : genome , "modality" : "rna" } ) unikey = unidata . get_uid ( ) self . data [ unikey ] = unidata del unidata_arr gc . collect ( ) self . _selected = unikey self . _unidata = self . data [ unikey ]
Used for raw data, Ignore multiarrays/multigraphs and only consider one matrix per unidata
Used for raw data Ignore multiarrays / multigraphs and only consider one matrix per unidata
""" Used for raw data, Ignore multiarrays/multigraphs and only consider one matrix per unidata """
self
modality
str