unravel.allen_institute.abca.merfish.merfish_filter module#
Use abca_merfish_filter or mf_filter from UNRAVEL to filter ABCA MERFISH cells based on columns and values in the cell metadata.
It integrates the filtering with the generation of exp_df and allows optional export of filtered data or the generation of updated 3D images.
Note
The input CSV may be previously filtered (e.g.,
abca_merfish_filter_by_mask) or it may be the full cell metadata (cell_metadata.csv).Columns to filter by:
parcellation_substructure(default)Values to filter by: e.g.,
ACBRegional columns can be printed with
cols -i <ABCA_root>/metadata/Allen-CCF-2020/20230630/views/parcellation_to_parcellation_term_membership_acronym.csvRegional values can be printed with
vals -i <ABCA_root>/metadata/Allen-CCF-2020/20230630/views/parcellation_to_parcellation_term_membership_acronym.csv -c substructureparcellation_is prepended to the regional column names in the cell metadata, so for examplesubstructurebecomesparcellation_substructure
- Outputs:
Filtered cell metadata CSV file (default: <input_stem>_filtered[_<first_value>][_neurons].csv)
With
--all_values, one CSV per unique value for each specified column.
- Next steps:
Use the filtered cell metadata to examine cell type prevalence or gene expression
For cell type proportions like in the MapMySections data challenge, use
mms_cell_type_proportionsto calculate proportions for a given ontological level (e.g., subclass)Then use
mms_cell_type_proportions_concatto concatenate multiple CSVs into one file (one row per input file)To visualize cell type proportions, use
abca_sunburstto make a CSV for sunburst plottingFor looking at gene expression, load the filtered cell metadata and join it with the expression data for the gene(s) of interest (
abca_merfish_join_expression)
Usage:#
abca_merfish_filter -b path/base_dir [–columns] [–values] [-o path/output.csv] [-n] [-v] abca_merfish_filter -b path/base_dir -a [-c column …] [-o path/output_dir] [-w workers] [-n] [-v]
- unravel.allen_institute.abca.merfish.merfish_filter.sanitize_filename(value)[source]#
Convert a column value to a filesystem-safe string.
- unravel.allen_institute.abca.merfish.merfish_filter.save_filtered_value(df, indices, value, output_path)[source]#
Save rows corresponding to one column value.
- unravel.allen_institute.abca.merfish.merfish_filter.filter_all_values(df, columns, output_dir, stem, neurons=False, workers=1)[source]#
Write one CSV for every unique value in each specified column.