Package 'bexy'

Title: Visualize and Parse the Output of 'BeXY'
Description: Provides functions for summarizing and plotting the output of the command-line tool 'BeXY' (<https://bitbucket.org/wegmannlab/bexy>), a tool that performs Bayesian inference of sex chromosome karyotypes and sex-linked scaffolds from low-depth sequencing data.
Authors: Madleina Caduff [aut, cre], Raphael Eckel [ctb], Christoph Leuenberger [ctb], Daniel Wegmann [aut]
Maintainer: Madleina Caduff <[email protected]>
License: GPL-2
Version: 0.1.3
Built: 2024-12-22 06:43:56 UTC
Source: CRAN

Help Index


Accurate Bayesian inference of sex chromosome karyotypes and sex-linked scaffolds from low-depth sequencing data

Description

Visualization of results produced by BeXY

Usage

bexy(path = NULL, readMCMCTrace = FALSE)

Arguments

path

The path where all the output files of BeXY are located. If NULL, the example files will be loaded.

readMCMCTrace

If TRUE, read the full trace of the MCMC of all parameters (potentially slow).

Value

An object of type bexy.


Getting posterior mean rho (ploidy ratio parameter) for each scaffold

Description

Getting posterior mean rho (ploidy ratio parameter) for each scaffold

Usage

getPosteriorMeanRho(object)

Arguments

object

A bexy object.

Value

A numeric vector containing the posterior mean of rho for each scaffold

See Also

bexy

Examples

bex <- bexy()
getPosteriorMeanRho(bex)

Getting the posterior mode for each autosomal trisomy

Description

Getting the posterior mode for each autosomal trisomy

Usage

getPosteriorModeAutosomalTrisomy(
  object,
  scaffoldName,
  threshold_certainty = 0.9
)

Arguments

object

A bexy object.

scaffoldName

The scaffold name, must be an autosome.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing the trisomy classification for each sample for the given scaffold

See Also

bexy

Examples

bex <- bexy()
getPosteriorModeAutosomalTrisomy(bex, "21")

Getting the posterior mode for each scaffold type

Description

Getting the posterior mode for each scaffold type

Usage

getPosteriorModeScaffoldTypes(object, threshold_certainty = 0.9)

Arguments

object

A bexy object.

threshold_certainty

The threshold for certainty on the posterior probabilities. All scaffolds that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing the scaffold type classification for each scaffold

See Also

bexy

Examples

bex <- bexy()
getPosteriorModeScaffoldTypes(bex)

Getting the posterior mode for each sex karyotype

Description

Getting the posterior mode for each sex karyotype

Usage

getPosteriorModeSexKaryotypes(object, threshold_certainty = 0.9)

Arguments

object

A bexy object.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing the sex karyotype classification for each sample

See Also

bexy

Examples

bex <- bexy()
getPosteriorModeSexKaryotypes(bex)

Getting all samples classified as a certain autosomal trisomy

Description

Getting all samples classified as a certain autosomal trisomy

Usage

getSamplesWithAutosomalTrisomy(object, scaffoldName, threshold_certainty = 0.9)

Arguments

object

A bexy object.

scaffoldName

The scaffold name, must be an autosome.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing all sample names that are classified as having an autosomal trisomy of scaffold 'scaffoldName'

See Also

bexy

Examples

bex <- bexy()
getSamplesWithAutosomalTrisomy(bex, "21")

Getting all samples classified as a specific sex karyotype

Description

Getting all samples classified as a specific sex karyotype

Usage

getSamplesWithThisKaryotype(object, karyotype, threshold_certainty = 0.9)

Arguments

object

A bexy object.

karyotype

One specific sex karyotype, can be XY, XX, X0, XXY, XYY, XXX or XXYY.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing all sample names that are classified as the sex karyotype given by argument 'karyotype'.

See Also

bexy

Examples

bex <- bexy()
getSamplesWithThisKaryotype(bex, "XX")

Getting all scaffolds classified as a specific scaffold type

Description

Getting all scaffolds classified as a specific scaffold type

Usage

getScaffoldsWithThisType(object, type, threshold_certainty = 0.9)

Arguments

object

A bexy object.

type

One specific scaffold type, can be Autosome, Y-linked, X-linked or Different.

threshold_certainty

The threshold for certainty on the posterior probabilities. All scaffolds that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

A character vector containing all scaffold names that are classified as the scaffold type given by argument 'type'.

See Also

bexy

Examples

bex <- bexy()
getScaffoldsWithThisType(bex, "X-linked")

Plotting a bexy object. To customize the plots, please call the respective plotting functions directly (e.g. plotTernary, plotCounts, plotBars...).

Description

Plotting a bexy object. To customize the plots, please call the respective plotting functions directly (e.g. plotTernary, plotCounts, plotBars...).

Usage

## S3 method for class 'bexy'
plot(x, ...)

Arguments

x

A bexy object.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plot(bex)

Plotting the autosomal trisomies

Description

Plotting the autosomal trisomies

Usage

plotAutosomalTrisomy(
  x,
  scaffoldName,
  colors = c("deepskyblue4", "darkred"),
  sampleNamesToHighlight = c(),
  label = TRUE,
  ...
)

Arguments

x

A bexy object.

scaffoldName

The name of the scaffold to plot (has to be an autosome)

colors

A vector of length two with the colors for diploid and triploid samples, respectively.

sampleNamesToHighlight

A vector of sample names that should be highlighted. If empty, samples are automatically highlighted based on the posterior probabilities.

label

Boolean indicating whether samples should be labeled.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotAutosomalTrisomy(bex, "21")

Plotting the autosomal trisomies: counts on that scaffold

Description

Plotting the autosomal trisomies: counts on that scaffold

Usage

plotAutosomalTrisomyCounts(
  x,
  scaffoldName,
  colors = c("deepskyblue4", "darkred"),
  sampleNamesToHighlight = c(),
  label = TRUE,
  ...
)

Arguments

x

A bexy object.

scaffoldName

The name of the scaffold to plot (has to be an autosome)

colors

A vector of length two with the colors for diploid and triploid samples, respectively.

sampleNamesToHighlight

A vector of sample names that should be highlighted. If empty, samples are automatically highlighted based on the posterior probabilities.

label

Boolean indicating whether samples should be labeled.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotAutosomalTrisomyCounts(bex, "21")

Plotting the autosomal trisomies: posterior probabilities

Description

Plotting the autosomal trisomies: posterior probabilities

Usage

plotAutosomalTrisomyPosteriorProbabilities(
  x,
  scaffoldName,
  colors = c("deepskyblue4", "darkred"),
  sampleNamesToHighlight = c(),
  label = TRUE,
  ...
)

Arguments

x

A bexy object.

scaffoldName

The name of the scaffold to plot (has to be an autosome)

colors

A vector of length two with the colors for diploid and triploid samples, respectively.

sampleNamesToHighlight

A vector of sample names that should be highlighted. If empty, samples are automatically highlighted based on the posterior probabilities.

label

Boolean indicating whether samples should be labeled.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotAutosomalTrisomyPosteriorProbabilities(bex, "21")

Plotting a barplot with the posterior probabilities of each sex karyotype per sample

Description

Plotting a barplot with the posterior probabilities of each sex karyotype per sample

Usage

plotBars(
  x,
  colors = c("lightblue", "lightpink", "khaki", "maroon1", "dodgerblue3", "red4", "navy"),
  maxNumSamplesPerPlot = 100,
  sortByKaryotype = TRUE,
  sampleNames = c(),
  ...
)

Arguments

x

A bexy object.

colors

A vector of length 7 with the colors for XY, XX, X0, XXY, XYY, XXX and XXYY, respectively.

maxNumSamplesPerPlot

How many samples to place next to each other into one barplot. If there are more samples, multiple barplots will be generated. This is to ensure that the labels are readable.

sortByKaryotype

If TRUE, the samples (i.e. the bars) are ordered by the posterior mode of the sex karyotype.

sampleNames

A vector of sample names that represents the order in which the bars are plotted. Overrides any argument given to sortByKaryotype.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotBars(bex)

Plotting the percentage of counts mapping to two scaffolds (by default a Y-linked scaffold against a X-linked scaffold), colored by sex karyotype

Description

Plotting the percentage of counts mapping to two scaffolds (by default a Y-linked scaffold against a X-linked scaffold), colored by sex karyotype

Usage

plotCounts(
  x,
  scaffoldX = NULL,
  scaffoldY = NULL,
  colors = c("turquoise3", "darkorange", "royalblue4"),
  sampleNamesToHighlight = c(),
  label = TRUE,
  ...
)

Arguments

x

A bexy object.

scaffoldX

A string with the name of the scaffold to be plotted on the x-axis. If NULL (default), a X-linked scaffold is used.

scaffoldY

A string with the name of the scaffold to be plotted on the y-axis. If NULL (default), a Y-linked scaffold is used.

colors

A vector of length three with the colors for aneuploid, XX and XY samples, respectively.

sampleNamesToHighlight

A vector of sample names that should be highlighted. If empty, samples are automatically highlighted based on the posterior probabilities.

label

Boolean indicating whether samples should be labeled.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotCounts(bex)

Plot the MCMC trace for a specific parameter

Description

Plot the MCMC trace for a specific parameter

Usage

plotMCMCTrace(object, parameterName, maxNumPlots = 20)

Arguments

object

A bexy object.

parameterName

The name of the parameter to plot (e.g. rho, logSigma, epsilon, s, t, a, f, ...)

maxNumPlots

The maximum number of plots to plot, default 20.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy(readMCMCTrace = TRUE)
plotMCMCTrace(bex, "rho", maxNumPlots = 1)

Plotting the ternary of a bexy object

Description

Plotting the ternary of a bexy object

Usage

plotTernary(
  x,
  colors = c("turquoise3", "darkorange", "royalblue4"),
  sampleNamesToHighlight = c(),
  label = TRUE,
  addSquares = TRUE,
  ...
)

Arguments

x

A bexy object.

colors

A vector of length three with the colors for aneuploid, XX and XY samples, respectively.

sampleNamesToHighlight

A vector of sample names that should be highlighted. If empty, samples are automatically highlighted based on the posterior probabilities.

label

Boolean indicating whether samples should be labeled.

addSquares

Boolean indicating whether 7-cell posterior probability square plots should be drawn.

...

Other parameters used for plotting.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
plotTernary(bex)

Printing a bexy object

Description

Printing a bexy object

Usage

## S3 method for class 'bexy'
print(x, ...)

Arguments

x

A bexy object.

...

Additional parameters passed to print functions.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
print(bex)

Summarizing a bexy object

Description

Summarizing a bexy object

Usage

## S3 method for class 'bexy'
summary(object, ...)

Arguments

object

A bexy object.

...

Additional parameters passed to summary functions.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
print(bex)

Write a file with the posterior mode for each autosomal trisomy

Description

Write a file with the posterior mode for each autosomal trisomy

Usage

writePosteriorModeAutosomalTrisomies(
  object,
  scaffoldName,
  file,
  threshold_certainty = 0.9
)

Arguments

object

A bexy object.

scaffoldName

The scaffold name, must be an autosome.

file

The name of the output file.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
tf <- tempfile(fileext = ".txt")
writePosteriorModeAutosomalTrisomies(bex, "21", tf)

Write a file with the posterior mode for each scaffold type

Description

Write a file with the posterior mode for each scaffold type

Usage

writePosteriorModeScaffoldTypes(object, file, threshold_certainty = 0.9)

Arguments

object

A bexy object.

file

The name of the output file.

threshold_certainty

The threshold for certainty on the posterior probabilities. All scaffolds that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
tf <- tempfile(fileext = ".txt")
writePosteriorModeScaffoldTypes(bex, tf)

Write a file with the posterior mode for each sex karyotype

Description

Write a file with the posterior mode for each sex karyotype

Usage

writePosteriorModeSexKaryotypes(object, file, threshold_certainty = 0.9)

Arguments

object

A bexy object.

file

The name of the output file.

threshold_certainty

The threshold for certainty on the posterior probabilities. All samples that have a posterior probability less than this threshold are classified as 'uncertain'.

Value

No return value, called for side effects.

See Also

bexy

Examples

bex <- bexy()
tf <- tempfile(fileext = ".txt")
writePosteriorModeSexKaryotypes(bex, tf)