drcme.bin.run_spca_fit

Script to run sparse principal component analysis on electrophysiology feature vectors.

The electrophysiology feature vectors used as inputs are in the form processed by the IPFX package. An optional metadata file can be given as an input to filter the cells in the data set.

The script produces several outputs in the specified output_dir, named with a specified output_code.

  • sparse_principal_components_[output_code].csv: sPCA values for each cell.

  • spca_components_used_[output_code].json: List of kept components for each data subset.

  • spca_loadings_[output_code].pkl: sPCA loadings, adjust explained variance, and transformed values for each data subset. Uses the joblib library for saving/loading.

class drcme.bin.run_spca_fit.DatasetParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Parameter schema for input datasets

DatasetParameters

key

description

default

field_type

json_type

fv_h5_file

HDF5 file with feature vectors

NA

InputFile

str

metadata_file

Metadata file in CSV format

None

InputFile

str

dendrite_type

Filter for dendrite type using information in metadata (all, spiny, aspiny)

all

String

str

allow_missing_structure

Whether or not structure value for cell in metadata can be missing

False

Boolean

bool

allow_missing_dendrite

Whether or not dendrite type value for cell in metadata can be missing

False

Boolean

bool

need_ramp_spike

Whether or not to exclude cells that did not fire an action potential from the ramp stimulus

True

Boolean

bool

limit_to_cortical_layers

List of cortical layers to limit the data set (using the metadata file)

[]

List

str

id_file

Text file with specimen IDs to use. Cells with IDs not in the file will be excluded.

None

InputFile

str

class drcme.bin.run_spca_fit.AnalysisParameters(extra=None, only=None, exclude=(), prefix='', strict=None, many=False, context=None, load_only=(), dump_only=(), partial=False)[source]

Parameter schema for sPCA analysis

This schema is designed to be a schema_type for an ArgSchemaParser object

AnalysisParameters

key

description

default

field_type

json_type

input_json

file path of input json file

NA

InputFile

str

output_json

file path to output json file

NA

OutputFile

str

log_level

set the logging level of the module

ERROR

LogLevel

str

params_file

JSON file with sPCA parameters

NA

InputFile

str

output_dir

Directory for output files

NA

OutputDir

str

output_code

Code for naming output files

NA

String

str

datasets

Schema for loading one or more specific datasets for the analysis

(REQUIRED)

DatasetParameters

list

Functions

main(params_file, output_dir, output_code, …)

Main runner function for script.

Classes

AnalysisParameters([extra, only, exclude, …])

Parameter schema for sPCA analysis

DatasetParameters([extra, only, exclude, …])

Parameter schema for input datasets