Creates the necessary configuration string for an indexed BAM or CRAM alignment so that it can be used in a JBrowse custom linear genome view.
track_alignments(track_data, assembly)
the URL to the BAM/CRAM alignments
the config string generated by assembly
a character vector of stringified AlignmentsTrack JSON configuration
It is important to note that while only the BAM/CRAM file is
passed as an argument, tracks_alignment
assumes that a BAM/CRAM
index of the same name is located with the file
For example:
track_alignments("data/alignments.bam")
Assumes that data/alignments.bam.bai
also exists.
This is a JBrowse 2 convention, and the default naming output of samtools
For more information on creating an index with samtools, visit https://www.htslib.org/
assembly <- assembly("https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz", bgzip = TRUE)
track_alignments("alignments.bam", assembly)
#> [1] "{\"type\": \"AlignmentsTrack\", \"name\": \"alignments\", \"assemblyNames\": [\"hg19\"], \"trackId\": \"hg19_alignments\", \"adapter\": { \"type\": \"BamAdapter\", \"bamLocation\": { \"uri\": \"alignments.bam\" }, \"index\": { \"location\": { \"uri\": \"alignments.bam.bai\" } } } }"
track_alignments("alignments.cram", assembly)
#> [1] "{\"type\": \"AlignmentsTrack\", \"name\": \"alignments\", \"assemblyNames\": [\"hg19\"], \"trackId\": \"hg19_alignments\", \"adapter\": { \"type\": \"CramAdapter\", \"cramLocation\": { \"uri\": \"alignments.cram\" }, \"craiLocation\": { \"uri\": \"alignments.cram.crai\" }, \"sequenceAdapter\": {\"type\":\"BgzipFastaAdapter\",\"fastaLocation\":{\"uri\":\"https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz\"},\"faiLocation\":{\"uri\":\"https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz.fai\"},\"gziLocation\":{\"uri\":\"https://jbrowse.org/genomes/hg19/fasta/hg19.fa.gz.gzi\"}} } }"