adding additional promoter sets
Browse files- README.md +115 -6
- rossi_2021_af_intergenic_combined.parquet +3 -0
- rossi_2021_af_intergenic_replicates.parquet +3 -0
- rossi_2021_af_start_codon_500bp_combined.parquet +3 -0
- rossi_2021_af_start_codon_500bp_replicates.parquet +3 -0
- scripts/CopyOfparse_rossi_filtered_peaks.R +0 -210
- scripts/genomecov_to_annotated_features.R +195 -14
README.md
CHANGED
|
@@ -67,6 +67,10 @@ features:
|
|
| 67 |
- rossi_2021_af_combined
|
| 68 |
- rossi_2021_af_replicates_mindel
|
| 69 |
- rossi_2021_af_combined_mindel
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
fields:
|
| 71 |
- name: regulator_locus_tag
|
| 72 |
dtype: string
|
|
@@ -82,6 +86,10 @@ features:
|
|
| 82 |
- rossi_2021_af_replicates_mindel
|
| 83 |
- rossi_2021_af_combined_mindel
|
| 84 |
- yep_filtered_peaks_combined
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
fields:
|
| 86 |
- name: target_locus_tag
|
| 87 |
dtype: string
|
|
@@ -97,6 +105,10 @@ features:
|
|
| 97 |
- rossi_2021_af_combined
|
| 98 |
- rossi_2021_af_replicates_mindel
|
| 99 |
- rossi_2021_af_combined_mindel
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
fields:
|
| 101 |
- name: seqnames
|
| 102 |
dtype: string
|
|
@@ -113,6 +125,10 @@ features:
|
|
| 113 |
- rossi_2021_af_combined
|
| 114 |
- rossi_2021_af_replicates_mindel
|
| 115 |
- rossi_2021_af_combined_mindel
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
fields:
|
| 117 |
- name: background_counts
|
| 118 |
dtype: int64
|
|
@@ -159,6 +175,19 @@ features:
|
|
| 159 |
description: FDR-adjusted q-value from hypergeometric test (multiple testing correction)
|
| 160 |
role: quantitative_measure
|
| 161 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
- applies_to:
|
| 163 |
- rossi_2021_af_replicates_mindel
|
| 164 |
- rossi_2021_af_combined_mindel
|
|
@@ -169,11 +198,6 @@ features:
|
|
| 169 |
- name: strand
|
| 170 |
dtype: string
|
| 171 |
description: Genomic strand of the promoter region (+ or -)
|
| 172 |
-
|
| 173 |
-
- applies_to:
|
| 174 |
-
- rossi_2021_af_replicates_mindel
|
| 175 |
-
- rossi_2021_af_combined_mindel
|
| 176 |
-
fields:
|
| 177 |
- name: mindel_name
|
| 178 |
dtype: string
|
| 179 |
description: Name of the promoter region as defined in the Mindel promoters
|
|
@@ -243,7 +267,7 @@ configs:
|
|
| 243 |
- config_name: rossi_2021_metadata_sample
|
| 244 |
description: Sample-level metadata for combined ChIP-exo experiments including experimental conditions
|
| 245 |
dataset_type: metadata
|
| 246 |
-
applies_to: ["rossi_2021_af_combined", "rossi_2021_af_combined_mindel", "yep_filtered_peaks_combined"]
|
| 247 |
data_files:
|
| 248 |
- split: train
|
| 249 |
path: rossi_2021_metadata_sample.parquet
|
|
@@ -369,6 +393,48 @@ configs:
|
|
| 369 |
dtype: string
|
| 370 |
description: SRA run accession identifier for this biological replicate
|
| 371 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 372 |
- config_name: rossi_2021_af_combined
|
| 373 |
description: Combined ChIP-exo annotated features with binding peaks and statistical significance metrics aggregated across biological replicates
|
| 374 |
dataset_type: annotated_features
|
|
@@ -425,6 +491,49 @@ configs:
|
|
| 425 |
dtype: int64
|
| 426 |
description: Unique identifier for the biological replicate
|
| 427 |
role: sample_id
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 428 |
---
|
| 429 |
# Rossi 2021
|
| 430 |
|
|
|
|
| 67 |
- rossi_2021_af_combined
|
| 68 |
- rossi_2021_af_replicates_mindel
|
| 69 |
- rossi_2021_af_combined_mindel
|
| 70 |
+
- rossi_2021_af_start_codon_500bp_replicates
|
| 71 |
+
- rossi_2021_af_combined_start_codon_500bp
|
| 72 |
+
- rossi_2021_af_replicates_intergenic_replicates
|
| 73 |
+
- rossi_2021_af_combined_intergenic
|
| 74 |
fields:
|
| 75 |
- name: regulator_locus_tag
|
| 76 |
dtype: string
|
|
|
|
| 86 |
- rossi_2021_af_replicates_mindel
|
| 87 |
- rossi_2021_af_combined_mindel
|
| 88 |
- yep_filtered_peaks_combined
|
| 89 |
+
- rossi_2021_af_start_codon_500bp_replicates
|
| 90 |
+
- rossi_2021_af_combined_start_codon_500bp
|
| 91 |
+
- rossi_2021_af_replicates_intergenic_replicates
|
| 92 |
+
- rossi_2021_af_combined_intergenic
|
| 93 |
fields:
|
| 94 |
- name: target_locus_tag
|
| 95 |
dtype: string
|
|
|
|
| 105 |
- rossi_2021_af_combined
|
| 106 |
- rossi_2021_af_replicates_mindel
|
| 107 |
- rossi_2021_af_combined_mindel
|
| 108 |
+
- rossi_2021_af_start_codon_500bp_replicates
|
| 109 |
+
- rossi_2021_af_combined_start_codon_500bp
|
| 110 |
+
- rossi_2021_af_replicates_intergenic_replicates
|
| 111 |
+
- rossi_2021_af_combined_intergenic
|
| 112 |
fields:
|
| 113 |
- name: seqnames
|
| 114 |
dtype: string
|
|
|
|
| 125 |
- rossi_2021_af_combined
|
| 126 |
- rossi_2021_af_replicates_mindel
|
| 127 |
- rossi_2021_af_combined_mindel
|
| 128 |
+
- rossi_2021_af_start_codon_500bp_replicates
|
| 129 |
+
- rossi_2021_af_combined_start_codon_500bp
|
| 130 |
+
- rossi_2021_af_replicates_intergenic_replicates
|
| 131 |
+
- rossi_2021_af_combined_intergenic
|
| 132 |
fields:
|
| 133 |
- name: background_counts
|
| 134 |
dtype: int64
|
|
|
|
| 175 |
description: FDR-adjusted q-value from hypergeometric test (multiple testing correction)
|
| 176 |
role: quantitative_measure
|
| 177 |
|
| 178 |
+
- applies_to:
|
| 179 |
+
- rossi_2021_af_intergenic_replicates
|
| 180 |
+
- rossi_2021_af_combined_intergenic
|
| 181 |
+
fields:
|
| 182 |
+
- name: ir_name
|
| 183 |
+
dtype: string
|
| 184 |
+
description: >-
|
| 185 |
+
Unique identifier of the intergenic region. See
|
| 186 |
+
yeast_genome_resources/intergenic_regions_metadata_5_1.csv for
|
| 187 |
+
details on the region (location, etc). Note that these intergenic regions are defined as the region between the end of one ORF and the start of the next, and are named according to the locus tags of the flanking ORFs (e.g., YAL001C-YAL002W). A intergenic
|
| 188 |
+
region is assigned to a promoter only when the 5' end is
|
| 189 |
+
continuous with the region.
|
| 190 |
+
|
| 191 |
- applies_to:
|
| 192 |
- rossi_2021_af_replicates_mindel
|
| 193 |
- rossi_2021_af_combined_mindel
|
|
|
|
| 198 |
- name: strand
|
| 199 |
dtype: string
|
| 200 |
description: Genomic strand of the promoter region (+ or -)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
- name: mindel_name
|
| 202 |
dtype: string
|
| 203 |
description: Name of the promoter region as defined in the Mindel promoters
|
|
|
|
| 267 |
- config_name: rossi_2021_metadata_sample
|
| 268 |
description: Sample-level metadata for combined ChIP-exo experiments including experimental conditions
|
| 269 |
dataset_type: metadata
|
| 270 |
+
applies_to: ["rossi_2021_af_combined", "rossi_2021_af_combined_mindel", "yep_filtered_peaks_combined", "rossi_2021_af_combined_start_codon_500bp", "rossi_2021_af_combined_intergenic"]
|
| 271 |
data_files:
|
| 272 |
- split: train
|
| 273 |
path: rossi_2021_metadata_sample.parquet
|
|
|
|
| 393 |
dtype: string
|
| 394 |
description: SRA run accession identifier for this biological replicate
|
| 395 |
|
| 396 |
+
- config_name: rossi_2021_af_start_codon_500bp_replicates
|
| 397 |
+
description: ChIP-exo annotated features at biological replicate level with binding scores and statistical significance metrics for promoter regions defined as 500bp upstream of the start codon
|
| 398 |
+
dataset_type: annotated_features
|
| 399 |
+
genome_resources:
|
| 400 |
+
region_sets:
|
| 401 |
+
start_codon_500bp:
|
| 402 |
+
path: https://huggingface.co/datasets/BrentLab/yeast_genome_resources/blob/main/start_codon_500bp_upstream_promoters.bed
|
| 403 |
+
join_column: target_locus_tag
|
| 404 |
+
data_files:
|
| 405 |
+
- split: train
|
| 406 |
+
path: rossi_2021_af_start_codon_500bp_replicates.parquet
|
| 407 |
+
dataset_info:
|
| 408 |
+
features:
|
| 409 |
+
- name: sample_id
|
| 410 |
+
dtype: int64
|
| 411 |
+
description: Unique identifier for the biological replicate
|
| 412 |
+
role: sample_id
|
| 413 |
+
- name: accession
|
| 414 |
+
dtype: string
|
| 415 |
+
description: SRA run accession identifier for this biological replicate
|
| 416 |
+
|
| 417 |
+
- config_name: rossi_2021_af_replicates_intergenic_replicates
|
| 418 |
+
description: ChIP-exo annotated features at biological replicate level with binding scores and statistical significance metrics for intergenic regions.
|
| 419 |
+
dataset_type: annotated_features
|
| 420 |
+
genome_resources:
|
| 421 |
+
region_sets:
|
| 422 |
+
intergenic:
|
| 423 |
+
path: https://huggingface.co/datasets/BrentLab/yeast_genome_resources/blob/main/intergenic_regions_metadata_5_1.csv
|
| 424 |
+
join_column: ir_name
|
| 425 |
+
data_files:
|
| 426 |
+
- split: train
|
| 427 |
+
path: rossi_2021_af_intergenic_replicates.parquet
|
| 428 |
+
dataset_info:
|
| 429 |
+
features:
|
| 430 |
+
- name: sample_id
|
| 431 |
+
dtype: int64
|
| 432 |
+
description: Unique identifier for the biological replicate
|
| 433 |
+
role: sample_id
|
| 434 |
+
- name: accession
|
| 435 |
+
dtype: string
|
| 436 |
+
description: SRA run accession identifier for this biological replicate
|
| 437 |
+
|
| 438 |
- config_name: rossi_2021_af_combined
|
| 439 |
description: Combined ChIP-exo annotated features with binding peaks and statistical significance metrics aggregated across biological replicates
|
| 440 |
dataset_type: annotated_features
|
|
|
|
| 491 |
dtype: int64
|
| 492 |
description: Unique identifier for the biological replicate
|
| 493 |
role: sample_id
|
| 494 |
+
|
| 495 |
+
- config_name: rossi_2021_af_combined_intergenic
|
| 496 |
+
description: >-
|
| 497 |
+
Combined ChIP-exo annotated features with binding score and
|
| 498 |
+
statistical significance metrics aggregated across biological
|
| 499 |
+
replicates. Binding peaks are annotated to intergenic regions as defined in
|
| 500 |
+
yeast_genome_resources/intergenic_regions_metadata_5_1.csv. Note that these intergenic regions are defined as the region between the end of one ORF and the start of the next, and are named according to the locus tags of the flanking ORFs (e.g., YAL001C-YAL002W). A intergenic region is assigned to a promoter only when the 5' end is continuous with the region.
|
| 501 |
+
dataset_type: annotated_features
|
| 502 |
+
genome_resources:
|
| 503 |
+
region_sets:
|
| 504 |
+
intergenic:
|
| 505 |
+
path: https://huggingface.co/datasets/BrentLab/yeast_genome_resources/blob/main/intergenic_regions_metadata_5_1.csv
|
| 506 |
+
join_column: ir_name
|
| 507 |
+
data_files:
|
| 508 |
+
- split: train
|
| 509 |
+
path: rossi_2021_af_intergenic_combined.parquet
|
| 510 |
+
dataset_info:
|
| 511 |
+
features:
|
| 512 |
+
- name: sample_id
|
| 513 |
+
dtype: int64
|
| 514 |
+
description: Unique identifier combining regulator and replicates
|
| 515 |
+
role: sample_id
|
| 516 |
+
|
| 517 |
+
- config_name: rossi_2021_af_combined_start_codon_500bp
|
| 518 |
+
description: >-
|
| 519 |
+
Combined ChIP-exo annotated features with binding score and
|
| 520 |
+
statistical significance metrics aggregated across biological
|
| 521 |
+
replicates for promoter regions defined as 500bp upstream of the start codon. Binding peaks are annotated to these promoter regions as defined in yeast_genome_resources/start_codon_500bp_upstream_promoters.bed.
|
| 522 |
+
dataset_type: annotated_features
|
| 523 |
+
genome_resources:
|
| 524 |
+
region_sets:
|
| 525 |
+
start_codon_500bp:
|
| 526 |
+
path: https://huggingface.co/datasets/BrentLab/yeast_genome_resources/blob/main/start_codon_500bp_upstream_promoters.bed
|
| 527 |
+
join_column: target_locus_tag
|
| 528 |
+
data_files:
|
| 529 |
+
- split: train
|
| 530 |
+
path: rossi_2021_af_start_codon_500bp_combined.parquet
|
| 531 |
+
dataset_info:
|
| 532 |
+
features:
|
| 533 |
+
- name: sample_id
|
| 534 |
+
dtype: int64
|
| 535 |
+
description: Unique identifier combining regulator and replicates
|
| 536 |
+
role: sample_id
|
| 537 |
---
|
| 538 |
# Rossi 2021
|
| 539 |
|
rossi_2021_af_intergenic_combined.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3132a023ed37fc4edba08fcd93f91ae089df6d1bf837078c39c67378ded9a842
|
| 3 |
+
size 248767645
|
rossi_2021_af_intergenic_replicates.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:03ed92d4dcc4998ab17eca636b32c913ef47ab0dbfec33d59bb42502f7ad6e0a
|
| 3 |
+
size 375396447
|
rossi_2021_af_start_codon_500bp_combined.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:431f6f399927ca994482adb8253806e9a07c8d53193146b2f37970e5a0371066
|
| 3 |
+
size 277869731
|
rossi_2021_af_start_codon_500bp_replicates.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c786e07a9e162ce050a1ee3d3e455cabcea64ffe63795686834093bb11d432e
|
| 3 |
+
size 417315059
|
scripts/CopyOfparse_rossi_filtered_peaks.R
DELETED
|
@@ -1,210 +0,0 @@
|
|
| 1 |
-
# fetch the zip files from the yeastepigenome.org server
|
| 2 |
-
# https://www.datacommons.psu.edu/download/eberly/pughlab/yeast-epigenome-project/
|
| 3 |
-
# and then extract them
|
| 4 |
-
# with
|
| 5 |
-
#!/usr/bin/env bash
|
| 6 |
-
# fetch_yep_peaks.sh
|
| 7 |
-
#
|
| 8 |
-
# Extracts *_chexmix_filtered_peaks.bed from each *_YEP.zip in ZIP_DIR.
|
| 9 |
-
# Output: yep_filtered_peaks/ in the current working directory.
|
| 10 |
-
#
|
| 11 |
-
# set -euo pipefail
|
| 12 |
-
#
|
| 13 |
-
# ZIP_DIR="${1:-/lts/mblab/downloaded_data/chipexo/yeastepigenome_data}"
|
| 14 |
-
# OUT_DIR="$(pwd)/yep_filtered_peaks"
|
| 15 |
-
#
|
| 16 |
-
# if [[ ! -d "$ZIP_DIR" ]]; then
|
| 17 |
-
# echo "[error] ZIP_DIR not found: $ZIP_DIR" >&2
|
| 18 |
-
# exit 1
|
| 19 |
-
# fi
|
| 20 |
-
#
|
| 21 |
-
# mkdir -p "$OUT_DIR"
|
| 22 |
-
#
|
| 23 |
-
# COUNT=0; SKIP=0; FAIL=0
|
| 24 |
-
#
|
| 25 |
-
# for zip_path in "$ZIP_DIR"/*_YEP.zip; do
|
| 26 |
-
# zip_name=$(basename "$zip_path")
|
| 27 |
-
# sample_id="${zip_name%_YEP.zip}"
|
| 28 |
-
# bed_name="${sample_id}_chexmix_filtered_peaks.bed"
|
| 29 |
-
# dest="$OUT_DIR/$bed_name"
|
| 30 |
-
#
|
| 31 |
-
# if [[ -f "$dest" ]]; then
|
| 32 |
-
# echo "[skip] $bed_name already exists"
|
| 33 |
-
# (( SKIP++ )) || true
|
| 34 |
-
# continue
|
| 35 |
-
# fi
|
| 36 |
-
#
|
| 37 |
-
# # file path inside the zip may vary — find it
|
| 38 |
-
# bed_in_zip=$(unzip -Z1 "$zip_path" 2>/dev/null | grep -m1 "${bed_name}$" || true)
|
| 39 |
-
#
|
| 40 |
-
# if [[ -z "$bed_in_zip" ]]; then
|
| 41 |
-
# echo "[warn] $bed_name not found in $zip_name — skipping" >&2
|
| 42 |
-
# (( FAIL++ )) || true
|
| 43 |
-
# continue
|
| 44 |
-
# fi
|
| 45 |
-
#
|
| 46 |
-
# echo "[ext ] $zip_name → $bed_name"
|
| 47 |
-
# unzip -p "$zip_path" "$bed_in_zip" > "$dest"
|
| 48 |
-
# (( COUNT++ )) || true
|
| 49 |
-
# done
|
| 50 |
-
#
|
| 51 |
-
# echo ""
|
| 52 |
-
# echo "[done] extracted=$COUNT skipped=$SKIP failed=$FAIL"
|
| 53 |
-
# echo "[done] output in: $OUT_DIR"
|
| 54 |
-
|
| 55 |
-
# the following can be run on the output
|
| 56 |
-
|
| 57 |
-
library(tidyverse)
|
| 58 |
-
library(arrow)
|
| 59 |
-
library(GenomicRanges)
|
| 60 |
-
library(here)
|
| 61 |
-
|
| 62 |
-
#' Convert BED format data frame to GRanges
|
| 63 |
-
#'
|
| 64 |
-
#' Handles coordinate system conversion from 0-indexed half-open BED format
|
| 65 |
-
#' to 1-indexed closed GenomicRanges format
|
| 66 |
-
#'
|
| 67 |
-
#' @param bed_df Data frame with chr, start, end columns in BED format (0-indexed, half-open)
|
| 68 |
-
#' @param zero_indexed Logical, whether input is 0-indexed (default: TRUE)
|
| 69 |
-
#' @return GRanges object
|
| 70 |
-
bed_to_granges <- function(bed_df, zero_indexed = TRUE) {
|
| 71 |
-
|
| 72 |
-
if (!all(c("chr", "start", "end") %in% names(bed_df))) {
|
| 73 |
-
stop("bed_df must have columns: chr, start, end")
|
| 74 |
-
}
|
| 75 |
-
|
| 76 |
-
# Convert from 0-indexed half-open [start, end) to 1-indexed closed [start, end]
|
| 77 |
-
if (zero_indexed) {
|
| 78 |
-
gr_start <- bed_df$start + 1
|
| 79 |
-
gr_end <- bed_df$end
|
| 80 |
-
} else {
|
| 81 |
-
gr_start <- bed_df$start
|
| 82 |
-
gr_end <- bed_df$end
|
| 83 |
-
}
|
| 84 |
-
|
| 85 |
-
# Create GRanges object (strand-agnostic for calling cards)
|
| 86 |
-
gr <- GenomicRanges::GRanges(
|
| 87 |
-
seqnames = bed_df$chr,
|
| 88 |
-
ranges = IRanges::IRanges(start = gr_start, end = gr_end),
|
| 89 |
-
strand = "*"
|
| 90 |
-
)
|
| 91 |
-
|
| 92 |
-
# Add any additional metadata columns
|
| 93 |
-
extra_cols <- setdiff(names(bed_df), c("chr", "start", "end", "strand"))
|
| 94 |
-
if (length(extra_cols) > 0) {
|
| 95 |
-
GenomicRanges::mcols(gr) <- bed_df[, extra_cols, drop = FALSE]
|
| 96 |
-
}
|
| 97 |
-
|
| 98 |
-
return(gr)
|
| 99 |
-
}
|
| 100 |
-
|
| 101 |
-
#' Annotate genomic regions with ChExMix peak scores
|
| 102 |
-
#'
|
| 103 |
-
#' Intersects a set of genomic regions (e.g. promoters) with ChExMix filtered
|
| 104 |
-
#' peaks and assigns each region a score. Regions overlapping a single peak
|
| 105 |
-
#' receive that peak's score; regions overlapping multiple peaks receive the
|
| 106 |
-
#' median score across all overlapping peaks. Non-overlapping regions are
|
| 107 |
-
#' scored 0.
|
| 108 |
-
#'
|
| 109 |
-
#' @param peaks_df Data frame with BED-format peak calls (0-indexed, half-open)
|
| 110 |
-
#' and a \code{score} column, as produced by \code{read_in_filtered_bed}.
|
| 111 |
-
#' @param regions_gr GRanges object of genomic regions to annotate
|
| 112 |
-
#' (e.g. an element of \code{regions_list}).
|
| 113 |
-
#'
|
| 114 |
-
#' @return A copy of \code{regions_gr} with an additional metadata column
|
| 115 |
-
#' \code{score}: the peak score for overlapping regions, 0 otherwise.
|
| 116 |
-
#'
|
| 117 |
-
#' @seealso \code{\link{bed_to_granges}}, \code{\link{read_in_filtered_bed}}
|
| 118 |
-
peaks_to_promoter_scores <- function(peaks_df, regions_gr) {
|
| 119 |
-
|
| 120 |
-
peaks_gr <- bed_to_granges(peaks_df)
|
| 121 |
-
|
| 122 |
-
hits <- GenomicRanges::findOverlaps(regions_gr, peaks_gr)
|
| 123 |
-
|
| 124 |
-
# for each hit, pull the peak score
|
| 125 |
-
scores_df <- tibble(
|
| 126 |
-
region_idx = S4Vectors::queryHits(hits),
|
| 127 |
-
score = peaks_df$score[S4Vectors::subjectHits(hits)]
|
| 128 |
-
) |>
|
| 129 |
-
summarise(score = median(score), .by = region_idx)
|
| 130 |
-
|
| 131 |
-
# initialize all promoters to 0, fill in overlapping ones
|
| 132 |
-
result <- rep(0, length(regions_gr))
|
| 133 |
-
result[scores_df$region_idx] <- scores_df$score
|
| 134 |
-
|
| 135 |
-
regions_gr_tmp <- regions_gr
|
| 136 |
-
regions_gr_tmp$score <- result
|
| 137 |
-
regions_gr_tmp
|
| 138 |
-
}
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
rossi_meta = arrow::read_parquet("~/code/hf/rossi_2021/rossi_2021_metadata.parquet")
|
| 142 |
-
chrmap = read_csv("~/code/hf/yeast_genome_resources/chrmap.csv.gz")
|
| 143 |
-
|
| 144 |
-
brentlab_features = read_csv("~/code/hf/yeast_genome_resources/brentlab_features.csv.gz")
|
| 145 |
-
|
| 146 |
-
# Load regions
|
| 147 |
-
regions_list = list(
|
| 148 |
-
yiming = read_tsv(
|
| 149 |
-
"~/code/hf/yeast_genome_resources/yiming_promoters.bed",
|
| 150 |
-
col_names = c('chr', 'start', 'end', 'locus_tag', 'score', 'strand')) %>%
|
| 151 |
-
bed_to_granges(),
|
| 152 |
-
mindel = arrow::read_parquet("~/code/hf/yeast_genome_resources/mindel_promoters.parquet") |>
|
| 153 |
-
bed_to_granges()
|
| 154 |
-
)
|
| 155 |
-
|
| 156 |
-
filtered_bed = list.files(here("data/yep_filtered_peaks"), full.names = TRUE)
|
| 157 |
-
names(filtered_bed) = str_extract(basename(filtered_bed), "^\\d+")
|
| 158 |
-
|
| 159 |
-
read_in_filtered_bed = function(path){
|
| 160 |
-
read_tsv(path, col_names = c('chr', 'start', 'end', 'source', 'score')) |>
|
| 161 |
-
left_join(dplyr::select(chrmap, chr, ucsc)) |>
|
| 162 |
-
dplyr::select(-chr) |>
|
| 163 |
-
dplyr::rename(chr = ucsc) |>
|
| 164 |
-
dplyr::relocate(chr)
|
| 165 |
-
}
|
| 166 |
-
|
| 167 |
-
filtered_bed_df_list = map(filtered_bed, read_in_filtered_bed)
|
| 168 |
-
|
| 169 |
-
filtered_bed_df_list_no_null = filtered_bed_df_list[unlist(map(filtered_bed_df_list, ~nrow(.) > 0))]
|
| 170 |
-
|
| 171 |
-
filtered_bed_df_list_no_null_in_meta = filtered_bed_df_list_no_null[
|
| 172 |
-
as.integer(names(filtered_bed_df_list_no_null)) %in% rossi_meta$yeastepigenome_id]
|
| 173 |
-
|
| 174 |
-
af_list = list(
|
| 175 |
-
yiming = map(filtered_bed_df_list_no_null_in_meta, peaks_to_promoter_scores, regions_list$yiming),
|
| 176 |
-
mindel = map(filtered_bed_df_list_no_null_in_meta, peaks_to_promoter_scores, regions_list$mindel)
|
| 177 |
-
)
|
| 178 |
-
|
| 179 |
-
af_list_dfs = list(
|
| 180 |
-
yiming = bind_rows(map(af_list$yiming, as_tibble), .id = "yeastepigenome_id") |>
|
| 181 |
-
mutate(yeastepigenome_id = as.integer(yeastepigenome_id)) |>
|
| 182 |
-
left_join(dplyr::select(brentlab_features, locus_tag, symbol)) |>
|
| 183 |
-
dplyr::rename(target_locus_tag = locus_tag, target_symbol = symbol) |>
|
| 184 |
-
left_join(rossi_meta) |>
|
| 185 |
-
group_by(sample_id, seqnames, start, end, width, strand, target_locus_tag, target_symbol) |>
|
| 186 |
-
reframe(score = median(score)) |>
|
| 187 |
-
group_by(sample_id) |>
|
| 188 |
-
arrange(desc(score)),
|
| 189 |
-
mindel = bind_rows(map(af_list$mindel, as_tibble), .id = "yeastepigenome_id") |>
|
| 190 |
-
mutate(yeastepigenome_id = as.integer(yeastepigenome_id)) |>
|
| 191 |
-
left_join(rossi_meta) |>
|
| 192 |
-
group_by(sample_id, seqnames, start, end, width, strand, target_locus_tag, target_symbol) |>
|
| 193 |
-
reframe(score = median(score)) |>
|
| 194 |
-
group_by(sample_id) |>
|
| 195 |
-
arrange(desc(score))
|
| 196 |
-
)
|
| 197 |
-
|
| 198 |
-
# arrow::write_parquet(
|
| 199 |
-
# af_list_dfs$yiming,
|
| 200 |
-
# "~/code/hf/rossi_2021/yep_filtered_peaks_yiming.parquet",
|
| 201 |
-
# compression = "zstd",
|
| 202 |
-
# write_statistics = TRUE
|
| 203 |
-
# )
|
| 204 |
-
#
|
| 205 |
-
# arrow::write_parquet(
|
| 206 |
-
# af_list_dfs$mindel,
|
| 207 |
-
# "~/code/hf/rossi_2021/yep_filtered_peaks_mindel.parquet",
|
| 208 |
-
# compression = "zstd",
|
| 209 |
-
# write_statistics = TRUE
|
| 210 |
-
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/genomecov_to_annotated_features.R
CHANGED
|
@@ -91,7 +91,8 @@ combine_replicates_af <- function(sample_set_id, genomecov_data, regions_gr) {
|
|
| 91 |
|
| 92 |
run_accession_list <- genomecov_data$meta %>%
|
| 93 |
filter(sample_id == sample_set_id) %>%
|
| 94 |
-
pull(run_accession)
|
|
|
|
| 95 |
|
| 96 |
library_totals <- genomecov_data$ds %>%
|
| 97 |
filter(accession %in% run_accession_list) %>%
|
|
@@ -508,7 +509,7 @@ enrichment_analysis <- function(sample_set_id,
|
|
| 508 |
# Main analysis workflow
|
| 509 |
# ============================================================================
|
| 510 |
|
| 511 |
-
PROMOTERS = "
|
| 512 |
|
| 513 |
# Load data
|
| 514 |
genomic_features <- arrow::read_parquet(
|
|
@@ -537,33 +538,74 @@ regions_list = list(
|
|
| 537 |
col_names = c('chr', 'start', 'end', 'locus_tag', 'score', 'strand')) %>%
|
| 538 |
bed_to_granges(),
|
| 539 |
mindel = arrow::read_parquet("~/code/hf/yeast_genome_resources/mindel_promoters.parquet") |>
|
| 540 |
-
bed_to_granges()
|
|
|
|
|
|
|
| 541 |
)
|
| 542 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 543 |
regions_gr <- regions_list[[PROMOTERS]]
|
| 544 |
|
| 545 |
# removes AAD6 and AAD16 from mindel. pseudogene no longer in annotations
|
| 546 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 547 |
|
| 548 |
# Process control samples
|
| 549 |
rossi_2021_control <- combine_control_af(genomecov$control, regions_gr)
|
| 550 |
|
|
|
|
|
|
|
|
|
|
| 551 |
# Process all sample_id sets
|
| 552 |
-
annotated_feature_counts <- map(sample_id_list, ~{
|
| 553 |
-
|
| 554 |
-
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
names(annotated_feature_counts) <- sample_id_list
|
| 556 |
|
| 557 |
# Perform enrichment analysis
|
| 558 |
-
annotated_feature_quants <- map(sample_id_list, ~{
|
| 559 |
-
|
| 560 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 561 |
rossi_2021_control$af$score,
|
| 562 |
sum(rossi_2021_control$library_totals$n),
|
| 563 |
annotated_feature_counts,
|
| 564 |
regions_gr
|
| 565 |
-
)
|
| 566 |
-
|
|
|
|
| 567 |
names(annotated_feature_quants) <- sample_id_list
|
| 568 |
|
| 569 |
if(PROMOTERS == "yiming"){
|
|
@@ -632,9 +674,80 @@ if(PROMOTERS == "yiming"){
|
|
| 632 |
# target_symbol = TRUE
|
| 633 |
# )
|
| 634 |
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
}
|
| 636 |
|
| 637 |
-
#
|
| 638 |
|
| 639 |
if(PROMOTERS == 'yiming'){
|
| 640 |
# Extract and format combined results
|
|
@@ -657,7 +770,7 @@ if(PROMOTERS == 'yiming'){
|
|
| 657 |
# Write combined results
|
| 658 |
# annotated_feature_quants_combined %>%
|
| 659 |
# write_parquet(
|
| 660 |
-
# "~/code/hf/rossi_2021/
|
| 661 |
# compression = "zstd",
|
| 662 |
# write_statistics = TRUE,
|
| 663 |
# chunk_size = 6708,
|
|
@@ -703,4 +816,72 @@ if(PROMOTERS == 'yiming'){
|
|
| 703 |
# )
|
| 704 |
# )
|
| 705 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 706 |
}
|
|
|
|
| 91 |
|
| 92 |
run_accession_list <- genomecov_data$meta %>%
|
| 93 |
filter(sample_id == sample_set_id) %>%
|
| 94 |
+
# pull(run_accession)
|
| 95 |
+
pull(accession)
|
| 96 |
|
| 97 |
library_totals <- genomecov_data$ds %>%
|
| 98 |
filter(accession %in% run_accession_list) %>%
|
|
|
|
| 509 |
# Main analysis workflow
|
| 510 |
# ============================================================================
|
| 511 |
|
| 512 |
+
PROMOTERS = "intergenic"
|
| 513 |
|
| 514 |
# Load data
|
| 515 |
genomic_features <- arrow::read_parquet(
|
|
|
|
| 538 |
col_names = c('chr', 'start', 'end', 'locus_tag', 'score', 'strand')) %>%
|
| 539 |
bed_to_granges(),
|
| 540 |
mindel = arrow::read_parquet("~/code/hf/yeast_genome_resources/mindel_promoters.parquet") |>
|
| 541 |
+
bed_to_granges(),
|
| 542 |
+
start_codon_500bp = rtracklayer::import("~/code/hf/yeast_genome_resources/start_codon_500bp_upstream_promoters.bed"),
|
| 543 |
+
intergenic = rtracklayer::import("~/code/hf/yeast_genome_resources/intergenic_regions_5_1.bed")
|
| 544 |
)
|
| 545 |
|
| 546 |
+
# rename name to target_locus_tag
|
| 547 |
+
colnames(GenomicRanges::mcols(regions_list$start_codon_500bp))[1] <- "target_locus_tag"
|
| 548 |
+
|
| 549 |
+
intergenic_meta = read_csv("~/code/hf/yeast_genome_resources/intergenic_regions_metadata_5_1.csv") |>
|
| 550 |
+
dplyr::select(ir_name, chr, start, end, feature_left, feature_right) |>
|
| 551 |
+
pivot_longer(-c(ir_name, chr, start, end), names_to = 'side', values_to = 'target_locus_tag') |>
|
| 552 |
+
left_join(dplyr::select(genomic_features, target_locus_tag = locus_tag,
|
| 553 |
+
target_symbol = symbol, target_strand = strand,
|
| 554 |
+
target_start = start, target_end = end)) |>
|
| 555 |
+
filter(chr != "chrM") |>
|
| 556 |
+
filter(!is.na(target_strand)) |>
|
| 557 |
+
mutate(valid = (target_strand == '-' & target_end <= start)
|
| 558 |
+
| (target_strand == '+' & target_start >= end)) |>
|
| 559 |
+
filter(valid)
|
| 560 |
+
|
| 561 |
regions_gr <- regions_list[[PROMOTERS]]
|
| 562 |
|
| 563 |
# removes AAD6 and AAD16 from mindel. pseudogene no longer in annotations
|
| 564 |
+
if(PROMOTERS != "intergenic"){
|
| 565 |
+
# really just for mindel
|
| 566 |
+
regions_gr = regions_gr[!is.na(regions_gr$target_locus_tag)]
|
| 567 |
+
} else if(PROMOTERS == "intergenic"){
|
| 568 |
+
regions_gr = regions_gr[regions_gr$name %in% unique(intergenic_meta$ir_name)]
|
| 569 |
+
}
|
| 570 |
|
| 571 |
# Process control samples
|
| 572 |
rossi_2021_control <- combine_control_af(genomecov$control, regions_gr)
|
| 573 |
|
| 574 |
+
library(parallel)
|
| 575 |
+
n_cores = 25
|
| 576 |
+
|
| 577 |
# Process all sample_id sets
|
| 578 |
+
# annotated_feature_counts <- map(sample_id_list, ~{
|
| 579 |
+
# combine_replicates_af(.x, genomecov$tagged, regions_gr)
|
| 580 |
+
# })
|
| 581 |
+
annotated_feature_counts <- mclapply(
|
| 582 |
+
sample_id_list,
|
| 583 |
+
\(x) combine_replicates_af(x, genomecov$tagged, regions_gr),
|
| 584 |
+
mc.cores = n_cores
|
| 585 |
+
)
|
| 586 |
names(annotated_feature_counts) <- sample_id_list
|
| 587 |
|
| 588 |
# Perform enrichment analysis
|
| 589 |
+
# annotated_feature_quants <- map(sample_id_list, ~{
|
| 590 |
+
# enrichment_analysis(
|
| 591 |
+
# .x,
|
| 592 |
+
# rossi_2021_control$af$score,
|
| 593 |
+
# sum(rossi_2021_control$library_totals$n),
|
| 594 |
+
# annotated_feature_counts,
|
| 595 |
+
# regions_gr
|
| 596 |
+
# )
|
| 597 |
+
# })
|
| 598 |
+
annotated_feature_quants <- mclapply(
|
| 599 |
+
sample_id_list,
|
| 600 |
+
\(x) enrichment_analysis(
|
| 601 |
+
x,
|
| 602 |
rossi_2021_control$af$score,
|
| 603 |
sum(rossi_2021_control$library_totals$n),
|
| 604 |
annotated_feature_counts,
|
| 605 |
regions_gr
|
| 606 |
+
),
|
| 607 |
+
mc.cores = n_cores
|
| 608 |
+
)
|
| 609 |
names(annotated_feature_quants) <- sample_id_list
|
| 610 |
|
| 611 |
if(PROMOTERS == "yiming"){
|
|
|
|
| 674 |
# target_symbol = TRUE
|
| 675 |
# )
|
| 676 |
# )
|
| 677 |
+
} else if (PROMOTERS == "start_codon_500bp") {
|
| 678 |
+
annotated_features_quants_replicates <- map(annotated_feature_quants, ~{
|
| 679 |
+
map(.x$replicates, as_tibble) %>%
|
| 680 |
+
list_rbind(names_to = "accession")}) %>%
|
| 681 |
+
list_rbind(names_to = "sample_id") %>%
|
| 682 |
+
mutate(sample_id = as.integer(sample_id)) %>%
|
| 683 |
+
left_join(
|
| 684 |
+
genomecov$tagged$meta %>%
|
| 685 |
+
ungroup() %>%
|
| 686 |
+
select(sample_id, regulator_locus_tag, regulator_symbol, accession) %>%
|
| 687 |
+
distinct(),
|
| 688 |
+
by = c("sample_id", "accession")) %>%
|
| 689 |
+
left_join(select(genomic_features, target_locus_tag = locus_tag, target_symbol = symbol)) %>%
|
| 690 |
+
dplyr::relocate(sample_id, accession, regulator_locus_tag, regulator_symbol,
|
| 691 |
+
target_locus_tag, target_symbol) %>%
|
| 692 |
+
select(-c(score, width, strand))
|
| 693 |
+
|
| 694 |
+
# annotated_features_quants_replicates %>%
|
| 695 |
+
# write_parquet(
|
| 696 |
+
# "~/code/hf/rossi_2021/rossi_2021_af_start_codon_500bp_replicates.parquet",
|
| 697 |
+
# compression = "zstd",
|
| 698 |
+
# write_statistics = TRUE,
|
| 699 |
+
# chunk_size = 5945,
|
| 700 |
+
# use_dictionary = c(
|
| 701 |
+
# sample_id = TRUE,
|
| 702 |
+
# accession = TRUE,
|
| 703 |
+
# regulator_locus_tag = TRUE,
|
| 704 |
+
# regulator_symbol = TRUE,
|
| 705 |
+
# seqnames = TRUE,
|
| 706 |
+
# target_locus_tag = TRUE,
|
| 707 |
+
# target_symbol = TRUE
|
| 708 |
+
# )
|
| 709 |
+
# )
|
| 710 |
+
|
| 711 |
+
} else if(PROMOTERS == 'intergenic'){
|
| 712 |
+
annotated_features_quants_replicates <- map(annotated_feature_quants, ~{
|
| 713 |
+
map(.x$replicates, as_tibble) %>%
|
| 714 |
+
list_rbind(names_to = "accession")}) %>%
|
| 715 |
+
list_rbind(names_to = "sample_id") %>%
|
| 716 |
+
mutate(sample_id = as.integer(sample_id)) %>%
|
| 717 |
+
left_join(
|
| 718 |
+
genomecov$tagged$meta %>%
|
| 719 |
+
ungroup() %>%
|
| 720 |
+
select(sample_id, regulator_locus_tag, regulator_symbol, accession) %>%
|
| 721 |
+
distinct(),
|
| 722 |
+
by = c("sample_id", "accession")) %>%
|
| 723 |
+
dplyr::rename(ir_name = name) |>
|
| 724 |
+
left_join(dplyr::select(intergenic_meta, ir_name, target_locus_tag, target_symbol),
|
| 725 |
+
relationship = "many-to-many") |>
|
| 726 |
+
dplyr::relocate(sample_id, accession, regulator_locus_tag, regulator_symbol,
|
| 727 |
+
ir_name, target_locus_tag, target_symbol) %>%
|
| 728 |
+
select(-c(score, width, strand))
|
| 729 |
+
|
| 730 |
+
# annotated_features_quants_replicates %>%
|
| 731 |
+
# write_parquet(
|
| 732 |
+
# "~/code/hf/rossi_2021/rossi_2021_af_intergenic_replicates.parquet",
|
| 733 |
+
# compression = "zstd",
|
| 734 |
+
# write_statistics = TRUE,
|
| 735 |
+
# chunk_size = 6040,
|
| 736 |
+
# use_dictionary = c(
|
| 737 |
+
# sample_id = TRUE,
|
| 738 |
+
# accession = TRUE,
|
| 739 |
+
# regulator_locus_tag = TRUE,
|
| 740 |
+
# regulator_symbol = TRUE,
|
| 741 |
+
# seqnames = TRUE,
|
| 742 |
+
# target_locus_tag = TRUE,
|
| 743 |
+
# target_symbol = TRUE,
|
| 744 |
+
# ir_name = TRUE
|
| 745 |
+
# )
|
| 746 |
+
# )
|
| 747 |
+
|
| 748 |
}
|
| 749 |
|
| 750 |
+
# combined_results
|
| 751 |
|
| 752 |
if(PROMOTERS == 'yiming'){
|
| 753 |
# Extract and format combined results
|
|
|
|
| 770 |
# Write combined results
|
| 771 |
# annotated_feature_quants_combined %>%
|
| 772 |
# write_parquet(
|
| 773 |
+
# "~/code/hf/rossi_2021/rossi_2021_af_yiming_combined.parquet",
|
| 774 |
# compression = "zstd",
|
| 775 |
# write_statistics = TRUE,
|
| 776 |
# chunk_size = 6708,
|
|
|
|
| 816 |
# )
|
| 817 |
# )
|
| 818 |
|
| 819 |
+
} else if(PROMOTERS == 'intergenic'){
|
| 820 |
+
annotated_feature_quants_combined <- map(annotated_feature_quants, ~{
|
| 821 |
+
as_tibble(.x$combined)}) %>%
|
| 822 |
+
list_rbind(names_to = "sample_id") %>%
|
| 823 |
+
mutate(sample_id = as.integer(sample_id)) %>%
|
| 824 |
+
left_join(
|
| 825 |
+
genomecov$tagged$meta %>%
|
| 826 |
+
ungroup() %>%
|
| 827 |
+
select(sample_id, regulator_locus_tag, regulator_symbol) %>%
|
| 828 |
+
distinct(),
|
| 829 |
+
by = "sample_id") %>%
|
| 830 |
+
dplyr::rename(ir_name = name) |>
|
| 831 |
+
left_join(dplyr::select(intergenic_meta, ir_name, target_locus_tag, target_symbol),
|
| 832 |
+
relationship = "many-to-many") |>
|
| 833 |
+
dplyr::relocate(sample_id, regulator_locus_tag, regulator_symbol,
|
| 834 |
+
ir_name, target_locus_tag, target_symbol) %>%
|
| 835 |
+
select(-c(score, width, strand))
|
| 836 |
+
|
| 837 |
+
# Write combined results
|
| 838 |
+
# annotated_feature_quants_combined %>%
|
| 839 |
+
# write_parquet(
|
| 840 |
+
# "~/code/hf/rossi_2021/rossi_2021_af_intergenic_combined.parquet",
|
| 841 |
+
# compression = "zstd",
|
| 842 |
+
# write_statistics = TRUE,
|
| 843 |
+
# chunk_size = 6040,
|
| 844 |
+
# use_dictionary = c(
|
| 845 |
+
# sample_id = TRUE,
|
| 846 |
+
# regulator_locus_tag = TRUE,
|
| 847 |
+
# regulator_symbol = TRUE,
|
| 848 |
+
# seqnames = TRUE,
|
| 849 |
+
# ir_name = TRUE,
|
| 850 |
+
# target_locus_tag = TRUE,
|
| 851 |
+
# target_symbol = TRUE
|
| 852 |
+
# ))
|
| 853 |
+
|
| 854 |
+
} else if(PROMOTERS == 'start_codon_500bp'){
|
| 855 |
+
|
| 856 |
+
annotated_feature_quants_combined <- map(annotated_feature_quants, ~{
|
| 857 |
+
as_tibble(.x$combined)}) %>%
|
| 858 |
+
list_rbind(names_to = "sample_id") %>%
|
| 859 |
+
mutate(sample_id = as.integer(sample_id)) %>%
|
| 860 |
+
left_join(
|
| 861 |
+
genomecov$tagged$meta %>%
|
| 862 |
+
ungroup() %>%
|
| 863 |
+
select(sample_id, regulator_locus_tag, regulator_symbol) %>%
|
| 864 |
+
distinct(),
|
| 865 |
+
by = "sample_id") %>%
|
| 866 |
+
left_join(select(genomic_features, target_locus_tag = locus_tag, target_symbol = symbol)) %>%
|
| 867 |
+
dplyr::relocate(sample_id, regulator_locus_tag, regulator_symbol,
|
| 868 |
+
target_locus_tag, target_symbol) %>%
|
| 869 |
+
select(-c(score, width, strand))
|
| 870 |
+
|
| 871 |
+
# Write combined results
|
| 872 |
+
# annotated_feature_quants_combined %>%
|
| 873 |
+
# write_parquet(
|
| 874 |
+
# "~/code/hf/rossi_2021/rossi_2021_af_start_codon_500bp_combined.parquet",
|
| 875 |
+
# compression = "zstd",
|
| 876 |
+
# write_statistics = TRUE,
|
| 877 |
+
# chunk_size = 5945,
|
| 878 |
+
# use_dictionary = c(
|
| 879 |
+
# sample_id = TRUE,
|
| 880 |
+
# regulator_locus_tag = TRUE,
|
| 881 |
+
# regulator_symbol = TRUE,
|
| 882 |
+
# seqnames = TRUE,
|
| 883 |
+
# target_locus_tag = TRUE,
|
| 884 |
+
# target_symbol = TRUE
|
| 885 |
+
# )
|
| 886 |
+
# )
|
| 887 |
}
|