Creates the necessary configuration string for an R data frame so that it can be viewed as a track in a JBrowse custom linear genome view.

track_data_frame(track_data, track_name, assembly)

Arguments

track_data

the data frame with track data. Must have cols: chrom, start, end, name. The column additional can optionally be include with more feature information. If a score column is present, it will be used and the track will be rendered to display quantitative features.

track_name

the name to use for the track

assembly

the config string generated by assembly

Value

a character vector of stringified track JSON configuration

Examples

assembly <- assembly("https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz", bgzip = TRUE)

df <- data.frame(
        chrom = c(1, 2),
        start = c(123, 456),
        end = c(789, 101112),
        name = c('feature1', 'feature2')
      )

track_data_frame(df, "my_features", assembly)
#> [1] "{ \"type\": \"FeatureTrack\", \"name\": \"my_features\", \"assemblyNames\": [\"hg19\"], \"trackId\": \"hg19_my_features\", \"adapter\": { \"type\": \"FromConfigAdapter\", \"features\": [{\"refName\": \"1\", \"start\": 123, \"end\": 789, \"uniqueId\": \"adbb4b07e579c61e22035582cc5b5a16\", \"name\": \"feature1\", \"type\": \"\", \"additional\": \"\" }, {\"refName\": \"2\", \"start\": 456, \"end\": 101112, \"uniqueId\": \"adbb4b07e579c61e22035582cc5b5a16\", \"name\": \"feature2\", \"type\": \"\", \"additional\": \"\" }] } }"