juicer_func {preciseTAD} | R Documentation

## Helper function for transforming a GRanges object into matrix form to be saved as .txt or .BED file and imported into juicer

### Description

Helper function for transforming a GRanges object into matrix form to be saved as .txt or .BED file and imported into juicer

### Usage

    juicer_func(grdat)

### Arguments

`grdat` | A GRanges object representing boundary coordinates

### Value

A dataframe that can be saved as a BED file to import into juicer

### Examples

    ## Not run:
    # Read in ARROWHEAD-called TADs at 5kb
    data(arrowhead_gm12878_5kb)

    # Extract unique boundaries
    bounds.GR <- extractBoundaries(domains.mat = arrowhead_gm12878_5kb,
                                   preprocess = FALSE,
                                   CHR = c("CHR21", "CHR22"),
                                   resolution = 5000)

    # Read in GRangesList of 26 TFBS
    data(tfbsList)

    tfbsList_filt <- tfbsList[which(names(tfbsList) %in%
                                                       c("Gm12878-Ctcf-Broad",
                                                         "Gm12878-Rad21-Haib",
                                                         "Gm12878-Smc3-Sydh",
                                                         "Gm12878-Znf143-Sydh"))]

    # Create the binned data matrix for CHR1 (training) and CHR22 (testing)
    # using 5 kb binning, distance-type predictors from 26 different TFBS from
    # the GM12878 cell line, and random under-sampling
    tadData <- createTADdata(bounds.GR = bounds.GR,
                             resolution = 5000,
                             genomicElements.GR = tfbsList_filt,
                             featureType = "distance",
                             resampling = "rus",
                             trainCHR = "CHR21",
                             predictCHR = "CHR22")

    # Perform random forest using TADrandomForest by tuning mtry over 10 values
    # using 3-fold CV
    tadModel <- TADrandomForest(trainData = tadData[[1]],
                                testData = tadData[[2]],
                                tuneParams = list(mtry = 2,
                                                ntree = 500,
                                                nodesize = 1),
                                cvFolds = 3,
                                cvMetric = "Accuracy",
                                verbose = TRUE,
                                model = TRUE,
                                importances = TRUE,
                                impMeasure = "MDA",
                                performances = TRUE)

    # Apply preciseTAD on a specific 2mb section of CHR22:17000000-19000000
    pt <- preciseTAD(genomicElements.GR = tfbsList_filt,
                     featureType = "distance",
                     CHR = "CHR22",
                     chromCoords = list(17000000, 19000000),
                     tadModel = tadModel[[1]],
                     threshold = 1.0,
                     verbose = TRUE,
                     parallel = TRUE,
                     cores = 2,
                     splits = 2,
                     DBSCAN_params = list(10000, 3),
                     flank = NULL)

    # Transform into juicer format
    juicer_func(pt[[2]])

    ## End(Not run)

[Package preciseTAD version 1.0.0 Index]