add_1D_features: add_1D_features

View source: R/add_1D_features.R

add_1D_featuresR Documentation

add_1D_features

Description

Adds 1D features to the gi_list instance. If any bin on gi_list overlaps with multiple feature records, feature values are aggregated for the bin according to the vector valued function agg (e.g., sum, mean)

Usage

add_1D_features(gi_list, df, chrs = NULL, features = NULL, agg = mean)

Arguments

gi_list

List of GenomicInteractions objects where each object named with chromosomes contains intrachromosomal interaction information (see ?gi_list_validate for a detailed explanation of valid gi_list instances).

df

DataFrame with columns named 'chr', and'start' and features to be added with their respective names.

chrs

a subset of chromosomes' e.g., c('chr21','chr22'). Defaults to all chromosomes specified in the data frame df.

features

features to be added. Needs to be a subset of colnames(df). Defaults to all columns in df other than 'chr','start',and 'end'.

agg

any vector valued function with one data argument: defaults to mean.

Value

a gi_list instance with 1D features stored in regions metadata handle of each list element (e.g., gi_list[[1]]@regions@elementMetadata) in the instance

Examples

df<-data.frame(chr='chr9',start=seq(1e6,10e6,1e6),end=seq(2e6,11e6,1e6))
gi_list<-generate_df_gi_list(df)
feats<-data.frame(chr='chr9',start=seq(1e6,10e6,1e6),gc=runif(10))
gi_list<-add_1D_features(gi_list,feats)

mervesa/HiCDCPlus documentation built on June 8, 2022, 3:43 a.m.