Добавил:
Sekretar
kiopkiopkiop18@yandex.ru
t.me/Prokururor I Вовсе не секретарь, но почту проверяю
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз:
Предмет:
Файл:Ординатура / Хирургия / Библиотека им академика М.И. Перельмана / Книга_5529_Библиотеки_им_академика_М_И_Перельмана
.pdf
234 Bioinformatics of Autoimmune Diseases
for _, row in metadata.iterrows():
run_id = row['runID']
condition = row['condition']
print(f"Processing {run_id} ({condition})...")
r1, r2 = find_fastq_pairs(run_id)
trimmed_r1, trimmed_r2 = trim_reads(run_id, r1, r2)
bam_file = align_reads(run_id, trimmed_r1, trimmed_r2)
peak_file = call_peaks(run_id, bam_file, condition)
print(f"Finished {run_id}, peaks at: {peak_file}")
if __name__ == "__main__":
run_pipeline()
The run _ pipeline function serves as the orchestrator for executing a complete ChIP-Seq
analysis workow, handling the progression from raw sequencing data to peak identication. It
begins by invoking the download _ and _ index _ reference function, which ensures that
the reference genome is present and properly indexed for BWA alignment. If the index les do not
exist, this function downloads the compressed reference genome, decompresses it, and creates the
necessary BWA index les. This step is crucial for aligning sequencing reads accurately to the
reference genome.
Once the reference setup is conrmed, run _ pipeline proceeds by reading the study meta-
data from a CSV le located at meta/metadata.csv. This le contains two columns: the runID,
which uniquely identies each sequencing run, and condition, which indicates whether the sample
is a treated or control group. The function iterates through each row in the metadata, extracting the
corresponding run ID and condition.
For each sample, the pipeline identies the paired-end FASTQ les using the find_ fastq_
pairs function. These les must follow a naming convention that includes the run ID and read pair
indicators (e.g., _ 1.fast q.gz and _ 2.fastq.g z). Once the paired les are located, they are
passed to the trim _ reads function, which uses Trimmomatic to remove low-quality bases
and sequencing adapters. The output of this step is two high-quality, trimmed FASTQ les for each
read pair.
Next, the align _ reads function aligns the trimmed reads to the indexed reference genome
using BWA-MEM. The output is initially written as a Sequence Alignment/Map (SAM) le, which
is then converted to a sorted BAM le through a pipeline using samtools view and samtools
sort. The intermediate SAM le is deleted after conversion to save disk space. The nal BAM le
contains the aligned sequencing reads in a format suitable for downstream analysis.
The last major step in the pipeline is peak calling, performed by the call _ peaks function
using MACS3. This tool identies regions of the genome with signicant enrichment of mapped
reads, which likely correspond to DNA–protein binding sites such as TF occupancy or histone
modications. The output of this step is a narrowPeak le that lists the genomic coordinates and
scores of the detected peaks. These les are stored in a dedicated peaks subdirectory under the main
results folder.
Overall, the run _ pipeline function automates the entire ChIP-Seq analysis process, tak-
ing raw sequencing reads through quality trimming, alignment, and peak detection. Its outputs
include trimmed FASTQ les, sorted BAM les of aligned reads, and narrowPeak les representing
enriched regions, which are the primary output for biological interpretation of transcriptional regulation and chromatin state in autoimmune research or other biological contexts. In the following, we
describe each ChIP-Seq output le generated by MACS3, where “*” denotes the sample ID.
The * _ pea k s.b ed le lists broad genomic regions identied as enriched by MACS3 during
ChIP-Seq peak analysis. It provides a minimal BED-format output that includes the chromosome,
start and end positions, and a basic score. This makes it suitable for general visualization purposes
in genome browsers or for use in analyses that involve intersecting peaks with known regulatory
elements or annotations.

235 DNA-Protein Interactions and Autoimmune Diseases
The * _ peaks.narrowPeak le is a specialized extension of the BED format designed to
represent transcription factor binding sites (TFBS) with greater precision. In addition to the basic
genomic coordinates, it includes extra columns such as signal strength, statistical signicance
(p-value), and FDR (q-value). This high-resolution format is ideal for identifying discrete binding
events and is commonly used for downstream analyses like motif enrichment or functional annotation using tools such as HOMER or MEME.
The * _ pea ks.x ls le provides a complete tab-delimited table summarizing all peaks
detected by MACS3. It includes in-depth peak statistics such as summit location, fold enrichment,
and associated signicance values. This le is particularly useful for ltering peaks by condence
level, ranking them by biological importance, and selecting regions for further experimental followup or functional analysis.
The * _ s um mit s.be d le identies the precise summit point within each peak (the position
with the highest read density), offering maximum resolution for pinpointing protein–DNA interaction sites. These summit coordinates are especially valuable in motif discovery workows, where
accurate mapping of the binding core is essential for uncovering sequence specicity and conditiondependent binding variation.
Table 7.2 presents an example of a sample narrowPeak le. Column descriptions are as follows:
• chrom: Chromosome name (e.g., chr1)
• chromStart and chromEnd: Genomic start and end positions of the peak
• name: Peak ID assigned by MACS3
• score: Integer score (typically used for visualization)
• strand: Always “.” in narrowPeak les (no strand-specic info)
• signalValue: Measure of enrichment (e.g., pileup height or read coverage)
• pValue: Statistical signicance (−log10)
• qValue: FDR (−log10)
• peak: Position of the peak summit relative to chromStart
In the following, we describe the signal Value, pValue, qValue, peak, and score metrics.
7.8.2.1 Computing signalValue
In ChIP-Seq data analysis using MACS3, the signalValue is a key metric reported for each identi-
ed peak, reecting the strength of enrichment at that region. It provides a quantitative measure
of how robust the signal is in the ChIP sample compared to the background control. Specically,
signalValue is calculated as the pileup height of reads at the peak summit, normalized by the total
number of reads in the dataset. This normalization allows for comparison across different samples
and experiments, regardless of differences in sequencing depth. By reporting the signal on a permillion-reads basis, MACS3 ensures that the value is representative of true biological enrichment
rather than technical variation.
TA BL E 7. 2
Example of a Typical narrowPeak Output File Generated by MACS3, Illustrating the
Format and Key Metrics used to Represent Enriched Genomic Regions in ChIP-Seq Data
Chrom chromStart chromEnd Name Score Strand signalValue pValue qValue Peak
chr1 345,000 345,500 peak_1 1000 . 75.3 45.1 20.5 250
chr1 567,000 567,450 peak_2 850 . 52.7 33.8 15.4 180
chr2 1,230,000 1,230,600 peak_3 920 . 60.4 40.2 18.9 230
chr3 890,000 890,400 peak_4 870 . 58 36.7 17.6 200
chrX 132,000 132,500 peak_5 780 . 50.2 30.3 14.7 150

236 Bioinformatics of Autoimmune Diseases
pileupatpeaksubmit
(
)
h
N/ 1, 000,000
To compute the signalValue, MACS3 rst models the ChIP-Seq signal by extending each read to
a predicted fragment length and calculating the coverage at each base pair across the genome. The
algorithm identies candidate peaks by searching for regions where the read coverage signicantly
exceeds what would be expected under a background model, typically built from the input control.
Once peaks are dened, MACS3 determines the summit of each peak (the point with the highest
read pileup) and calculates the local signal intensity at that position. This raw signal is then scaled
by the total number of mapped reads to obtain the signalValue, often expressed in units such as tags
per million (TPM).
gnalValue =
More precisely, it is:
where h is the height of the pileup at the peak submit (the number of the extended reads overlapping
the summit) and N is the total number of mapped reads in the treatment sample (ChIP).
The interpretation of signalValue (Figure 7.3) is straightforward: a higher value indicates stron-
ger enrichment and a more condent binding event. Peaks with high signalValue are generally considered more biologically signicant, suggesting a robust association between the protein of interest
and the underlying genomic region. These peaks are often prioritized for downstream analysis, such
as motif discovery or regulatory element annotation. However, signalValue should be interpreted in
conjunction with other statistics reported by MACS3, such as the p-value and q-value, which reect
the statistical signicance and FDR, respectively. Together, these metrics provide a comprehensive
view of the condence and magnitude of protein–DNA interactions captured by ChIP-Seq.
7.8.2.2 Computing pValue
In ChIP-Seq analysis using MACS3, the p-value is a statistical measure that quanties the signicance of observed enrichment in read counts at a given genomic region, compared to what would be
expected by random background noise. For each candidate peak, MACS3 tests whether the number
of reads observed in the ChIP sample is signicantly higher than what would occur under a null
model that assumes a uniform distribution of reads across the genome or reects background signal
totalnumberofreads
gnalValue =
inmillions
FIGURE 7.3 ChIP-Seq peaks and signal values.

237 DNA-Protein Interactions and Autoimmune Diseases
ˇ
−ˆ
x
e ˆ
pP
= x!xk
p1 ˜ p2 ˜ p3 …˜ p
n
p
i
°
np.
˙
ˆ
˛
captured by a control sample. The goal is to determine the probability that the observed enrichment
occurred by chance.
The p-value is computed based on a Poisson distribution, which models the count of sequencing
reads falling in a genomic region. Specically, MACS3 calculates the expected number of reads (λ)
in a window based on the background model and then evaluates the probability of observing at least
as many reads as were actually seen in the ChIP data. The formula used is:
= ( ˙)=
Xk
˜
where X is a Poisson random variable representing the number of reads in a region under the null
hypothesis, k is the observed number of reads (pileup height), and λ is the expected number of reads
in that region based on background estimation. The background λ may be determined globally
across the genome or locally, depending on the density of reads in the surrounding regions and the
presence of control (input) samples.
When a control sample is available, MACS3 constructs a dynamic λ by combining the local
background from the control data with broader estimates to better account for local chromatin
accessibility or sequencing biases. It selects the maximum of three λ values: one estimated from
a 1-kb window centered on the peak, another from a 5-kb window, and a global λ from the entire
genome. This conservative approach helps MACS3 avoid calling false positives in regions with
naturally high background.
The resulting p-value represents the probability of obtaining a peak of the observed height or
higher under the assumption of background noise. Small p-values indicate that the peak is unlikely
to be due to chance and suggest true protein–DNA binding events. To control for multiple testing,
MACS3 further adjusts the p-values into q-values using the Benjamini-Hochberg procedure, which
estimates the FDR across all tested peaks. This process ensures that the reported peaks are both
statistically and biologically meaningful.
7.8.2.3 Computing qValue
In ChIP-Seq analysis using MACS3, the q-value is a critical metric that represents the FDR adjusted
p-value for each called peak. It provides a statistical measure of condence, indicating the expected
proportion of false positives among the peaks with equal or smaller p-values. This adjustment is
essential when performing thousands or millions of hypothesis tests across the genome, as is typical
in ChIP-Seq, to control for multiple testing and reduce the risk of interpreting noise as a true signal.
To compute the q-value for each peak, MACS3 rst calculates a raw p-value based on the local
enrichment of ChIP reads over background as discussed above.
Once p-values for all candidate peaks are computed, MACS3 adjusts them to control for FDR
using the Benjamini-Hochberg procedure. This method sorts all p-values in increasing order
and computes the corresponding q-value
=
min
i
ji
j
˝
˘
j
for each peak as:
ˇ
where n is the total number of peaks tested. The q-value for each peak is then the minimum of these
adjusted ratios, moving from the most signicant peak (smallest p-value) to the least signicant.
This process ensures that the q-values are monotonic and interpretable as FDR estimates.
A low q-value implies that the peak is unlikely to be a false positive, giving researchers higher
condence in its biological relevance. In practice, a common threshold for signicance is q < 0.05,
indicating that no more than 5% of the peaks below this threshold are expected to be false discoveries. Thus, the q-value computed by MACS3 plays a central role in distinguishing true protein–DNA
binding events from random uctuations in the background signal.

238 Bioinformatics of Autoimmune Diseases
()
]
(
pvalue
)
10log −
7. 8 .2 . 4 P ea k
The peak value refers to the highest pileup of sequencing reads within a peak region and is typically
reported as the maximum signal strength at the peak summit. This value captures the local enrichment of ChIP reads relative to the genome-wide background and provides an intuitive representation
of how strongly a protein binds at that specic location. The peak value is derived after the algorithm scans the genome to identify regions with statistically signicant accumulation of extended
reads, and it corresponds to the point within a peak where the signal is at its highest; often referred
to as the summit.
To compute the peak value, MACS3 rst aligns the sequencing reads and models each one as
an extended DNA fragment, using an estimated fragment length. It then constructs a signal track
representing the number of overlapping fragments at each base pair across the genome. Within each
detected peak region, MACS3 identies the summit (the position with the highest read pileup) and
records this maximum value as the peak value. Formally, if the peak spans from genomic coordinate
a to b, and the function (x) denotes the read coverage at position x, the peak value is computed as:
xˆ[a,b
This raw count is inuenced by sequencing depth and other experimental conditions, so it is
typically normalized to allow meaningful comparison across samples. In some reports, the peak
value is shown as TPM at the summit, which involves dividing the raw pileup by the total number
of mapped reads (in millions) in the ChIP sample.
The peak value is a critical component for interpreting ChIP-Seq data, as it helps prioritize peaks
for downstream biological analysis. Higher peak values generally correspond to stronger or more
consistent protein–DNA interactions, making those regions of particular interest for further validation, motif discovery, or functional annotation. However, it is important to interpret peak values
in the context of other metrics such as q-value and fold enrichment to avoid bias from regions of
articially high coverage or mappability artifacts.
7.8.2.5 Score
In ChIP-Seq analysis using MACS3, the score assigned to each peak is a log-transformed value
derived from the p-value, representing the statistical signicance of the observed enrichment at
that genomic region. This score is particularly useful for visualizing and ranking peaks based on
condence. It is included in the standard output les, such as the narrowPeak and broadPeak
formats, and provides a compact numerical summary of how strongly the peak deviates from the
expected background distribution.
The score in MACS3 is calculated using the following formula:
10
This transformation converts the p-value into a Phred-like quality score, which increases as the
p-value decreases. A smaller p-value indicates a more statistically signicant enrichment, and therefore a higher score. For example, a p-value of 10−5 corresponds to a score of 50, while a p-value of
−10
10
results in a score of 100. This allows researchers to rank peaks by their statistical strength and
facilitates ltering by a threshold score when needed.
The score thus reects how extreme the observed read enrichment is compared to what would be
expected by chance. Since the score is logarithmic, it enables easier interpretation and plotting on
genome browsers, where higher scores correspond to more prominent peaks.
It is important to note that while the score is derived from the p-value, it does not account for
multiple testing. For this reason, it should be interpreted alongside the q-value, which reects the
FDR. Nonetheless, the MACS3 score remains a valuable and compact indicator of condence in
each peak and is widely used in downstream analyses and visual representations.

239 DNA-Protein Interactions and Autoimmune Diseases
7.8.3 ANNOTATION AND FUNCTIONAL INTERPRETATION
Following peak calling with MACS3, ChIP-Seq annotations and functional interpretation focus on
understanding the biological signicance of the identied enriched regions. The rst step in this process is annotating the peaks to genomic features such as promoters, exons, introns, and intergenic
regions. This is typically done using annotation tools like HOMER, ChIPseeker, or annotatePeaks.
pl, which align peak coordinates with gene annotations from genome databases like GENCODE or
RefSeq. Peaks located near TSSs are particularly informative, as they often indicate direct regulatory events. The proximity of peaks to known gene elements allows for the identication of potential
target genes regulated by the bound TF or histone modication.
Once peaks are annotated, the next step is functional enrichment analysis, which explores
whether the genes associated with peaks are overrepresented in specic biological pathways or GO
categories. Tools such as DAVID, g:Proler, or GREAT are often used to perform this step. These
analyses help reveal the biological processes, molecular functions, and cellular components that
are potentially regulated by the protein of interest. For example, in autoimmune disease studies,
enrichment might highlight immune-related pathways, cytokine signaling, or antigen processing,
depending on the ChIP target.
Additionally, integrating ChIP-Seq peaks with epigenomic datasets, such as DNase hypersensitivity, histone modications, or chromatin state maps from resources like ENCODE or Roadmap
Epigenomics, renes the interpretation of regulatory activity. Peaks overlapping active histone
marks like H3K27ac or H3K4me3 may indicate enhancers or promoters, respectively, providing
deeper insights into regulatory dynamics. Moreover, motif analysis within peak regions can uncover
sequence motifs bound by the immunoprecipitated TF or co-occurring regulators, allowing for the
prediction of regulatory networks.
Finally, differential peak analysis between conditions (e.g., disease versus control) can highlight
condition-specic regulatory events. By quantifying peak intensities and comparing them across
samples, researchers can identify differentially bound regions that may underlie phenotypic differences. These condition-specic peaks can then be linked to differentially expressed genes or
disease-associated variants, forming a basis for hypothesis generation in mechanistic studies and
therapeutic targeting.
7.8.3.1 Annotating with Homer
HOMER is a widely used suite of tools for the analysis and interpretation of ChIP-Seq data. One of
its core functionalities is the annotation of ChIP-Seq peaks, which helps researchers understand the
biological relevance of DNA-protein interactions identied during peak calling. After peak calling
tools such as MACS3 identify regions of enriched DNA binding, HOMER can be used to assign
these peaks to genomic features such as promoters, exons, introns, or intergenic regions, thereby
providing a functional context to the binding events.
HOMER performs peak annotation by comparing the genomic coordinates of called peaks to
known gene annotations, typically sourced from genome databases such as RefSeq or Ensembl. It
associates each peak with the nearest TSS, assigning a gene ID and describing the relative location
of the peak, such as whether it falls upstream or downstream of the gene or overlaps with gene bodies. This type of annotation allows researchers to infer potential regulatory relationships between
TFs or chromatin marks and target genes.
In addition to genomic feature annotation, HOMER supports motif discovery, which can be
applied to the peak sequences to identify enriched DNA motifs that may represent binding sites for
TFs. This integrated capability enables users to link observed binding patterns to known regulatory
elements and to hypothesize about the mechanisms of transcriptional regulation underlying the
ChIP-Seq signals. Overall, HOMER serves as a critical step in ChIP-Seq pipelines for translating
raw peak data into biologically meaningful insights by connecting peaks to genes and functional
elements within the genome.

240 Bioinformatics of Autoimmune Diseases
HOMER can be efciently installed through the Conda ecosystem using the mamba package
manager, which provides faster dependency resolution and installation compared to the default
Conda tool. To install HOMER, the user should rst ensure that mamba is available in their environment, typically within a dedicated bioinformatics or ChIP-Seq analysis Conda environment. If
it is not installed, you can install it using:
conda install mamba -c conda-forge
Then, the HOMER installation is performed by executing the command:
mamba install homer
This command retrieves the HOMER package along with its dependencies from a compatible
Conda channel, such as Bioconda. This method provides a convenient and reproducible way to set
up HOMER without needing to manually download scripts or congure paths.
Once HOMER is installed, it is essential to keep the tool updated to benet from improvements,
bug xes, and support for newer genomes or features. The update process is straightforward and
follows the same syntax as the installation, using the command:
mamba update homer
This command checks for the latest available version of HOMER within the environment’s active
channels and replaces the older version with the updated one. Regular updates ensure compatibility
with the evolving bioinformatics landscape and maintain the reliability of peak annotation and
motif discovery tasks in ChIP-Seq workows.
Before using HOMER for ChIP-Seq peak annotation, it is necessary to download the appropriate
genome annotation les for the species and genome build of interest, such as the human genome
version hg38. HOMER relies on pre-formatted reference genomes and associated annotation data
to accurately assign peaks to genomic features like promoters, exons, or intergenic regions. Without
these les, HOMER will not be able to map peaks to genes or interpret their regulatory context.
To download genome annotation les, HOMER provides configureHomer.pl utility, which
automates the retrieval and formatting of genomic data. For instance, to download the annotation
for the human hg38 genome, the user should run the command:
configureHomer.pl -install hg38
If you encounter an error, ensure that the le is in your system’s PATH, or use the “which” command in Linux to locate its path. The command “congureHomer.pl” fetches the necessary les,
including the chromosome sequences, annotation tables, and known TSS information, and stores
them in the appropriate HOMER directory structure. The annotation databases are downloaded to
a specic directory under the installation path. The tool also ensures that the genome is indexed and
ready for use in downstream tasks such as peak annotation and motif analysis.
It is important to match the genome version used for annotation with the version used during
alignment and peak calling to avoid discrepancies in genomic coordinates. Downloading the correct genome ensures consistency throughout the pipeline and increases the reliability of the biological interpretations drawn from the data. HOMER supports a wide range of organisms and genome
builds, making it exible for diverse ChIP-Seq studies, but each genome must be installed explicitly
before it can be used. Refer to the HOMER documentation for more details on annotation databases
and additional functionalities.
The Python program chipseq _ homer _ annotation.py is designed to automate the
process of annotating ChIP-Seq peaks, specically those called by MACS3, using HOMER’s
an notatePe aks.pl utility. This program usage is as follows:

241 DNA-Protein Interactions and Autoimmune Diseases
python chipseq_homer_annotation.py -i peaks.narrowPeak -g hg38 -o
annotated.txt
The program’s input le is peaks.narrowPeak provided by MACS3, and the output le is
a n n ot ate d.t x t . If you follow the analysis in this chapter, the MACS3 output les will be saved
in the “results” directory. Inside this directory, there will be a peaks.narrowPeak le for each
sample. When running the Python script, make sure you provide the correct input and output le
paths. For example:
mkdir -p annotations
python chipseq_homer_annotation.py \
-i results/peaks/SRR26147696_peaks.narrowPeak \
-g hg38 -o annotations/SRR26147696_annotated.txt
To annotate multiple peak les, you can create a Python or Bash script that uses a loop to iterate
over all peak les in the MACS3 output directory and process each le.
HOMER provides a streamlined way to integrate peak annotation into a larger analysis pipeline
and ensures reproducibility and ease of use for researchers working with genomic data. The Python
script begins by importing the necessary libraries, including os and subprocess for interacting
with the system shell, argparse for parsing command-line arguments, and pandas for handling
tabular data when converting le formats.
def run_command(command):
print(f"Running: {command}")
subprocess.run(command, shell=True, check=True)
def convert_narrowpeak_to_bed(narrowpeak_file, bed_file):
print(f"Converting {narrowpeak_file} to BED format...")
df = pd.read_csv(narrowpeak_file, sep="\t", header=None)
bed = df.iloc[:, [0, 1, 2]]
bed.to_csv(bed_file, sep="\t", header=False, index=False)
The core functionality starts with the run _ command function, which simply wraps a shell
command and runs it using Python’s s ub proc e ss.ru n method. This ensures that external commands like HOMER’s annotation script can be executed from within the Python environment,
and it prints each command being executed for transparency and debugging. The next function,
convert _ narrowpeak _ to _ bed, is responsible for converting MACS3’s output, which is
typically in .narrowPeak format, to a standard BED format required by HOMER. It reads the
input le using pandas, selects the chromosome, start, and end columns, and writes this minimal
BED le to disk. This conversion is necessary because HOMER expects a clean three-column BED
input for annotation, while the narrowPeak format contains additional metadata that is not used in
this step.
def run_homer_annotation(bed_file, genome, output_file):
print(f"Running HOMER annotation for {bed_file} on genome {genome}...")
command = f"annotatePeaks.pl {bed_file} {genome} > {output_file}"
run_command(command)
def parse_arguments():
parser = argparse.ArgumentParser(
description="Annotate MACS3 peaks using HOMER."
)
parser.add_argument(
"-i",
"--input",
required=True,

242 Bioinformatics of Autoimmune Diseases
help="Input MACS3 narrowPeak or BED file."
)
parser.add_argument(
"-g",
"--genome",
default="hg38",
help="Genome version (e.g., hg38, mm10)."
)
parser.add_argument(
"-o",
"--output",
default="annotated_peaks.txt",
help="Output annotated file."
)
return parser.parse_args()
The function run _ homer _ annotation is the core of the pipeline. It builds the command
to invoke an not ate P eak s.pl, taking as input the BED le, a genome ID such as hg38, and
a desired output lename. It then delegates execution of this command to the previously dened
run _ command function. This encapsulation ensures that annotation is handled as a single logical step while preserving modularity. The parse _ arguments function denes how users can
provide input parameters when running the script. It allows the user to specify the input le (which
can be either .narrowPeak or .bed), the genome version, and the name of the output le. This
design makes the script exible and easily integrable with other tools.
def main():
args = parse_arguments()
input_file = args.input
genome = args.genome
output_file = args.output
ext = os.path.splitext(input_file)[-1]
# Convert if narrowPeak
if ext == ".narrowPeak":
bed_file = input_file.replace(".narrowPeak", ".bed")
convert_narrowpeak_to_bed(input_file, bed_file)
else:
bed_file = input_file
run_homer_annotation(bed_file, genome, output_file)
print(f"Annotation completed. Output saved to {output_file}")
if __name__ == "__main__":
main()
The main function orchestrates the entire workow. It rst parses the command-line argu-
ments, identies whether the input le is in narrowPeak format, and if so, triggers a conversion
to BED. Once the appropriate BED le is available, it calls the annotation function with the userspecied genome and output le path. Finally, a completion message is printed to inform the user
that the annotation is done. By wrapping all these steps together, the program offers a robust and
user-friendly interface for annotating ChIP-Seq peaks with functional genomic information using
HOMER.
In the annotation output le (Table 7.3), each row represents a peak and its genomic context.
The Annotation column broadly categorizes the peak location (e.g., promoter-TSS, intron, intergenic), while the Detailed Annotation provides specic positional information. Distance to TSS is
reported in base pairs, showing how far the peak is from the closest TSS. HOMER also reports transcript IDs from RefSeq, Ensembl, Entrez, and Unigene databases, as well as gene symbols, aliases,

TA BL E 7. 3
Example Output from HOMER’s Peak Annotation, Presented in Two Parts for Clarity. The Table Summarizes the Genomic Context and
Gene Associations of ChIP-Seq Peaks Based on Their Proximity to Known Features
Peak Focus Ratio/
PeakID Chr Start End Strand Score Region Size Annotation Detailed Annotation Distance to TSS
1 chr1 3,450,000 3,451,000
2 chr2 1,234,000 1,235,000
3 chr6
4 chrX 9,876,543 9,877,543
5 chr3 5,678,900 5,680,000
PeakID Entrez ID Nearest Unigene Nearest RefSeq Nearest Ensembl Gene Name Gene Alias Gene Description Gene Type
1 3559 Hs.456123 NM_000417 ENSG00000145675 IL2RA CD25 Interleukin-2 receptor alpha chain protein-coding
2 6772 Hs.332432 NM_007315 ENSG00000115415 STAT1 ISGF3 Signal transducer and activator of protein-coding
3 3122 Hs.789654 NM_019111 ENSG00000206308 HLA-DRA DR Major histocompatibility complex, protein-coding
4 50943 Hs.112233 NM_014009 ENSG00000049768 FOXP3 IPEX Forkhead box protein P3 protein-coding
5 941 Hs.334455 NM_005191 ENSG00000121594 CD80 B7 CD80 molecule protein-coding
3.3E+07 3.3E+07 +
+
−
−
+
1000 0.85 promoter-TSS
780 0.76 intron intron 1 of STAT1 1420
1200 0.92 promoter-TSS
500 0.6 exon exon 2 of FOXP3
650 0.73 intergenic 48 kb from nearest gene CD80 48,932
−250 from TSS of IL2RA −250
−50 from TSS of HLA-DRA −50
transcription 1
class II, DR alpha
−98
243 DNA-Protein Interactions and Autoimmune Diseases
Соседние файлы в папке Библиотека им академика М.И. Перельмана
