Skip to content
Georgia Goddard edited this page Jul 2, 2026 · 2 revisions

Here we discuss the ObservedBW and PredBW commands, which generate both the observed predicted accessibility tracks from the fragment files as well as the predicted accessibility with removed Tn5 bias based on the ChromBPNet model.

Before any data generation commands can be run, a directory must first be created, both for the outputs in general and for the cohorts.

mkdir -p ~/ChromBPNet/outputs
mkdir -p ~/ChromBPNet/outputs/mouse

ObservedBW

The ObservedBW command is built to iteratively generate the accessibility profiles from the pseudo-bulked cell type fragment files.

cell_types=("Corticotrophs" "Gonadotrophs" "Lactotrophs" "Melanotrophs" "Somatotrophs" "Stem_cells" "Thyrotrophs")
IN="~/atac_seq_data/mouse_merged"        # Directory containing all pseudo-bulked fragment files
OUT="~/ChromBPnet/outputs/mouse"         # Output directory for cohorts and cell types

# Run observed bigwig files command
for cell_type in "${cell_types[@]}"
do
        echo "Beginning cell type: $cell_type"

        cell_file=$IN/"${cell_type}_merged_sorted.tsv.gz"

        echo "Make filtered .tsv file from ${cell_file}"
        zcat "${cell_file}" | grep -E "^chr[0-9XYM]+\b" > $OUT/${cell_type}/${cell_type}_temp.tsv

        echo "Beginning filtering of ${cell_type}"
        grep -v "^#" $OUT/${cell_type}/${cell_type}_temp.tsv | cut -f1,2,3 > $OUT/${cell_type}/${cell_type}_temp.bed

        echo "Generate bedgraph file for ${cell_type}"
        bedtools genomecov -i $OUT/${cell_type}/${cell_type}_temp.bed -bg -g ~/genome/mm10/mm10.chrom.sizes > $OUT/${cell_type}/${cell_type}_observed.bdg

        echo "Convert bedgraph to bigwig for ${cell_type}"
        bedGraphToBigWig $OUT/${cell_type}/${cell_type}_observed.bdg ~/genome/mm10/mm10.chrom.sizes $OUT/${cell_type}/${cell_type}_observed.bw

        echo "Done ${cell_type}."

        rm $OUT/${cell_type}/${cell_type}_temp.tsv $OUT/${cell_type}/${cell_type}_temp.bed $OUT/${cell_type}/${cell_type}_observed.bdg

done

Output format

# One BigWig file per cell type
~/ChromBPNet/outputs/$cohort/$cell_type/${cell_type}_observed.bw

PredBW

The PredBW command selects all cell type models generated within one cohort, and generates predicted accessibility tracks using the chrombpnet pred_bw function. The function identifies whether predicted accessibility has already been computed for the model, and will accurately skip these models so not to repeat analyses.

The chrombpnet pred_bw function generates bigwigs containing predictions on a defined set of input regions.

Usage

PredBW \
   "$bias_directory" \
   "$model_directory" \
   "$genome" \
   "$peaks_file" \
   "$output_directory"

Input format

bias_directory      # Directory for the respective bias model (found at ~/ChromBPNet/Bias_Models/)
model_directory     # Directory for the target models to be used (found at ~/ChromBPNet/Models/)
genome              # Name of genome (e.g., "mm10", "rn6", "hg38")
peaks_file          # Consensus peaks - must be in BED format
output_directory    # Directory for the 

Output format

All output files will be found in ~/ChromBPNet/outputs/$cohort/$cell_type/pred_bw/

${cell_type}_predicted_bias.bw                       # Predictions from the bias.h5 model
${cell_type}_predicted_chrombpnet.bw                 # Predictions from the chrombpnet.h5 model
${cell_type}_predicted_chrombpnet_nobias.bw          # Predictions from the chrombpnet_nobias.h5 model - TARGET MODEL FOR DOWNSTREAM ANALYSES
${cell_type}_predicted_bias_preds.bed                # BED file with filtered regions the predictions were generated from
${cell_type}_predicted_chrombpnet.bed                # BED file with filtered regions the predictions were generated from
${cell_type}_predicted_chrombpnet_nobias_preds.bw    # BED file with filtered regions the predictions were generated from

Note: All .bed output files contain the same information, which is the same regions defined in the peaks_file input.

Clone this wiki locally