P2Mdb / code /README.md
kmmuleelab's picture
Restructure code/analysis/ into scRNA-seq_code/ and Bulk-code/ subdirectories
8ff1c51 verified
|
Raw History Blame Contribute Delete
5.6 kB

P2M.db Analysis Code

  • analysis/: complete analysis scripts partitioned into scRNA-seq_code/ and Bulk-code/, documentation and MIT license.
  • validation/: matrix QC, five-cohort annotation comparisons, marker checks and manuscript figures.
  • validation/parameters.csv: shared workflow settings; recorded accession-specific settings remain in each dataset directory.
  • read_data.R: example for reading expression data and specimen metadata.
  • parameters.py: general formatter for processing_parameters.csv parameter group tables.
  • export_expression.R: general export utility for RDS expression matrices and metadata.

Read the data

Requires R and SeuratObject.

Rscript code/read_data.R scRNA-seq/GSE264205/GSE264205.rds
Rscript code/read_data.R bulk/GSE205209/expression.rds

For a bulk object containing multiple matrices, supply an exact matrix name as argument 2. If sample IDs recur across platforms, supply the platform as argument 3. The single-cell example uses specimen_role to select tumor tissue. Malignant ascites, other fluid specimens, normal and unresolved roles are excluded even when their coarse sample_class is Metastasis. Bulk selections use the recorded specimen class. TCGA clinical M0/M1 is distinct from specimen class. Annotation methods remain independent. Inspect the cohort metadata and comparison definitions before analysis.

Analysis scripts

Analysis pipelines are partitioned into dedicated subdirectories under analysis/:

Single-cell RNA-seq scripts (analysis/scRNA-seq_code/)

All single-cell analysis and downstream formatting scripts are organized under code/analysis/scRNA-seq_code/:

  • single_cell.R: original single-cell pipeline (QC, normalization, Harmony integration, SingleR annotation, CellChat, Monocle3, clusterProfiler).
  • single_cell_analysis.R: multi-stage comparative analysis pipeline for added single-cell cohorts.
    Rscript code/analysis/scRNA-seq_code/single_cell_analysis.R GSE203067 prepare
    
  • annotate_single.R: automated and reference-based cell annotation using SingleR and scType marker scoring.
    Rscript code/analysis/scRNA-seq_code/annotate_single.R GSE203067
    
  • doublets.py: DoubletDetection wrapper script for identifying doublet cells.
    python code/analysis/scRNA-seq_code/doublets.py
    
  • format_deg.R: cell-type differential expression table formatting.
  • format_enrichment.R: cell-type functional enrichment table formatting.
  • format_gene_singler.R: SingleR cell-type marker expression matrix formatting.
  • format_gene_sctype.R: scType cell-type marker expression matrix formatting.

Bulk transcriptome scripts (analysis/Bulk-code/)

All bulk transcriptome analysis and preprocessing pipelines are organized under code/analysis/Bulk-code/:

  • bulk_geo.R: bulk GEO microarray and RNA-seq analysis pipeline (limma, GEOquery).
  • bulk_tcga.R: bulk TCGA pan-cancer primary-versus-metastasis processing pipeline.
  • bulk_counts.R: author count matrix ingestion, QC, and packaging into standardized RDS objects.
    Rscript code/analysis/Bulk-code/bulk_counts.R INPUT_DIR OUTPUT_DIR GSE317536 package
    

General utilities (top-level code/)

Top-level general dataset utilities, shared databases, and benchmark code remain at the code/ root:

  • read_data.R: example for reading expression matrices and specimen metadata.
  • parameters.py: parameter table group formatter.
  • export_expression.R: expression matrix export utility.
    Rscript code/export_expression.R scRNA-seq/GSE264205/GSE264205.rds OUTPUT_DIR
    
  • resources/: reference gene sets and marker databases.
  • validation/: benchmark validation, quality control, and paper figure code.

Source: https://github.com/bigdata-lrkai/P2M.Rcode Commit: 11530593102b06d74ad7199a940adcbb234015f1. Script filenames have been standardized; their contents and license are preserved. The original scripts retain historical paths, manual grouping and known formatting limitations. Code availability does not certify that all historical analyses were rerun. All files can be downloaded independently from Hugging Face.

Parameter table format

Each accession's processing_parameters.csv has two columns, function and parameters, with one function per row. The formatter preserves individual values and can read either the original three-column layout or the grouped layout.

python code/parameters.py --group INPUT.csv OUTPUT.csv

Requires Python 3 and the standard library. The output must not already exist. Functions marked (workflow reference) describe the original workflow rather than recovered accession-specific execution logs. Recorded values take precedence.

TCGA survival analyses

Overall-survival inputs, all tested gene models and model diagnostics for 18 TCGA cohorts are provided in each bulk/TCGA_*/survival/ directory; the combined gene results are in analysis/survival.csv.gz. Death and last-follow-up times are retained, with one tumor profile per patient. Analyses use clinical M0/M1 groups, which are distinct from specimen tissue origin. Nominal and BH-adjusted Cox P values and proportional-hazards diagnostics are reported separately. Website Kaplan-Meier curves use a median expression split and a log-rank test.

The current survival workflow is in validation/survival/. GEO survival files retain their source-specific endpoints and historical subsets; the TCGA update does not assert that those GEO analyses were reproduced.