ShortRead additional methods {easyRNASeq} | R Documentation

## Methods extending the ShortRead package functionalities

### Description

These are functions extending the ShortRead packages capabilities:

### Usage

    demultiplex(obj,barcodes=c(),barcodes.qty=12,barcode.length=6,
    edition.dist=2,type=c("independant","within"),index.only=FALSE,mc.cores=1L)
    barcodePlot(obj,barcodes=c(),type=c("independant","within"),
    barcode.length=6,show.barcode=20,...)
    chastityFilter(.name="Illumina Chastity Filter")
    naPositionFilter(.name="NA Position Filter")

### Arguments

`obj` | An object derived from class `AlignedRead`
`barcodes` | A character vector describing the multiplex (i.e. barcode) sequences used in the experiment.
`barcodes.qty` | An integer describing the number of barcodes
`barcode.length` | An integer describing the barcode length in bp
`edition.dist` | The maximal edition distance (i.e. the number of changes to apply), to accept an incorrectly sequenced barcode.
`type` | The type of barcode used. `independent` represents barcodes generated by the illumina protocol; i.e. a separate additional sequencing step performed once the first mate has been sequenced. `within` represents barcodes that are part of the sequenced reads as established by Lefrancois P et al., BMC Genomics, 2009
`index.only` | simply return the index and not the barcode themselves.
`mc.cores` | A parameter ultimately passed to srdistance to enable parallel processing on mc.cores. On linux and Mac only, windows task remain serially processed.
`.name` | An internal string describing the filter
`show.barcode` | An integer specifying how many barcodes should be displayed in the final output.
`...` | additional graphic parameters

### Details

- `barcodePlot` Creates a plot showing the barcode distribution of a multiplexed sequencing library.

- `chastityFilter` Creates a `SRFilter` instance that filters SolexaExport read according to the chastity filtering value.

- `demultiplex` Split a single `AlignedRead` object into a list of `AlignedRead` objects according to the barcodes provided by the user. It supports multicore processing but has a default serial behaviour.

- `naPositionFilter` Creates a `SRFilter` instance that filters SolexaExport read having an NA position.

When demultiplexing, the function if provided with just the `AlignedRead` will try to find out how many barcodes were used and what they are. This is unwise to do as many barcodes will get wrongly sequenced and not always the most frequent ones are the one you used! It's therefore strongly advised to specify the barcodes' sequences that were used.

### Value

- `barcodePlot` returns invisibly the barcode frequencies.

- `chastityFilter` returns a `SRFilter` instance.

- `demultiplex` returns a list of `AlignedRead` objects.

- `naPositionFilter` returns a `SRFilter` instance.

### Author(s)

Nicolas Delhomme

### See Also

`SRFilter` `AlignedRead`

### Examples

    	## Not run:
    	# the barcode
    	barcodes=c("ACACTG","ACTAGC","ATGGCT","TTGCGA")

    invisible(download.file(paste0("https://github.com/UPSCb/UPSCb/raw/",
           "master/tutorial/easyRNASeq/multiplex_export.txt.gz"),
           "multiplex_export.txt.gz"))

    	# the multiplexed data
    	alns <- readAligned(".",
                        pattern="multiplex_export",
                        filter=compose(
                          chastityFilter(),
                          nFilter(2),
                          chromosomeFilter(regex="chr")),
                        type="SolexaExport",
                        withAll=TRUE)

    	# barcode plot
    	barcodePlot(alns,
                barcodes=barcodes,
                type="within",
                barcode.length=6,
                show.barcode=20,
                main="All samples",
                xlim=c(0,0.5))

    	# demultiplexing
    	dem.alns <- demultiplex(alns,
                            barcodes=barcodes,
                            edition.dist=2,
                            barcodes.qty=4,
                            type="within")

    	# plotting again
    	par(mfrow=c(2,2))
    	barcode.frequencies <- lapply(
                                  names(dem.alns$barcodes),
                                  function(barcode,alns){
                                    barcodePlot(
                                                alns$barcodes[[barcode]],
                                                barcodes=barcode,
                                                type="within",barcode.length=6,
                                                show.barcode=20,
                                                main=paste(
                                                  "Expected barcode:",
                                                  barcode))
                                  },dem.alns)

    ## End(Not run)

[Package easyRNASeq version 2.24.1 Index]