Skip to main content

Single neuron SWC file processing, Allen fluorescence data processing, data integration and model construction

Project description

A comprehensive toolkit for neuronal data analysis, featuring SWC file processing, feature extraction, multimodal data fusion, and machine learning model training.

Installation

pip install Sp_Neuron

Quick Start

conda create -n neuron python=3.12
conda activate neuron
pip install Sp_Neuron

Help Documentation

Sp_Neuron [-h] [-v] <command> ...

Sp_Neuron - Complete neuronal data analysis workflow

options:
  -h, --help     show this help message and exit
  -v, --version  show program's version number and exit

Workflow commands:
  <command>
    download     Download Allen experimental data
    preprocess   Preprocess experimental data
    swc          SWC file processing and analysis
    feature      Feature extraction and integration
    fusion       Multimodal data fusion
    model        Model training and prediction

Complete workflow examples:

# 1. Download experimental data
Sp_Neuron download --experiments data/experiments.csv --download-dir data/experiment_data --annotation data/annotation_25.nrrd --limit 10

# 2. Preprocess experimental data
Sp_Neuron preprocess --experiments data/experiments.csv --download-dir data/experiment_data --annotation data/annotation_25.nrrd --output-dir data/experiment_data/result

# 3. Process SWC files
Sp_Neuron swc --annotation data/annotation_25.nrrd --input data/orig_swc_data/ --output results/swc_results.csv

# 4. Extract features
Sp_Neuron feature --swc-results results/swc_results.csv --adjacency data/adjacency_matrix.csv --output results/features.csv

# 5. Data fusion
Sp_Neuron fusion --features results/features.csv --experiment-results data/experiment_data/result/merged_results.csv --output results/fusion_results.csv

# 6. Train model
Sp_Neuron model --fusion-results results/fusion_results.csv --gene-data data/gene_data.csv --output results/gene_importance.csv

Requirements:

  • Python 3.12+

  • Dependencies: pandas, numpy, tensorflow, pyswcloader, networkx

Version: 1.0.0

Step-by-Step Workflow

  1. Download Experimental Data:

    Sp_Neuron download [-h] --experiments EXPERIMENTS --download-dir DOWNLOAD_DIR --annotation ANNOTATION [--allen-tree ALLEN_TREE] [--acro-dict ACRO_DICT] [--limit LIMIT]
    options:
      -h, --help            show this help message and exit
      --experiments EXPERIMENTS, -e EXPERIMENTS
                            Experimental data file path
      --download-dir DOWNLOAD_DIR
                            Data download directory
      --annotation ANNOTATION, -a ANNOTATION
                            Brain annotation file path
      --allen-tree ALLEN_TREE
                            Allen brain tree file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path
      --limit LIMIT, -n LIMIT
                            Download quantity limit (0 means download all)

    Example:

    Sp_Neuron download \
      --experiments data/experiments.csv \
      --download-dir data/experiment_data \
      --annotation data/annotation_25.nrrd \
      --limit 10
  2. Preprocess Experimental Data:

    Sp_Neuron preprocess [-h] --experiments EXPERIMENTS --download-dir DOWNLOAD_DIR --annotation ANNOTATION --output-dir OUTPUT_DIR [--allen-tree ALLEN_TREE] [--acro-dict ACRO_DICT] [--use-projection-density]
    options:
      -h, --help            show this help message and exit
      --experiments EXPERIMENTS, -e EXPERIMENTS
                            Experimental data file path
      --download-dir DOWNLOAD_DIR
                            Data download directory
      --annotation ANNOTATION, -a ANNOTATION
                            Brain annotation file path
      --output-dir OUTPUT_DIR
                            Preprocessing results output directory
      --allen-tree ALLEN_TREE
                            Allen brain tree file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path
      --use-projection-density
                            Use projection density data

    Example:

    Sp_Neuron preprocess \
      --experiments data/experiments.csv \
      --download-dir data/experiment_data \
      --annotation data/annotation_25.nrrd \
      --output-dir data/experiment_data/result
  3. Process SWC Files:

    Sp_Neuron swc [-h] --annotation ANNOTATION --input INPUT --output OUTPUT [--resolution RESOLUTION] [--allen-tree ALLEN_TREE] [--acro-dict ACRO_DICT]
    options:
      -h, --help            show this help message and exit
      --annotation ANNOTATION, -a ANNOTATION
                            Brain annotation file path
      --input INPUT, -i INPUT
                            Input SWC file directory path
      --output OUTPUT, -o OUTPUT
                            Output results file path
      --resolution RESOLUTION, -r RESOLUTION
                            Resolution parameter
      --allen-tree ALLEN_TREE
                            Allen brain tree file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path

    Example:

    Sp_Neuron swc \
      --annotation data/annotation_25.nrrd \
      --input data/orig_swc_data/ \
      --output results/swc_results.csv \
      --resolution 25
  4. Extract Features:

    Sp_Neuron feature [-h] --swc-results SWC_RESULTS --adjacency ADJACENCY --output OUTPUT [--allen-tree ALLEN_TREE] [--acro-dict ACRO_DICT] [--progress-file PROGRESS_FILE]
    options:
      -h, --help            show this help message and exit
      --swc-results SWC_RESULTS, -s SWC_RESULTS
                            SWC processing results file path
      --adjacency ADJACENCY, -adj ADJACENCY
                            Adjacency matrix file path
      --output OUTPUT, -o OUTPUT
                            Output features file path
      --allen-tree ALLEN_TREE
                            Allen brain tree file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path
      --progress-file PROGRESS_FILE
                            Progress save file path

    Example:

    Sp_Neuron feature \
      --swc-results results/swc_results.csv \
      --adjacency data/adjacency_matrix.csv \
      --output results/features.csv
  5. Data Fusion:

    Sp_Neuron fusion [-h] --features FEATURES --experiment-results EXPERIMENT_RESULTS --output OUTPUT [--adjacency ADJACENCY] [--allen-tree ALLEN_TREE] [--acro-dict ACRO_DICT] [--min-path-length MIN_PATH_LENGTH]
    options:
      -h, --help            show this help message and exit
      --features FEATURES, -f FEATURES
                            Features file path
      --experiment-results EXPERIMENT_RESULTS, -er EXPERIMENT_RESULTS
                            Experimental data results file path
      --output OUTPUT, -o OUTPUT
                            Output fusion results file path
      --adjacency ADJACENCY
                            Adjacency matrix file path
      --allen-tree ALLEN_TREE
                            Allen brain tree file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path
      --min-path-length MIN_PATH_LENGTH
                            Minimum path length

    Example:

    Sp_Neuron fusion \
      --features results/features.csv \
      --experiment-results data/experiment_data/result/merged_results.csv \
      --output results/fusion_results.csv
  6. Train Model:

    Sp_Neuron model [-h] --fusion-results FUSION_RESULTS --gene-data GENE_DATA --output OUTPUT [--acro-dict ACRO_DICT] [--window-size WINDOW_SIZE] [--epochs EPOCHS] [--batch-size BATCH_SIZE]
    options:
      -h, --help            show this help message and exit
      --fusion-results FUSION_RESULTS, -f FUSION_RESULTS
                            Data fusion results file path
      --gene-data GENE_DATA, -g GENE_DATA
                            Gene data file path
      --output OUTPUT, -o OUTPUT
                            Output gene importance file path
      --acro-dict ACRO_DICT
                            Acronym dictionary file path
      --window-size WINDOW_SIZE
                            Sliding window size
      --epochs EPOCHS       Training epochs
      --batch-size BATCH_SIZE
                            Batch size

    Example:

    Sp_Neuron model \
      --fusion-results results/fusion_results.csv \
      --gene-data data/gene_data.csv \
      --output results/gene_importance.csv

Command Reference

Global Options

  • -h, --help: Show help message and exit

  • -v, --version: Show program’s version number and exit

Available Commands

download

Download Allen experimental data

Sp_Neuron download --experiments <file> --download-dir <dir> --annotation <file> [--limit N]

preprocess

Preprocess experimental data

Sp_Neuron preprocess --experiments <file> --download-dir <dir> --annotation <file> --output-dir <dir>

swc

Process SWC files and analyze neuronal structures

Sp_Neuron swc --annotation <file> --input <dir> --output <file> [--resolution 25]

feature

Extract and integrate neuronal features

Sp_Neuron feature --swc-results <file> --adjacency <file> --output <file>

fusion

Perform multimodal data fusion

Sp_Neuron fusion --features <file> --experiment-results <file> --output <file>

model

Train machine learning models and predict gene importance

Sp_Neuron model --fusion-results <file> --gene-data <file> --output <file>

File Structure

Input Files

  • annotation_25.nrrd: Brain region annotation file

  • experiments.csv: Experimental data metadata

  • adjacency_matrix.csv: Brain region connectivity matrix

  • gene_data.csv: Gene expression data

  • SWC files in organized directory structure

Output Files

  • swc_results.csv: Processed SWC file results

  • features.csv: Extracted neuronal features

  • fusion_results.csv: Fused multimodal data

  • gene_importance.csv: Gene importance rankings

Configuration

Default configuration can be viewed using:

from Sp_Neuron import Config
Config.show_info()

Dependencies

  • Python 3.12+

  • pandas

  • numpy

  • tensorflow

  • pyswcloader

  • networkx

Support

For issues and questions, please contact: 1984607077@qq.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sp_neuron-1.0.1.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sp_neuron-1.0.1-py3-none-any.whl (43.0 kB view details)

Uploaded Python 3

File details

Details for the file sp_neuron-1.0.1.tar.gz.

File metadata

  • Download URL: sp_neuron-1.0.1.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for sp_neuron-1.0.1.tar.gz
Algorithm Hash digest
SHA256 cdfe22fc586a90fb380b8cfc966631734725f821363ae9c6c279c51340392094
MD5 e11c14227ccb231589b05e14a71411c7
BLAKE2b-256 23458b6b601daca9ca91c00ac78f483d15653af303a6a10fecca8779bb96ecaa

See more details on using hashes here.

File details

Details for the file sp_neuron-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: sp_neuron-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 43.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for sp_neuron-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 472ea7e1c9ed5772128dd4f953b53f0cfac96d594400bdf1f90ef80ee8394b2e
MD5 c0adab2e4fd4cbed00c59ef2cb9e3ce2
BLAKE2b-256 072c509b9c0cddbf365f922903000ea734ecbc884329526675749f240aa80486

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page