unravel.allen_institute.abca.scRNA_seq.expression module#
Use abca_scRNAseq_expression (rna_exp) from UNRAVEL to extract expression data for specific genes from the ABCA.
- Inputs:
Cell metadata from the Allen Brain Cell Atlas (use
abca_cacheto download).Gene metadata from the Allen Brain Cell Atlas (use
abca_cacheto download).Expression data from the Allen Brain Cell Atlas (use
abca_cacheto download).
- Outputs:
A CSV file with the expression data for the selected genes, indexed by cell_label.
Note
Only the first gene in the list will be used to name the output file.
For humans, the cell type must be specified (Neurons or Nonneurons).
For mice, optionally filter neurons or nonneurons with
abca_scRNAseq_filterafter joining cell metadata and expression data usingabca_scRNAseq_join_cell_metadata.The output will be a CSV file with the expression data for the selected genes, indexed by cell_label.
Usage:#
abca_scRNAseq_expression -b path/base_dir -g genes [-s mouse | human] [-c Neurons | Nonneurons] [-o output] [-v]
Usage for humans:#
abca_scRNAseq_expression -b path/base_dir -g genes -c Neurons [-o output_dir] [-v]
Usage for mice:#
abca_scRNAseq_expression -b path/base_dir -g genes [-o output_dir] [-v]
- unravel.allen_institute.abca.scRNA_seq.expression.load_RNAseq_cell_metadata(download_base, species='human')[source]#
Load the cell metadata from the RNA-seq data.
- Parameters:
download_base (Path) – The base directory where the data is downloaded.
species (str) – The species to use (human or mouse). Default: ‘human’.
- Returns:
cell_df – The cell metadata dataframe. Index: cell_label. Columns: feature_matrix_label, region_of_interest_acronym, x, y, cluster_alias.
- Return type:
pd.DataFrame
- unravel.allen_institute.abca.scRNA_seq.expression.load_RNAseq_gene_metadata(download_base, species='human')[source]#
Load the gene metadata from the RNA-seq data.
- Parameters:
download_base (Path) – The base directory where the data is downloaded.
species (str) – The species to use (human or mouse). Default: ‘human’.
- Returns:
gene_df – The gene metadata dataframe. Index: gene_identifier. Columns: gene_symbol, biotype, name.
- Return type:
pd.DataFrame
- unravel.allen_institute.abca.scRNA_seq.expression.extract_gene_expression(file, cell_indexes, gene_filtered)[source]#
Load an h5ad file and extract selected cells and genes.
- unravel.allen_institute.abca.scRNA_seq.expression.get_gene_data_wo_cache_and_chunking(download_base, cell_df, all_genes, selected_genes, species='human', cell_type=None)[source]#
Load and structure gene expression data directly from RNA-seq data for specific genes.
- Parameters:
download_base (Path) – The base directory where the data is located.
cell_df (pandas.DataFrame) – Cell metadata indexed on cell_label.
all_genes (pandas.DataFrame) – Gene metadata indexed on gene_identifier.
selected_genes (list of strings) – List of gene_symbols that are a subset of those in the full genes DataFrame.
species (str) – The species to use (human or mouse). Default: ‘human’.
cell_type (str) – The cell type to use for humans (Neurons or Nonneurons). Default: None.
- Returns:
output_gene_data – Subset of gene data indexed by cell.
- Return type:
pandas.DataFrame
- unravel.allen_institute.abca.scRNA_seq.expression.load_annotated_cell_metadata(download_base, species, cell_df=None)[source]#
Load cell metadata if needed, then add annotations and colors.