Load bam(s) and view the context around a mutation

view_mutation_igv(
  this_mutation,
  this_seq_type = "genome",
  igv_port = 60506,
  socket,
  sort_by = "base",
  colour_by,
  squish = FALSE,
  viewaspairs = FALSE
)

Arguments

this_mutation

Specify the mutation of interest in MAF format.

this_seq_type

Specify the seq type, default is genome.

igv_port

Specify the port IGV is listening on. Default: 60506 (optional if using the default).

socket

Provide the socket variable obtained by running this function with no arguments.

sort_by

base, quality, sample or readGroup.

colour_by

Specify how IGV should colour the reads (see IGV documentation).

squish

Force reads to be squished (see IGV documentation). Default is FALSE.

viewaspairs

Set to TRUE if you want the reads to be shown as pairs rather than independently (see IGV documentation), default is FALSE.

Value

Path to file (.png).

Details

Load bam(s) and view the context around a mutation. IMPORTANT: you must be running IGV on the host that is running R and you need to have it listening on a port. The simplest scenario is to run this command on a terminal (if using a Mac), assuming you are using R on gphost10 and you have a ssh config that routes gp10 to that host

ssh -X gp10

then launch IGV (e.e. from a conda installation):

conda activate igv; igv &

Then obtain a socket and run this function as per the example.

Examples

if (FALSE) {
socket = make_igv_snapshot() #run with no arguments to get the socket for a running IGV instance
this_mutation = get_coding_ssm(seq_type="capture") %>% head(1)
view_mutation_igv(this_mutation, 
                  socket = socket,
                  this_seq_type = "capture",
                  colour_by = "READ_STRAND",
                  squish = TRUE,
                  viewaspairs = TRUE)
}