copy_clust_info: copy_clust_info

View source: R/functions_clusteringKmeans.R

copy_clust_infoR Documentation

copy_clust_info

Description

copy_clust_info

Usage

copy_clust_info(target, to_copy, row_ = "id", cluster_ = "cluster_id")

Arguments

target

A data.table or GRanges returned from ssvFetch*, the target to which cluster info will be added.

to_copy

A data.table or GRanges returned from ssvSignalClustering, from which to copy cluster if.

row_

variable name mapped to row, likely id or gene name for ngs data. Default is "id" and works with ssvFetch* output.

cluster_

variable name to use for cluster info. Default is "cluster_id".

Value

data.table or GRanges (whichever target is) containing row order and cluster assignment derived from to_copy. Suitable for ssvSignalHeatmap and related functions.

Examples

#this takes cluster info from signal and applies to peak hits to
#create a heatmap of peak hits clustered by signal.
clust_dt1 = ssvSignalClustering(CTCF_in_10a_profiles_dt)
peak_hit_gr = ssvFetchGRanges(
  CTCF_in_10a_narrowPeak_grs,
  qgr = CTCF_in_10a_overlaps_gr
)
peak_hit_gr.clust = copy_clust_info(peak_hit_gr, clust_dt1)
peak_hit_gr.clust$hit = peak_hit_gr.clust$y > 0
ssvSignalHeatmap(peak_hit_gr.clust, fill_ = "hit") +
  scale_fill_manual(values = c("FALSE" = "gray90", "TRUE" = "black"))

jrboyd/seqsetvis documentation built on March 17, 2024, 3:14 p.m.