### Install Python Setuptools and Wheel
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Installs setuptools and wheel, which are essential for building and distributing Python packages.
```bash
pip install setuptools wheel
```
--------------------------------
### Install Recommended Python Libraries
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Installs specific recommended versions of pandas, scipy, and matplotlib.
```bash
pip install pandas==0.19.2 scipy==1.0.0 matplotlib==2.0.0
```
--------------------------------
### Start PhylogicNDT Docker Container
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Starts an interactive Docker container for PhylogicNDT and navigates into its directory.
```bash
docker run -i -t phylogicndt
cd phylogicndt
```
--------------------------------
### Install Logsumexp for Faster Compute
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Installs the logsumexp package from GitHub for potentially faster computation.
```bash
pip install -e git+https://github.com/rmcgibbo/logsumexp.git#egg=sselogsumexp
```
--------------------------------
### Get PhylogicSim Help
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Use this command to view all available options and help information for the PhylogicSim module.
```bash
./PhylogicNDT.py PhylogicSim --help
```
--------------------------------
### Clone PhylogicNDT Repository
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Clone the PhylogicNDT repository from GitHub to start the installation process.
```bash
git clone https://github.com/broadinstitute/PhylogicNDT.git
cd PhylogicNDT
```
--------------------------------
### Install PhylogicNDT Requirements
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Installs all Python package dependencies listed in the 'req' file.
```bash
pip install -r req
```
--------------------------------
### Install Python Packages (Debian)
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Installs Python 2.7, R, and necessary system packages on Debian-based systems for manual installation.
```bash
apt-get install python-pip build-essential python-dev r-base r-base-dev git graphviz libgraphviz-dev
```
--------------------------------
### Run PhylogicNDT Cluster with Sample Data
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-Example.ipynb
Executes the PhylogicNDT.py Cluster module, specifying individual sample data directly via the -s argument. Each -s argument defines sample ID, MAF file, purity, and timepoint. This example demonstrates how to input multiple samples.
```bash
#!/bin/bash
./PhylogicNDT.py Cluster -i Test_Clust -s sample_00:MySimulation_0.txt::0.7:0 -s sample_01:MySimulation_1.txt::0.7:1 -s sample_02:MySimulation_2.txt::0.7:2 -s sample_03:MySimulation_3.txt::0.7:3
```
--------------------------------
### Display PhylogicSim Help
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-PhylogicSim.ipynb
Use this command to display all available command-line arguments and their descriptions for the PhylogicSim module. This is useful for understanding the various simulation parameters.
```bash
!./PhylogicNDT.py PhylogicSim --help
```
--------------------------------
### Run PhylogicNDT Clustering with Sample Info
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the Clustering module, specifying sample information directly.
```bash
./PhylogicNDT.py Cluster -i Patient_ID -s Sample1_id:Sample1_maf:Sample1_CN_seg:Sample1_Purity:Sample1_Timepoint -s Sample2_id:Sample2_maf:Sample2_CN_seg:Sample2_Purity:Sample2_Timepoint ... SampleN_info
```
--------------------------------
### Run PhylogicSim with Default Parameters
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Execute the simulation module with its default settings. This is a basic run without any specific configurations.
```bash
./PhylogicNDT.py PhylogicSim
```
--------------------------------
### Example Mutation Data Structure
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
This JSON-like structure represents mutation data, including reference and alternative read counts, CCF (cellular cross-fraction), chromosome, and position. It's used for visualizing and analyzing somatic mutations.
```json
{"chr18:13213393:A:T": {"ref_cnt": ["0", "3", "4", "13"], "ccf_hat": [0.09, 0.17, 0.16, 0.52], "alt_cnt": ["0", "3", "4", "13"], "chrom": "chr18", "pos": "13213393"}, "chr1:189508346:A:T": {"ref_cnt": ["17", "92", "36", "18"], "ccf_hat": [0.29, 0.03, 0.14, 0.65], "alt_cnt": ["0", "0", "0", "4"], "chrom": "chr1", "pos": "189508346"}, "chr5:105791975:A:T": {"ref_cnt": ["103", "83", "141", "219"], "ccf_hat": [0.08, 0.11, 0.3, 0.63], "alt_cnt": ["0", "1", "5", "27"], "chrom": "chr5", "pos": "105791975"}, "chr19:37085998:A:T": {"ref_cnt": ["37", "43", "25", "15"], "ccf_hat": [0.16, 0.13, 0.19, 0.61], "alt_cnt": ["0", "1", "0", "3"], "chrom": "chr19", "pos": "37085998"}, "chr4:13768761:A:T": {"ref_cnt": ["154", "111", "83", "117"], "ccf_hat": [0.02, 0.02, 0.24, 0.73], "alt_cnt": ["0", "0", "5", "41"], "chrom": "chr4", "pos": "13768761"}, "chr5:142128037:A:T": {"ref_cnt": ["168", "120", "123", "51"], "ccf_hat": [0.04, 0.08, 0.12, 0.76], "alt_cnt": ["0", "1", "1", "9"], "chrom": "chr5", "pos": "142128037"}, "chr4:109006791:A:T": {"ref_cnt": ["83", "53", "117", "99"], "ccf_hat": [0.04, 0.04, 0.18, 0.6], "alt_cnt": ["0", "0", "5", "26"], "chrom": "chr4", "pos": "109006791"}, "chr10:125649324:A:T": {"ref_cnt": ["140", "179", "124", "151"], "ccf_hat": [0.05, 0.05, 0.28, 0.65], "alt_cnt": ["0", "1", "4", "19"], "chrom": "chr10", "pos": "125649324"}, "chr1:61872286:A:T": {"ref_cnt": ["24", "32", "37", "25"], "ccf_hat": [0.23, 0.08, 0.13, 0.73], "alt_cnt": ["0", "0", "0", "7"], "chrom": "chr1", "pos": "61872286"}, "chr11:39379914:A:T": {"ref_cnt": ["17", "20", "26", "33"], "ccf_hat": [0.29, 0.13, 0.35, 0.77], "alt_cnt": ["0", "0", "1", "10"], "chrom": "chr11", "pos": "39379914"}, "chr18:37378724:A:T": {"ref_cnt": ["204", "217", "42", "118"], "ccf_hat": [0.06, 0.04, 0.24, 0.75], "alt_cnt": ["2", "3", "2", "43"], "chrom": "chr18", "pos": "37378724"}, "chr5:11911058:A:T": {"ref_cnt": ["179", "336", "95", "209"], "ccf_hat": [0.04, 0.06, 0.15, 0.81], "alt_cnt": ["0", "3", "1", "36"], "chrom": "chr5", "pos": "11911058"}, "chr8:131534148:A:T": {"ref_cnt": ["20", "61", "43", "38"], "ccf_hat": [0.26, 0.09, 0.34, 0.73], "alt_cnt": ["0", "1", "2", "10"], "chrom": "chr8", "pos": "131534148"}, "chr19:43375509:A:T": {"ref_cnt": ["38", "57", "29", "37"], "ccf_hat": [0.16, 0.04, 0.32, 0.86], "alt_cnt": ["0", "0", "1", "15"], "chrom": "chr19", "pos": "43375509"}, "chr5:82474821:A:T": {"ref_cnt": ["99", "145", "77", "38"], "ccf_hat": [0.02, 0.11, 0.25, 0.73], "alt_cnt": ["0", "9", "8", "24"], "chrom": "chr5", "pos": "82474821"}, "chr17:51719439:A:T": {"ref_cnt": ["142", "142", "142", "133"], "ccf_hat": [0.05, 0.02, 0.34, 0.62], "alt_cnt": ["0", "0", "7", "20"], "chrom": "chr17", "pos": "51719439"}}
```
--------------------------------
### List Output Files
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-PhylogicSim.ipynb
This command lists all files generated by the simulation. Understanding these files is crucial for further analysis, including input for clustering modules and detailed parameter checks.
```bash
ls
```
--------------------------------
### Display PhylogicNDT Help
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-Example.ipynb
Run the PhylogicNDT script with the --help flag to display available tools and their arguments.
```bash
!./PhylogicNDT.py --help
```
--------------------------------
### Create Sample Name Table Widget
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes a jQuery UI widget for displaying a table of sample names, aliases, and pie plots. Requires sample data and column definitions.
```javascript
$(function() { $.widget("PhylogicNDT_report.sample_name_table", {
options: {
columns: [],
sample_names: [],
sample_aliases: [],
sample_dates: [],
pie_plots: []
},
_create: function() {
let columns = this.options.columns;
let table = d3.select(this.element.context).append("table")
.attr("class", "table table-bordered hover");
table.append("thead")
.selectAll("td")
.data(columns)
.join("td")
.attr("style", "font-weight:bold; font-size: 12px")
.html(d => d);
table.append("tbody")
.selectAll("tr")
.data(this.options.sample_names)
.join("tr")
.attr("style", "font-size: 12px; cursor: pointer;")
.attr("class", "active-sample")
.attr("onclick", "$(\"#sample-name-table\").sample_name_table(\"toggle_sample\", this)")
.html((d, i) => "
" + d + " | " + (this.options.sample_aliases.length ? "" + this.options.sample_aliases[i] + " | " : "") + (this.options.sample_dates.length ? "" + this.options.sample_dates[i] + " | " : "") + "
| ");
},
toggle_sample: function(row) {
if (row.className === "active-sample") {
row.className = "removed-sample";
} else {
row.className = "active-sample"
}
}
});
$("#sample-name-table").sample_name_table({"sample_aliases": ["T0", "T1", "T2", "T3"], "pie_plots": ["iVBORw0KGgoAAAANSUhEUgAAAGoAAABqCAYAAABUIcSXAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAPYQAAD2EBqD+naQAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi40LCBodHRwOi8vbWF0cGxvdGxpYi5vcmcv7US4rQAACuFJREFUeJztnW1sW9UZx3/XebMdp4mTponbJC1t2hraqdCOsbEOVBATaNPYOtg0GKwwxuADr5YmjU5IkwqTGF6BTWyDsZVuIDSN8mGjaJsGA42XaWs6Ck3dUvJCmrh5jxMndq5f7j74Fl3f2CGpz7XvTe9P8ofz3OPzHPvvc+7xuec8R1IUBRvz4yh1BWwWhi2URbCFsgi2UBbBFsoi2EJZBFsoi2ALZRFsoSyCLZRFsIWyCLZQFsEWyiLYQlkEWyiLUF7qChSKP+hrBrYCrYATcAGVgAzEgDjQB3SEAuHTpapnoUhWenDoD/p8wDbda+UiihgADmlfoUA4LLqeRmB6ofxBXwNwI7ALuMgAF4eBfcBzoUB41IDyhWBaofxB36eBALCTTFdmNDJwAAiGAuH/FsHfojCdUP6g74vAbuCyheSXpArcrjW4XetwudqQpMxtV1HSpFJREslJEokxotFOEsmxhVbjDWBPKBD++9l8BiMwjVD+oM8LPA7cNF++Gs8WGup34KneMEecT2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eOQtunp+ZpTLonL85I+ITP5Hb/6eUdFbDH1gpIb3fFZr6+t/mtODB/K8wxr09j3J4NCcP/P7QoHwQaN8FuPJ3r2QvVTh+AcPMDr2zyK4Fs/Q8Mt0986JptNP5nMahuFCqV3BTWhmLBRSHA3dxfjEW0a7F8r4xNuETvxAb5bJhC+N5HiLMIryrFwNkfZtMvHtAEin4xx5/1b6+nMGLDQd4cEXOXL0VtLZIeBSZMKWGh5jttgRML8L/EZvX9H4FTa27zHlCltFSdLVs5e+/qdyXV56ETDPoIr1FLrW7Km+gE3n/wKXszX3G0vA7OxpOo/fn2t0lyITC/23xapLqaI0X0dmpj1rSVx5eR3tax+gqfHakq5gUpQkpwcP0NXzKInkuP6yDNwQCoRfLGadSh33fD+ZoIRZeKo30b72AepqP1PUOilKmuGRg3T3Pp7vZIFzK+75GdSYfnvJE4+hrvYSVrfeibfu84bXZWTsVbp79zI9HcqXZR9w3zl3koAWNXLkU+Q5m8NTfQHLG66ioX4HNXM3M581sXgfwyN/ZWj4z0SnO/Nls8/m0KK2rseBm+fLV1nZREP9Dhrqd+CtvSTXpr
```
--------------------------------
### Run PhylogicSim with a Purity File
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Provide a TSV file to specify the purity of each sample individually. If not provided, purity is set for all samples using the -p flag. The file can optionally include columns for alpha, beta, and N values for coverage betabinomial, otherwise these are set by -ap, -b, and -nb flags.
```bash
./PhylogicNDT.py PhylogicSim -i MySimulation -nodes 5 -clust_file /Example_Clust_File.txt -pfile /Example_PurityFile.txt
```
--------------------------------
### Run PhylogicNDT Help Command
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Displays the help message for the PhylogicNDT command-line interface.
```bash
./PhylogicNDT.py --help
```
--------------------------------
### Build PhylogicNDT Docker Image
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Builds a Docker image tagged as 'phylogicndt' from the current directory.
```bash
docker build --tag phylogicndt .
```
--------------------------------
### Initialize Cluster Switches with Data
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes the cluster switches component with provided cluster data. This sets up the initial state for cluster selection and interaction.
```javascript
$("#cluster-switches").cluster_switches({"cluster_dict": {"1": {"ccf_hat": [0.97, 0.99, 0.93, 0.97], "tumor_abundance": [0.98, 1.0, 0.92, 0.97], "ccf_high": [1.0, 1.0, 0.98, 1.0], "color": "rgb(39,140,24)", "drivers": [], "ccf_low": [0.94, 0.97, 0.88, 0.94], "muts": {"chr1:203116592:A:T": {"ref_cnt": ["38", "41", "35", "20"], "ccf_hat": [0.87, 0.9, 0.84, 0.78], "alt_cnt": ["11", "24", "10", "7"], "chrom": "chr1", "pos": "203116592"}, "chr6:54069115:A:T": {"ref_cnt": ["72", "22", "39", "43"], "ccf_hat": [0.84, 0.91, 0.9, 0.89], "alt_cnt": ["16", "27", "17", "27"], "chrom": "chr6", "pos": "54069115"}, "chr6:31180141:A:T": {"ref_cnt": ["42", "20", "77", "28"], "ccf_hat": [0.86, 0.94, 0.81, 0.88], "alt_cnt": ["12", "30", "19", "19"], "chrom": "chr6", "pos": "31180141"}, "chr16:12137783:A:T": {"ref_cnt": ["155", "108", "123", "115"], "ccf_hat": [0.86, 0.95, 0.9, 0.83], "alt_cnt": ["42", "79", "44", "49"], "chrom": "chr16", "pos": "12137783"}, "chr4:12358155:A:T": {"ref_cnt": ["117", "79", "128", "132"], "ccf_hat": [0.83, 0.93, 0.69, 0.76], "alt_cnt": ["15", "29", "13", "21"], "chrom": "chr4", "pos": "12358155"}, "chr5:39128627:A:T": {"ref_cnt": ["80", "75", "117", "42"], "ccf_hat": [0.76, 0.94, 0.91, 0.73], "alt_cnt": ["9", "30", "24", "7"], "chrom": "chr5", "pos": "39128627"}, "chr6:1417608:A:T": {"ref_cnt": ["48", "39", "70", "48"], "ccf_hat": [0.77, 0.87, 0.82, 0.93], "alt_cnt": ["9", "35", "18", "35"], "chrom": "chr6"}}}
```
--------------------------------
### Run PhylogicNDT Clustering with SIF File
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the Clustering module using a sample information file (.sif) for input.
```bash
./PhylogicNDT.py Cluster -i Patient_ID -sif Patient.sif
```
--------------------------------
### Run PhylogicSim with Custom Output Prefix
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Specify a custom prefix for all output files generated by the simulation. This helps in organizing simulation results.
```bash
./PhylogicNDT.py PhylogicSim -i MySimulation
```
--------------------------------
### Run PhylogicNDT LeagueModel with Comparison Files
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the LeagueModel module using a cohort name and multiple comparison files.
```bash
./PhylogicNDT.py LeagueModel -cohort Cohort -comps comp1 comp2 ... compN
```
--------------------------------
### PhylogicNDT Cluster Module Help
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-Example.ipynb
Displays the help message for the PhylogicNDT.py Cluster module, outlining all available optional arguments and their descriptions. Use this to understand the parameters for clustering.
```bash
#!/bin/bash
./PhylogicNDT.py Cluster --help
```
--------------------------------
### Run PhylogicNDT BuildTree
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the BuildTree module, requiring individual ID, sample information file, mutation CCF file, and cluster CCF file.
```bash
./PhylogicNDT.py BuildTree -i Indiv_ID -sif Patient.sif -m mutation_ccf_file -c cluster_ccf_file
```
--------------------------------
### Run PhylogicSim with Default Values
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-PhylogicSim.ipynb
Execute the PhylogicSim module with default parameters. The '-i' argument specifies a prefix for all output files generated during the simulation.
```bash
#Run the command with the default values
!./PhylogicNDT.py PhylogicSim -i MySimulation
```
--------------------------------
### Run PhylogicNDT GrowthKinetics
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the GrowthKinetics module, specifying tumor burden and time points. Tumor burden and time are required when rates are desired.
```bash
./PhylogicNDT.py GrowthKinetics -i Indiv_ID -sif Patient.sif -ab cell_population_abundance_mcmc_trace -w 10 10 10 10 10 -t 1 2 3 4 5
```
--------------------------------
### Initialize and Render Phylogenetic Tree
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes the phylogenetic tree visualization by setting up SVG elements, calculating coordinates, and rendering branch labels. This code is typically run once to set up the initial view.
```javascript
let svg_tree = d3.select("#tree").append("svg").attr("width", 800).attr("height", 600);
let node = svg_tree.append("g").attr("id", "nodes");
let link = svg_tree.append("g").attr("id", "links");
let branch_label_cont = svg_tree.append("g"), branch_trunc_labels = {}, branch_full_labels = {};
for (let e in edges) {
let edge = edges[e],
cnvs = Object.keys(cluster_dict[edge[1]].muts).filter(m => m.startsWith("loss") || m.startsWith("gain") || m === "WGD"),
branch_height = Math.abs(tree_coordinates[edge[0]][1] - tree_coordinates[edge[1]][1]),
n_labels = Math.max(4, branch_height / 10 - 2),
label_list = [Object.keys(cluster_dict[edge[1]].muts).length, ...cluster_dict[edge[1]].drivers, ...cnvs],
truncate = label_list.length > n_labels + 1,
trunc_labels = truncate ? [...label_list.slice(0, n_labels), "..."] : label_list;
branch_trunc_labels[edge[1]] = (trunc_labels);
branch_full_labels[edge[1]] = (label_list);
branch_label_cont.append("text")
.attr("y", (tree_coordinates[edge[0]][1] + tree_coordinates[edge[1]][1]) / 2 - (5 * (trunc_labels.length)))
.attr("text-anchor", "middle")
.attr("font-size", 10)
.attr("font-weight", "bold")
.attr("parent", edge[0])
.attr("child", edge[1])
.selectAll("tspan")
.data(trunc_labels)
.join("tspan")
.attr("x", (tree_coordinates[edge[0]][0] + tree_coordinates[edge[1]][0]) / 2)
.attr("dy", 10)
.attr("onclick", d => d === "..." ? $(\"#tree\").tree(\"expand\", this)" : "")
.attr("style", d => d === "..." ? "cursor: pointer;" : "")
.text((d, i) => i ? d : "(" + d + ")");
}
let x_values = Object.values(tree_coordinates).map(p => p[0]),
y_values = Object.values(tree_coordinates).map(p => p[1]),
x_min = Math.min(...x_values),
x_max = Math.max(...x_values),
y_min = Math.min(...y_values),
y_max = Math.max(...y_values),
view_x_min = x_max - x_min > 300 ? x_min - 50 : (x_min + x_max) / 2 - 200,
view_y_min = y_max - y_min > 400 ? y_min - 50 : (y_min + y_max) / 2 - 250,
view_width = x_max - x_min > 300 ? x_max - x_min + 100 : 400,
view_height = y_max - y_min > 400 ? y_max - y_min + 100 : 500;
svg_tree.attr("viewBox", [view_x_min, view_y_min, view_width, view_height].join(","));
this._elements.svg_tree = svg_tree.node();
this._elements.branch_full_labels = branch_full_labels;
this._elements.branch_trunc_labels = branch_trunc_labels;
this._refresh();
```
--------------------------------
### Run PhylogicSim with a Segment File
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Use a segment file to specify copy number values for sampling. If no file is provided, a built-in CN profile based on hg19 contigs is used. Refer to 'Example_SegFile.txt' for the required format.
```bash
./PhylogicNDT.py PhylogicSim -i MySimulation -nodes 5 -seg /Example_SegFile.txt
```
--------------------------------
### Run PhylogicNDT Cluster with BuildTree
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the Clustering module and integrates it with the BuildTree module using the -rb flag.
```bash
./PhylogicNDT.py Cluster -i Patient_ID -sif Patient.sif -rb
```
--------------------------------
### Run PhylogicNDT LeagueModel with Aggregated Table
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the LeagueModel module using a cohort name and a single aggregated comparison table.
```bash
./PhylogicNDT.py LeagueModel -cohort Cohort -comparison_cn comps
```
--------------------------------
### Run PhylogicNDT Clustering Module
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-Example.ipynb
This code snippet demonstrates how to initiate the clustering module within PhylogicNDT. It involves processing sample data and adding mutations.
```python
INFO:root:Present in blacklist: 0
INFO:root:Added sample sample_01
INFO:root:Adding Mutations from Sample: sample_02
```
--------------------------------
### Run PhylogicSim with Specified Number of Samples
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Control the number of samples to be simulated. This parameter is essential for defining the scale of the simulation.
```bash
./PhylogicNDT.py PhylogicSim -i MySimulation -ns 7
```
--------------------------------
### Run PhylogicNDT Clustering with Iterations
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the Clustering module with a specified number of iterations.
```bash
./PhylogicNDT.py Cluster -ni 1000
```
--------------------------------
### jQuery Plugin Initialization for Mutation Visualization
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes the mutation visualization plugin on a DOM element with specific cluster data. The 'cluster_dict' object contains detailed information about each cluster, including CCF values, colors, drivers, and mutations.
```javascript
$("#mutation-visual").mutation_visual({"cluster_dict": {"1": {"ccf_hat": [0.97, 0.99, 0.93, 0.97], "tumor_abundance": [0.98, 1.0, 0.92, 0.97], "ccf_high": [1.0, 1.0, 0.98, 1.0], "color": "rgb(39,140,24)", "drivers": [], "ccf_low": [0.94, 0.97, 0.88, 0.94], "muts": {"chr1:203116592:A:T": {"ref_cnt": ["38", "41", "35", "20"], "ccf_hat": [0.87, 0.9, 0.84, 0.78], "alt_cnt": ["11", "24", "10", "7"], "chrom": "chr1", "pos": "203116592"}, "chr6:54069115:A:T": {"ref_cnt": ["72", "22", "39", "43"], "ccf_hat": [0.84, 0.91, 0.9, 0.89], "alt_cnt": ["16", "27", "17", "27"], "chrom": "chr6", "pos": "54069115"}, "chr6:31180141:A:T": {"ref_cnt": ["42", "20", "77", "28"], "ccf_hat": [0.86, 0.94, 0.81, 0.88], "alt_cnt": ["12", "30", "19", "19"], "chrom": "chr6", "pos": "31180141"}, "chr16:12137783:A:T": {"ref_cnt": ["155", "108", "123", "115"], "ccf_hat": [0.86, 0.95, 0.9, 0.83], "alt_cnt": ["42", "79", "44", "49"], "chrom": "chr16", "pos": "12137783"}, "chr4:12358155:A:T": {"ref_cnt": ["117", "79", "128", "132"], "ccf_hat": [0.83, 0.93, 0.69, 0.76], "alt_cnt": ["15", "29", "13", "21"], "chrom": "chr4", "pos": "12358155"}, "chr5:39128627:A:T": {"ref_cnt": ["80", "75", "117", "42"], "ccf_hat": [0.76, 0.94, 0.91, 0.73], "alt_cnt":
```
--------------------------------
### Run PhylogicNDT SinglePatientTiming
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Runs the SinglePatientTiming module, requiring individual ID and a sample information file.
```bash
./PhylogicNDT.py Timing -i Indiv_ID -sif Patient.sif
```
--------------------------------
### Run PhylogicSim with Specified Number of Clones
Source: https://github.com/broadinstitute/phylogicndt/blob/master/README.md
Define the number of distinct clones present in the simulated samples. A minimum of 2 clones is required, with the first always being the clonal clone.
```bash
./PhylogicNDT.py PhylogicSim -i MySimulation -nodes 5
```
--------------------------------
### Display Simulation Plot
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/PhylogicNDT-Example.ipynb
Display the generated plot image from the simulation. Ensure the image file exists in the current directory.
```python
Image(filename='MySimulation_plot.png')
```
--------------------------------
### Initialize Tree Switch Widget
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes the tree switch widget if the 'tree_switch_options' variable is true. This widget likely controls a tree-based visualization.
```javascript
let tree_switch_options = false;
if (tree_switch_options) {
$("#tree-switch").tree_switch(tree_switch_options)
}
```
--------------------------------
### Mutation Plot Plugin Initialization
Source: https://github.com/broadinstitute/phylogicndt/blob/master/ExampleRuns/Example_ND.phylogic_report.html
Initializes the mutation plot jQuery plugin with provided cluster data. This code demonstrates how to instantiate the plot and pass configuration options.
```javascript
$("#mutation-plot").mutation_plot({"cluster_dict": {"1": {"ccf_hat": [0.97, 0.99, 0.93, 0.97], "tumor_abundance": [0.98, 1.0, 0.92, 0.97], "ccf_high": [1.0, 1.0, 0.98, 1.0], "color":
```