Skip to content

Commit 5496cd3

Browse files
committed
more formatting...
1 parent 8e21119 commit 5496cd3

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,36 +32,37 @@ Start by creating a simulator instance.
3232
simulator_environment <- initSimulator()
3333
simulator_obj <- simulator_environment$this
3434
api <- simulator_environment$api
35+
```
3536

36-
2. Set Reference Data
37+
### 2. Set Reference Data
3738
The simulator learns parameters from provided reference datasets.
38-
Reference Expression Matrices (exprmat): Used to estimate marginal distributions.
39-
Subject-level (sbj): For subject-level expression counts.
40-
Cell-level (cel): For individual cell expression counts.
41-
Cell Type Expression Profiles (cteprf): Defines mean expression per gene across cell types.
42-
Co-expression Programs (coexPrograms): Specifies gene groups that co-express and their correlation.
43-
Subject-level (sbj): For co-expression across subjects. Cell types sharing a program synchronize at the subject level.
44-
Cell-level (cel): For co-expression within individual cells.
45-
46-
3. Fit Marginal Distribution Models
39+
* **Reference Expression Matrices (exprmat): Used to estimate marginal distributions.
40+
* **Subject-level (sbj): For subject-level expression counts.
41+
* **Cell-level (cel): For individual cell expression counts.
42+
* **Cell Type Expression Profiles (cteprf): Defines mean expression per gene across cell types.
43+
* **Co-expression Programs (coexPrograms): Specifies gene groups that co-express and their correlation.
44+
* **Subject-level (sbj): For co-expression across subjects. Cell types sharing a program synchronize at the subject level.
45+
* **Cell-level (cel): For co-expression within individual cells.
46+
47+
### 3. Fit Marginal Distribution Models
4748
This step fits Gamma distribution models for each gene. A third-degree polynomial model (lm(variance ~ poly(mean, 3, raw = TRUE))) predicts variance from mean; residuals add variability.
4849
simulator_obj <- api$fitMds(simulator_obj)
4950

50-
4. Simulate Baseline Cells (Cell-Level Variability)
51+
### 4. Simulate Baseline Cells (Cell-Level Variability)
5152
This generates initial cell-level expression, incorporating cell-level co-expression. Internal private$utils$generateVals samples from Gamma distributions with co-expression.
5253
# nSubject: number of subjects; nCell: number of cells per subject per cell type
5354
simCells_output <- api$simBseLnCels(simulator_obj, nSubject = 10, nCell = 100)
5455

55-
5. Simulate Subject-Level Means (Subject-Level Variability)
56+
### 5. Simulate Subject-Level Means (Subject-Level Variability)
5657
This generates subject-level mean expression for each gene and cell type, including subject-level co-expression patterns. Internal private$utils$generateVals is used for sampling.
5758
# nSubject: number of subjects
5859
simSbjs_output <- api$simSbjLvMeans(simulator_obj, nSubject = 10)
5960

60-
6. Compute Combined Cell-Level Parameters
61+
### 6. Compute Combined Cell-Level Parameters
6162
Subject-level means adjust cell-level distribution models, creating unique cell-level Gamma distribution parameters for each gene, cell type, and subject. The original cell-level distribution's mean is adjusted while maintaining the relative variance (coefficient of variation, variance / mean) for each gene.
6263
cel_params_combined <- api$computeCelParams(simulator_obj, sbjLvMeans = simSbjs_output$simSbjs)
6364

64-
7. Convert Cell-Level Distributions to Final Expressions
65+
### 7. Convert Cell-Level Distributions to Final Expressions
6566
Baseline cells are transformed to reflect subject-level variability. This involves converting baseline cell expressions to p-values using their original Gamma distribution parameters, then transforming these p-values back into new expression values using the subject-specific cell-level parameters.
6667
final_exprmat_output <- api$convertCelLvDist(
6768
simCells = simCells_output$simCells,
@@ -70,7 +71,7 @@ final_exprmat_output <- api$convertCelLvDist(
7071
)
7172

7273
Additional Utility Function
73-
api$GENERATE_CC_SPECS(nBkSamples, nTotalCells, baselineProps, sdFrac): Generates cellular composition specifications. It produces a matrix specifying cell counts per cell type for subjects, using baselineProps (proportion of each cell type) and sdFrac (standard deviation fraction) for sampling from a normal distribution.
74+
* **api$GENERATE_CC_SPECS(nBkSamples, nTotalCells, baselineProps, sdFrac): Generates cellular composition specifications. It produces a matrix specifying cell counts per cell type for subjects, using baselineProps (proportion of each cell type) and sdFrac (standard deviation fraction) for sampling from a normal distribution.
7475
# Example: Generate specs for 5 subjects, 1000 total cells, with baseline proportions
7576
# baseline_props <- c(typeA = 0.5, typeB = 0.5)
7677
# cell_comp_specs <- api$GENERATE_CC_SPECS(nBkSamples = 5, nTotalCells = 1000, baselineProps = baseline_props, sdFrac = 0.1)

0 commit comments

Comments
 (0)