Last data update: 2014.03.03

R: Exact alignment of DNA sequences against a reference
alignShortReadsR Documentation

Exact alignment of DNA sequences against a reference

Description

This method aligns given sequences against a given reference genome using the matchPDict method. Only exact (no errors) and unique matches are returned.

Usage

alignShortReads(object, bsGenome, seqNames, ensemblNotation)

Arguments

object

The reads that should be aligned agiven either as a DNAStringSet or a AVASet instance. In the latter case the reference sequences are extracted and aligned.

bsGenome

A bsGenome instance providing the reference sequences.

seqNames

The names of the sequences in bsGenome that should be used. If omitted, all reference sequences are used.

ensemblNotation

If set to TRUE, “chr” is removed from the reference sequences' names in the returned alignment. Default value is FALSE.

Details

All reads are aligned against the reference and its reverse complement. If the reads are not in 5' to 3' orientation, they should be reversed before. Note that only exact and unique alignments are reported. Use matchPDict directly for more flexibility.

Value

An object of class AlignedRead or a AVASet instance.

Author(s)

Hans-Ulrich Klein

See Also

matchPDict, DNAStringSet, AlignedRead, AVASet

Examples

library("BSgenome.Scerevisiae.UCSC.sacCer2")
reads = DNAStringSet(c(
  "CCGTTCAAAGAGCCCTTGGCCCATAATCCACCGGTT",
  "ATCCTGCCACAGGAGTCCATGGAGGTTTCGCCA"))
alignShortReads(reads, Scerevisiae, seqNames="chrIII")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(R453Plus1Toolbox)
Loading required package: VariantAnnotation
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: GenomeInfoDb
Loading required package: stats4
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: Rsamtools
Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'VariantAnnotation'

The following object is masked from 'package:base':

    tabulate

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/R453Plus1Toolbox/alignShortReads.Rd_%03d_medium.png", width=480, height=480)
> ### Name: alignShortReads
> ### Title: Exact alignment of DNA sequences against a reference
> ### Aliases: alignShortReads
> ###   alignShortReads,AVASet,BSgenome,character,logical-method
> ###   alignShortReads,AVASet,BSgenome,character,missing-method
> ###   alignShortReads,AVASet,BSgenome,missing,logical-method
> ###   alignShortReads,AVASet,BSgenome,missing,missing-method
> ###   alignShortReads,DNAStringSet,BSgenome,character,logical-method
> ###   alignShortReads,DNAStringSet,BSgenome,character,missing-method
> ###   alignShortReads,DNAStringSet,BSgenome,missing,logical-method
> ###   alignShortReads,DNAStringSet,BSgenome,missing,missing-method
> ### Keywords: alignShortReads
> 
> ### ** Examples
> 
> library("BSgenome.Scerevisiae.UCSC.sacCer2")
Loading required package: BSgenome
Loading required package: rtracklayer
> reads = DNAStringSet(c(
+   "CCGTTCAAAGAGCCCTTGGCCCATAATCCACCGGTT",
+   "ATCCTGCCACAGGAGTCCATGGAGGTTTCGCCA"))
> alignShortReads(reads, Scerevisiae, seqNames="chrIII")
class: AlignedRead
length: 2 reads; width: 33 36 cycles
chromosome: chrIII chrIII 
position: 120000 212030 
strand: + + 
alignQuality: NumericQuality 
alignData varLabels:  
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>