export.ofst,GRanges-method {ORFik} | R Documentation

## Store GRanges / GAlignments object as .ofst

### Description

A much faster way to store, load and use bam files.
.ofst is ORFik fast serialized object, an optimized format for coverage reads with cigar and replicate number. It uses the fst format as back-end: `fst-package`.
A .ofst ribo seq file can compress the information in a bam file from 5GB down to a few MB. This new files has super fast reading time, only a few seconds, instead of minutes. It also has random index access possibility of the file.
.ofst is represented as a data.frane format with minimum 4 columns:
1. chromosome
2. start (left most position)
3. strand (+, -, *)
4. width (not added if cigar exists)
5. cigar (not needed if width exists): (cigar # M's, match/mismatch total)
5. score: duplicates of that read
6. size: qwidth according to reference of read
If file is from GAlignmentPairs, it will contain a cigar1, cigar2 instead of cigar and start1 and start2 instead of start

### Usage

    ## S4 method for signature 'GRanges'
    export.ofst(x, file, ...)

### Arguments

`x` | a GRanges, GAlignments or GAlignmentPairs object
`file` | a character, location on disc (full path)
`...` | additional arguments for write_fst

### Details

Other columns can be named whatever you want and added to meta columns. Positions are 1-based, not 0-based as .bed. Import with import.ofst

### Value

NULL, object saved to disc

### Examples

    ## GRanges
    gr <- GRanges("1:1-3:-")
    # export.ofst(gr, file = "path.ofst")
    ## GAlignment
    # Make input data.frame
    df <- data.frame(seqnames = "1", cigar = "3M", start = 1L, strand = "+")
    ga <- ORFik:::getGAlignments(df)
    # export.ofst(ga, file = "path.ofst")

[Package ORFik version 1.10.13 Index]