Skip to contents

plot_profile makes gtrellis plot of CN profile over all chromosomes. Sample, Chromosome, Start, End and value of CN at the segment are the input.

Usage

plot_profile(sa, cn, filename, ylim = NULL, ylab = "CN")

Arguments

sa

a data frame which contains Sample Chromosome Start End

cn

vector giving CN profile for the segments specified in sa

filename

name of file where the plot will be stored

ylim

vector of two elements giving the lower, upper values to which limit CN

ylab

label to be placed on y axis (default 'CN')

Value

invisibly, saves the plot as a tiff

See also

analyze_TCGA_study

Examples

if (FALSE) {
# Ex: profile plot for a sample;
#     assumes that example from analyze_TCGA_study is already run
#
sample_names = unique(da_vD$Sample)
i=1
sample_names[i]
#[1] "TCGA-AF-2687-01A-02D-1732-01"
sa = da %>% filter(Sample == sample_names[i])
#
# RCN
r = 2^sa$Segment_Mean
w = w = sa$End - sa$Start # should be +1
plot_profile(sa, r, paste0(sample_names[i], '_RCN.tiff'),
             ylim = c(0,3), ylab = 'RCN')
#
# ACN for CNH (unfiltered)
cnh = find_cnhplus(grid, r = r, w = w, k=2, plus = F)
cnh
#   purity ploidy     kappa
#1   0.25   2.99 0.1733696
#2   0.25   3.00 0.1734264

acn_cnh = r2q(r, cnh$purity[1], cnh$ploidy[1])
plot_profile(sa, acn_cnh, paste0(sample_names[i], '_ACN_for_CNH.tiff'),
            ylim = c(-10,10), ylab = 'ACN for CNH')
#
# ACN for CNH+
# oo[[i]]
#                   sample_name purity ploidy     kappa
#1 TCGA-AF-2687-01A-02D-1732-01      1   1.94 0.1880932
#2 TCGA-AF-2687-01A-02D-1732-01      1   1.93 0.1883289

acn_cnhplus = r2q(r, oo[[i]]$purity[1], oo[[i]]$ploidy[1])
plot_profile(sa, acn_cnhplus, paste0(sample_names[i], '_ACN_for_CNHplus.tiff'),
             ylim = c(-10,10), ylab = 'ACN for CNH+')
}