# New Frankenplot quick-start
## Dependencies
The new Frankenplot has been developed using R 4.2.1 and depends on (recent versions of) these R packages:
```
getopt
stringr
VariantAnnotation
data.table
GenomicRanges
BSgenome.Hsapiens.UCSC.hg19
BSgenome
Repitools
org.Hs.eg.db
TxDb.Hsapiens.UCSC.hg19.knownGene
csaw
ggplot2
ggrepel
patchwork
```
## Code
The new frankenplot consists of one R-script and one Rmarkdown script. Both are available in `autoseq_snakemake/pipeline/scipts` in the `new-frankenplot` branch.
### frankenscript.R
This is the main R script to be used in the pipeline, very similarly to the current `liqbioCNA_Interactive_plots.R` script. The last few arguments are not used in the new script, and 2 new ones are added:
```
# (from frankenscript.R)
args <- rbind(
c("frankenplot_Rmd", NA, 1, "character", "path to frankenplot.Rmd script"), # added
c("output", NA, 1, "character", "output html file including directory"), # added
c("tumor_cnr", NA, 1, "character", "tumor bin file from CNVkit"),
c("tumor_cns", NA, 1, "character", "tumor segment file from CNVkit"),
c("normal_cnr", NA, 2, "character", "normal bin file from CNVkit"),
c("normal_cns", NA, 2, "character", "normal segment file from CNVkit"),
c("het_snps_vcf", NA, 1, "character", "heterozygous SNPs .vcf file"),
c("purecn_csv", NA, 1, "character", "PureCN result .csv file"),
c("purecn_genes_csv", NA, 1, "character", "PureCN result _genes.csv"),
c("purecn_loh_csv", NA, 1, "character", "PureCN result _loh.csv"),
c("purecn_variants_csv", NA, 1, "character", "PureCN result _variants.csv"),
c("svcaller_T_DEL", NA, 1, "character", "Tumor SV caller DEL-events.gtf"),
c("svcaller_T_DUP", NA, 1, "character", "Tumor SV caller DUP-events.gtf"),
c("svcaller_T_INV", NA, 1, "character", "Tumor SV caller INV-events.gtf"),
c("svcaller_T_TRA", NA, 1, "character", "Tumor SV caller TRA-events.gtf"),
c("svcaller_N_DEL", NA, 2, "character", "Normal SV caller DEL-events.gtf"),
c("svcaller_N_DUP", NA, 2, "character", "Normal SV caller DUP-events.gtf"),
c("svcaller_N_INV", NA, 2, "character", "Normal SV caller INV-events.gtf"),
c("svcaller_N_TRA", NA, 2, "character", "Normal SV caller TRA-events.gtf"),
c("germline_mut_vcf", NA, 2, "character", "germline mutation vcf file"),
c("somatic_mut_vcf", NA, 1, "character", "somatic mutation vcf file")#,
# c("plot_png", NA, 1, "character", "plot .png file name"), # removed
# c("plot_png_normal", NA, 1, "character", "normal CNV plot .png file name"), # removed
# c("cna_json", NA, 1, "character", "CNA output json file name"), # removed
# c("purity_json", NA, 1, "character", "purity output json file name"), # removed
# c("gene_track", NA, 1, "character", "gene_track csv file name") # removed
)
```
### Tumor-only pipeline
To run as tumor-only, just omit the arguments related to the matched normal, inlcuding `normal_cnr`,`normal_cns`,`svcaller_N_*` and `germline_mut_vcf`.
### frankenplot.Rmd
The `frankenscript.R` script calls `frankenplot.Rmd` to generate the result in a .html document, allowing the entire loaded workspace to be available to the Rmarkdown script. The output directory is also used for temporary files, which are then removed by Rmarkdown.
```
# (from frankenscript.R)
rmarkdown::render(
input = opts$frankenplot_Rmd,
output_file = opts$output,
envir = parent.frame()
)
```