diff --git a/DESCRIPTION b/DESCRIPTION index c75b5c9..dfc9657 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -52,5 +52,5 @@ ByteCompile: true Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 VignetteBuilder: knitr diff --git a/NAMESPACE b/NAMESPACE index c12c891..9c37dd2 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,27 +6,6 @@ export(date_log) export(hrd_results_tabs) export(is_vcf) export(is_vcf_bpi) -export(linx_breakend_process) -export(linx_breakend_read) -export(linx_clusters_process) -export(linx_clusters_read) -export(linx_drivercatalog_process) -export(linx_drivercatalog_read) -export(linx_drivers_process) -export(linx_drivers_read) -export(linx_fusion_process) -export(linx_fusion_read) -export(linx_links_process) -export(linx_links_read) -export(linx_rmd) -export(linx_svs_process) -export(linx_svs_read) -export(linx_viscopynumber_read) -export(linx_visfusion_read) -export(linx_visgeneexon_read) -export(linx_visproteindomain_read) -export(linx_vissegments_read) -export(linx_vissvdata_read) export(mkdir) export(pkg_exists) export(plot_bnd_sr_pr_tot_hist) diff --git a/R/linx.R b/R/linx.R deleted file mode 100644 index 53bc94c..0000000 --- a/R/linx.R +++ /dev/null @@ -1,449 +0,0 @@ -LINX_DESCRIPTIONS <- tibble::tribble( - ~Table, ~Field, ~Type, ~Description, - "svs", "vcfId", "c", "ID of break junction for mapping to GRIDSS / PURPLE vcf", - "svs", "svId", "c", "ID of break junction", - "svs", "clusterId", "c", "ID of cluster which break junction is assigned to", - "svs", "clusterReason", "c", paste0( - "Reason for clustering and svId of clustered break ", - "junction for other break junction(s) to which the variant has been clustered" - ), - "svs", "fragileSiteStart", "c", "Start breakend of break junction is in a known fragile site (T/F)", - "svs", "fragileSiteEnd", "c", "End breakend of break junction is in a known fragile site (T/F)", - "svs", "isFoldback", "c", "Break junction is classified as a foldback (T/F)", - "svs", "lineTypeStart", "c", "Start breakend of break junction is in a known or suspected line source region", - "svs", "lineTypeEnd", "c", "End breakend of break junction is in a known or suspected line source region", - "svs", "junctionCopyNumberMin", "d", "Minimum bound JCN estimate for breakjunction", - "svs", "junctionCopyNumberMax", "d", "Maximum bound JCN estimate for breakjunction", - "svs", "geneStart", "c", "Gene(s) overlapping start breakend of SV", - "svs", "geneEnd", "c", "Gene(s) overlapping end breakend of SV", - # "svs", "replicationTimingStart", "d", ".", - # "svs", "replicationTimingEnd", "d", ".", - "svs", "localTopologyIdStart", "c", paste0( - "ID for group of proximate breakends to the ", - "start breakend of break junction within an extending 5kb window" - ), - "svs", "localTopologyIdEnd", "c", paste0( - "ID for group of proximate breakends to the end ", - "breakend of break junction within an extending 5kb window" - ), - "svs", "localTopologyStart", "c", paste0( - "Local breakend topology type at site of start breakend. ", - "[ISOLATED_BE, DSB, TI_ONLY, SIMPLE_DUP, FOLDBACK, FOLDBACK_DSB, ", - "SAME_ORIENT, COMPLEX_FOLDBACK, COMPLEX_LINE, COMPLEX_OTHER]" - ), - "svs", "localTopologyEnd", "c", paste0( - "Local breakend topology type at site of end breakend. ", - "[ISOLATED_BE, DSB, TI_ONLY, SIMPLE_DUP, FOLDBACK, FOLDBACK_DSB, ", - "SAME_ORIENT, COMPLEX_FOLDBACK, COMPLEX_LINE, COMPLEX_OTHER]" - ), - "svs", "localTICountStart", "d", "Number of chained templated insertions in local topology group of start breakend", - "svs", "localTICountEnd", "d", "Number of chained templated insertions in local topology group of end breakend", - "breakend", "id", "c", "Id of breakend annotation", - "breakend", "svId", "c", "Id of break junction", - "breakend", "isStart", "c", "Annotation relates to the start breakend of the break junction (1 = true,0 = false)", - "breakend", "gene", "c", "Gene annotated", - "breakend", "transcriptId", "c", "Ensembl stable transcript id of annotation", - "breakend", "canonical", "c", paste0( - "Transcript is the canonical transcript of the gene. ", - "Linx annotates 1 record for each canonical transcript ", - "overlapping the breakend + a record for any non-canonical ", - "transcript that is annotated as part of a fusion" - ), - "breakend", "geneOrientation", "c", paste0( - "Orientation which breakend points relative to the ", - "gene taking into account both gene strand and breakend orientation." - ), - "breakend", "disruptive", "c", "Breakend is part of a break junction which disrupts the exonic sequence of the transcript", - "breakend", "reportedDisruption", "c", "Breakend is disruptive and gene is flagged as reportable for disruption", - "breakend", "undisruptedCopyNumber", "d", paste0( - "Number of remaining wildtype alleles of the gene that ", - "are not disrupted by the breakend. If <0.5 then disruption is considered Homozygous" - ), - "breakend", "regionType", "c", paste0( - "Location of the breakend relative to the transcript. ", - "[UPSTREAM (within 100kb upstream of the 1st base of the transcript), INTRONIC, EXONIC]" - ), - "breakend", "codingType", "c", paste0( - "Location of the breakend relative to the coding context of the transcript. ", - "[CODING, NON_CODING, UTR_5P, UTR_3P, ENHANCER (IG enhancer rearrangements only)" - ), - "breakend", "biotype", "c", "Ensembl biotype of the transcript", - "breakend", "exonicBasePhase", "d", "If regionType = EXONIC, the exact base phase of the breakend, else -1", - "breakend", "nextSpliceExonRank", "d", paste0( - "The exon rank of the next splice acceptor (if gene ", - "orientation is 'DOWNSTREAM') or splice donor (if gene orientation is 'UPSTREAM')" - ), - "breakend", "nextSpliceExonPhase", "d", paste0( - "The phase of the 1st base after the next splice acceptor ", - "(if gene orientation is 'DOWNSTREAM') or splice donor (if gene orientation is 'UPSTREAM')" - ), - "breakend", "nextSpliceDistance", "d", "The distance in bases to the next splice site identified in nextSpliceExonRank", - "breakend", "totalExonCount", "d", "Total number of exons in the transcript", - "breakend", "type", "c", ".", - "breakend", "chromosome", "c", ".", - "breakend", "orientation", "c", ".", - "breakend", "strand", "c", ".", - "breakend", "chrBand", "c", ".", - "breakend", "exonUp", "d", ".", - "breakend", "exonDown", "d", ".", - "breakend", "junctionCopyNumber", "d", ".", - "clusters", "clusterId", "c", "Unique Id for the cluster", - "clusters", "category", "c", "High level categorisation of the cluster classification", - "clusters", "synthetic", "c", paste0( - "Set to TRUE if the cluster is resolved to a non complex ", - "type by simplification of a short templated insertion (<1kb)" - ), - "clusters", "resolvedType", "c", "Resolved classification of the cluster.", - "clusters", "clusterCount", "d", "The number of break junctions in the cluster", - "clusters", "clusterDesc", "c", "String containing the types and counts of break junctions in the cluster. eg. DEL=2_INV=2", - "links", "clusterId", "c", "Id of the cluster which contains the link", - "links", "chainId", "c", paste0( - "Id of the chain to which the link belongs representing a ", - "multi-segment prediction of the derivative chromosome" - ), - "links", "chainIndex", "c", paste0( - "Position of the linked segment in the chain. The predicted ", - "chain can be reconstructed by traversing each linked segment in order ie. 0,1,...,n" - ), - "links", "chainCount", "d", "Total count of linked segments in the chan", - "links", "lowerSvId", "c", "svId of the leftmost breakend of the linked segment", - "links", "upperSvId", "c", "svId of the rightmost breakend of the linked segment", - "links", "lowerBreakendIsStart", "c", "True if the lower breakend is the start breakend of the break junction", - "links", "upperBreakendIsStart", "c", "True if the right breakend is the start breakend of the break junction", - "links", "chromosome", "c", "Chromosome of the linked segment", - "links", "arm", "c", "Arm (P/Q) of the linked segment", - "links", "assembled", "c", "True if the segment is linked by a GRIDSS assembly", - "links", "traversedSVCount", "d", "The number of other breakends that are located on the linked segment", - "links", "length", "d", "Length of the linked segment", - "links", "junctionCopyNumber", "d", "Predicted copy number of the chain", - "links", "junctionCopyNumberUncertainty", "d", "Uncertainty in the copy number of the chain", - "links", "pseudogeneInfo", "c", paste0( - "If the segment precisely matches an exon of an ensembl gene, ", - "then contains details of the matching exon: {geneName;TranscriptId,ExonRank,ExonLength}" - ), - "links", "ecDna", "c", "True if the link is predicted to be part of a DM / ecDNA chain", - "fusion", "fivePrimeBreakendId", "c", "Id of the 5' breakend in the fusion", - "fusion", "threePrimeBreakendId", "c", "Id of the 3' breakend in the fusion", - "fusion", "name", "c", "Name of the fusion in the form 5'GENE_3'GENE", - "fusion", "reported", "c", "True if the fusion meets all reportable fusion criteria for Linx", - "fusion", "reportedType", "c", paste0( - "If one or both of the genes matches a promiscuous gene or known rearrangement ", - "in the HMF fusion knowledgebase, then the type of reportable gene pair: ", - "[KNOWN_PAIR, PROMISCUOUS_5, PROMISCUOUS_3, PROMISCUOUS_BOTH, EXON_DEL_DUP, ", - "IG_PROMISCUOUS, IG_KNOWN_PAIR, KNOWN_PAIR_UNMMABLE_3 or NONE (if no match is found)" - ), - "fusion", "reportableReasons", "c", "Reasons for given reportable status", - "fusion", "phased", "c", "Set to 1 if a phased fusion can be formed (after allowing for exon skipping)", - "fusion", "likelihood", "c", ".", - "fusion", "chainLength", "d", "0 for simple fusions. If fusion is chained equal to the total length of segments chained between 5' and 3' partners", - "fusion", "chainLinks", "d", "0 for simple fusions. If fusion is chained equal to the number of segments chained between 5' and 3' partners", - "fusion", "chainTerminated", "c", paste0( - "True if the fusion is interrupted either on the 5' partner ", - "side by a chained breakend prior to the start of the 5' gene ", - "or by a chained breakend prior to the last coding base of the 3' gene" - ), - "fusion", "domainsKept", "c", "List of 3' partner domains retained in fusion product (as annotated by PROSITE profiles)", - "fusion", "domainsLost", "c", "List of 3' partner domains lost in fusion product (as annotated by PROSITE profiles)", - "fusion", "skippedExonsUp", "d", "Count of splice donors required to be skipped on 5' partner side to form an inframe fusion.", - "fusion", "skippedExonsDown", "d", "Count of splice donors required to be skipped on 3' partner side to form an inframe fusion", - "fusion", "fusedExonUp", "d", "Last exon fused on 5' partner side", - "fusion", "fusedExonDown", "d", "First exon fused on 3' partner side", - "fusion", "geneStart", "c", ".", - "fusion", "geneContextStart", "c", ".", - "fusion", "transcriptStart", "c", ".", - "fusion", "geneEnd", "c", ".", - "fusion", "geneContextEnd", "c", ".", - "fusion", "transcriptEnd", "c", ".", - "fusion", "junctionCopyNumber", "d", ".", - "drivercatalog", "chromosome", "c", "Chromosome of gene", - "drivercatalog", "chromosomeBand", "c", "Chromosome band of driver", - "drivercatalog", "gene", "c", "Gene name", - "drivercatalog", "transcript", "c", "Transcript name", - "drivercatalog", "isCanonical", "c", "Is canonical", - "drivercatalog", "driver", "c", "Driver type [AMP, DEL, MUTATION]", - "drivercatalog", "category", "c", "Gene driver type [ONCO, TSG]", - "drivercatalog", "likelihoodMethod", "c", "Method used to determine likelihood [AMP, DEL, BIALLELIC, DNDS, HOTSPOT, INFRAME]", - "drivercatalog", "driverLikelihood", "d", "Likelihood that gene is a driver", - # "drivercatalog", "NA", "c", ".", - "drivercatalog", "missense", "d", "Number of missense variants in gene", - "drivercatalog", "nonsense", "d", "Number of nonsense variants in gene", - "drivercatalog", "splice", "d", "Number of splice variants in gene", - "drivercatalog", "inframe", "d", "Number of inframe variants in gene", - "drivercatalog", "frameshift", "d", "Number of frameshift variants in gene", - "drivercatalog", "biallelic", "c", "True if any variants in the gene are biallelic", - "drivercatalog", "minCopyNumber", "d", "Minimum copy number found in the gene exons", - "drivercatalog", "maxCopyNumber", "d", "Maximum copy number found in the gene exons", - "drivers", "clusterId", "c", "Id of cluster which break junction associated with driver. Set to -1 for ARM or CHR level events.", - "drivers", "gene", "c", "Gene of driver. Multiple clusters may be linked to a gene for a sample", - "drivers", "eventType", "c", paste0( - "Type of driver. [GAIN (amplification by SV), GAIN_ARM (amplification of whole arm), ", - "GAIN_CHR (amplification of whole chromosome), DEL (homozygous deletion), ", - "LOH (focal LOH), LOH_ARM (arm level LOH), LOH_CHR (chromosome level LOH), ", - "LOH_SV_TELO (LOH from SV to telomere), LOH_SV_CENTRO (LOH from SV to centromere), ", - "HOM_DUP_DISRUPTION (homozygous disruption via cross exonic tandem duplication), ", - "HOM_DEL_DISRUPTION (homozygous disruption without homozygous copy number loss)]" - ) -) - -#' Read LINX Table -#' -#' Generic function to read LINX tables. -#' -#' @param x Path to LINX file. -#' @param tab Table type to subset on. -#' @keywords internal -#' @noRd -linx_read_table <- function(x, tab) { - subset_tab <- function(tab) { - LINX_DESCRIPTIONS |> - dplyr::filter(.data$Table == tab) |> - dplyr::select(-"Table") - } - - descr <- subset_tab(tab) - nm <- descr[["Type"]] - cnames <- descr[["Field"]] - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == cnames)) - d -} - -#' Get LINX Description for Table Type -#' -#' Gets LINX Description for Table Type -#' -#' @param tab Table type to subset on. -#' @keywords internal -#' @noRd -linx_descr_tab <- function(tab) { - LINX_DESCRIPTIONS |> - dplyr::filter(.data$Table == tab) |> - dplyr::select("Field", "Description") -} - -#' Read LINX SVS File -#' -#' Reads the `linx.svs.tsv` file. -#' -#' @param x Path to `linx.svs.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.svs.tsv.gz", package = "gpgr") -#' (l <- linx_svs_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "localTICountEnd") -#' -#' @export -linx_svs_read <- function(x) { - linx_read_table(x, "svs") -} - -#' Read LINX Breakend File -#' -#' Reads the `linx.breakend.tsv` file. -#' -#' @param x Path to `linx.breakend.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.breakend.tsv.gz", package = "gpgr") -#' (l <- linx_breakend_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "junctionCopyNumber") -#' -#' @export -linx_breakend_read <- function(x) { - linx_read_table(x, "breakend") -} - -#' Read LINX Clusters File -#' -#' Reads the `linx.clusters.tsv` file. -#' -#' @param x Path to `linx.clusters.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.clusters.tsv.gz", package = "gpgr") -#' (l <- linx_clusters_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "clusterDesc") -#' -#' @export -linx_clusters_read <- function(x) { - linx_read_table(x, "clusters") -} - -#' Read LINX Links File -#' -#' Reads the `linx.links.tsv` file. -#' -#' @param x Path to `linx.links.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.links.tsv.gz", package = "gpgr") -#' (l <- linx_links_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "ecDna") -#' -#' @export -linx_links_read <- function(x) { - linx_read_table(x, "links") -} - -#' Read LINX Fusion File -#' -#' Reads the `linx.fusion.tsv` file. -#' -#' @param x Path to `linx.fusion.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.fusion.tsv.gz", package = "gpgr") -#' (l <- linx_fusion_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "junctionCopyNumber") -#' -#' @export -linx_fusion_read <- function(x) { - linx_read_table(x, "fusion") -} - -#' Read LINX Driver Catalog File -#' -#' Reads the `linx.driver.catalog.tsv` file. -#' -#' @param x Path to `linx.driver.catalog.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.driver.catalog.tsv.gz", package = "gpgr") -#' (l <- linx_drivercatalog_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "maxCopyNumber") -#' -#' @export -linx_drivercatalog_read <- function(x) { - linx_read_table(x, "drivercatalog") -} - -#' Read LINX Drivers File -#' -#' Reads the `linx.drivers.tsv` file. -#' -#' @param x Path to `linx.drivers.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.drivers.tsv.gz", package = "gpgr") -#' (l <- linx_drivers_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "eventType") -#' -#' @export -linx_drivers_read <- function(x) { - linx_read_table(x, "drivers") -} - -#' Process LINX SVS File -#' -#' Processes the `linx.svs.tsv` file. -#' -#' @param x Path to `linx.svs.tsv` file. -#' -#' @return The input file as a processed tibble. -#' @export -linx_svs_process <- function(x) { - d <- linx_svs_read(x) |> - dplyr::relocate(.data$geneStart, .data$geneEnd, .after = .data$clusterId) - descr <- linx_descr_tab("svs") - list(tab = d, descr = descr) -} - -#' Process LINX Breakend File -#' -#' Processes the `linx.breakend.tsv` file. -#' -#' @param x Path to `linx.breakend.tsv` file. -#' -#' @return The input file as a tibble with column description. -#' @export -linx_breakend_process <- function(x) { - d <- linx_breakend_read(x) - descr <- linx_descr_tab("breakend") - list(tab = d, descr = descr) -} - -#' Process LINX Clusters File -#' -#' Processes the `linx.clusters.tsv` file. -#' -#' @param x Path to `linx.clusters.tsv` file. -#' -#' @return The input file as a tibble. -#' @export -linx_clusters_process <- function(x) { - d <- linx_clusters_read(x) - descr <- linx_descr_tab("clusters") - list(tab = d, descr = descr) -} - -#' Process LINX Links File -#' -#' Processes the `linx.links.tsv` file. -#' -#' @param x Path to `linx.links.tsv` file. -#' -#' @return The input file as a tibble. -#' @export -linx_links_process <- function(x) { - d <- linx_links_read(x) - descr <- linx_descr_tab("links") - list(tab = d, descr = descr) -} - -#' Process LINX Fusion File -#' -#' Processes the `linx.fusion.tsv` file. -#' -#' @param x Path to `linx.fusion.tsv` file. -#' -#' @return The input file as a tibble. -#' @export -linx_fusion_process <- function(x) { - d <- linx_fusion_read(x) - descr <- linx_descr_tab("fusion") - list(tab = d, descr = descr) -} - -#' Process LINX Driver Catalog File -#' -#' Processes the `linx.driver.catalog.tsv` file. -#' -#' @param x Path to `linx.driver.catalog.tsv` file. -#' -#' @return The input file as a tibble. -#' @export -linx_drivercatalog_process <- function(x) { - d <- linx_drivercatalog_read(x) - descr <- linx_descr_tab("drivercatalog") - list(tab = d, descr = descr) -} - -#' Process LINX Drivers File -#' -#' Processes the `linx.drivers.tsv` file. -#' -#' @param x Path to `linx.drivers.tsv` file. -#' -#' @return The input file as a tibble. -#' @export -linx_drivers_process <- function(x) { - d <- linx_drivers_read(x) - descr <- linx_descr_tab("drivers") - list(tab = d, descr = descr) -} diff --git a/R/linx_vis.R b/R/linx_vis.R deleted file mode 100644 index 6dd04ef..0000000 --- a/R/linx_vis.R +++ /dev/null @@ -1,188 +0,0 @@ -#' Read LINX VisCopyNumber File -#' -#' Reads the `linx.vis_copy_number.tsv` file. -#' -#' @param x Path to `linx.vis_copy_number.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_copy_number.tsv.gz", package = "gpgr") -#' (l <- linx_viscopynumber_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "BAF") -#' -#' @export -linx_viscopynumber_read <- function(x) { - nm <- c( - SampleId = "c", Chromosome = "c", Start = "i", End = "i", - CopyNumber = "d", BAF = "d" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d |> - dplyr::mutate(Chrom = sub("chr", "", .data$Chromosome)) |> - dplyr::select("Chrom", "Start", "End", CN = "CopyNumber", "BAF") |> - dplyr::arrange(mixedrank(.data$Chrom)) |> - dplyr::mutate(Chrom = as.factor(.data$Chrom)) -} - -#' Read LINX VisFusion File -#' -#' Reads the `linx.vis_fusion.tsv` file. -#' -#' @param x Path to `linx.vis_fusion.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_fusion.tsv.gz", package = "gpgr") -#' (l <- linx_visfusion_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "FusedExonDown") -#' -#' @export -linx_visfusion_read <- function(x) { - nm <- c( - SampleId = "c", ClusterId = "d", Reportable = "c", - GeneNameUp = "c", TranscriptUp = "c", ChrUp = "c", - PosUp = "d", StrandUp = "d", RegionTypeUp = "c", - FusedExonUp = "d", GeneNameDown = "c", TranscriptDown = "c", - ChrDown = "c", PosDown = "d", StrandDown = "d", - RegionTypeDown = "c", FusedExonDown = "d" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d -} - -#' Read LINX VisGeneExon File -#' -#' Reads the `linx.vis_gene_exon.tsv` file. -#' -#' @param x Path to `linx.vis_gene_exon.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_gene_exon.tsv.gz", package = "gpgr") -#' (l <- linx_visgeneexon_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "ExonEnd") -#' -#' @export -linx_visgeneexon_read <- function(x) { - nm <- c( - SampleId = "c", ClusterId = "d", Gene = "c", Transcript = "c", - Chromosome = "c", AnnotationType = "c", ExonRank = "d", - ExonStart = "d", ExonEnd = "d" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d |> - dplyr::select(-"SampleId") |> - dplyr::mutate(Chromosome = sub("chr", "", .data$Chromosome)) |> - dplyr::arrange(.data$ClusterId, .data$Gene, .data$Chromosome) |> - dplyr::mutate(ClusterId = factor(.data$ClusterId)) |> - dplyr::rename(Chrom = "Chromosome") -} - -#' Read LINX VisProteinDomain File -#' -#' Reads the `linx.vis_protein_domain.tsv` file. -#' -#' @param x Path to `linx.vis_protein_domain.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_protein_domain.tsv.gz", package = "gpgr") -#' (l <- linx_visproteindomain_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "Info") -#' -#' @export -linx_visproteindomain_read <- function(x) { - nm <- c( - SampleId = "c", ClusterId = "d", Transcript = "c", Chromosome = "c", - Start = "i", End = "i", Info = "c" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d |> - dplyr::select(-"SampleId") |> - dplyr::mutate(Chromosome = sub("chr", "", .data$Chromosome)) |> - dplyr::arrange(.data$ClusterId, .data$Chromosome, .data$Start) |> - dplyr::mutate(ClusterId = factor(.data$ClusterId)) |> - dplyr::rename(Chrom = "Chromosome") -} - -#' Read LINX VisSegments File -#' -#' Reads the `linx.vis_segments.tsv` file. -#' -#' @param x Path to `linx.vis_segments.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_segments.tsv.gz", package = "gpgr") -#' (l <- linx_vissegments_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "InDoubleMinute") -#' -#' @export -linx_vissegments_read <- function(x) { - nm <- c( - SampleId = "c", ClusterId = "d", ChainId = "d", Chromosome = "c", - PosStart = "c", PosEnd = "c", LinkPloidy = "d", InDoubleMinute = "c" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d |> - dplyr::select(-"SampleId") |> - dplyr::mutate(Chromosome = sub("chr", "", .data$Chromosome)) |> - dplyr::arrange(.data$ClusterId, .data$ChainId, .data$Chromosome) |> - dplyr::mutate(ClusterId = factor(.data$ClusterId)) -} - -#' Read LINX VisSvData File -#' -#' Reads the `linx.vis_sv_data.tsv` file. -#' -#' @param x Path to `linx.vis_sv_data.tsv` file. -#' -#' @return The input file as a tibble. -#' @examples -#' x <- system.file("extdata/linx/tables/linx.vis_sv_data.tsv.gz", package = "gpgr") -#' (l <- linx_vissvdata_read(x)) -#' @testexamples -#' expect_equal(colnames(l)[ncol(l)], "InDoubleMinute") -#' -#' @export -linx_vissvdata_read <- function(x) { - nm <- c( - SampleId = "c", ClusterId = "d", ChainId = "d", SvId = "d", - Type = "c", ResolvedType = "c", IsSynthetic = "c", ChrStart = "c", - ChrEnd = "c", PosStart = "d", PosEnd = "d", OrientStart = "d", - OrientEnd = "d", InfoStart = "c", InfoEnd = "c", - JunctionCopyNumber = "d", InDoubleMinute = "c" - ) - ctypes <- paste(nm, collapse = "") - d <- readr::read_tsv(x, col_types = ctypes) - assertthat::assert_that(ncol(d) == length(nm)) - assertthat::assert_that(all(colnames(d) == names(nm))) - d |> - dplyr::select(-"SampleId") |> - dplyr::arrange(.data$ClusterId, .data$ChainId) |> - dplyr::mutate(ClusterId = factor(.data$ClusterId)) |> - dplyr::select( - "ClusterId", "ChrStart", "ChrEnd", - "PosStart", "PosEnd", dplyr::everything() - ) -} diff --git a/R/rmd.R b/R/rmd.R index 91ecdf9..8e21b99 100644 --- a/R/rmd.R +++ b/R/rmd.R @@ -1,58 +1,3 @@ -#' Generate UMCCR LINX Report -#' -#' Generates a UMCCR LINX HTML report. It does so with the following steps: -#' 1. recursively copy the table and plot directories into tmp/plot and tmp/table -#' 2. copy the rmd into tmp/linx.Rmd -#' 3. render the rmd inside tmp/ -#' 4. return the path to the output HTML -#' -#' @param sample Name of sample. -#' @param table_dir Path to LINX table directory. -#' @param plot_dir Path to LINX plot directory. -#' @param out_file Path to output HTML file (needs '.html' suffix). -#' @param quiet Suppress printing during rendering. -#' -#' @return Path to rendered HTML report. -#' @export -linx_rmd <- function(sample, table_dir, plot_dir, out_file = NULL, quiet = FALSE) { - assertthat::assert_that( - is.character(sample), nchar(sample) > 0, - dir.exists(table_dir), dir.exists(plot_dir), - quiet %in% c(FALSE, TRUE) - ) - if (!is.null(out_file)) { - assertthat::assert_that( - is.character(out_file), - tools::file_ext(out_file) == "html" - ) - } else { - out_file <- glue::glue("linx_{sample}.html") - } - tmp_dir <- tempdir() - rmd_dir <- system.file("rmd/linx", package = "gpgr") - cpdir(table_dir, tmp_dir) - cpdir(plot_dir, tmp_dir) - cpdir(rmd_dir, tmp_dir) - rmd_file <- file.path(tmp_dir, "linx", "linx.Rmd") - out_dir <- dirname(out_file) - mkdir(out_dir) - pars <- list( - table_dir = table_dir, - plot_dir = plot_dir, - sample = sample - ) - # suppress DT large size warning - options(DT.warn.size = FALSE) - rmarkdown::render( - input = rmd_file, - params = pars, - output_dir = out_dir, - output_file = I(out_file), - run_pandoc = TRUE, - quiet = quiet - ) -} - #' Generate UMCCR Cancer Report #' #' Generates a UMCCR Cancer Report. It does so with the following steps: diff --git a/README.Rmd b/README.Rmd index af38e36..39f4639 100644 --- a/README.Rmd +++ b/README.Rmd @@ -40,15 +40,6 @@ conda install r-gpgr -c umccr -c conda-forge -c bioconda ## Main modules -### 🕸 LINX {#id_-linx} - -- Generate a HTML report with results from the `LINX` structural variant - visualisation tool from the Hartwig Medical Foundation - (). - See the [CLI](#cli) section below for options. -- For useful functions for reading/processing `LINX` results, see the vignette at - . - ### 🔮 PURPLE {#id_-purple} - Read and process output files from the `PURPLE` purity/copy number estimator @@ -89,10 +80,6 @@ echo "#-----------------------------------#" echo "gpgr.R --help" & gpgr.R --help echo "" echo "#-----------------------------------#" -echo "#------- LINX Report -------#" -echo "gpgr.R linx --help" & gpgr.R linx --help -echo "" -echo "#-----------------------------------#" echo "#------- Cancer Report -------#" echo "gpgr.R canrep --help" & gpgr.R canrep --help echo "" diff --git a/inst/cli/gpgr.R b/inst/cli/gpgr.R index 7931341..24e30d7 100755 --- a/inst/cli/gpgr.R +++ b/inst/cli/gpgr.R @@ -12,19 +12,15 @@ p$add_argument("-v", "--version", action = "version", version = glue::glue("{pro subparser_name <- "subparser_name" subp <- p$add_subparsers(help = "sub-command help", dest = subparser_name) -source(system.file("cli/linx.R", package = "gpgr")) source(system.file("cli/canrep.R", package = "gpgr")) -linx_add_args(subp) canrep_add_args(subp) args <- p$parse_args() if (length(args$subparser_name) == 0) { p$print_help() -} else if (args$subparser_name == "linx") { - linx_parse_args(args) } else if (args$subparser_name == "canrep") { canrep_parse_args(args) } else { - stop("Need to specify 'linx' or 'canrep' in the cli...") + stop("Need to specify 'canrep' in the cli...") } diff --git a/inst/cli/linx.R b/inst/cli/linx.R deleted file mode 100644 index 7c155b9..0000000 --- a/inst/cli/linx.R +++ /dev/null @@ -1,24 +0,0 @@ -linx_add_args <- function(subp) { - linx <- subp$add_parser("linx", help = "UMCCR LINX Report.") - linx$add_argument("--sample", help = "Sample name.", required = TRUE) - linx$add_argument("--plot", help = "Path to LINX plot directory.", required = TRUE) - linx$add_argument("--table", help = "Path to LINX table directory.", required = TRUE) - linx$add_argument("--out", help = "HTML output file name [def: linx_{sample}.html].") - linx$add_argument("--quiet", help = "Suppress log printing during rendering.", action = "store_true") -} - -linx_parse_args <- function(args) { - # print(c("You've called linx. Here are the arguments: ", args)) - cli::cli_h1("Start rendering LINX R Markdown report!") - tab <- normalizePath(args$table) - pl <- normalizePath(args$plot) - res <- gpgr::linx_rmd( - sample = args$sample, - table_dir = tab, - plot_dir = pl, - out_file = args$out, - quiet = args$quiet - ) - cli::cli_h1("Finished rendering LINX R Markdown report!") - cli::cli_alert_info("Path to HTML output:\n{res}") -} diff --git a/inst/extdata/linx/README.md b/inst/extdata/linx/README.md deleted file mode 100644 index 5f04b3d..0000000 --- a/inst/extdata/linx/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Tables are results from a GRIDSS/PURPLE/LINX run on `SEQCII_50pc`. -The shortcut version of the pipeline was run on pre-called Manta results. - -- `linx.vis_fusion.tsv.gz` was empty so I've included one row from another test - sample. diff --git a/inst/extdata/linx/tables/.gitignore b/inst/extdata/linx/tables/.gitignore deleted file mode 100644 index f5aaca2..0000000 --- a/inst/extdata/linx/tables/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -/linx.breakend.tsv.gz -/linx.clusters.tsv.gz -/linx.driver.catalog.tsv.gz -/linx.drivers.tsv.gz -/linx.fusion.tsv.gz -/linx.links.tsv.gz -/linx.svs.tsv.gz -/linx.version -/linx.viral_inserts.tsv.gz -/linx.vis_copy_number.tsv.gz -/linx.vis_fusion.tsv.gz -/linx.vis_gene_exon.tsv.gz -/linx.vis_protein_domain.tsv.gz -/linx.vis_segments.tsv.gz -/linx.vis_sv_data.tsv.gz diff --git a/inst/extdata/linx/tables/linx.breakend.tsv.gz.dvc b/inst/extdata/linx/tables/linx.breakend.tsv.gz.dvc deleted file mode 100644 index 328a204..0000000 --- a/inst/extdata/linx/tables/linx.breakend.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: dcfb6db6f2b36e3e65c1fa7f63ac69ed - size: 111775 - path: linx.breakend.tsv.gz diff --git a/inst/extdata/linx/tables/linx.clusters.tsv.gz.dvc b/inst/extdata/linx/tables/linx.clusters.tsv.gz.dvc deleted file mode 100644 index 72ab4c6..0000000 --- a/inst/extdata/linx/tables/linx.clusters.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: a69cebed42afe739e261bfaa5a3dcba0 - size: 2468 - path: linx.clusters.tsv.gz diff --git a/inst/extdata/linx/tables/linx.driver.catalog.tsv.gz.dvc b/inst/extdata/linx/tables/linx.driver.catalog.tsv.gz.dvc deleted file mode 100644 index f7aa683..0000000 --- a/inst/extdata/linx/tables/linx.driver.catalog.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: e40a2bcf0eb1f296811ba75b6c47a4c1 - size: 582 - path: linx.driver.catalog.tsv.gz diff --git a/inst/extdata/linx/tables/linx.drivers.tsv.gz.dvc b/inst/extdata/linx/tables/linx.drivers.tsv.gz.dvc deleted file mode 100644 index 7f93e16..0000000 --- a/inst/extdata/linx/tables/linx.drivers.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 482a25d282a7b1b705799c7671c3cf9c - size: 186 - path: linx.drivers.tsv.gz diff --git a/inst/extdata/linx/tables/linx.fusion.tsv.gz.dvc b/inst/extdata/linx/tables/linx.fusion.tsv.gz.dvc deleted file mode 100644 index 9a252dc..0000000 --- a/inst/extdata/linx/tables/linx.fusion.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 892642ddadcebde9bbcda16793c2c390 - size: 1101 - path: linx.fusion.tsv.gz diff --git a/inst/extdata/linx/tables/linx.links.tsv.gz.dvc b/inst/extdata/linx/tables/linx.links.tsv.gz.dvc deleted file mode 100644 index bfe7a92..0000000 --- a/inst/extdata/linx/tables/linx.links.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: da30f035aeba4f3885dc4474ac91c82a - size: 221 - path: linx.links.tsv.gz diff --git a/inst/extdata/linx/tables/linx.svs.tsv.gz.dvc b/inst/extdata/linx/tables/linx.svs.tsv.gz.dvc deleted file mode 100644 index 9a883c9..0000000 --- a/inst/extdata/linx/tables/linx.svs.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: c040f7577868660816832b63394beaa5 - size: 3423 - path: linx.svs.tsv.gz diff --git a/inst/extdata/linx/tables/linx.version.dvc b/inst/extdata/linx/tables/linx.version.dvc deleted file mode 100644 index a8ab9da..0000000 --- a/inst/extdata/linx/tables/linx.version.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 15bdcf661aea6bdfa42a347018b22374 - size: 41 - path: linx.version diff --git a/inst/extdata/linx/tables/linx.viral_inserts.tsv.gz.dvc b/inst/extdata/linx/tables/linx.viral_inserts.tsv.gz.dvc deleted file mode 100644 index 5050a6c..0000000 --- a/inst/extdata/linx/tables/linx.viral_inserts.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: b5f777e2d492fb56a2d1f47bda346fdb - size: 67 - path: linx.viral_inserts.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_copy_number.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_copy_number.tsv.gz.dvc deleted file mode 100644 index 8ca70ce..0000000 --- a/inst/extdata/linx/tables/linx.vis_copy_number.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 5862126303beed147289377cec196465 - size: 22456 - path: linx.vis_copy_number.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_fusion.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_fusion.tsv.gz.dvc deleted file mode 100644 index f7519c3..0000000 --- a/inst/extdata/linx/tables/linx.vis_fusion.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: b1800bd561be5e6689a7dde4fe39dbe6 - size: 242 - path: linx.vis_fusion.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_gene_exon.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_gene_exon.tsv.gz.dvc deleted file mode 100644 index 06c7399..0000000 --- a/inst/extdata/linx/tables/linx.vis_gene_exon.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 7906743383448a729279d97be9e419a8 - size: 3113 - path: linx.vis_gene_exon.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_protein_domain.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_protein_domain.tsv.gz.dvc deleted file mode 100644 index cdf8587..0000000 --- a/inst/extdata/linx/tables/linx.vis_protein_domain.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 19b18df629d2f4eeb9df59684c723af7 - size: 999 - path: linx.vis_protein_domain.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_segments.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_segments.tsv.gz.dvc deleted file mode 100644 index 7c81036..0000000 --- a/inst/extdata/linx/tables/linx.vis_segments.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: bcf5fb9560dac2f0fbb102dd990dd8a9 - size: 14537 - path: linx.vis_segments.tsv.gz diff --git a/inst/extdata/linx/tables/linx.vis_sv_data.tsv.gz.dvc b/inst/extdata/linx/tables/linx.vis_sv_data.tsv.gz.dvc deleted file mode 100644 index f88dab2..0000000 --- a/inst/extdata/linx/tables/linx.vis_sv_data.tsv.gz.dvc +++ /dev/null @@ -1,4 +0,0 @@ -outs: -- md5: 1960569a5ccaf8e347d9768bfaf5a851 - size: 17185 - path: linx.vis_sv_data.tsv.gz diff --git a/inst/rmd/linx/.gitignore b/inst/rmd/linx/.gitignore deleted file mode 100644 index 7a4fcf5..0000000 --- a/inst/rmd/linx/.gitignore +++ /dev/null @@ -1 +0,0 @@ -linx.html diff --git a/inst/rmd/linx/_navbar.html b/inst/rmd/linx/_navbar.html deleted file mode 100644 index 03b15fa..0000000 --- a/inst/rmd/linx/_navbar.html +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/inst/rmd/linx/linx.Rmd b/inst/rmd/linx/linx.Rmd deleted file mode 100644 index 039ab7d..0000000 --- a/inst/rmd/linx/linx.Rmd +++ /dev/null @@ -1,380 +0,0 @@ ---- -author: "University of Melbourne Centre for Cancer Research" -date: "`r Sys.time()`" -output: - html_document: - theme: cosmo - css: style.css - code_download: true - rmdformats::material: - highlight: kate -params: - title: "UMCCR LINX Report" - sample: "x" - plot_dir: "x" - table_dir: "x" -description: "UMCCR LINX Report" -title: "`r paste(params$sample, params$title)`" ---- - -```{r knitr_opts, include=F} -knitr::opts_chunk$set( - collapse = TRUE, echo = FALSE, - warning = FALSE, message = FALSE, - error = FALSE -) -``` - -```{r load_pkgs, message=FALSE, warning=FALSE} -library(assertthat, include.only = "assert_that") -library(details, include.only = "details") -library(dplyr, include.only = c("select", "mutate", "filter", "arrange")) -library(DT, include.only = "datatable") -library(glue, include.only = "glue") -library(gpgr) -library(knitr, include.only = "kable") -library(purrr, include.only = "set_names") -library(stringr, include.only = "str_match") -``` - -```{r funcs} -blank_lines <- function(n = 10) { - cat(rep("  ", n), sep = "\n") -} - -dt_table <- function(x) { - x |> - DT::datatable( - filter = list(position = "top", clear = FALSE, plain = TRUE), - class = "cell-border display compact", - rownames = FALSE, - extensions = c("Scroller", "Buttons", "KeyTable"), - options = list( - scroller = TRUE, scrollY = 400, scrollX = TRUE, - autoWidth = FALSE, keys = TRUE, - buttons = c("csv", "excel"), dom = "Blfrtip" - ) - ) -} - -# path to table -ptab <- function(type) { - x <- file.path(params$table_dir, glue("{params$sample}.linx.{type}.tsv")) - assertthat::assert_that(file.exists(x), msg = glue::glue("The file {x} does not exist!")) - x -} - -linx_path_plot_chr <- function() { - pat <- glue("{params$sample}\\.chr(.*)\\.(\\d+)\\.png") |> as.character() - x <- list.files(file.path(params$plot_dir), pattern = pat, full.names = TRUE) - if (length(x) == 0) { - warning(glue::glue("No LINX chromosome plots found in\n{params$plot_dir}.")) - return(NULL) - } - d <- str_match(x, pat) |> - dplyr::as_tibble(.name_repair = "minimal") |> - set_names(c("path", "chrom", "nsegs")) |> - dplyr::mutate( - path = file.path(params$plot_dir, path), - nsegs = as.integer(nsegs) - ) |> - dplyr::arrange(gpgr:::mixedrank(chrom)) - d -} - -linx_path_plot_cluster <- function() { - pat <- glue("{params$sample}\\.cluster-(\\d+)\\.sv(\\d+)\\.(\\d+)\\.png") |> as.character() - x <- list.files(file.path(params$plot_dir), pattern = pat, full.names = TRUE) - if (length(x) == 0) { - warning(glue::glue("No LINX cluster plots found in\n{params$plot_dir}.")) - return(NULL) - } - d <- str_match(x, pat) |> - dplyr::as_tibble(.name_repair = "minimal") |> - set_names(c("path", "clusterId", "svId", "nsegs")) |> - dplyr::mutate( - path = file.path(params$plot_dir, path), - nsegs = as.integer(nsegs), - clusterId = as.integer(clusterId) - ) |> - dplyr::arrange(clusterId) |> - dplyr::mutate(clusterId = sprintf(glue("%0{nchar(max(clusterId))}d"), clusterId)) - d -} -``` - -```{r read_tables} -tabs <- list( - main_svs = ptab("svs") |> gpgr::linx_svs_process(), - main_breakend = ptab("breakend") |> gpgr::linx_breakend_process(), - main_clusters = ptab("clusters") |> gpgr::linx_clusters_process(), - main_links = ptab("links") |> gpgr::linx_links_process(), - main_fusion = ptab("fusion") |> gpgr::linx_fusion_process(), - main_drivercatalog = ptab("driver.catalog") |> gpgr::linx_drivercatalog_process(), - main_drivers = ptab("drivers") |> gpgr::linx_drivers_process(), - vis_copy_number = ptab("vis_copy_number") |> gpgr::linx_viscopynumber_read(), - vis_fusion = ptab("vis_fusion") |> gpgr::linx_visfusion_read(), - vis_gene_exon = ptab("vis_gene_exon") |> gpgr::linx_visgeneexon_read(), - vis_protein_domain = ptab("vis_protein_domain") |> gpgr::linx_visproteindomain_read(), - vis_segments = ptab("vis_segments") |> gpgr::linx_vissegments_read(), - vis_sv_data = ptab("vis_sv_data") |> gpgr::linx_vissvdata_read() -) -``` - -## Tables {.tabset #tables} - -### Main {.tabset} - -```{r svs0} -l <- tabs$main_svs -``` - -#### Annotations (`r nrow(l$tab)`) - -- additional annotations of each non PON filtered break junction -- `svs.tsv` - -```{r svs} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r blank2, results='asis'} -blank_lines(2) -``` - -```{r breakend0} -l <- tabs$main_breakend -``` - -#### Breakends (`r nrow(l$tab)`) - -- impact of each non PON filtered break junction on each overlapping gene -- `breakend.tsv` - -```{r breakend} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r clusters0} -l <- tabs$main_clusters -``` - -#### Clusters (`r nrow(l$tab)`) - -- clustering of all non PON filtered SV events and their resolved - classification. -- `clusters.tsv` - -```{r clusters} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r links0} -l <- tabs$main_links -``` - -#### Links (`r nrow(l$tab)`) - -- segments joining break junction pairs predicted to be linked and phased in - _cis_ on the derivative chromosome. -- `links.tsv` - -```{r links} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r fusion0} -l <- tabs$main_fusion -``` - -#### Fusions (`r nrow(l$tab)`) - -- All inframe and outframe fusions predicted in the sample including HMF - fusion knowledgebase annotations. -- `fusion.tsv` - -```{r fusion} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r drivercatalog0} -l <- tabs$main_drivercatalog -``` - -#### Driver Catalog (`r nrow(l$tab)`) - -- Reproduction of the driver catalog produced by PURPLE with homozygous - disruption events appended. -- `driver.catalog.tsv` - -```{r drivercatalog} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -```{r drivers0} -l <- tabs$main_drivers -``` - -#### Drivers (`r nrow(l$tab)`) - -- Linkage of drivers from driver catalog to SV cluster which contributed to - those drivers including LOH, deletion, disruption and amplification events. -- `drivers.tsv` - -```{r drivers} -details::details(kable(l$descr), lang = "none", summary = "Column Description") -dt_table(l$tab) -``` - -### Vis {.tabset} - -```{r vis_copy_number0} -l <- tabs$vis_copy_number -``` - -#### Copy Number (`r nrow(l)`) - -- `vis_copy_number.tsv` - -```{r vis_copy_number} -dt_table(l) |> - DT::formatCurrency(~ Start + End, currency = "", interval = 3, mark = ",", digits = 0) -``` - -```{r blank1, results='asis'} -blank_lines(2) -``` - -```{r vis_fusion0} -l <- tabs$vis_fusion -``` - -#### Fusion (`r nrow(l)`) - -- `vis_fusion.tsv` - -```{r vis_fusion} -dt_table(l) -``` - -```{r vis_gene_exon0} -l <- tabs$vis_gene_exon -``` - -#### Gene Exon (`r nrow(l)`) - -- `vis_gene_exon.tsv` - -```{r vis_gene_exon} -dt_table(l) |> - DT::formatCurrency(~ ExonStart + ExonEnd, currency = "", interval = 3, mark = ",", digits = 0) -``` - -```{r vis_protein_domain0} -l <- tabs$vis_protein_domain -``` - -#### Protein Domain (`r nrow(l)`) - -- `vis_protein_domain.tsv` - -```{r vis_protein_domain} -dt_table(l) |> - DT::formatCurrency(~ Start + End, currency = "", interval = 3, mark = ",", digits = 0) -``` - -```{r vis_segments0} -l <- tabs$vis_segments -``` - -#### Segments (`r nrow(l)`) - -- `vis_segments.tsv` - -```{r vis_segments} -dt_table(l) -``` - -```{r vis_sv_data0} -l <- tabs$vis_sv_data -``` - -#### SV Data (`r nrow(l)`) - -- `vis_sv_data.tsv` - -```{r vis_sv_data} -dt_table(l) |> - DT::formatCurrency(~ PosStart + PosEnd, currency = "", interval = 3, mark = ",", digits = 0) -``` - -## Plots (Chromosome) {.tabset #plots-chrom} - -```{r plot_chrom, results='asis'} -chrom_plots <- linx_path_plot_chr() -if (!is.null(chrom_plots)) { - cat(glue("\n**Total:** {nrow(chrom_plots)} chromosome plots"), "\n\n\n") - for (i in seq_len(nrow(chrom_plots))) { - r <- chrom_plots[i, ] - cat(glue("\n### chr{r$chrom}"), "\n") - cat(glue("\nnsegs: {as.integer(r$nsegs)}"), "\n\n\n") - cat(glue(""), "\n\n\n") - blank_lines(1) - cat("\n\n\n") - } -} else { - cat("No LINX chromosome plots were generated") -} -``` - -## Plots (Cluster) {.tabset #plots-cluster} - -```{r plot_cluster, results='asis'} -cluster_plots <- linx_path_plot_cluster() -if (!is.null(cluster_plots)) { - cat(glue("\n**Total:** {nrow(cluster_plots)} cluster plots"), "\n\n\n") - for (i in seq_len(nrow(cluster_plots))) { - r <- cluster_plots[i, ] - cat(glue("\n### {r$clusterId}"), "\n\n\n") - cat(glue( - "clusterId: {r$clusterId} | ", - "svId: {r$svId} | nsegs: {r$nsegs}" - ), "\n\n\n") - cat(glue(""), "\n\n\n") - blank_lines(2) - cat("\n\n\n") - } -} else { - cat("No LINX cluster plots were generated") -} -``` - -## Addendum {.tabset #addendum} - -
-Show - - -### Session Info - -```{r session_info, echo=FALSE} -pkgs_of_interest <- c("base", "gpgr") -si <- gpgr::session_info_kable(pkgs_of_interest) -si$si_pkg -si$si_pl -``` - -### Report Inputs - -```{r report_inputs} -report_inputs <- dplyr::tibble(key = names(params), value = unlist(params)) -report_inputs |> kable() -``` - -
diff --git a/inst/rmd/linx/render.R b/inst/rmd/linx/render.R deleted file mode 100644 index 8d200c3..0000000 --- a/inst/rmd/linx/render.R +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env Rscript - -require(here) -require(gpgr) -require(glue) - -sbj <- "SBJ02299" -sample <- "SBJ02299_PRJ221222_L2200695" -dd <- glue(here("nogit/linx/{sbj}")) -pd <- glue("{dd}/plots") -td <- glue("{dd}/annotations") -od <- here("nogit/linx/html_reports") -of <- glue("{sample}_linx.html") - -gpgr::linx_rmd( - sample = sample, - table_dir = td, - plot_dir = pd, - out_file = file.path(od, of) -) diff --git a/inst/rmd/linx/render.sh b/inst/rmd/linx/render.sh deleted file mode 100644 index 82f8c61..0000000 --- a/inst/rmd/linx/render.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -gpgr_dir="/Users/pdiakumis/projects/gpgr" -sbj="SBJ02299" -sample="SBJ02299_PRJ221222_L2200695" -dd="${gpgr_dir}/nogit/linx/${sbj}" -pd="${dd}/plots" -td="${dd}/annotations" -od="${gpgr_dir}/nogit/linx/html_reports" -of="${sample}_linx.html" - -# link to cli -gpgr_cli=$(Rscript -e 'x = system.file("cli/gpgr.R", package = "gpgr"); cat(x, "\n")') - -$gpgr_cli linx \ - --sample ${sample} \ - --plot ${pd} \ - --table ${td} \ - --out ${od}/${of} diff --git a/inst/rmd/linx/style.css b/inst/rmd/linx/style.css deleted file mode 100644 index ce7fd87..0000000 --- a/inst/rmd/linx/style.css +++ /dev/null @@ -1,23 +0,0 @@ -.navbar-brand { - padding: 5px 15px; -} - -/* https://stackoverflow.com/questions/42183672/how-to-implement-a-navbar-dropdown-hover-in-bootstrap-v4/48224232#48224232 */ -.dropdown:hover > .dropdown-menu { - display: block; -} -.dropdown > .dropdown-toggle:active { - /*Without this, clicking will make it sticky*/ - pointer-events: none; -} - -.main-container { - max-width: 1400px !important; - margin-left: auto; - margin-right: auto; -} - -.navbar-default { - color: #11A7BB; - background-color: #11A7BB; -} diff --git a/inst/rmd/linx/vccc_small.jpg b/inst/rmd/linx/vccc_small.jpg deleted file mode 100644 index 817f5ac..0000000 Binary files a/inst/rmd/linx/vccc_small.jpg and /dev/null differ diff --git a/inst/scripts/multiqc/functions.R b/inst/scripts/multiqc/functions.R deleted file mode 100644 index aab1f84..0000000 --- a/inst/scripts/multiqc/functions.R +++ /dev/null @@ -1,118 +0,0 @@ -library(dplyr, include.only = c("bind_rows", "left_join")) -library(purrr, include.only = c("map", "map_chr", "reduce", "list_merge", "imap", "set_names")) -library(RJSONIO, include.only = "fromJSON") - -mj2df <- function(json) { - stopifnot(file.exists(json)) - p <- fromJSON(json) - nm <- "umccr_subj_id" - gen <- parse_gen(p) |> - remove_control_samples() |> - bind_rows(.id = nm) - raw <- parse_raw(p) |> - remove_control_samples() |> - bind_rows(.id = nm) - - # data is in tidy format: - # - each variable has its own column - # - each observation (sample) has its own row - # - each value has its own cell - left_join(gen, raw, by = nm, suffix = c(".gen", ".raw")) -} - -remove_control_samples <- function(l) { - controls <- c("Alice", "Bob", "Chen", "Elon", "Dakota") - controls2 <- paste0(controls, rep(c("_T", "_B"), each = length(controls))) - # also remove 'idxstats' samples - controls_regex <- paste(c(controls2, "idxstats"), collapse = "|") - l <- l[!grepl(controls_regex, names(l))] - l -} - -mkdir <- function(d) { - if (!dir.exists(d)) { - dir.create(d, recursive = TRUE) - } - d -} - -# Following are modified/simplified from TidyMultiqc -parse_gen <- function(p) { - el <- "report_general_stats_data" - stopifnot(inherits(p, "list"), el %in% names(p)) - p[[el]] |> reduce(~ list_merge(.x, !!!.y)) -} - -parse_raw <- function(p) { - el <- "report_saved_raw_data" - stopifnot(inherits(p, "list"), el %in% names(p)) - # For each tool - p[[el]][["dragen_frag_len"]] <- NULL - p[[el]] |> - imap(function(samples, tool) { - # Remove the superflous "multiqc_" from the start of the tool name - tool <- sub("multiqc_", "", tool) - - # For each sample - samples |> kv_map(function(metrics, sample) { - # For each metric in the above tool - list( - key = sample, - value = metrics |> kv_map(function(mvalue, mname) { - # Sanitise metric names - combined_metric <- list( - key = paste0(tool, ".", mname), - value = mvalue - ) - }) - ) - }) - }) |> - reduce(utils::modifyList) -} - -kv_map <- function(l, func) { - mapped <- imap(l, func) |> - set_names(nm = NULL) - keys <- mapped |> map_chr("key") - vals <- mapped |> map("value") - vals |> set_names(keys) -} - -select_column_subset_alignmentqc <- function(d) { - cols_to_keep <- c( - "umccr_subj_id" = "umccr_subj_id", - "tot_input_reads" = "dragen_map_metrics.Total input reads", - "tot_input_reads_pct" = "dragen_map_metrics.Total input reads pct", - "num_dup_reads" = "dragen_map_metrics.Number of duplicate marked reads", - "num_dup_reads_pct" = "dragen_map_metrics.Number of duplicate marked reads pct", - "num_uniq_reads_pct" = "dragen_map_metrics.Number of unique reads (excl. duplicate marked reads) pct", - "mapped_reads" = "dragen_map_metrics.Mapped reads", - "mapped_reads_pct" = "dragen_map_metrics.Mapped reads pct", - "unmapped_reads" = "dragen_map_metrics.Unmapped reads", - "unmapped_reads_pct" = "dragen_map_metrics.Unmapped reads pct", - "singleton_reads" = "dragen_map_metrics.Singleton reads (itself mapped; mate unmapped)", - "singleton_reads_pct" = "dragen_map_metrics.Singleton reads (itself mapped; mate unmapped) pct", - "paired_reads" = "dragen_map_metrics.Paired reads (itself & mate mapped)", - "paired_reads_pct" = "dragen_map_metrics.Paired reads (itself & mate mapped) pct", - "paired_reads_proper" = "dragen_map_metrics.Properly paired reads", - "paired_reads_proper_pct" = "dragen_map_metrics.Properly paired reads pct", - "read_length" = "dragen_map_metrics.Estimated read length", - "insert_length_mean" = "dragen_map_metrics.Insert length: mean", - "insert_length_median" = "dragen_map_metrics.Insert length: median", - "contamination" = "dragen_map_metrics.Estimated sample contamination", - "cov_seqed_avg_genome" = "dragen_map_metrics.Average sequenced coverage over genome", - "cov_aligned_avg_genome" = "dragen_cov_metrics.Average alignment coverage over genome", - "cov_autosomal_median" = "dragen_ploidy.Autosomal median coverage", - "cov_chrx_median" = "dragen_ploidy.X median coverage", - "cov_chry_median" = "dragen_ploidy.Y median coverage", - "cov50_genome_pct" = "dragen_cov_metrics.PCT of genome with coverage [ 50x: inf)", - "ploidy_est" = "dragen_ploidy.Ploidy estimation" - ) - - assertthat::assert_that(base::all(cols_to_keep %in% base::names(d))) - - d |> - dplyr::select(dplyr::all_of(cols_to_keep)) |> - purrr::set_names(base::names(cols_to_keep)) -} diff --git a/inst/scripts/multiqc/tidy_multiqc.R b/inst/scripts/multiqc/tidy_multiqc.R deleted file mode 100755 index c088e2d..0000000 --- a/inst/scripts/multiqc/tidy_multiqc.R +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env Rscript - -library(argparser, include.only = c("arg_parser", "add_argument", "parse_args")) -library(arrow, include.only = "write_parquet") -library(readr, include.only = "write_tsv") -source(system.file("scripts/multiqc/functions.R", package = "gpgr")) - -p <- arg_parser( - description = "Export MultiQC json to tidy data.frame/tsv/parquet", hide.opts = TRUE -) -p <- add_argument(p, - arg = "--json", - help = "Path to 'multiqc_data.json'." -) -p <- add_argument(p, - arg = "--outdir", - help = "Output directory for results.", - default = "tidymultiqc" -) -p <- add_argument(p, - arg = "--name", - help = "Prefix name for output files." -) -args <- parse_args(p) - - -stopifnot( - file.exists(args$json), is.character(args$name), nchar(args$name) > 0, - is.character(args$outdir), nchar(args$outdir) > 0 -) -name <- args$name -outdir <- normalizePath(mkdir(args$outdir)) -json <- args$json - -# main function -d1 <- mj2df(json) -d2 <- select_column_subset_alignmentqc(d1) - -## write to TSV and Parquet format -tsv_out <- file.path(outdir, paste(name, "tsv", sep = ".")) -parquet_out <- file.path(outdir, paste(name, "parquet", sep = ".")) -write_tsv(d2, tsv_out) -write_parquet(d2, parquet_out) diff --git a/inst/scripts/run_chord_hrdetect.R b/inst/scripts/run_chord_hrdetect.R deleted file mode 100644 index 751b30d..0000000 --- a/inst/scripts/run_chord_hrdetect.R +++ /dev/null @@ -1,107 +0,0 @@ -suppressPackageStartupMessages(require(BSgenome.Hsapiens.UCSC.hg38)) -suppressPackageStartupMessages(require(furrr)) -suppressPackageStartupMessages(require(future)) -suppressPackageStartupMessages(require(glue)) -suppressPackageStartupMessages(require(gpgr)) -suppressPackageStartupMessages(require(here)) -suppressPackageStartupMessages(require(kableExtra)) -suppressPackageStartupMessages(require(tidyverse)) - -s <- tibble::tribble( - ~sample, ~prefix, ~snv, ~sv, ~cnv, ~genome, - "SBJ00037", "SBJ00037__SBJ00037_PRJ200529_L2000958", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00197", "SBJ00197__SBJ00197_MDX190186_L1900909", "-somatic-ensemble-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv", "GRCh37", - "SBJ00481", "SBJ00481__SBJ00481_PTC_TsqN200327_L2000243", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00574_1", "SBJ00574_1__SBJ00574_PRJ200428_L2000802", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00574_2", "SBJ00574_2__SBJ00574_PRJ200429_L2000803", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00590", "SBJ00590__SBJ00590_MDX200156_L2000853", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00597", "SBJ00597__SBJ00597_MDX200162_L2000855", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00600", "SBJ00600__SBJ00600_PRJ200484_L2000839", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00602", "SBJ00602__SBJ00602_PRJ200487_L2000841", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00603", "SBJ00603__SBJ00603_PRJ200489_L2000843", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00605", "SBJ00605__SBJ00605_PRJ200504_L2000847", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00607", "SBJ00607__SBJ00607_MDX200165_L2000857", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00608", "SBJ00608__SBJ00608_MDX200170_L2000872", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00609", "SBJ00609__SBJ00609_PRJ200508_L2000874", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00610", "SBJ00610__SBJ00610_PRJ200511_L2000876", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00611", "SBJ00611__SBJ00611_PRJ200514_L2000878", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00612", "SBJ00612__SBJ00612_PRJ200517_L2000880", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00614", "SBJ00614__SBJ00614_PRJ200523_L2000916", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00615", "SBJ00615__SBJ00615_MDX200175_L2000910", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00616", "SBJ00616__SBJ00616_MDX200183_L2000912", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00617", "SBJ00617__SBJ00617_MDX200173_L2000908", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00618", "SBJ00618__SBJ00618_MDX200185_L2000914", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00620", "SBJ00620__SBJ00620_PRJ200532_L2000960", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00621", "SBJ00621__SBJ00621_MDX200196_L2000955", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00622", "SBJ00622__SBJ00622_MDX200190_L2000951", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00623", "SBJ00623__SBJ00623_MDX200193_L2000953", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00624", "SBJ00624__SBJ00624_MDX200199_L2000957", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00625", "SBJ00625__SBJ00625_PRJ200539_L2000962", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00627", "SBJ00627__SBJ00627_MDX200205_L2000998", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00628", "SBJ00628__SBJ00628_PRJ200545_L2000983", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00629", "SBJ00629__SBJ00629_PRJ200542_L2000981", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00630", "SBJ00630__SBJ00630_MDX200202_L2000979", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00631", "SBJ00631__SBJ00631_PRJ200548_L2000985", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00632", "SBJ00632__SBJ00632_PRJ200550_L2000987", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00633", "SBJ00633__SBJ00633_MDX200211_L2000991", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00635", "SBJ00635__SBJ00635_MDX200214_L2001000", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00636", "SBJ00636__SBJ00636_PRJ200552_L2001002", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00637", "SBJ00637__SBJ00637_PRJ200555_L2001004", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00638", "SBJ00638__SBJ00638_PRJ200576_L2001006", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", - "SBJ00639", "SBJ00639__SBJ00639_PRJ200579_L2001008", "-somatic-PASS.vcf.gz", "-manta.vcf.gz", ".purple.cnv.somatic.tsv", "hg38", -) %>% - # dplyr::filter(sample %in% c("", "")) %>% - dplyr::mutate( - dd = file.path(here::here("nogit")), - snv = file.path(dd, "snv", paste0(prefix, snv)), - sv = file.path(dd, "sv", paste0(prefix, sv)), - cnv = file.path(dd, "cnv", paste0(prefix, cnv)) - ) - -future::plan(multicore) -res <- seq_len(nrow(s)) %>% - furrr::future_map(function(i) { - # purrr::map(function(i) { - cat(s$sample[i], "CHORD\n") - chord_sv_df <- gpgr::chord_mantavcf2df(s$sv[i]) - chord <- gpgr::chord_run( - vcf.snv = s$snv[i], - df.sv = chord_sv_df, - sv.caller = "manta", - sample.name = s$sample[i], - ref.genome = s$genome[i] - ) - - cat(s$sample[i], "HRDetect\n") - hrdetect <- gpgr::hrdetect_run( - nm = s$sample[i], - snvindel_vcf = s$snv[i], - sv_vcf = s$sv[i], - cnv_tsv = s$cnv[i], - genome = s$genome[i], - snvoutdir = file.path(here::here("nogit"), "results", "hrdetect", s$sample[i]) - ) - list( - chord = chord$prediction, - hrdetect = hrdetect - ) - }) - -saveRDS(res, here::here("nogit/results/chord_hrdetect_2020-12-08.rds")) - -res <- readRDS(here::here("nogit/results/chord_hrdetect_2020-12-08.rds")) - -chord <- purrr::map(res, "chord") %>% dplyr::bind_rows() -hrdetect <- purrr::map(res, "hrdetect") %>% dplyr::bind_rows() - -print(chord) -print(hrdetect) - -s <- "SBJ00632" -chord %>% - filter(sample == s) %>% - t() - -hrdetect %>% - filter(sample == s) %>% - t() diff --git a/man/linx_breakend_process.Rd b/man/linx_breakend_process.Rd deleted file mode 100644 index 9425bd2..0000000 --- a/man/linx_breakend_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_breakend_process} -\alias{linx_breakend_process} -\title{Process LINX Breakend File} -\usage{ -linx_breakend_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.breakend.tsv} file.} -} -\value{ -The input file as a tibble with column description. -} -\description{ -Processes the \code{linx.breakend.tsv} file. -} diff --git a/man/linx_breakend_read.Rd b/man/linx_breakend_read.Rd deleted file mode 100644 index 2227697..0000000 --- a/man/linx_breakend_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_breakend_read} -\alias{linx_breakend_read} -\title{Read LINX Breakend File} -\usage{ -linx_breakend_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.breakend.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.breakend.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.breakend.tsv.gz", package = "gpgr") -(l <- linx_breakend_read(x)) -} diff --git a/man/linx_clusters_process.Rd b/man/linx_clusters_process.Rd deleted file mode 100644 index 1f5ee55..0000000 --- a/man/linx_clusters_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_clusters_process} -\alias{linx_clusters_process} -\title{Process LINX Clusters File} -\usage{ -linx_clusters_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.clusters.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Processes the \code{linx.clusters.tsv} file. -} diff --git a/man/linx_clusters_read.Rd b/man/linx_clusters_read.Rd deleted file mode 100644 index 85425b4..0000000 --- a/man/linx_clusters_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_clusters_read} -\alias{linx_clusters_read} -\title{Read LINX Clusters File} -\usage{ -linx_clusters_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.clusters.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.clusters.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.clusters.tsv.gz", package = "gpgr") -(l <- linx_clusters_read(x)) -} diff --git a/man/linx_drivercatalog_process.Rd b/man/linx_drivercatalog_process.Rd deleted file mode 100644 index 09cd3b4..0000000 --- a/man/linx_drivercatalog_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_drivercatalog_process} -\alias{linx_drivercatalog_process} -\title{Process LINX Driver Catalog File} -\usage{ -linx_drivercatalog_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.driver.catalog.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Processes the \code{linx.driver.catalog.tsv} file. -} diff --git a/man/linx_drivercatalog_read.Rd b/man/linx_drivercatalog_read.Rd deleted file mode 100644 index 1b98bc0..0000000 --- a/man/linx_drivercatalog_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_drivercatalog_read} -\alias{linx_drivercatalog_read} -\title{Read LINX Driver Catalog File} -\usage{ -linx_drivercatalog_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.driver.catalog.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.driver.catalog.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.driver.catalog.tsv.gz", package = "gpgr") -(l <- linx_drivercatalog_read(x)) -} diff --git a/man/linx_drivers_process.Rd b/man/linx_drivers_process.Rd deleted file mode 100644 index 6a6764d..0000000 --- a/man/linx_drivers_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_drivers_process} -\alias{linx_drivers_process} -\title{Process LINX Drivers File} -\usage{ -linx_drivers_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.drivers.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Processes the \code{linx.drivers.tsv} file. -} diff --git a/man/linx_drivers_read.Rd b/man/linx_drivers_read.Rd deleted file mode 100644 index 377ca7b..0000000 --- a/man/linx_drivers_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_drivers_read} -\alias{linx_drivers_read} -\title{Read LINX Drivers File} -\usage{ -linx_drivers_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.drivers.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.drivers.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.drivers.tsv.gz", package = "gpgr") -(l <- linx_drivers_read(x)) -} diff --git a/man/linx_fusion_process.Rd b/man/linx_fusion_process.Rd deleted file mode 100644 index d744db1..0000000 --- a/man/linx_fusion_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_fusion_process} -\alias{linx_fusion_process} -\title{Process LINX Fusion File} -\usage{ -linx_fusion_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.fusion.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Processes the \code{linx.fusion.tsv} file. -} diff --git a/man/linx_fusion_read.Rd b/man/linx_fusion_read.Rd deleted file mode 100644 index 6208dcd..0000000 --- a/man/linx_fusion_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_fusion_read} -\alias{linx_fusion_read} -\title{Read LINX Fusion File} -\usage{ -linx_fusion_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.fusion.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.fusion.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.fusion.tsv.gz", package = "gpgr") -(l <- linx_fusion_read(x)) -} diff --git a/man/linx_links_process.Rd b/man/linx_links_process.Rd deleted file mode 100644 index 19b141e..0000000 --- a/man/linx_links_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_links_process} -\alias{linx_links_process} -\title{Process LINX Links File} -\usage{ -linx_links_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.links.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Processes the \code{linx.links.tsv} file. -} diff --git a/man/linx_links_read.Rd b/man/linx_links_read.Rd deleted file mode 100644 index 6922284..0000000 --- a/man/linx_links_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_links_read} -\alias{linx_links_read} -\title{Read LINX Links File} -\usage{ -linx_links_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.links.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.links.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.links.tsv.gz", package = "gpgr") -(l <- linx_links_read(x)) -} diff --git a/man/linx_rmd.Rd b/man/linx_rmd.Rd deleted file mode 100644 index 97bae8f..0000000 --- a/man/linx_rmd.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rmd.R -\name{linx_rmd} -\alias{linx_rmd} -\title{Generate UMCCR LINX Report} -\usage{ -linx_rmd(sample, table_dir, plot_dir, out_file = NULL, quiet = FALSE) -} -\arguments{ -\item{sample}{Name of sample.} - -\item{table_dir}{Path to LINX table directory.} - -\item{plot_dir}{Path to LINX plot directory.} - -\item{out_file}{Path to output HTML file (needs '.html' suffix).} - -\item{quiet}{Suppress printing during rendering.} -} -\value{ -Path to rendered HTML report. -} -\description{ -Generates a UMCCR LINX HTML report. It does so with the following steps: -\enumerate{ -\item recursively copy the table and plot directories into tmp/plot and tmp/table -\item copy the rmd into tmp/linx.Rmd -\item render the rmd inside tmp/ -\item return the path to the output HTML -} -} diff --git a/man/linx_svs_process.Rd b/man/linx_svs_process.Rd deleted file mode 100644 index 10d9dd7..0000000 --- a/man/linx_svs_process.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_svs_process} -\alias{linx_svs_process} -\title{Process LINX SVS File} -\usage{ -linx_svs_process(x) -} -\arguments{ -\item{x}{Path to \code{linx.svs.tsv} file.} -} -\value{ -The input file as a processed tibble. -} -\description{ -Processes the \code{linx.svs.tsv} file. -} diff --git a/man/linx_svs_read.Rd b/man/linx_svs_read.Rd deleted file mode 100644 index dee9c45..0000000 --- a/man/linx_svs_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx.R -\name{linx_svs_read} -\alias{linx_svs_read} -\title{Read LINX SVS File} -\usage{ -linx_svs_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.svs.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.svs.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.svs.tsv.gz", package = "gpgr") -(l <- linx_svs_read(x)) -} diff --git a/man/linx_viscopynumber_read.Rd b/man/linx_viscopynumber_read.Rd deleted file mode 100644 index 9c7e4b3..0000000 --- a/man/linx_viscopynumber_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_viscopynumber_read} -\alias{linx_viscopynumber_read} -\title{Read LINX VisCopyNumber File} -\usage{ -linx_viscopynumber_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_copy_number.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_copy_number.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_copy_number.tsv.gz", package = "gpgr") -(l <- linx_viscopynumber_read(x)) -} diff --git a/man/linx_visfusion_read.Rd b/man/linx_visfusion_read.Rd deleted file mode 100644 index 1efe6f5..0000000 --- a/man/linx_visfusion_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_visfusion_read} -\alias{linx_visfusion_read} -\title{Read LINX VisFusion File} -\usage{ -linx_visfusion_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_fusion.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_fusion.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_fusion.tsv.gz", package = "gpgr") -(l <- linx_visfusion_read(x)) -} diff --git a/man/linx_visgeneexon_read.Rd b/man/linx_visgeneexon_read.Rd deleted file mode 100644 index 0ebdf03..0000000 --- a/man/linx_visgeneexon_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_visgeneexon_read} -\alias{linx_visgeneexon_read} -\title{Read LINX VisGeneExon File} -\usage{ -linx_visgeneexon_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_gene_exon.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_gene_exon.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_gene_exon.tsv.gz", package = "gpgr") -(l <- linx_visgeneexon_read(x)) -} diff --git a/man/linx_visproteindomain_read.Rd b/man/linx_visproteindomain_read.Rd deleted file mode 100644 index 8255b14..0000000 --- a/man/linx_visproteindomain_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_visproteindomain_read} -\alias{linx_visproteindomain_read} -\title{Read LINX VisProteinDomain File} -\usage{ -linx_visproteindomain_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_protein_domain.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_protein_domain.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_protein_domain.tsv.gz", package = "gpgr") -(l <- linx_visproteindomain_read(x)) -} diff --git a/man/linx_vissegments_read.Rd b/man/linx_vissegments_read.Rd deleted file mode 100644 index 7311d73..0000000 --- a/man/linx_vissegments_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_vissegments_read} -\alias{linx_vissegments_read} -\title{Read LINX VisSegments File} -\usage{ -linx_vissegments_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_segments.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_segments.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_segments.tsv.gz", package = "gpgr") -(l <- linx_vissegments_read(x)) -} diff --git a/man/linx_vissvdata_read.Rd b/man/linx_vissvdata_read.Rd deleted file mode 100644 index fd7baa6..0000000 --- a/man/linx_vissvdata_read.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/linx_vis.R -\name{linx_vissvdata_read} -\alias{linx_vissvdata_read} -\title{Read LINX VisSvData File} -\usage{ -linx_vissvdata_read(x) -} -\arguments{ -\item{x}{Path to \code{linx.vis_sv_data.tsv} file.} -} -\value{ -The input file as a tibble. -} -\description{ -Reads the \code{linx.vis_sv_data.tsv} file. -} -\examples{ -x <- system.file("extdata/linx/tables/linx.vis_sv_data.tsv.gz", package = "gpgr") -(l <- linx_vissvdata_read(x)) -} diff --git a/tests/testthat/test-roxytest-testexamples-linx.R b/tests/testthat/test-roxytest-testexamples-linx.R deleted file mode 100644 index d64ea5b..0000000 --- a/tests/testthat/test-roxytest-testexamples-linx.R +++ /dev/null @@ -1,59 +0,0 @@ -# Generated by roxytest: do not edit by hand! - -# File R/linx.R: @testexamples - -test_that("Function linx_svs_read() @ L240", { - - x <- system.file("extdata/linx/tables/linx.svs.tsv.gz", package = "gpgr") - (l <- linx_svs_read(x)) - expect_equal(colnames(l)[ncol(l)], "localTICountEnd") -}) - - -test_that("Function linx_breakend_read() @ L258", { - - x <- system.file("extdata/linx/tables/linx.breakend.tsv.gz", package = "gpgr") - (l <- linx_breakend_read(x)) - expect_equal(colnames(l)[ncol(l)], "junctionCopyNumber") -}) - - -test_that("Function linx_clusters_read() @ L276", { - - x <- system.file("extdata/linx/tables/linx.clusters.tsv.gz", package = "gpgr") - (l <- linx_clusters_read(x)) - expect_equal(colnames(l)[ncol(l)], "clusterDesc") -}) - - -test_that("Function linx_links_read() @ L294", { - - x <- system.file("extdata/linx/tables/linx.links.tsv.gz", package = "gpgr") - (l <- linx_links_read(x)) - expect_equal(colnames(l)[ncol(l)], "ecDna") -}) - - -test_that("Function linx_fusion_read() @ L312", { - - x <- system.file("extdata/linx/tables/linx.fusion.tsv.gz", package = "gpgr") - (l <- linx_fusion_read(x)) - expect_equal(colnames(l)[ncol(l)], "junctionCopyNumber") -}) - - -test_that("Function linx_drivercatalog_read() @ L330", { - - x <- system.file("extdata/linx/tables/linx.driver.catalog.tsv.gz", package = "gpgr") - (l <- linx_drivercatalog_read(x)) - expect_equal(colnames(l)[ncol(l)], "maxCopyNumber") -}) - - -test_that("Function linx_drivers_read() @ L348", { - - x <- system.file("extdata/linx/tables/linx.drivers.tsv.gz", package = "gpgr") - (l <- linx_drivers_read(x)) - expect_equal(colnames(l)[ncol(l)], "eventType") -}) - diff --git a/tests/testthat/test-roxytest-testexamples-linx_vis.R b/tests/testthat/test-roxytest-testexamples-linx_vis.R deleted file mode 100644 index 981a382..0000000 --- a/tests/testthat/test-roxytest-testexamples-linx_vis.R +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by roxytest: do not edit by hand! - -# File R/linx_vis.R: @testexamples - -test_that("Function linx_viscopynumber_read() @ L15", { - - x <- system.file("extdata/linx/tables/linx.vis_copy_number.tsv.gz", package = "gpgr") - (l <- linx_viscopynumber_read(x)) - expect_equal(colnames(l)[ncol(l)], "BAF") -}) - - -test_that("Function linx_visfusion_read() @ L45", { - - x <- system.file("extdata/linx/tables/linx.vis_fusion.tsv.gz", package = "gpgr") - (l <- linx_visfusion_read(x)) - expect_equal(colnames(l)[ncol(l)], "FusedExonDown") -}) - - -test_that("Function linx_visgeneexon_read() @ L75", { - - x <- system.file("extdata/linx/tables/linx.vis_gene_exon.tsv.gz", package = "gpgr") - (l <- linx_visgeneexon_read(x)) - expect_equal(colnames(l)[ncol(l)], "ExonEnd") -}) - - -test_that("Function linx_visproteindomain_read() @ L107", { - - x <- system.file("extdata/linx/tables/linx.vis_protein_domain.tsv.gz", package = "gpgr") - (l <- linx_visproteindomain_read(x)) - expect_equal(colnames(l)[ncol(l)], "Info") -}) - - -test_that("Function linx_vissegments_read() @ L138", { - - x <- system.file("extdata/linx/tables/linx.vis_segments.tsv.gz", package = "gpgr") - (l <- linx_vissegments_read(x)) - expect_equal(colnames(l)[ncol(l)], "InDoubleMinute") -}) - - -test_that("Function linx_vissvdata_read() @ L168", { - - x <- system.file("extdata/linx/tables/linx.vis_sv_data.tsv.gz", package = "gpgr") - (l <- linx_vissvdata_read(x)) - expect_equal(colnames(l)[ncol(l)], "InDoubleMinute") -}) - diff --git a/vignettes/linx.Rmd b/vignettes/linx.Rmd deleted file mode 100644 index f0de2fa..0000000 --- a/vignettes/linx.Rmd +++ /dev/null @@ -1,201 +0,0 @@ ---- -title: "LINX" -date: "`r Sys.Date()`" -output: rmarkdown::html_document ---- - -```{r setup, message=FALSE, warning=FALSE} -require(gpgr) -require(devtools) -require(dplyr) -require(knitr) -require(DT) -``` - -```{r funcs, echo=FALSE} -dt_table_random10 <- function(x, n = 10) { - # select 10 random rows - x |> - dplyr::slice_sample(n = n) |> - DT::datatable( - filter = list(position = "top", clear = FALSE, plain = TRUE), - class = "cell-border display compact", - rownames = FALSE, - extensions = c("Scroller", "Buttons", "KeyTable"), - options = list( - scroller = TRUE, scrollY = 400, scrollX = TRUE, - autoWidth = FALSE, keys = TRUE, - buttons = c("csv", "excel"), dom = "Blfrtip" - ) - ) -} -``` - - -Introduction -============ - -LINX: annotation, interpretation and visualisation tool for structural variants. - -- . -- groups SV calls together into events -- inputs: GRIDSS SVs, PURPLE CNVs, gene panel, known fusions/fragile sites/LINEs - -Table Outputs -------------- - -### Annotations - -- additional annotations of each non PON filtered break junction -- `svs.tsv` - -```{r} -system.file("extdata/linx/tables/linx.svs.tsv.gz", package = "gpgr") |> - gpgr::linx_svs_read() |> - dt_table_random10() -``` - - -### Breakends - -- impact of each non PON filtered break junction on each overlapping gene -- `breakend.tsv` - -```{r} -system.file("extdata/linx/tables/linx.breakend.tsv.gz", package = "gpgr") |> - gpgr::linx_breakend_read() |> - dt_table_random10() -``` - -### Clusters - -- clustering of all non PON filtered SV events and their resolved - classification. -- `clusters.tsv` - -```{r} -system.file("extdata/linx/tables/linx.clusters.tsv.gz", package = "gpgr") |> - gpgr::linx_clusters_read() |> - dt_table_random10() -``` - -### Links - -- segments joining break junction pairs predicted to be linked and phased in - _cis_ on the derivative chromosome. -- `links.tsv` - -```{r} -system.file("extdata/linx/tables/linx.links.tsv.gz", package = "gpgr") |> - gpgr::linx_links_read() |> - dt_table_random10(n = 1) -``` - -### Fusions - -- All inframe and outframe fusions predicted in the sample including HMF - fusion knowledgebase annotations. -- `fusion.tsv` - -```{r} -system.file("extdata/linx/tables/linx.fusion.tsv.gz", package = "gpgr") |> - gpgr::linx_fusion_read() |> - dt_table_random10() -``` - -### Driver Catalog - -- Reproduction of the driver catalog produced by PURPLE with homozygous - disruption events appended. -- `driver.catalog.tsv` - -```{r} -system.file("extdata/linx/tables/linx.driver.catalog.tsv.gz", package = "gpgr") |> - gpgr::linx_drivercatalog_read() |> - dt_table_random10() -``` - -### Drivers - -- Linkage of drivers from driver catalog to SV cluster which contributed to - those drivers including LOH, deletion, disruption and amplification events. -- `drivers.tsv` - -```{r} -system.file("extdata/linx/tables/linx.drivers.tsv.gz", package = "gpgr") |> - gpgr::linx_drivers_read() |> - dt_table_random10() -``` - -### Viral Inserts (Not Documented) - -## Table 'vis' outputs - -### Copy Number - -- `linx.vis_copy_number.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_copy_number.tsv.gz", package = "gpgr") |> - gpgr::linx_viscopynumber_read() |> - dt_table_random10() -``` - -### Fusion - -- `linx.vis_fusion.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_fusion.tsv.gz", package = "gpgr") |> - gpgr::linx_visfusion_read() |> - dt_table_random10(n = 1) -``` - -### Gene Exon - -- `linx.vis_gene_exon.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_gene_exon.tsv.gz", package = "gpgr") |> - gpgr::linx_visgeneexon_read() |> - dt_table_random10() -``` - -### Protein Domain - -- `linx.vis_protein_domain.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_protein_domain.tsv.gz", package = "gpgr") |> - gpgr::linx_visproteindomain_read() |> - dt_table_random10() -``` - -### Segments - -- `linx.vis_segments.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_segments.tsv.gz", package = "gpgr") |> - gpgr::linx_vissegments_read() |> - dt_table_random10() -``` - -### SV Data - -- `linx.vis_sv_data.tsv` - -```{r} -system.file("extdata/linx/tables/linx.vis_sv_data.tsv.gz", package = "gpgr") |> - gpgr::linx_vissvdata_read() |> - dt_table_random10() -``` - -## Session Info - -```{r session_info, echo=FALSE} -pkgs_of_interest <- c("base", "gpgr") -si <- gpgr::session_info_kable(pkgs_of_interest) -si$si_pkg -si$si_pl -```