R: rangeToFastq: Extract read information from alignments for...

rangeToFastq {rbamtools} | R Documentation

## rangeToFastq: Extract read information from alignments for given genomic range as fastq.

### Description

The function `rangeToFastq` writes all (or selected) aligns from a `bamRange` into a compressed fastq file.

### Usage

    rangeToFastq(object, filename, which, append=FALSE)

### Arguments

`object` | bamReader. Must be opened.

`filename` | Name of output 'fastq' file.

`which` | (Optional) Logical vector. When given, the routine checks for each of the given values the value of which. When TRUE the corresponding align will be written to the output file, otherwise will be skipped.

`append` | (Optional) When TRUE, the routine will append to an existing file. Otherwise existing files will be overwritten.

### Author(s)

Wolfgang Kaisers

### Examples

    bam <- system.file("extdata", "accepted_hits.bam", package="rbamtools")
    reader <- bamReader(bam, idx=TRUE)
    coords <- as.integer(c(0, 0, 249250621))
    range <- bamRange(reader, coords)
    rangeToFastq(range, "range.fq.gz")
    index <- sample(1:size(range), 100)
    rangeToFastq(range, "range_subset.fq.gz", which=index)

[Package rbamtools version 2.16.17 Index]