LSMA

LONDON SCHOOL OF MULTIOMICS & AI

LSMA

LONDON SCHOOL OF MULTIOMICS & AI

Free course

Free course

0 of 31 lessons

Where two Polycomb proteins bind

Where two Polycomb proteins bind

Where two Polycomb proteins bind

Do CBX6 and CBX7 bind the same promoters, and more than chance would explain? Annotate two peak sets, compare their genes, build a shuffled null and decide what that null can and cannot show.

This project follows Multi-omics integration with MOFA2 and DIABLO, and draws mostly on Genomic ranges with Bioconductor and ChIP-seq peaks and annotation.

Research question

CBX6 and CBX7 are two Polycomb proteins. Do they bind the same promoters, more often than chance would explain, and are those promoters the kind of genes Polycomb is known to silence?

Polycomb proteins form complexes that keep genes switched off, especially genes that control development, such as the HOX genes that lay out the body plan. CBX6 and CBX7 are two of several related "chromobox" proteins that can join these complexes. If they work in the same complexes, their binding sites should coincide. The peak files for both come with ChIPseeker, so you already have everything you need.

How to approach this

  • Work from the lessons. Tasks 1 and 2 repeat steps from ChIP-seq peaks and annotation for both proteins. Tasks 3 and 4 add two ways of asking "more than chance?", one for genes and one for peaks. Task 5 asks what the shared genes are.
  • Write one script that loads the packages, reads both files and runs every step, so you can rerun it from the top, as in A reproducible workflow.
  • Use the hg19 gene models. The sample files are hg19, and the checkpoints below come from TxDb.Hsapiens.UCSC.hg19.knownGene. With other gene models your numbers will differ slightly.
  • Write down the definitions first. Before running anything, decide your promoter window for the annotation and your distance cut-off for "a gene with a promoter peak". The checkpoints use ±3 kb for the annotation and 1 kb from the TSS for the gene lists.

Two ideas from earlier modules come back here. The Fisher test of task 3 is the two-by-two table test from Counts and proportions, applied to genes instead of patients. The shuffled peaks of task 4 are the permutation idea from Resampling: bootstrap and permutation: build the distribution you would expect if nothing were going on, by rearranging the data, and see where the real value falls.

Both tests need a sensible idea of "chance", and that is where most of the thinking in this project lies. A test can only be as good as the comparison it makes. Keep asking: compared with what?

1

Read and check both peak sets

Genomic ranges with Bioconductor and ChIP-seq peaks and annotation

  • Read the CBX6 and CBX7 files with readPeakFile(), count the peaks and summarise their widths.
  • Give both objects the same chromosomes and the hg19 seqinfo, and check that no peak runs past the end of its chromosome.

Hint. getSampleFiles() returns a named list, so files[["CBX6_BF"]] picks a file by name, which is safer than by position. Compare seqlevels() of the two objects with setdiff(): one set has a chromosome the other lacks. Make the levels the same with union(), then copy the lengths and build from the TxDb with seqinfo(txdb)[chroms]. Task 4 needs the chromosome lengths.

Checkpoint: 1,331 CBX6 and 1,663 CBX7 peaks; median widths 1,789 and 1,781 bases; CBX6 has one peak on chrY, which CBX7 lacks; after adding the seqinfo, 0 peaks run past a chromosome end.

2

Annotate and compare

ChIP-seq peaks and annotation, and Module 3

  • Annotate both peak sets with tssRegion = c(-3000, 3000).
  • Collapse the categories to Promoter, Exon, Intron, Distal Intergenic and Other, and draw one stacked bar per protein with ggplot2.

Hint. Strip the brackets from the annotation with sub(" \\(.*", "", x), then put any category that is not one of the four named ones into "Other" with ifelse(). Stack both data frames with rbind(), adding a column for the protein. geom_bar(position = "fill") draws proportions; coord_flip() lays the bars sideways so the labels are easy to read. Use Okabe–Ito colours and set the factor levels so Promoter comes first, as in Module 3.

Checkpoint: promoter peaks are 58.8% of CBX6 peaks and 53.5% of CBX7 peaks; distal intergenic 27.9% and 31.3%; introns 8.0% and 9.3%. The two proteins have very similar profiles, with a slightly larger promoter share for CBX6.

3

Shared promoter genes

ChIP-seq peaks and annotation and Counts and proportions

  • List the genes with a peak within 1 kb of their TSS for each protein, and count the genes in both.
  • Test whether the overlap is larger than chance with a two-by-two table and fisher.test(), using all genes in the TxDb as the universe.

Hint. Take geneId where abs(distanceToTSS) <= 1000, then unique() and na.omit(). The universe is the set of genes that could have been picked: here names(genes(txdb)). For each gene in it, record TRUE or FALSE for "has a CBX6 promoter peak" and for "has a CBX7 promoter peak" with %in%, and table() the two. Read the odds ratio and its confidence interval, not only the p-value. Check the table's margins against your gene counts: if one is off by one, find out why.

Checkpoint: 585 CBX6 genes, 654 CBX7 genes, 397 in both; universe 23,056 genes. The table is 22,215 / 257 / 187 / 397, and its CBX6 total is 584, not 585, because one CBX6 gene is among those genes() leaves out. Odds ratio 183 (95% CI 147 to 230); the p-value prints as 0, meaning smaller than R can represent.

4

Peak overlap against shuffled peaks

Resampling: bootstrap and permutation

  • Count the CBX6 peaks that overlap a CBX7 peak.
  • Write a function that moves every CBX6 peak to a random position on its own chromosome, keeping its width. Repeat 200 times, count overlaps each time, and compare.

Hint. sum(overlapsAny(cbx6, cbx7)) gives the observed count. For the shuffle, look up each peak's chromosome length with seqlengths(gr)[as.character(seqnames(gr))], draw a start with runif() between 1 and the length minus the width, and build a new GRanges with the same seqnames and widths. Wrap that in replicate(), after set.seed(). The permutation p-value is (number of shuffles at least as large as observed + 1) ÷ (number of shuffles + 1), as in Resampling: bootstrap and permutation.

Checkpoint: 957 CBX6 peaks overlap a CBX7 peak. With set.seed(2026) and 200 shuffles, the shuffled counts run from 0 to 9, mean 3.8. None reaches 957, so p = 1 ÷ 201 = 0.005, the smallest value 200 shuffles can give.

5

Which genes, and a short report

ChIP-seq peaks and annotation and Volcano plot and interpretation

  • Turn the shared genes into symbols and count how many belong to classic developmental families: HOX, and the PAX, SOX, TBX, LHX, NKX and FOX transcription factors.
  • List the shared promoter peaks with the highest CBX7 scores, and write a methods paragraph and two limitations.

Hint. mapIds() from org.Hs.eg.db turns Entrez IDs into symbols. grepl("^HOX", sym) is TRUE for symbols that start with HOX; "^(PAX|SOX|TBX|LHX|NKX|FOX)" matches any of six prefixes. Prefixes are a crude way to find gene families, so look at the matches. For the top peaks, filter the CBX7 table to promoter peaks of shared genes and sort by V5, the score column, in decreasing order. In the methods, name the files and their build, the TxDb and its version, both distance definitions and the shuffle.

Checkpoint: 8 shared symbols start with HOX (HOXB9; HOXC10, HOXC12, HOXC13 and the antisense RNA HOXC13-AS; HOXD10, HOXD11 and HOXD12), and 29 match the six transcription-factor prefixes. The top-scoring shared promoter peaks include NKX2-6, HMX3, FOXA1, HOXC12 and TAL1, all regulators of development. Your limitations mention that peak scores are not comparable between experiments, and that the shuffle ignores where peaks can be found (see below).

What the project shows

If your results match the checkpoints, the answer to the research question is yes, with a caveat on how big a yes. CBX6 and CBX7 bind largely the same promoters: 397 genes in common out of 585 and 654. The shared genes are rich in the developmental regulators Polycomb is known to silence, which is a reassuring check that the peaks capture real biology.

Compared with what?

The caveat is in the size of the numbers. An odds ratio of 183 and zero overlaps in 200 shuffles, against 957 real ones, are striking, but both tests compare with a weak idea of chance. The shuffle places peaks anywhere on a chromosome with equal probability, including in stretches of unreadable sequence and gene deserts where no Polycomb protein would bind. The Fisher test treats every gene in the TxDb as equally likely to carry a peak, although Polycomb proteins favour CpG-island promoters, a minority of all genes. Any two proteins that both prefer CpG-island promoters would show a large overlap by these measures, whether or not they work together. The tests show the overlap is not random; they cannot show that the two proteins act as a pair. A fairer comparison would shuffle peaks only among promoters, or among CpG islands, and ask whether the overlap is still larger than expected. That is a harder question, and a good one to try next.

That is also the habit this module has tried to build. Ranges make overlaps easy to compute, and almost any two genomic feature sets overlap more than uniform chance, so the work is in choosing what to compare with. The same was true of the promoter window in ChIP-seq peaks and annotation, the default test in DNA methylation with methylKit and the supervised separation in Multi-omics integration with MOFA2 and DIABLO: a number means something only once you know what it was compared with.

The end of the course

This brings the course to its end. You started with vectors and data frames, learned the statistics that say how far a result can be trusted, made figures that show data honestly, and then used those skills on RNA-seq counts, machine learning, single cells and, in this module, positions on the genome. The habits travel further than any one package: look at the data before you test it, choose the analysis and thresholds before you see the results, report effect sizes with their uncertainty, state the comparison behind every "more than chance", and record exactly what you ran. If you want to go further, the Further reading page collects the key papers and guides for each module.

Go deeper: a fairer shuffle

To ask whether CBX6 and CBX7 share promoters beyond their common preference for promoters, restrict the universe. One way: take the promoters from promoters(genes(txdb), upstream = 1000, downstream = 1000), keep those that touch any peak from either protein, and ask whether, among these, the CBX6-bound and CBX7-bound sets overlap more than expected. The Fisher test then runs on that smaller universe. Another way, for peaks, is to shuffle each CBX6 peak only within regions of the same type, for example among CpG islands; packages such as regioneR provide such restricted randomisations. Expect the odds ratio to fall a long way, and expect the answer to depend on the universe you pick. Report the universe as carefully as the result.

Take it further

Add methylation. Polycomb-bound CpG-island promoters are usually unmethylated, so an obvious next question is whether the promoters bound by both proteins have lower methylation than other promoters. The methylKit test files cannot answer it, because they are on hg18 and cover part of one chromosome. Public whole-genome bisulfite data on hg19 or hg38 can, after you check the build of each file and, if needed, move one set of coordinates to the other's build with liftOver() and the matching chain file.

For a portfolio, keep the script, the stacked bar chart, the shuffle results and a short write-up in one project folder. State the files, builds, definitions and package versions, so a reader could rerun every number above.

End of Module 7: Genomic ranges and epigenomics in RThis is the last module, and the end of the course. The Further reading page collects papers and guides for every module.

Further reading · Module 7Yu, Wang & He 2015: ChIPseeker, including peak overlap and comparison. · All reading for this course

Check your understanding

1. Why must the CBX6 and CBX7 peaks carry chromosome lengths before the shuffle in task 4?

2. None of 200 shuffles reached the observed 957 overlaps. What is the permutation p-value?

3. Why might the huge odds ratio overstate how closely CBX6 and CBX7 work together?

Ask LSMA