ecotyper.discovery_scrna

scRNA-seq discovery (EcoTyper_discovery_scRNA.R):

  1. cell-type-specific genes (state_discovery_scRNA_filter_genes.R);

  2. cell-cell correlation matrices (state_discovery_scRNA_distances.R) and NMF on them (state_discovery_NMF.R with discovery_cross_cor);

  3. rank selection;

  4. initial states (state_discovery_initial_plots_scRNA.R);

  5. marker genes and NMF re-discovery on expression (state_discovery_extract_features_scRNA.R);

  6. initial states on expression;

  7. QC filter (state_discovery_first_filter_scRNA.R);

  8. ecotypes (ecotypes_scRNA.R, ecotypes_assign_samples_scRNA.R).

Functions

assign_samples_scrna(initial, states, eco, ...)

ecotypes_assign_samples_scRNA.R.

cell_type_specific_genes(expr, annotation, ...)

Step 1 for all cell types (each R process repeats the same subsampling).

cross_correlation(expr, annotation, ...[, ...])

de_subsample(annotation, cell_ids)

Annotation of the cells used for the DE test: set.seed(1234) then up to 500 cells per cell type, cell types in sorted order.

discover_ecotypes_scrna(initial, states, ...)

do_cv(data, variable, value)

doCV (lib/misc.R): within-group variance, decreasing.

do_de(data, variable, value[, ranks])

doDE(data, variable, value) (lib/misc.R): Wilcoxon rank-sum test of one group against all other samples.

extract_features_scrna(cc, initial_assignment)

fast_cor(X)

HiClimR::fastCor(X) with its defaults (nSplit = 1, optBLAS = FALSE): cor() between columns, zero-variance columns set to NA.

Classes

CrossCor(cell_type, log_data, scaled_filt, cor)

ScFeatures(cell_type, full_fcs, top_fcs, ...)

SpecificGenes(raw, filtered)

ecotyper.discovery_scrna.do_de(data, variable, value, ranks=None)[source]

doDE(data, variable, value) (lib/misc.R): Wilcoxon rank-sum test of one group against all other samples. ranks: row_ranks() of data, reused across groups (same result).

Parameters:
Return type:

DataFrame

ecotyper.discovery_scrna.do_cv(data, variable, value)[source]

doCV (lib/misc.R): within-group variance, decreasing.

Parameters:
Return type:

DataFrame

ecotyper.discovery_scrna.de_subsample(annotation, cell_ids)[source]

Annotation of the cells used for the DE test: set.seed(1234) then up to 500 cells per cell type, cell types in sorted order.

Parameters:

annotation (DataFrame)

Return type:

DataFrame

class ecotyper.discovery_scrna.SpecificGenes(raw: 'pd.DataFrame', filtered: 'pd.DataFrame')[source]

Bases: object

Parameters:
raw: DataFrame
filtered: DataFrame
ecotyper.discovery_scrna.cell_type_specific_genes(expr, annotation, cell_types, mode='cell type specific', scale_column=None)[source]

Step 1 for all cell types (each R process repeats the same subsampling).

Parameters:
Return type:

dict

ecotyper.discovery_scrna.fast_cor(X)[source]

HiClimR::fastCor(X) with its defaults (nSplit = 1, optBLAS = FALSE): cor() between columns, zero-variance columns set to NA.

Parameters:

X (ndarray)

Return type:

ndarray

class ecotyper.discovery_scrna.CrossCor(cell_type: 'str', log_data: 'pd.DataFrame', scaled_filt: 'pd.DataFrame', cor: 'pd.DataFrame', scaled_full: 'pd.DataFrame | None' = None)[source]

Bases: object

Parameters:
cell_type: str
log_data: DataFrame
scaled_filt: DataFrame
cor: DataFrame
scaled_full: DataFrame | None = None
ecotyper.discovery_scrna.cross_correlation(expr, annotation, cell_type, specific, scale_column=None)[source]
Parameters:
Return type:

CrossCor

class ecotyper.discovery_scrna.ScFeatures(cell_type: 'str', full_fcs: 'pd.DataFrame', top_fcs: 'pd.DataFrame', log_full: 'pd.DataFrame', log_top: 'pd.DataFrame', top_scaled: 'pd.DataFrame', full_scaled: 'pd.DataFrame')[source]

Bases: object

Parameters:
cell_type: str
full_fcs: DataFrame
top_fcs: DataFrame
log_full: DataFrame
log_top: DataFrame
top_scaled: DataFrame
full_scaled: DataFrame
ecotyper.discovery_scrna.extract_features_scrna(cc, initial_assignment, r_exact=True)[source]
Parameters:
Return type:

ScFeatures

ecotyper.discovery_scrna.discover_ecotypes_scrna(initial, states, cell_types, annotation, p_value_cutoff=1.0, min_states=3)[source]
Parameters:
Return type:

Ecotypes

ecotyper.discovery_scrna.assign_samples_scrna(initial, states, eco, cell_types, annotation, top_cols=('Ecotype',))[source]

ecotypes_assign_samples_scRNA.R.

Parameters:
Return type:

EcotypeRecovery