p_prior_mutations: Computes prior probability of mutations

View source: R/p_prior_mutations.r

p_prior_mutationsR Documentation

Computes prior probability of mutations

Description

This is an auxiliary function in single package. It computes the prior probability of mutation in a gene library.

Usage

p_prior_mutations(
  rates.matrix,
  mean.n.mut,
  ref_seq,
  save = FALSE,
  output_file = "tablePriorMutations.txt"
)

Arguments

rates.matrix

Mutation rate matrix: 4x5 matrix, each row/col representing a nucleotide (col adds deletion), and the values is the mutational rate from row to col.

mean.n.mut

Mean number of mutations expected (one number).

ref_seq

DNAStringSet containing the true reference sequence.

save

Logical. Should data be saved in a output_file?

output_file

File name for output, if save=TRUE.

Value

Data frame with columns wt.base (wild type nucleotide), nucleotide (mutated nucleotide), p_mutation (probaility of mutation)

Examples

refseq_fasta <- system.file("extdata", "ref_seq.fasta", package = "single")
ref_seq <- Biostrings::subseq(Biostrings::readDNAStringSet(refseq_fasta), 1,10)
train_reads_example <- system.file("extdata", "train_seqs_500.sorted.bam",
                                   package = "single")
counts_pnq <- pileup_by_QUAL(train_reads_example,pos_start=1,pos_end=10)
p_prior_mutations <- p_prior_mutations(rates.matrix = mutation_rate,
    mean.n.mut = 5,ref_seq = ref_seq)
head(p_prior_mutations)

rocioespci/single documentation built on April 18, 2023, 8:48 p.m.