R/read_junction.R
read_junction_table.Rd
Read an *all_jxs.tsv
or *jxs.tsv
file created by bam_to_junctions()
or
manually by the user using Megadepth. The rows of a *jxs.tsv
can have
either 7 or 14 columns, which can lead to warnings when reading in - these
are safe to ignore. For details on the format of the input TSV file, check
https://github.com/ChristopherWilks/megadepth#junctions.
read_junction_table(tsv_file)
A character(1)
specifying the path to the tab-separated
(TSV) file created manually using megadepth_shell()
or on a previous
bam_to_junctions()
run.
A tibble::tibble()
with the junction data that follows the format
specified at https://github.com/ChristopherWilks/megadepth#junctions.
## Install if necessary
install_megadepth()
#> The latest megadepth version is 1.2.0
#> This is not an interactive session, therefore megadepth has been installed temporarily to
#> /tmp/RtmpmgolT5/megadepth
## Find the example BAM file
example_bam <- system.file("tests", "test.bam",
package = "megadepth", mustWork = TRUE
)
## Run bam_to_junctions()
example_jxs <- bam_to_junctions(example_bam, overwrite = TRUE)
## Read the junctions in as a tibble
all_jxs <- read_junction_table(example_jxs[["all_jxs.tsv"]])
all_jxs
#> # A tibble: 35 × 7
#> read_name chr start end mapping_strand cigar unique
#> <chr> <chr> <dbl> <dbl> <chr> <chr> <int>
#> 1 26573693 chr10 4358579 4581019 - 61M222441N11M 0
#> 2 59413733 chr10 8458623 8778558 + 13M319936N59M 0
#> 3 63502504 chr10 8722315 8848720 - 50M126406N22M 1
#> 4 15130473 chr10 8722508 8870679 - 61M148172N11M 1
#> 5 22331161 chr10 8756762 8780518 - 62M23757N10M 1
#> 6 37510913 chr10 8756762 8780518 - 62M23757N10M 1
#> 7 38798461 chr10 8756762 8780518 - 62M23757N10M 1
#> 8 62329988 chr10 8756762 8780518 - 62M23757N10M 1
#> 9 66789502 chr10 8756762 8780518 - 62M23757N10M 1
#> 10 78396176 chr10 8756762 8780518 - 62M23757N10M 1
#> # ℹ 25 more rows