File size: 5,597 Bytes
0f8afe0
2f6f3d5
8ff1c51
dc7a70d
 
0f8afe0
8ff1c51
 
2f6f3d5
0f8afe0
 
 
2f6f3d5
 
0f8afe0
 
2f6f3d5
 
0f8afe0
 
3d163e2
0f8afe0
 
 
 
 
8ff1c51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0f8afe0
 
 
 
 
 
 
d78534d
 
 
 
 
 
 
 
 
 
 
 
 
 
0bff91b
 
 
 
 
 
 
 
 
 
 
 
8ff1c51
0bff91b
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# P2M.db Analysis Code

- `analysis/`: complete analysis scripts partitioned into `scRNA-seq_code/` and `Bulk-code/`, documentation and MIT license.
- [validation/](validation/): matrix QC, five-cohort annotation comparisons, marker checks and manuscript figures.
- [validation/parameters.csv](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.

```sh
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.
  ```sh
  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.
  ```sh
  Rscript code/analysis/scRNA-seq_code/annotate_single.R GSE203067
  ```
- `doublets.py`: DoubletDetection wrapper script for identifying doublet cells.
  ```sh
  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.
  ```sh
  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.
  ```sh
  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.

```sh
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/`](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.