chromatogram {sangerseqR} | R Documentation

## Generate Chromatogram

### Description

Generates a chromatogram from a `sangerseq` class object.

### Usage

    chromatogram(obj, trim5 = 0, trim3 = 0, showcalls = c("primary",
      "secondary", "both", "none"), width = 500, height = NA, cex.mtext = 1,
      cex.base = 1, ylim = 2, filename = NULL, showtrim = FALSE,
      showhets = TRUE)

    ## S4 method for signature 'sangerseq'
    chromatogram(obj, trim5 = 0, trim3 = 0,
      showcalls = c("primary", "secondary", "both", "none"), width = 100,
      height = 2, cex.mtext = 1, cex.base = 1, ylim = 3, filename = NULL,
      showtrim = FALSE, showhets = TRUE)

### Arguments

`obj` | `sangerseq` class object
`trim5` | Number of bases to trim from the beginning of the sequence.
`trim3` | Number of bases to trim from the end of the sequence.
`showcalls` | Which basecall sequence to show. Any value other than "primary", "secondary" or "both" will result in basecalls not being shown.
`width` | Approximate number of bases per line.
`height` | Height of each plot row. Ignored by some devices.
`cex.mtext` | Size factor for the text in the margins.
`cex.base` | Size factor for the basecall text.
`ylim` | Peaks larger than this many times the IQR larger than the median will be cutoff.
`filename` | Name of PDF file to save to. A "NULL" value outputs the chromatogram to the current device.
`showtrim` | If true, highlights trimmed region instead of hiding it.
`showhets` | Whether or not to highlight heterozygous positions.

### Details

This function outputs a chromatogram to the current device or to a PDF file (filename is not NULL). Primary, Secondary or both basecalls can be shown if they are contained in the `sangerseq` object provided. What is shown will depend on how they were generated. If generated and provided by the ABIF or SCF file, then it will show the primary calls on the first line and the secondary calls on the second line. If generated by `makeBaseCalls`, then they will show the maximum and alternate basecalls only for heterozygous peaks. Finally, if the `setAllelePhase` has been run on the object, then the first line is the reference sequence and the second line is the alternate allele.

The range of the trace data shown is trimmed to the called sequence by default. Setting `trim5` and `trim3` to NULL will show the complete trace 5' and 3' of the called bases, respectively. This will generally create a very long trace. Conversely, setting `trim5` and `trim3` to an integer > 0 will hide the data corresponding to that number of bases at each end. For example, `trim5=10` and `trim3=20` will remove 10 bases from the 5' end and 20 bases from the 3' end.

Several output parameters can also be set to control how the figure appears. However, it should be noted that if the current device is too small, R will return an error and not show the chromatogram. This is common with long sequence reads. To bypass this error, we recommend that the user set `filename`. This will cause the chromatogram to be saved to a PDF file in the current working directory.

### Value

A plot showing the chromatogram tracedata and, optionally, basecalls.

### See Also

`makeBaseCalls`, `setAllelePhase`, `sangerseq`

### Examples

    hetsangerseq <- readsangerseq(system.file("extdata",
                                              "heterozygous.ab1",
                                              package = "sangerseqR"))
    hetcalls <- makeBaseCalls(hetsangerseq, ratio = 0.33)
    chromatogram(hetcalls, width = 100, height = 2, trim5 = 50, trim3 = 100,
                 showcalls = "both", filename = "chromatogram.pdf")

[Package sangerseqR version 1.30.1 Index]