millefyPlot: Visualize read covearge in single-cell RNA-Seq data

Description Usage Arguments Value Examples

View source: R/millefy-track.R

Description

Visualize read covearge in single-cell RNA-Seq data

Usage

1
2
3
4
5
millefyPlot(track_data, track_type, heights, sc_type = c("coverage",
  "heatmap"), chr, start, end, binsize, title, axis = TRUE,
  axis_height = 1, sc_avg = TRUE, sc_avg_height = 1,
  sc_avg_scale = NA, sc_avg_log = FALSE, sc_average_mode = c("mean",
  "median"), sc_sort_destiny = c("none", "all", "group"))

Arguments

track_data

A list of tracks.

track_type

A list of track types. Track types are: "sc", "bed", "add" (bulk NGS), "avg", "gene", "title", "axis".

heights

A list of track heights. Or, you can use a unit (e.g., 'unit(c(1,1,12,2,1), c("null", "cm", "null", "null", "null")').

sc_type

A string. "heatmap" (default) or "coverage".

chr

A string. Chromosome name.

start

An integer. Start position.

end

An integer. End position.

binsize

A integer. By default bin size is automatically determined so that the number of bins is 1000.

title

A string. Title.

axis

A logical. If TRUE (default), axis for genomic coordinate is shown.

axis_height

A number. The height of the axis track.

sc_avg

A logical. If TRUE (defalut), a track for averaged read coverage for every group is generated.

sc_avg_height

A number. The height of the averaged read coverage track.

sc_avg_scale

A number. Maximum value of the averaged read coverage track.

sc_avg_log

A logical. If TRUE (default is FALSE), the values in the averaged read coverage track is log-transformed.

sc_average_mode

A string. "mean" (default) or "median". How to summarise single-cell read coverage across samples in every group.

sc_sort_destiny

'none' (default) or 'all' or 'group'.

Value

Description of return values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Path to bigWig files
bwfiles = Sys.glob(file.path(system.file("extdata", package="millefy"), "*.bw"))

# Group labels for bigWig files (same length as \\code{bwfiles})
groups = c("00h", "00h", "00h", "12h", "12h", "12h")

# Color labels for bigWig files (A named vector with the same length as the number of kinds of \\code{groups})
color_labels <- colorRampPalette(c("yellow", "red"))(length(unique(groups))+1)[1:length(unique(groups))]
names(color_labels)  <- unique(groups)

# Parameters
max_value = 7873

# Single cell track
scTrackBw <- list(path_bam_files = bwfiles, groups = groups, group_colors = color_labels, max_value = max_value, isBw=TRUE)

# Gene annotation track (For faster performance, try to use \\code{dt_gtf} paramter)
path_gtf <- system.file("extdata", "example.gtf", package="millefy")
dt_gtf_exon <- gtfToDtExon(path_gtf)
geneTrack1 <- list(path_gtf = path_gtf, dt_gtf = dt_gtf_exon, label = "GENCODE")

# Prepare arguments for \\code{millefyPlot()}
tdlist <- list(scTrackBw, geneTrack1)
tt <- c("sc", "gene")
heights = c(12, 2)
text_main = "My plot"

# Location to visualize
chr =  "chr19" # character
start = 5824708 # integer
end = 5845478 # integer

########
# Plot #
########
# Plot
# When we don't set the sc_sort_destiny parameter (default), the order of single cells is the order of bwfiles.
l <- millefyPlot(track_data=tdlist, track_type=tt, heights=heights,
          sc_type = "heatmap",
          chr = chr, start = start, end = end,
          sc_avg = TRUE, sc_avg_height = 1,
          title = text_main)


# Replot
# When we set sc_sort_destiny = 'all', all single cells are reordered by diffusion maps.
invisible(
  millefyPlot(
        track_data=l$track_data, track_type=l$track_type, heights=l$heights,
        sc_type = "heatmap",
        chr = chr, start = start, end = end,
        sc_avg = TRUE, sc_avg_height = 1,
        title = text_main, sc_avg_scale = 10, sc_sort_destiny = 'all'
        )
)

# Replot
# When we set sc_sort_destiny = 'group', all single cells in each group are reordered by diffusion maps.
invisible(
  millefyPlot(
        track_data=l$track_data, track_type=l$track_type, heights=l$heights,
        sc_type = "heatmap",
        chr = chr, start = start, end = end,
        sc_avg = TRUE, sc_avg_height = 1,
        title = text_main,
        sc_avg_scale = 10, sc_sort_destiny = 'group'
        )
)

yuifu/millefy documentation built on Dec. 26, 2019, 1:41 a.m.