TabixFile-methods {rtracklayer} | R Documentation

## TabixFile Import/Export

### Description

These methods support the import and export of `Rsamtools:TabixFile`TabixFile objects. These are generally useful when working with tabix-indexed files that have a non-standard format (i.e., not BED nor GFF), as well as exporting an object with arbitrary columns (like a GRanges) to an indexed, tab-separated file. This relies on the tabix header, which indicates the columns in the file that correspond to the chromosome, start and end. The BED and GFF parsers handle tabix transparently.

### Usage

    ## S4 method for signature 'TabixFile,ANY,ANY'
    import(con, format, text,
                       which = if (is.na(genome)) NULL
                               else as(seqinfoForGenome(genome), "GenomicRanges"),
                       genome = NA, header = TRUE, ...)
    exportToTabix(object, con, ...)

### Arguments

`con` | For `import`, a `TabixFile` object; for `exportToTabix`, a string naming the destination file.
`object` | The object to export. It is coerced to a `data.frame`, written to a tab-separated file, and indexed with tabix for efficient range-based retrieval of the data using `import`.
`format` | If any known format, like “bed” or “gff” (or one of their variants), then the appropriate parser is applied. If any other value, then the tabix header is consulted for the format. By default, this is taken from the file extension.
`text` | Ignored.
`which` | A range data structure coercible to `IntegerRangesList`, like a `GRanges`. Only the intervals in the file overlapping the given ranges are returned. The default is to use the range over the entire genome given by `genome`, if specified.
`genome` | The identifier of a genome, or `NA` if unknown. Typically, this is a UCSC identifier like “hg19”. An attempt will be made to derive the `seqinfo` on the return value using either an installed BSgenome package or UCSC, if network access is available.
`header` | If `TRUE`, then the header in the indexed file, which might include a track line, is sent to the parser. Otherwise, the initial lines are skipped, according to the `skip` field in the tabix index header.
`...` | Extra arguments to pass to the underlying import routine, which for non-standard formats is `read.table` or `write.table`.

### Value

For `import`, a `GRanges` object.

For `exportToTabix`, a `TabixFile` object that is directly passable to `import`.

### Author(s)

Michael Lawrence

### References

http://samtools.sourceforge.net/tabix.shtml

### See Also

`scanTabix` and friends

[Package rtracklayer version 1.48.0 Index]