save_tr2g_bustools {BUSpaRse} | R Documentation

## Save transcript to gene file for use in `bustools`

### Description

This function saves the transcript to gene data frame generated by this package in whatever means in a format required by `bustools`. In order to use `bustools` to generate the gene count or TCC matrix, a file that maps transcripts to genes is required. This should be a tsv file with 2 columns: the first column for transcript ID and the second for gene ID. The order of transcripts in this file must be the same as the order in the kallisto index, and this ordering can be ensured by the function `sort_tr2g`. There must also be no headers. All columns other than `transcript` and `gene` will be discarded. To save a file with those columns, directly save the transcript to gene data frame with function like `write.table`, `readr::write_delim`, and `fwrite`.

### Usage

    save_tr2g_bustools(tr2g, file_save = "./tr2g.tsv", ...)

### Arguments

`tr2g` | The data frame output from the `tr2g_*` family of functions.
`file_save` | File name of the file to be saved. The directory in which the file is to be saved must exist.
`...` | Other arguments passed to `fwrite`, such as `sep`, `quote`, and `col.names`.

### Value

Nothing is returned into the R session. A tsv file of the format required by `bustools` with the name and directory specified will be written to disk.

### Examples

    toy_path <- system.file("testdata", package = "BUSpaRse")
    file_use <- paste(toy_path, "gtf_test.gtf", sep = "/")
    tr2g <- tr2g_gtf(file = file_use, verbose = FALSE)
    save_tr2g_bustools(tr2g, file_save = "./tr2g.tsv")

[Package BUSpaRse version 1.0.0 Index]