Skip to content

PreprocessPeaks

Georgia Goddard edited this page Jul 1, 2026 · 1 revision

Here we outline the use of the PreprocessPeaks command, which integrates both custom code and elements of the ChromBPNet pipeline for data preprocessing.

The following data is generated:

  • Define train, validation, and test chromosome splits (using the chrombpnet prep splits function)
  • Converts the input peak file from a 3 column to a 10 column format
  • Generate non-peaks (background regions) using the chrombpnet prep nonpeaks function

First make a directory for the ChromBPNet data to reside in:

mkdir -p ~/ChromBPNet
mkdir -p ~/ChromBPNet/splits
mkdir -p ~/ChromBPNet/data

Note: These directories must exist for the function to run, otherwise it will return an Error.

Usage

PreprocessPeaks \
    `$peaks_file` \
    `$input_directory \
    genome_name \
    output_name 

Input Format

Required arguments:
peaks_file            # Input peak file generated using `macs2` or taken from the CPA as detailed in [Download Data][Download-data].
                        File must be provided as a .bed file.
input_directory       # Base directory for the function to build on using other inputs. 
                        This directory is one stage back from ~/ChromBPNet and ~/genome, which must share this common parent directory. 
genome_name           # Currently, the function only supports the following input genomes: mm10, hg38, and rn6. 
                        This genome is necessary for generating the fold splits and background regions. 
                        For processing genomes outside this list, this function cannot be used.
                        In this case, refer to the function in the `ChromBPNet_pipeline/functions` directory and run each stage separately. 
output_name           # Name of output peaks data for multiple cohorts processed within one genome (e.g., 'peaks' or 'neonatal_peaks').

Output Format

Split folds for the input genome (X = 0-4):

~/ChromBPNet/splits/$genome/{fold_X}.json

Modified peak file - 3 column to 10 column format for consistency and compatibility with downstream ChromBPNet model training:

~/ChromBPNet/data/$genome/$output_name/{file_name}_modified.bed

Background regions for the input genome and region file provided:

~/ChromBPNet/data/$genome/$output_name/temp.bed               # Temporary blacklist region of all regions but expanded by 1057 on either side.
~/ChromBPNet/data/$genome/$output_name/peaks_no_blacklist.bed # .bed file of peak regions that do not overlap with the blacklist regions 
                                                                (extended by 1057 bp on both sides).

Non-peak regions that GC-match with the peak regions based on each fold. These regions will be used in the ChromBPNet model training, so must be fold-specific:

~/ChromBPNet/data/$genome/$output_name/output_{fold_X}_negatives.bed
~/ChromBPNet/data/$genome/$output_name/output_{fold_X}_auxiliary/

Clone this wiki locally