View source: R/add_2D_features.R
add_2D_features | R Documentation |
Adds 2D features to a gi_list instance. If any bin on gi_list overlaps with
multiple feature records, features are aggregated among matches according
to the univariate vector valued function agg (e.g., sum, mean). For efficient
use of memory, using add/expand 1D features (see ?add_1D_features
and
expand_1D_features
) in sequence is recommended
instead of using add_2D_features
directly for each chromosome.
add_2D_features(gi, df, features = NULL, agg = sum)
gi |
Element of a valid |
df |
data frame for a single chromosome containing columns named chr,
startI and startJ and features to be added with their respective names
(if df contains multiple chromosomes, you can convert it into a
list of smaller data.frames for each chromosome and apply this function
with |
features |
features to be added. Needs to be subset of
|
agg |
any vector valued function with one data argument:
defaults to |
a gi_list element with 2D features stored in metadata handle
(i.e., mcols(gi)
).
df<-data.frame(chr='chr9',start=seq(1e6,10e6,1e6)) gi_list<-generate_df_gi_list(df,Dthreshold=500e3) feats<-data.frame(chr='chr9', startI=seq(1e6,10e6,1e6),startJ=seq(1e6,10e6,1e6),counts=rpois(10,lambda=5)) gi_list[['chr9']]<-add_2D_features(gi_list[['chr9']],feats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.