merge_mutations_in_phase: Collapses mutations in phase into one event

Description Usage Arguments Details Value See Also Examples

View source: R/merge_mutations_in_phase.R

Description

Given a mutations data frame and a bam file, this function collapses mutations in phase identified by the ID_column into one event. While doing that, it ignores the reads that support both the reference and alternative alleles for different mutations in phase.

Usage

1
2
merge_mutations_in_phase(mutations, bam, tag = "",
  ID_column = "phasingID", min_base_quality = 20, min_mapq = 30)

Arguments

mutations

A data frame with the reporter mutations. Should have the columns CHROM, POS, REF, ALT.

bam

path to bam file

tag

the RG tag if the bam has more than one sample

ID_column

The name of the column in mutations data.frame that has the IDs for mutations in phase. NA values will be filled automatically by unique mutation identifiers.

min_base_quality

minimum base quality for a read to be counted

min_mapq

integer specifying the minimum mapping quality for reads to be included.

Details

Mutations in phase are those that are supported by the same reads (same allele). The function doesn't identify mutations in phase, but rather use an ID column in the input whose name is specified by ID_column to tell which mutations are in phase.

Since two or more mutations can be supported by the same evidence, this function merges these mutations into one event. The function will also remove the mismatches that are not exhibited in all the covered phased mutations (since this function is developed for the intent of minimal residual disease testing).

The output will include the merged mutations, the probability of purification, which is defined as the number of reads covering at least two mutations in phase divided by the number of informative reads. Informative reads count is the total number of unique reads mapping to the mutations input (including both mutations in phase and other mutations).

Value

A list with the following slots:

out:

A data frame that has the columns:

  • Phasing_id: the ID of the mutations/event.

  • ref: number of reference reads.

  • alt: number of alternative reads.

  • n_reads_multi_mutation: Number of reads that span more than one mutation in phase.

  • all_reads: total number of reads.

  • multi_support: number of reads that support the alt allele of multiple mutations in phase.

purification_prob:

Probability of purification: sum(n_reads_multi_mutation)/sum(all_reads)

multi_support:

Number of multi-support reads in all mutations/events

informative_reads:

Number of unique reads covering the mutations/events

See Also

test_ctDNA get_mutations_read_names

Examples

1
2
3
data("mutations", package = "ctDNAtools")
bamT1 <- system.file("extdata", "T1.bam", package = "ctDNAtools")
merge_mutations_in_phase(mutations = mutations[5:10, ], bam = bamT1, ID_column = "PHASING")

ctDNAtools documentation built on March 26, 2020, 7:39 p.m.