diff --git a/.Rbuildignore b/.Rbuildignore new file mode 100644 index 0000000..680036d --- /dev/null +++ b/.Rbuildignore @@ -0,0 +1,8 @@ +^inst/\.quarto$ +^\.png$ +^\.quarto$ +^\.github$ +^LICENSE\.md$ +^NOTES\.md$ +^README\.Rmd$ +^Dockerfile$ diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..655e9e9 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,17 @@ +The Bioconductor community values + +* an open approach to science that promotes the sharing of ideas, code, and expertise +* collaboration +* diversity and inclusivity +* a kind and welcoming environment +* community contributions + +In line with these values, Bioconductor is dedicated to providing a welcoming, supportive, collegial, experience free of harassment, intimidation, and bullying regardless of: + +* identity: gender, gender identity and expression, sexual orientation, disability, physical appearance, ethnicity, body size, race, age, religion, etc. +* intellectual position: approaches to data analysis, software preferences, coding style, scientific perspective, etc. +* stage of career + +In order to uphold these values, members of the Bioconductor community are required to follow the Code of Conduct.The latest version of Bioconductor project Code of Conduct is available at http://bioconductor.org/about/code-of-conduct/. Please read the Code of Conduct before contributing to this project. + +Thank you! diff --git a/.github/workflows/biocbook.yml b/.github/workflows/biocbook.yml new file mode 100644 index 0000000..723be33 --- /dev/null +++ b/.github/workflows/biocbook.yml @@ -0,0 +1,111 @@ +name: biocbook + +on: + push: + branches: + - devel + - RELEASE_** + +jobs: + build-push: + runs-on: ubuntu-latest + name: build-book (${{ github.ref_name }}) + permissions: + contents: write + packages: write + + steps: + + - name: 🧾 Checkout repository + uses: actions/checkout@v3 + + - name: ⏳ Collect Workflow Telemetry + uses: runforesight/workflow-telemetry-action@v1 + + - name: 🐳 Set up QEMU + uses: docker/setup-qemu-action@v2 + - name: 🐳 Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: πŸ“ Get book info + id: info + env: + OWNER: ${{ github.repository_owner }} + run: | + Pkgname=$(grep -m1 -E '^Package: +' DESCRIPTION | sed -E 's/.*: +//') + echo Pkgname=${Pkgname} >> "${GITHUB_ENV}" + pkgname=${Pkgname,,} + echo pkgname=${pkgname} >> "${GITHUB_ENV}" + owner=${OWNER,,} + echo owner=${owner} >> "${GITHUB_ENV}" + echo pkgversion=$(grep -m1 -E '^Version: +' DESCRIPTION | sed -E 's/.*: +//') >> "${GITHUB_ENV}" + + - name: πŸ” Log in to the Github Container registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ env.owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: 🏷 Get metadata for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ghcr.io/${{ env.owner }}/${{ env.pkgname }} + tags: | + ${{ github.ref_name }} + ${{ env.pkgversion }} + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'devel') }} + + - name: πŸ“¦ Install, build and check package in local Docker image + id: docker + uses: docker/build-push-action@v4 + with: + context: . + load: true + tags: ${{ steps.meta.outputs.tags }} + build-args: | + BIOC_VERSION=${{ github.ref_name }} + + - name: πŸš€ Push local Docker image to ghcr.io + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + build-args: | + BIOC_VERSION=${{ github.ref_name }} + + - name: πŸ“š Recover pkg artifacts generated during build in local Docker container (pkg bundle and book) + env: + IMG: ${{ steps.docker.outputs.ImageID }} + run: | + SHA=$(docker container create ${{ env.IMG }}) + docker container cp ${SHA}:/${{ env.Pkgname }}_${{ env.pkgversion }}.tar.gz . + tar --extract --gzip --file ${{ env.Pkgname }}_${{ env.pkgversion }}.tar.gz + echo bundle_path=${{ env.Pkgname }}_${{ env.pkgversion }}.tar.gz >> "${GITHUB_ENV}" + echo book_path=${{ env.Pkgname }}/inst/doc/book/ >> "${GITHUB_ENV}" + + - name: 🏷 Get gh-branch directory to deploy to + run: | + echo target_folder=$(echo ${{ github.ref_name }} | sed 's,RELEASE_,,' | tr '_' '.') >> "${GITHUB_ENV}" + + - name: πŸš€ Deploy book to Github Pages on versioned branch + uses: JamesIves/github-pages-deploy-action@v4.4.3 + with: + folder: ${{ env.book_path }}/ + target-folder: docs/${{ env.target_folder }}/ + branch: gh-pages + clean: false + + - name: πŸ’Ύ Upload package bundle artifact + uses: actions/upload-artifact@v3 + with: + name: bundle + path: ${{ env.bundle_path }} + + - name: πŸ’Ύ Upload book artifact + uses: actions/upload-artifact@v3 + with: + name: book + path: ${{ env.book_path }} diff --git a/.github/workflows/deploy-bookdown.yaml b/.github/workflows/deploy-bookdown.yaml deleted file mode 100644 index fb68f04..0000000 --- a/.github/workflows/deploy-bookdown.yaml +++ /dev/null @@ -1,100 +0,0 @@ -name: Docker image - -on: - schedule: - - cron: '0 1 1,16 * *' - push: - branches: - - main - -env: - registry: ghcr.io - user: js2264 - repository: ohca - -jobs: - build-push: - strategy: - matrix: - BIOC_VERSION: [devel, RELEASE_3_17] - runs-on: ubuntu-latest - name: ${{ matrix.BIOC_VERSION }} - permissions: - contents: read - packages: write - steps: - - - name: 🧾 Checkout repository - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: πŸ“€ Free Disk Space (Ubuntu) - uses: jlumbroso/free-disk-space@v1.3.0 - - - name: 𝌚 Get current package version - id: version - run: | - version=$(grep -m1 -E '^Version: +' DESCRIPTION | sed -E 's/.*: +//') - - - name: πŸ” Log in to the Container registry - uses: docker/login-action@v2 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.PAT_GITHUB }} - - - name: 🏷 Get metadata for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ghcr.io/js2264/ohca - tags: | - type=raw,value=latest,enable=true - type=raw,value=${{ steps.version.outputs.version }},enable=true - type=raw,value=bioc_${{ matrix.BIOC_VERSION }},enable=true - - - name: πŸ‘· Build and push multi-arch Docker image - uses: docker/build-push-action@v4 - with: - context: . - GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} - platforms: linux/amd64 - file: Dockerfile - push: true - tags: ${{ steps.meta.outputs.tags }} - outputs: type=image,annotation-index.org.opencontainers.image.description=OHCA - build-args: | - VERSION=${{ steps.version.outputs.version }} - BIOC_VERSION=${{ matrix.BIOC_VERSION }} - - - render-deploy: - needs: build-push - strategy: - matrix: - BIOC_VERSION: [devel] - runs-on: ubuntu-latest - container: ghcr.io/js2264/ohca:bioc_${{ matrix.BIOC_VERSION }} - steps: - - - name: 🧾 Checkout repository - uses: actions/checkout@v3 - with: - persist-credentials: false - - - name: πŸ–Œ Render OHCA book from versionized OHCA container - run: | - quarto install tinytex - quarto render - - - name: πŸ“š Install rsync - run: | - apt-get update && apt-get install -y rsync - - - name: πŸš€ Deploy OHCA book to Github Pages on versionized branch - uses: JamesIves/github-pages-deploy-action@v4.4.3 - with: - folder: docs/ - branch: bioc_${{ matrix.BIOC_VERSION }} - clean: true diff --git a/.github/workflows/rworkflows.yml b/.github/workflows/rworkflows.yml new file mode 100644 index 0000000..0df685c --- /dev/null +++ b/.github/workflows/rworkflows.yml @@ -0,0 +1,53 @@ +## Adapted from neurogenomics/rworkflows: rworkflows::use_workflow() + +name: rworkflows +'on': + push: + branches: + - devel + - RELEASE_** + pull_request: + branches: + - devel + - RELEASE_** + +jobs: + rworkflows: + runs-on: ${{ matrix.config.os }} + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + container: ${{ matrix.config.cont }} + strategy: + fail-fast: ${{ false }} + matrix: + config: + - os: ubuntu-latest + bioc: devel + r: auto + cont: ghcr.io/bioconductor/bioconductor:devel + rspm: https://packagemanager.rstudio.com/cran/__linux__/focal/release + # - os: macOS-latest + # bioc: release + # r: auto + # cont: ~ + # rspm: ~ + # - os: windows-latest + # bioc: release + # r: auto + # cont: ~ + # rspm: ~ + steps: + - uses: neurogenomics/rworkflows@master + with: + run_bioccheck: ${{ false }} + run_rcmdcheck: ${{ true }} + as_cran: ${{ false }} + run_vignettes: ${{ false }} + has_testthat: ${{ true }} + run_covr: ${{ false }} + run_pkgdown: ${{ false }} + has_runit: ${{ false }} + has_latex: ${{ false }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run_docker: ${{ false }} + runner_os: ${{ runner.os }} + cache_version: cache-v1 diff --git a/DESCRIPTION b/DESCRIPTION index d02532a..83302eb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,6 +22,9 @@ Depends: fourDNData Imports: plyinteractions, + terra, + Rfast, + WGCNA, diffHic, strawr, hicrep, @@ -37,9 +40,9 @@ Imports: rebook, quarto, sessioninfo +Suggests: Remotes: - github::TaoYang-dev/hicrep, - github::tidyomics/plyinteractions + github::TaoYang-dev/hicrep biocViews: HiC, DNA3DStructure diff --git a/Dockerfile b/Dockerfile index a189f5f..40cadc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,10 @@ ARG BIOC_VERSION -ARG VERSION - -# Pull the base image from bioconductor/bioconductor_docker FROM bioconductor/bioconductor_docker:${BIOC_VERSION} +COPY . /opt/pkg -LABEL org.opencontainers.image.source=https://github.com/js2264/OHCA -LABEL org.opencontainers.image.documentation=https://js2264.github.io/OHCA -LABEL org.opencontainers.image.authors="OHCA authors" -LABEL org.opencontainers.image.description="Orchestrating Hi-C analysis with Bioconductor" -LABEL org.opencontainers.image.licenses=MIT -LABEL org.opencontainers.image.version ${VERSION} +# Install book package +RUN Rscript -e 'repos <- BiocManager::repositories() ; remotes::install_local(path = "/opt/pkg/", repos=repos, dependencies=TRUE, build_vignettes=FALSE, upgrade=TRUE) ; sessioninfo::session_info(installed.packages()[,"Package"], include_base = TRUE)' -# Install quarto -# Install OHCA package suite -# Install OHCA package itself -# Print info -# Cleanup files -WORKDIR /opt/OHCA -COPY . /opt/OHCA -RUN make +## Build/install using same approach than BBS +RUN R CMD INSTALL /opt/pkg +RUN quarto install tinytex && R CMD build --keep-empty-dirs --no-resave-data /opt/pkg diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8df9cbc --- /dev/null +++ b/LICENSE @@ -0,0 +1,2 @@ +YEAR: 2023 +COPYRIGHT HOLDER: Jacques Serizay diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..6e4f550 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2023 Jacques Serizay + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile deleted file mode 100644 index 9459926..0000000 --- a/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -RCMD := Rscript -e - -.PHONY: quarto -quarto: ## Update to latest available quarto - @echo "πŸ’Ύ Installing latest Quarto CLI" - wget https://quarto.org/docs/download/_download.json;\ - ver=$$(grep -o '"version": "[^"]*' _download.json | grep -o '[^"]*$$');\ - wget https://github.com/quarto-dev/quarto-cli/releases/download/v"$${ver}"/quarto-"$${ver}"-linux-amd64.deb;\ - sudo dpkg -i quarto-"$${ver}"-linux-amd64.deb;\ - rm quarto-"$${ver}"-linux-amd64.deb;\ - rm _download.json;\ - quarto --version;\ - -.PHONY: setup -setup: ## Install HiCExperiment & co packages with pak. - @echo "πŸ“¦ Installing OHCA core packages" - $(RCMD) 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/devel/")' - $(RCMD) 'write(paste0("R_BIOC_VERSION=", gsub(".[0-9]*$$", "", as.character(packageVersion("BiocVersion")))), paste0(Sys.getenv("R_HOME"), "/etc/Renviron.site"), append = TRUE)' - $(RCMD) 'pak::repo_status()$$url' - $(RCMD) 'pak::pkg_install("HiCExperiment", ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'remove.packages(c("HiContacts"))' - $(RCMD) 'pak::pkg_install("HiContacts", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'pak::pkg_install("HiCool", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'pak::pkg_install("HiContactsData", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'pak::pkg_install("fourDNData", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'pak::pkg_install("DNAZooData", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - $(RCMD) 'pak::pkg_install("tidyomics/plyinteractions", upgrade = TRUE, ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - -.PHONY: install -install: ## Install OHCA package and dependencies with pak. - @echo "πŸš€ Installing OHCA book package" - $(RCMD) 'pak::pkg_install(".", ask = FALSE, dependencies = c("Depends", "Imports", "Suggests"))' - -.PHONY: info -info: ## list installed packages - @echo "πŸ—‚ Listing installed packages" - $(RCMD) 'pkgs <- installed.packages()[,"Package"] ; sessioninfo::session_info(pkgs, include_base = TRUE)' - -.PHONY: render -render: ## Render OHCA book - @echo "πŸ“– Rendering OHCA book" - $(RCMD) 'pkgs <- installed.packages()[,"Package"] ; sessioninfo::session_info(pkgs, include_base = TRUE)' - quarto render --to html - -.PHONY: cleanup -cleanup: ## Removing temp files before pushing to ghcr.io - @echo "🧹 Cleaning up" - $(RCMD) 'pak::cache_clean()' - rm -rf /tmp/* - rm -rf *_cache - df -h - -.PHONY: help -help: - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' - -.PHONY: all -all: quarto setup install info cleanup - -.DEFAULT_GOAL := all diff --git a/OHCA.scss b/OHCA.scss deleted file mode 100644 index ecf14bc..0000000 --- a/OHCA.scss +++ /dev/null @@ -1,153 +0,0 @@ -/*-- scss:defaults --*/ - -$primary: #008CBA !default; - -/*-- scss:rules --*/ - -.sidebar-title { - // color: #480F1F; -} - -img.quarto-cover-image { - box-shadow: 0 .5rem 1rem rgba(0,0,0,.15); -} - -/* Central column page ------------------------------------------------------ */ - -@media (min-width: 992px){ -body.floating .page-columns { - display: grid; - gap: 0; - // grid-template-columns: [screen-start] 1.5em [screen-start-inset] 5fr [page-start] minmax(25px, 50px) [page-start-inset] minmax(50px, 150px) [body-start-outset] minmax(25px, 50px) [body-start] 1.5em [body-content-start] minmax(500px, calc( 1000px - 3em )) [body-content-end] 1.5em [body-end] minmax(25px, 50px) [body-end-outset] minmax(50px, 150px) [page-end-inset] minmax(25px, 50px) [page-end] 5fr [screen-end-inset] 1.5em [screen-end]; - grid-template-columns: [screen-start] 0em [screen-start-inset] 0fr [page-start] minmax(300px, 25%) [body-start-outset] 0em [body-start] 1.5em [body-content-start] minmax(500px, 50%) [body-content-end] 1.5em [body-end] 0em [body-end-outset] minmax(50px, 15%) [page-end-inset] minmax(25px, 50px) [page-end] 0fr [screen-end-inset] 0em [screen-end]; - grid-template-columns: [screen-start] 0em [screen-start-inset] 0em [page-start] minmax(300px, 25%) [body-start-outset] 0em [body-start] 3.5em [body-content-start] minmax(500px, 50%) [body-content-end] 1.5em [body-end] 0em [body-end-outset] minmax(50px, 15%) [page-end-inset] minmax(25px, 50px) [page-end] 0fr [screen-end-inset] 0em [screen-end]; -}} -main { - margin-top: 0em; -} -div.sidebar.sidebar-navigation.rollup.quarto-sidebar-toggle-contents, nav.sidebar.sidebar-navigation:not(.rollup) { - background-color: #f1f1f1; -} - -/* Left navbar ------------------------------------------------------ */ - -div.sidebar-item-container .active, div.sidebar-item-container .show>.nav-link, div.sidebar-item-container .sidebar-link>code { - // color: #480f1f; - font-weight: 800; -} - -.text-start { - text-align: left !important; - font-weight: 800; -} - -#quarto-sidebar { - transition: width .15s ease-in; - padding: 14px 10%; -} - -/* right navbar ------------------------------------------------------ */ - -.sidebar nav[role=doc-toc] ul>li>a.active, .sidebar nav[role=doc-toc] ul>li>ul>li>a.active { - // border-left: 4px solid #480f1f; - border-left: 4px solid; - // color: #480f1f !important; - font-weight: 800; -} - -#toc-title+ ul > li > .nav-link { - font-weight: 800; -} - -/* Headings ------------------------------------------------------ */ - -h2 { - margin-top: 3rem; - margin-bottom: 1rem; - font-size: 1.5rem; -} -h3 { margin-top: 1.5em; font-size: 1.2rem; } -h4 { margin-top: 1.5em; font-size: 1.1rem; } -h5 { margin-top: 1.5em; font-size: 1rem; } - -h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { - line-height: 2; - font-weight: 700; -} - -.quarto-section-identifier { - color: #6C6C6C; - font-weight: normal; -} - -/* Underlining links ------------------------------------ */ - -.citation a, .footnote-ref { - text-decoration: underline; -} - -/* Put a border around session info print ------------------------------------------------ */ - -#session-info code, p+ pre code { - // border: 1px solid black -} - -/* Code colors ------------------------------------------------------------------------- */ - -// Text color of `backticked` words -code { - color: #008CBA; -} - -// Border of `backticked` words -li code , .anchored code , p code , .flex-fill code { - // border: 1px solid #008CBA; -} -kbd, samp { - // border: 1px solid; -} - -// background color of chunks of code *WITH A SPECIFIED LANGUAGE* -div.sourceCode { - // background-color: rgba(0, 170, 227, 0.025); - background-color: #f1f1f1; - border: none; -} - -pre.sourceCode { - border: none; - font-size: .875em; - overflow: visible !important; -} - -pre code { - background-color: transparent; - font-size: inherit; - color: inherit; - word-break: normal; - // border: 1px solid rgb(0 0 0 / 65%); -} - -.cell-output-stdout code , .code-with-filename code , .cell-output-stderr code { - background-image: linear-gradient(160deg,#f8f8f8 0,#f1f1f1 100%); -} - -/* Printing ------------------------------------------------ */ - -@media print { - :root { - font-size: 11pt; - } - #quarto-sidebar, #TOC, .nav-page { - display: none; - } - .page-columns .content { - grid-column-start: page-start; - } - .fixed-top { - position: relative; - } - .panel-caption, .figure-caption, figcaption { - color: #666; - } -} diff --git a/_common.R b/_common.R deleted file mode 100644 index 789e562..0000000 --- a/_common.R +++ /dev/null @@ -1,23 +0,0 @@ -set.seed(1014) - -knitr::opts_chunk$set( - comment = "## ", - collapse = TRUE, - cache = TRUE, - fig.align = "center" -) - -options( - dplyr.print_min = 6, - dplyr.print_max = 6, - pillar.max_footer_lines = 2, - pillar.min_chars = 15, - stringr.view_n = 6, - # Temporarily deactivate cli output for quarto - cli.num_colors = 0, - cli.hyperlink = FALSE, - pillar.bold = TRUE, - width = 9999 # 80 - 3 for #> comment -) - -ggplot2::theme_set(ggplot2::theme_gray(12)) diff --git a/_quarto.yml b/_quarto.yml deleted file mode 100644 index d1d7a68..0000000 --- a/_quarto.yml +++ /dev/null @@ -1,68 +0,0 @@ -project: - type: book - output-dir: docs - -book: - title: "Orchestrating Hi-C analysis with Bioconductor" - reader-mode: false - page-footer: - left: | - OHCA: Orchestrating Hi-C analysis with Bioconductor was written by - J. Serizay - right: | - This book was built with Quarto. - cover-image: cover.jpg - favicon: cover.jpg - site-url: https://js2264.github.io/OHCA/ - repo-url: https://github.com/js2264/OHCA/ - repo-branch: main - repo-actions: [edit, issue] - chapters: - - index.qmd - - preamble.qmd - - part: "Fundamentals concepts" - chapters: - - principles.qmd - - data-representation.qmd - - parsing.qmd - - visualization.qmd - - part: "In-depth Hi-C analysis" - chapters: - - matrix-centric.qmd - - interactions-centric.qmd - - topological-features.qmd - - part: "Advanced Hi-C topics" - chapters: - - disseminating.qmd - - interoperability.qmd - - workflow-yeast.qmd - - workflow-chicken.qmd - - workflow-centros.qmd - -format: - html: - default-image-extension: pdf - theme: - - yeti - - OHCA.scss - code-link: true - author-meta: "Jacques Serizay" - highlight-style: atom-one-dark.theme - citations-hover: true - citation-location: margin - toc: true - toc-float: - collapsed: false - toc-depth: 3 - website: - sidebar: - # style: "docked" - search: true - collapse-level: 5 - -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua - -csl: apa.csl - -editor: visual diff --git a/atom-one-dark.theme b/atom-one-dark.theme deleted file mode 100644 index ea6b50b..0000000 --- a/atom-one-dark.theme +++ /dev/null @@ -1,370 +0,0 @@ -{ - "custom-styles": { - "Diff": { - "Added line": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Changed line (new)": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Changed line (old)": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Removed line": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - } - }, - "Go": { - "Predeclared Identifier": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - } - }, - "INI Files": { - "Assignment": { - "selected-text-color": "#5f5f5f", - "text-color": "#5f5f5f" - }, - "Section": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - } - }, - "JavaScript": { - "Built-in Objects": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Function Declaration": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Function Name": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Module": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Object Member": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Object Method (Built-in)": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - } - }, - "Markdown": { - "Code": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Emphasis Text": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Fenced Code": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Header H1": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Header H2": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Header H3": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Header H4": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Header H5": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Header H6": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Link": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Reference-Link Name": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Reference-Link Target": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Reference-Link Target: Link": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Reference-Link: Email": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Reference-Link: Link": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Strong Text": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - } - }, - "Python": { - "Builtin Function": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "String Substitution": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - } - }, - "Rust": { - "Lifetime": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Macro": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Self": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Trait": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Type": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - } - }, - "TypeScript": { - "Built-in Objects": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Module": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Object Member": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Object Method (Built-in)": { - "italic": false, - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "Reserved": { - "italic": false - }, - "Types": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - } - }, - "XML": { - "Attribute": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Element": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - } - } - }, - "editor-colors": { - "BackgroundColor": "#282c34", - "BracketMatching": "#8e44ad", - "CodeFolding": "#363c4a", - "CurrentLine": "#0A99BBFF", - "CurrentLineNumber": "#abb2bf", - "IconBorder": "#282c34", - "IndentationLine": "#3a3f44", - "LineNumbers": "#636D83", - "MarkBookmark": "#0404bf", - "MarkBreakpointActive": "#8b0607", - "MarkBreakpointDisabled": "#820683", - "MarkBreakpointReached": "#6d6e07", - "MarkError": "#c24038", - "MarkExecution": "#4d4e50", - "MarkWarning": "#d19a66", - "ModifiedLines": "#e06c75", - "ReplaceHighlight": "#a34f56", - "SavedLines": "#98c379", - "SearchHighlight": "#3D528BFF", - "Separator": "#3f4347", - "SpellChecking": "#c24038", - "TabMarker": "#21252B", - "TemplateBackground": "#31363b", - "TemplateFocusedPlaceholder": "#123723", - "TemplatePlaceholder": "#123723", - "TemplateReadOnlyPlaceholder": "#4d1f24", - "TextSelection": "#363c4a", - "WordWrapMarker": "#3a3f44" - }, - "metadata": { - "copyright": [ - "SPDX-FileCopyrightText: 2016 GitHub Inc.", - "SPDX-FileCopyrightText: 2020 Waqar Ahmed " - ], - "license": "SPDX-License-Identifier: MIT", - "name": "Atom One Dark", - "revision": 3 - }, - "text-styles": { - "Alert": { - "background-color": "#4d1f24", - "bold": true, - "selected-text-color": "#95da4c", - "text-color": "#95da4c" - }, - "Annotation": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Attribute": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "BaseN": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "BuiltIn": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Char": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Comment": { - "italic": true, - "selected-text-color": "#a0a0a0", - "text-color": "#a0a0a0" - }, - "CommentVar": { - "italic": true, - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "Constant": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "ControlFlow": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "DataType": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "DecVal": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Documentation": { - "selected-text-color": "#da4453", - "text-color": "#a43340" - }, - "Error": { - "selected-text-color": "#f44747", - "text-color": "#f44747", - "underline": true - }, - "Extension": { - "bold": true, - "selected-text-color": "#167acc", - "text-color": "#167acc" - }, - "Float": { - "selected-text-color": "#d19a66", - "text-color": "#d19a66" - }, - "Function": { - "selected-text-color": "#167acc", - "text-color": "#167acc" - }, - "Import": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Information": { - "selected-text-color": "#e46700", - "text-color": "#c45b00" - }, - "Keyword": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Normal": { - "selected-text-color": "#5f5f5f", - "text-color": "#5f5f5f" - }, - "Operator": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "Others": { - "selected-text-color": "#27ae60", - "text-color": "#27ae60" - }, - "Preprocessor": { - "selected-text-color": "#c678dd", - "text-color": "#c678dd" - }, - "RegionMarker": { - "background-color": "#153042", - "selected-text-color": "#3daee9", - "text-color": "#2980b9" - }, - "SpecialChar": { - "selected-text-color": "#56b6c2", - "text-color": "#56b6c2" - }, - "SpecialString": { - "selected-text-color": "#da4453", - "text-color": "#da4453" - }, - "String": { - "selected-text-color": "#98c379", - "text-color": "#98c379" - }, - "Variable": { - "selected-text-color": "#e06c75", - "text-color": "#e06c75" - }, - "VerbatimString": { - "selected-text-color": "#da4453", - "text-color": "#da4453" - }, - "Warning": { - "selected-text-color": "#da4453", - "text-color": "#da4453" - } - } -} diff --git a/inst/.gitignore b/inst/.gitignore new file mode 100644 index 0000000..85fe9a3 --- /dev/null +++ b/inst/.gitignore @@ -0,0 +1,6 @@ +/.quarto/ +docs/ +*html +*rmarkdown +*_files +*_cache diff --git a/inst/_quarto.yml b/inst/_quarto.yml new file mode 100644 index 0000000..0f09571 --- /dev/null +++ b/inst/_quarto.yml @@ -0,0 +1,12 @@ +project: + type: book + output-dir: docs + +metadata-files: + - assets/_book.yml + - assets/_website.yml + - assets/_format.yml + - assets/_knitr.yml + +filters: + - extensions/tools-tabset-ext/tools-tabset.lua diff --git a/inst/assets/_book.yml b/inst/assets/_book.yml new file mode 100644 index 0000000..fd67ce2 --- /dev/null +++ b/inst/assets/_book.yml @@ -0,0 +1,37 @@ +book: + title: "Orchestrating Hi-C analysis with Bioconductor" + chapters: + - index.qmd + - pages/preamble.qmd + - part: "Fundamentals concepts" + chapters: + - pages/principles.qmd + - pages/data-representation.qmd + - pages/parsing.qmd + - pages/visualization.qmd + - part: "In-depth Hi-C analysis" + chapters: + - pages/matrix-centric.qmd + - pages/interactions-centric.qmd + - pages/topological-features.qmd + - part: "Advanced Hi-C topics" + chapters: + - pages/disseminating.qmd + - pages/interoperability.qmd + - pages/workflow-yeast.qmd + - pages/workflow-chicken.qmd + - pages/workflow-centros.qmd + downloads: pdf + cover-image: assets/cover.jpg + favicon: assets/cover.jpg + sidebar: + tools: + - icon: git + menu: + - text: Source Code + url: https://github.com/js2264/OHCA/ + - text: Browse version `devel` + url: https://js2264.github.io/OHCA/devel/ + style: "docked" + background: "light" + collapse-level: 5 diff --git a/inst/assets/_format.yml b/inst/assets/_format.yml new file mode 100644 index 0000000..81ea0b5 --- /dev/null +++ b/inst/assets/_format.yml @@ -0,0 +1,18 @@ +format: + html: + grid: + sidebar-width: 500px + body-width: 800px + theme: + - cosmo + - assets/book.scss + mainfont: "Atkinson Hyperlegible, sans-serif" + highlight-style: atom-one + code-link: true + editor: visual + # citation-location: margin + bibliography: assets/bibliography.bib + from: markdown+emoji + pdf: default + +csl: assets/apa.csl diff --git a/inst/assets/_knitr.yml b/inst/assets/_knitr.yml new file mode 100644 index 0000000..d0001a2 --- /dev/null +++ b/inst/assets/_knitr.yml @@ -0,0 +1,15 @@ +knitr: + opts_chunk: + collapse: true + comment: "## " + cache: false + fig.align: "center" + python.reticulate: false + R.options: + dplyr.print_min: 6 + dplyr.print_max: 6 + pillar.max_footer_lines: 2 + pillar.min_chars: 15 + stringr.view_n: 6 + pillar.bold: TRUE + width: 77 # 80 - 3 for #> comments diff --git a/inst/assets/_website.yml b/inst/assets/_website.yml new file mode 100644 index 0000000..77d15cf --- /dev/null +++ b/inst/assets/_website.yml @@ -0,0 +1,14 @@ +website: + back-to-top-navigation: true + search: + location: sidebar + page-footer: + background: light + left: | + OHCA: Orchestrating Hi-C analysis with Bioconductor was written by + J. Serizay + right: | + This book was built with BiocBook with :heart: + repo-branch: devel + repo-actions: [edit, issue] + open-graph: true diff --git a/apa.csl b/inst/assets/apa.csl similarity index 100% rename from apa.csl rename to inst/assets/apa.csl diff --git a/bibliography.bib b/inst/assets/bibliography.bib similarity index 94% rename from bibliography.bib rename to inst/assets/bibliography.bib index 2421a3e..93ceb44 100644 --- a/bibliography.bib +++ b/inst/assets/bibliography.bib @@ -1,3 +1,39 @@ +@Manual{serizay2023, + title = {BiocBook: Write, publish and maintain versioned Quarto books with Bioconductor}, + author = {Jacques Serizay}, + year = {2023}, + note = {R package version 0.99.0}, + url = {https://github.com/js2264/BiocBook}, +} + +@Manual{lun2023, + title = {rebook: Re-using Content in Bioconductor Books}, + author = {Aaron Lun}, + year = {2023}, + note = {R package version 1.11.1}, + url = {https://bioconductor.org/packages/rebook}, + doi = {10.18129/B9.bioc.rebook}, +} + +@software{Allaire_Quarto_2022, +author = {Allaire, J.J. and Teague, Charles and Scheidegger, Carlos and Xie, Yihui and Dervieux, Christophe}, +doi = {10.5281/zenodo.5960048}, +month = jan, +title = {{Quarto}}, +url = {https://github.com/quarto-dev/quarto-cli}, +version = {1.2}, +year = {2022} +} + +@Manual{Wickham2022, + title = {devtools: Tools to Make Developing R Packages Easier}, + author = {Hadley Wickham and Jim Hester and Winston Chang and Jennifer Bryan}, + year = {2022}, + note = {R package version 2.4.5}, + url = {https://CRAN.R-project.org/package=devtools}, +} + + @article{Dekker_2002, doi = {10.1126/science.1067799}, url = {https://doi.org/10.1126%2Fscience.1067799}, @@ -445,4 +481,4 @@ @article{Mifsud_2017 editor = {Mark Isalan}, title = {{GOTHiC}, a probabilistic model to resolve complex biases and to identify real interactions in Hi-C data}, journal = {{PLOS} {ONE}} -} \ No newline at end of file +} diff --git a/inst/assets/book.scss b/inst/assets/book.scss new file mode 100644 index 0000000..fc40464 --- /dev/null +++ b/inst/assets/book.scss @@ -0,0 +1,212 @@ +/*-- scss:defaults --*/ + +$primary: #070707 !default; +$body-color: #070707 !default; + +/*-- scss:rules --*/ + +/* ------------------------------------------------------ */ +/* ------------------------------------------------------ */ +/* ------------------ CUSTOM RULES ---------------------- */ +/* ------------------------------------------------------ */ +/* ------------------------------------------------------ */ + +// Add any custom css styling here... + + + +/* ------------------------------------------------------ */ +/* ------------------------------------------------------ */ +/* ----------------- DEFAULT RULES ---------------------- */ +/* ------------------------------------------------------ */ +/* ------------------------------------------------------ */ + +code { color: #070707; } + +/* Code chunks ------------------------------------------ */ + +div.sourceCode { + background-color: #ffffff00; + border: 2px; + border-radius: 8px; + box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.06), 0 2px 5px 0 rgba(0, 0, 0, 0.06), 0 10px 10px 0 rgba(0, 0, 0, 0.05), 0 22px 13px 0 rgba(0, 0, 0, 0.03), 0 39px 16px 0 rgba(0, 0, 0, 0.01), 0 61px 17px 0 rgba(0, 0, 0, 0); +} + +pre.sourceCode.r, code.sourceCode.r { + + $border: 2px; + color: #070707; + background: #FFF; + background-clip: padding-box; /* !importantΓ© */ + border: solid $border transparent; /* !importantΓ© */ + border-radius: 8px; + + &:before { + content: ''; + position: absolute; + top: 0; right: 0; bottom: 0; left: 0; + z-index: -1; + margin: -$border; /* !importantΓ© */ + border-radius: inherit; /* !importantΓ© */ + background: linear-gradient(to right, #18a603, #0484a9, #0087af); + } + +} + +/* Chapter label ---------------------------------------- */ + +.chapter-number::before { + content: "Chapter "; +} + +.chapter-number::after { + content: " –"; +} + +/* Cover image ------------------------------------------ */ + +.quarto-cover-image { + max-width: 250px; + float: right; + margin-left: 30px; + margin-top: -30px; + margin-right: 10%; +} + +/* Left navbar ------------------------------------------ */ + +div.sidebar-item-container .active, div.sidebar-item-container .show>.nav-link, div.sidebar-item-container .sidebar-link>code { + font-weight: 800; +} + +.sidebar-title { + font-weight: 800; + background: linear-gradient(to right, #18a603, #0484a9, #0087af); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; +} + +.sidebar-tools-main { + font-weight: normal; + background: white; + color: black; + -webkit-background-clip: text; + -webkit-text-fill-color: black; +} + +.sidebar-navigation li a { + text-decoration: underline; +} + +.text-start { + text-align: left !important; + font-weight: 800; +} + +#quarto-sidebar { + transition: width .15s ease-in; + padding: 14px 10%; + background-color: white; +} + +.sidebar.sidebar-navigation:not(.rollup) { + border-right: 0px !important +} + +.sidebar-navigation .sidebar-item { + font-size: 1rem; + line-height: 2em; +} + +.sidebar-menu-container { + border: solid #add2dd 1px; + border-radius: 8px; + padding: 8px; + margin-top: 25px; +} + +/* right navbar ----------------------------------------- */ + +.sidebar nav[role=doc-toc] ul>li>a.active, .sidebar nav[role=doc-toc] ul>li>ul>li>a.active { + border-left: 4px solid #3792ad; + font-weight: 800; +} + +#toc-title+ ul > li > .nav-link { + font-weight: 800; +} + +/* Headings and text styling --------------------------- */ + +h1 { + font-size: 36px; + color: #070707; + font-weight: 700; + border-image: linear-gradient(to right, #18a603, #0484a9, #0087af) 1; + border-bottom-style: solid; + border-bottom-width: 4px; +} +h2 { + margin-top: 3rem; + margin-bottom: 1rem; + font-size: 32px; + border-bottom: 0px; +} +h3 { margin-top: 1.5em; font-size: 1.2rem; } +h4 { margin-top: 1.5em; font-size: 1.1rem; } +h5 { margin-top: 1.5em; font-size: 1rem; } + +h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5 { + line-height: 120%; + margin: 0 0 1rem; + width: fit-content; + padding-top: 0.5rem; + color: #070707; +} + +p { + margin: 0 0 1rem; + font-size: 1rem; + color: #070707; + line-height: 130%; + display: block; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0px; + margin-inline-end: 0px; +} + +.quarto-section-identifier { + color: #070707; + font-weight: normal; +} + +ul li::marker { + color: #3792ad; +} + +/* Underlining links ------------------------------------ */ + +.citation a, .footnote-ref { + text-decoration: underline; +} + +/* Printing --------------------------------------------- */ + +@media print { + :root { + font-size: 11pt; + } + #quarto-sidebar, #TOC, .nav-page { + display: none; + } + .page-columns .content { + grid-column-start: page-start; + } + .fixed-top { + position: relative; + } + .panel-caption, .figure-caption, figcaption { + color: #666; + } +} diff --git a/cover.jpg b/inst/assets/cover.jpg similarity index 100% rename from cover.jpg rename to inst/assets/cover.jpg diff --git a/_extensions/pandoc-ext/section-bibliographies/_extension.yml b/inst/extensions/pandoc-ext/section-bibliographies/_extension.yml similarity index 100% rename from _extensions/pandoc-ext/section-bibliographies/_extension.yml rename to inst/extensions/pandoc-ext/section-bibliographies/_extension.yml diff --git a/_extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua b/inst/extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua similarity index 100% rename from _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua rename to inst/extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua diff --git a/inst/extensions/tools-tabset-ext/tools-tabset.lua b/inst/extensions/tools-tabset-ext/tools-tabset.lua new file mode 100644 index 0000000..6b11e00 --- /dev/null +++ b/inst/extensions/tools-tabset-ext/tools-tabset.lua @@ -0,0 +1,39 @@ + + +local kTabsetIcons = { + ["VS Code"] = "vscode-logo.jpg", + ["R"] = "rstudio-logo.jpg", + ["Terminal"] = "text-editor-logo.jpg" +} + +local injected = false +local function injectChooseYourTool() + if not injected then + injected = true + quarto.doc.include_text('after-body', [[ + + ]]) + end +end + +function Tabset(el) + if el.attr.attributes["group"] == "tools-tabset" then + injectChooseYourTool() + for i, tab in ipairs(el.tabs) do + local text = pandoc.utils.stringify(tab.title) + local icon = kTabsetIcons[text] + if icon then + tab.title.content:insert(1, pandoc.Image("", "/pages/images/" .. icon)) + end + end + end + return el +end \ No newline at end of file diff --git a/index.qmd b/inst/index.qmd similarity index 82% rename from index.qmd rename to inst/index.qmd index 02f5fe4..59e7d2b 100644 --- a/index.qmd +++ b/inst/index.qmd @@ -1,16 +1,28 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - -```{r} +```{r "intro"} #| echo: false -source("_common.R") -.gh_url <- file.path('https://github.com', rmarkdown::metadata[['github-repo']]) +intro <- tryCatch( + { + description <- packageDescription("OHCA") + pkg <- description$Package + version <- description$Version + authors <- eval(parse(text = description$Authors)) + license <- description$License + glue::glue( + "**Package:** {pkg}
\n", + "**Authors:** {paste(format(authors, include = c('given', 'family', 'role')), collapse = ', ')}
\n", + "**Compiled:** {as.character(Sys.Date())}
\n", + "**Package version:** {version}
\n", + "**R version:** {R.version.string}
\n", + "**BioC version:** {BiocManager::version()}
\n", + "**License:** {license}
" + ) + }, + error = function(e) {"Local preview"} +) ``` +`r intro` + # Welcome {-} This is the landing page of the **"Orchestrating Hi-C analysis with Bioconductor"** @@ -19,11 +31,9 @@ book starts with key concepts important for the analysis of chromatin conformati presents `Bioconductor` tools that can be leveraged to process, analyze, explore and visualize Hi-C data. -`r rebook::openingDetails(Copyright='J. Serizay', Source=.gh_url)` - ::: {.content-hidden when-format="pdf"} -# Table of contents {-} +## Table of contents {-} This book is divided in three parts: @@ -54,7 +64,7 @@ This book is divided in three parts: # Installation & requirements {-} -## General audience +## General audience {-} This books aims to demonstrate how to pre-process, parse and investigate Hi-C data in `R`. For this reason, a significant portion of this book consists of executable R code chunks. @@ -66,7 +76,8 @@ If you do not have `R >= 4.3` installed, you will need to update your `R` versio will require `R >= 4.3`. ::: {.callout-note collapse="true"} -## Installing R 4.3 πŸ‘‡ + +### Installing R 4.3 πŸ‘‡ Detailed instructions are available [here](https://github.com/js2264/setup_ubuntu) to install `R 4.3` on a Linux machine (Ubuntu 22.04). @@ -116,14 +127,15 @@ sudo apt install -y \ libhdf5-dev libudunits2-dev libgdal-dev libgeos-dev \ libproj-dev libnode-dev libmagick++-dev ``` + ::: -- `Bioconductor >= 3.17` is also required. You can check whether `Bioconductor` is available and its version in `R` by typing `BiocManager::version()`. If you do not have `BiocManager` >= 3.17 installed, you will need to update it as follows: +- `Bioconductor >= 3.18` is also required. You can check whether `Bioconductor` is available and its version in `R` by typing `BiocManager::version()`. If you do not have `BiocManager` >= 3.18 installed, you will need to update it as follows: ```{r eval = FALSE} if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") -BiocManager::install(version = "3.17") +BiocManager::install(version = "3.18") ``` - You will also need important packages, which will be described in length in this book. @@ -138,7 +150,7 @@ BiocManager::install("fourDNData", ask = FALSE) BiocManager::install("DNAZooData", ask = FALSE) ``` -## Developers +## Developers {-} For developers or advanced R users, the `devel` versions of these packages can be installed along with their dependencies: @@ -153,7 +165,7 @@ pak::pkg_install("js2264/fourDNData", ask = FALSE, dependencies = c("Depends", " pak::pkg_install("js2264/DNAZooData", ask = FALSE, dependencies = c("Depends", "Imports", "Suggests")) ``` -## Docker image +## Docker image {-} If you have `docker` installed, the easiest approach would be to run the following command in a `shell` terminal: @@ -182,28 +194,27 @@ quarto render ``` ::: {.callout-warning} + All dependencies listed above will be required! + ::: The actual rendering of this book is done by GitHub Actions, and the rendered static website is hosted by GitHub Pages. -## Session info {-} -```{r} -#| echo: false -#| results: "hide" -#| message: false -#| warning: false -library("HiCExperiment") -library("HiCool") -library("HiContacts") -library("HiContactsData") -library("fourDNData") -library("DNAZooData") -library("OHCA") -``` +# Session info {-} + +::: {.callout-note collapse="true"} -```{r} -sessioninfo::session_info() +## Click to expand πŸ‘‡ {-} + +```{r "session info"} +#| cache: false +sessioninfo::session_info( + installed.packages()[,"Package"], + include_base = TRUE +) ``` + +::: diff --git a/data-representation.qmd b/inst/pages/data-representation.qmd similarity index 99% rename from data-representation.qmd rename to inst/pages/data-representation.qmd index 9759b59..8828975 100644 --- a/data-representation.qmd +++ b/inst/pages/data-representation.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Hi-C data structures in R ```{r} @@ -12,7 +5,6 @@ bibliography: bibliography.bib #| results: "hide" #| message: false #| warning: false -source("_common.R") library(ggplot2) library(GenomicRanges) library(InteractionSet) @@ -33,6 +25,7 @@ metadata(yeast_hic) <- list( ``` ::: {.callout-note} + ## Aims This chapter introduces the four main classes offered by `Bioconductor` leveraged to perform Hi-C analysis, describes their structure and how to interact with them: @@ -40,13 +33,16 @@ leveraged to perform Hi-C analysis, describes their structure and how to interac - `GRanges` (jump to [the section](#granges-class)) - `GInteractions` (jump to [the section](#ginteractions-class)) - `ContactFile` (jump to [the section](#contactfile-class)) -- `HiCExperiment` (jump to [the section](#hicexperiment-class)) +- `HiCExperiment` (jump to [the section](#hicexperiment-class)) + ::: ::: {.callout-tip} + ## TL;DR Directly jump to the [last section of this chapter](#visual-summary-of-the-hicexperiment-data-structure) to get a visual representation of these data structures. + ::: ## `GRanges` class @@ -152,11 +148,13 @@ These methods are referred to as "intra-range" methods as they work *"one-region-at-a-time"*. ::: {.callout-note} -## Note + +##### Note - Each range of the input `GRanges` object is modified independently from the other ranges in the following code chunks. - Intra-range operations are **endomorphisms**: they all take `GRanges` inputs and always return `GRanges` objects. + ::: - Shifting each genomic range in a `GRanges` object by a certain number of bases: @@ -226,10 +224,12 @@ gr * 1000 # ----- Zoom in by a given factor (effectively decreasing the `GRanges ``` ::: {.callout-warning} -## Going further + +##### Going further To fully grasp how to operate `GRanges` objects, we highly recommend reading the detailed documentation for this class by typing `?GenomicRanges` and `` ?GenomicRanges::`intra-range-methods` ``. + ::: #### Inter-range methods {#inter-range} @@ -238,9 +238,11 @@ Compared to "intra-range" methods described above, **inter-range** methods involve comparisons *between* ranges **in a single** GRanges object. ::: {.callout-note} -## Note + +##### Note Compared to previous section, the result of each function described below depends on the **entire set of ranges** in the input `GRanges` object. + ::: - Computing the "inverse" genomic ranges, i.e. ranges in-between the input ranges: @@ -266,9 +268,11 @@ coverage(gr, weight = 'GC') ``` ::: {.callout-warning} -## Going further + +##### Going further To fully grasp how to operate `GRanges` objects, we highly recommend reading the detailed documentation for this class by typing `` ?GenomicRanges::`inter-range-methods` ``. + ::: ### Comparing multiple `GRanges` objects @@ -338,9 +342,11 @@ The `Hits` output clearly describes what overlaps with what: - The query (peak) `#5` overlaps with subject (TSS) `#2` ::: {.callout-note} -## Note + +##### Note Because no other query index or subject index is listed in the `ov` output, none of the remaining ranges from `query` overlap with ranges from `subject`. + ::: - Subsetting by overlaps between a query and a subject @@ -364,7 +370,8 @@ countOverlaps(query = peaks, subject = TSSs) ``` ::: {.callout-note} -## Note + +##### Note Note that which `GRanges` goes in `query` or `subject` is crucial! Counting **for each peak, the number of TSSs it overlaps with** is very different from **for each TSS, how many peaks it overlaps with**. @@ -382,6 +389,7 @@ We can add these counts to the original `query` object: TSSs$n_peaks <- countOverlaps(query = TSSs, subject = peaks) TSSs ``` + ::: - `%over%`, `%within%`, `%outside%` : handy operators @@ -412,9 +420,11 @@ peaks %outside% TSSs ``` ::: {.callout-warning} -## Going further + +##### Going further To fully grasp how to find overlaps between `GRanges` objects, we highly recommend reading the detailed documentation by typing `` ?IRanges::`findOverlaps-methods` ``. + ::: #### Find nearest range from a subject for each range in a query @@ -620,12 +630,14 @@ swapAnchors(gi) ``` ::: {.callout-warning} -## Note + +##### Note "Sorting" and "swapping" a `GInteractions` object are two **entirely different actions**: - "sorting" reorganizes all *rows* (interactions); - "swapping" *anchors* reorganizes *"first" and "second" anchors* for each interaction independently. + ::: #### `GInteractions` distance method @@ -1175,3 +1187,5 @@ queries to seamlessly import parts or all the data contained in disk-stored Hi-C contact matrices in a variety of formats. ![](images/20230309114202.png) + +# References {-} diff --git a/disseminating.qmd b/inst/pages/disseminating.qmd similarity index 99% rename from disseminating.qmd rename to inst/pages/disseminating.qmd index 9448de9..6d38453 100644 --- a/disseminating.qmd +++ b/inst/pages/disseminating.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Data gateways: accessing public Hi-C data portals ```{r} @@ -12,7 +5,6 @@ bibliography: bibliography.bib #| results: "hide" #| message: false #| warning: false -source("_common.R") library(ggplot2) library(GenomicRanges) library(InteractionSet) @@ -22,6 +14,7 @@ library(DNAZooData) ``` ::: {.callout-note} + ## Aims This chapter focuses on introducing two important portals hosting public Hi-C datasets: the [4DN Consortium](https://www.4dnucleome.org/) @@ -30,6 +23,7 @@ a programmatic access to these portals: - `fourDNData` - `DNAZooData` + ::: The Hi-C experimental approach has gained significant traction across multiple @@ -143,9 +137,11 @@ fourDNData(experimentSetAccession = '4DNES25ABNZ1', type = 'pairs') |> ``` ::: {.callout-warning} -## Watch out + +#### Watch out `.pairs` files can be particularly large and therefore will take both and long time to download and a large storage footprint. + ::: - `type = 'insulation'` will fetch a `.bigwig` track file precomputed by the 4DN consortium. This track corresponds to the genome-wide insulation score computed by `cooltools` as described in @Crane_2015. To know more about this, read [the excerpt from 4DN data portal](https://data.4dnucleome.org/resources/data-analysis/insulation_compartment_scores#insulation_scores_and_boundaries_page_all). Once fetched from the 4DN data portal, the local file can be imported in `R` using the `import` function, which will generate a `RleList` object. @@ -367,3 +363,5 @@ corrected by the DNA Zoo consortium. metadata(hicfile)$assemblyURL ## [1] "https://dnazoo.s3.wasabisys.com/Hypsibius_dujardini/nHd_3.1_HiC.fasta.gz" ``` + +# References {-} diff --git a/images/20230215221337.png b/inst/pages/images/20230215221337.png similarity index 100% rename from images/20230215221337.png rename to inst/pages/images/20230215221337.png diff --git a/images/20230221172531.png b/inst/pages/images/20230221172531.png similarity index 100% rename from images/20230221172531.png rename to inst/pages/images/20230221172531.png diff --git a/images/20230303125432.png b/inst/pages/images/20230303125432.png similarity index 100% rename from images/20230303125432.png rename to inst/pages/images/20230303125432.png diff --git a/images/20230306102639.png b/inst/pages/images/20230306102639.png similarity index 100% rename from images/20230306102639.png rename to inst/pages/images/20230306102639.png diff --git a/images/20230309114047.png b/inst/pages/images/20230309114047.png similarity index 100% rename from images/20230309114047.png rename to inst/pages/images/20230309114047.png diff --git a/images/20230309114202.png b/inst/pages/images/20230309114202.png similarity index 100% rename from images/20230309114202.png rename to inst/pages/images/20230309114202.png diff --git a/images/20230321230247.png b/inst/pages/images/20230321230247.png similarity index 100% rename from images/20230321230247.png rename to inst/pages/images/20230321230247.png diff --git a/images/20230321233026.png b/inst/pages/images/20230321233026.png similarity index 100% rename from images/20230321233026.png rename to inst/pages/images/20230321233026.png diff --git a/images/20230322002953.png b/inst/pages/images/20230322002953.png similarity index 100% rename from images/20230322002953.png rename to inst/pages/images/20230322002953.png diff --git a/images/20230322003342.png b/inst/pages/images/20230322003342.png similarity index 100% rename from images/20230322003342.png rename to inst/pages/images/20230322003342.png diff --git a/images/20230322085136.png b/inst/pages/images/20230322085136.png similarity index 100% rename from images/20230322085136.png rename to inst/pages/images/20230322085136.png diff --git a/images/20230322102803.png b/inst/pages/images/20230322102803.png similarity index 100% rename from images/20230322102803.png rename to inst/pages/images/20230322102803.png diff --git a/images/20230322102919.png b/inst/pages/images/20230322102919.png similarity index 100% rename from images/20230322102919.png rename to inst/pages/images/20230322102919.png diff --git a/images/20230322181000.png b/inst/pages/images/20230322181000.png similarity index 100% rename from images/20230322181000.png rename to inst/pages/images/20230322181000.png diff --git a/images/20230322181300.png b/inst/pages/images/20230322181300.png similarity index 100% rename from images/20230322181300.png rename to inst/pages/images/20230322181300.png diff --git a/images/20230324125800.png b/inst/pages/images/20230324125800.png similarity index 100% rename from images/20230324125800.png rename to inst/pages/images/20230324125800.png diff --git a/images/20230327182802.png b/inst/pages/images/20230327182802.png similarity index 100% rename from images/20230327182802.png rename to inst/pages/images/20230327182802.png diff --git a/images/20230403090000.png b/inst/pages/images/20230403090000.png similarity index 100% rename from images/20230403090000.png rename to inst/pages/images/20230403090000.png diff --git a/images/20230403134800.png b/inst/pages/images/20230403134800.png similarity index 100% rename from images/20230403134800.png rename to inst/pages/images/20230403134800.png diff --git a/images/20230421134800.jpg b/inst/pages/images/20230421134800.jpg similarity index 100% rename from images/20230421134800.jpg rename to inst/pages/images/20230421134800.jpg diff --git a/images/20230523141745.jpg b/inst/pages/images/20230523141745.jpg similarity index 100% rename from images/20230523141745.jpg rename to inst/pages/images/20230523141745.jpg diff --git a/images/20230523144800.png b/inst/pages/images/20230523144800.png similarity index 100% rename from images/20230523144800.png rename to inst/pages/images/20230523144800.png diff --git a/images/20230523152700.png b/inst/pages/images/20230523152700.png similarity index 100% rename from images/20230523152700.png rename to inst/pages/images/20230523152700.png diff --git a/images/20230523153300.png b/inst/pages/images/20230523153300.png similarity index 100% rename from images/20230523153300.png rename to inst/pages/images/20230523153300.png diff --git a/images/20230523180000.png b/inst/pages/images/20230523180000.png similarity index 100% rename from images/20230523180000.png rename to inst/pages/images/20230523180000.png diff --git a/images/20230523180300.png b/inst/pages/images/20230523180300.png similarity index 100% rename from images/20230523180300.png rename to inst/pages/images/20230523180300.png diff --git a/images/20230525134200.png b/inst/pages/images/20230525134200.png similarity index 100% rename from images/20230525134200.png rename to inst/pages/images/20230525134200.png diff --git a/inst/pages/images/rstudio-logo.jpg b/inst/pages/images/rstudio-logo.jpg new file mode 100644 index 0000000..0177f5c Binary files /dev/null and b/inst/pages/images/rstudio-logo.jpg differ diff --git a/inst/pages/images/text-editor-logo.jpg b/inst/pages/images/text-editor-logo.jpg new file mode 100644 index 0000000..bc9e17b Binary files /dev/null and b/inst/pages/images/text-editor-logo.jpg differ diff --git a/inst/pages/images/vscode-logo.jpg b/inst/pages/images/vscode-logo.jpg new file mode 100644 index 0000000..22c00ce Binary files /dev/null and b/inst/pages/images/vscode-logo.jpg differ diff --git a/interactions-centric.qmd b/inst/pages/interactions-centric.qmd similarity index 97% rename from interactions-centric.qmd rename to inst/pages/interactions-centric.qmd index a6b9ce8..2fa08e3 100644 --- a/interactions-centric.qmd +++ b/inst/pages/interactions-centric.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Interactions-centric analysis ```{r} @@ -12,7 +5,6 @@ bibliography: bibliography.bib #| results: "hide" #| message: false #| warning: false -source("_common.R") library(dplyr) library(ggplot2) library(GenomicRanges) @@ -39,9 +31,11 @@ eco1_pf <- PairsFile(eco1_pairsf) ``` ::: {.callout-note} + ## Aims This chapter focuses on the various analytical tools offered by `HiContacts` to compute interaction-related metrics from a `HiCExperiment` object. + ::: **Interaction-centric** analyses consider a `HiCExperiment` object from the @@ -54,6 +48,7 @@ This encompasses: - Computing distribution of distance-dependent interaction frequency along chromosomes, a.k.a. scalograms ::: {.callout-note} + ## Note - Contrary to functions presented in the previous chapter, the functions described in this chapter are **not**: they @@ -61,9 +56,11 @@ take `HiCExperiment` objects as input and generally return data frames rather than modified `HiCExperiment` objects. - Internally, most of the functions presented in this chapter make a call to `interactions()` to coerce it into `GInteractions`. + ::: ::: {.callout-tip collapse="true"} + ## Generating the example `hic` object πŸ‘‡ To demonstrate `HiContacts` functionalities, we will create @@ -93,6 +90,7 @@ hic <- import(cf, focus = 'II', resolution = 2000) ```{r} hic ``` + ::: ## Distance law(s) @@ -231,6 +229,7 @@ v4C `ggplot2` can be used to visualize the 4C-like profile over multiple chromosomes. :::{.column-page-right} + ```{r fig.asp = 0.7, out.width = '100%'} df <- as_tibble(v4C) ggplot(df, aes(x = center, y = score)) + @@ -240,6 +239,7 @@ ggplot(df, aes(x = center, y = score)) + scale_x_continuous(labels = scales::unit_format(unit = "M", scale = 1e-06)) + facet_wrap(~seqnames, scales = 'free_y') ``` + ::: This clearly highlights trans interactions of the chromosome `II` centromere @@ -262,6 +262,7 @@ Several scalograms can be plotted together to compare distance-dependent contact frequencies along a given chromosome in different samples. :::{.column-page-right} + ```{r fig.asp = .4, out.width = '100%'} eco1_hic <- import( CoolFile(HiContactsData('yeast_eco1', 'mcool')), @@ -278,8 +279,10 @@ merged_scalo <- rbind( plotScalogram(merged_scalo |> filter(chr == 'II'), ylim = c(1e3, 1e5)) + facet_grid(~sample) ``` + ::: This example points out the overall longer interactions within the long arm of the chromosome `II` in an `eco1` mutant. +# References {-} diff --git a/interoperability.qmd b/inst/pages/interoperability.qmd similarity index 97% rename from interoperability.qmd rename to inst/pages/interoperability.qmd index 1bd3770..66b9c81 100644 --- a/interoperability.qmd +++ b/inst/pages/interoperability.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Interoperability: using HiCExperiment with other R packages ::: {.callout-note} @@ -29,7 +22,6 @@ following packages is illustrated here: #| results: "hide" #| message: false #| warning: false -source("_common.R") library(ggplot2) library(purrr) library(GenomicRanges) @@ -244,7 +236,6 @@ Unfortunately, the format of the input to `TopDom` is rather tricky (see `?TopDo The following chunk of code shows how to coerce a `HiCExperiment` object into a `TopDom`-compatible object. - ```{r} library(TopDom) hic <- import(coolf_wt, format = 'cool') @@ -294,6 +285,7 @@ rtracklayer::export(topologicalFeatures(hic, 'domain'), 'hic_domains.bed') `GOTHiC` relies on a cumulative binomial test to detect interactions between distal genomic loci that have significantly more reads than expected by chance in Hi-C experiments (@Mifsud_2017). ::: {.callout-important icon='true'} + ### Using the `GOTHiC` function Unfortunately, the main `GOTHiC` function @@ -386,13 +378,4 @@ interactions(res) -## References {-} - -::: {#refs} -::: - -## Session info {-} - -```{r echo = FALSE} -sessioninfo::session_info() -``` +# References {-} diff --git a/matrix-centric.qmd b/inst/pages/matrix-centric.qmd similarity index 97% rename from matrix-centric.qmd rename to inst/pages/matrix-centric.qmd index e1d190f..5dd8799 100644 --- a/matrix-centric.qmd +++ b/inst/pages/matrix-centric.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Matrix-centric analysis ```{r} @@ -12,7 +5,6 @@ bibliography: bibliography.bib #| results: "hide" #| message: false #| warning: false -source("_common.R") library(ggplot2) library(GenomicRanges) library(InteractionSet) @@ -33,9 +25,11 @@ hic_eco1 <- import( ``` ::: {.callout-note} + ## Aims This chapter focuses on the various analytical tools offered by `HiContacts` to compute matrix-related metrics from a `HiCExperiment` object. + ::: In the first part of this book, we have seen how to query parts or all of the @@ -66,15 +60,18 @@ This encompasses: ![](images/20230421134800.jpg) ::: {.callout-note} + ## Note - All the functions described in this chapter are **endomorphisms**: they take `HiCExperiment` objects as input and return modified `HiCExperiment` objects. - Internally, most of the functions presented in this chapter make a call to `as.matrix()` to coerce it into a `matrix`. + ::: ::: {.callout-tip collapse="true"} + ## Generating the example `hic` object πŸ‘‡ To demonstrate `HiContacts` functionalities, we will create @@ -99,6 +96,7 @@ hic <- import(cf, focus = 'II', resolution = 2000) ```{r} hic ``` + ::: ## Operations in an individual matrix @@ -131,6 +129,7 @@ should be nearly identical to `balanced` scores, which were originally imported from the disk-stored contact matrix. :::{.column-body-outset-right} + ```{r out.width = '100%', fig.asp = .33} patchwork::wrap_plots( plotMatrix(normalized_hic, use.scores = 'count', caption = FALSE), @@ -139,6 +138,7 @@ patchwork::wrap_plots( nrow = 1 ) ``` + ::: ### Computing observed/expected (O/E) map @@ -169,6 +169,7 @@ detrended_hic Topological features will be visually more prominent in the O/E `detrended` Hi-C map. :::{.column-page-right} + ```{r out.width = '100%', fig.asp = .33} patchwork::wrap_plots( plotMatrix(detrended_hic, use.scores = 'balanced', scale = 'log10', limits = c(-3.5, -1.2), caption = FALSE), @@ -177,13 +178,16 @@ patchwork::wrap_plots( nrow = 1 ) ``` + ::: ::: {.callout-note} -## Scale for `detrended` scores + +#### Scale for `detrended` scores - `expected` scores are in `linear` scale and Β± in the same amplitude than `balanced` scores; - `detrended` scores are in `log2` scale, in general approximately centered around 0. When plotting `detrended` scores, -`scale = linear` should be set to prevent the default `log10` scaling. +`scale = linear` should be set to prevent the default `log10` scaling. + ::: ### Computing autocorrelated map @@ -216,7 +220,8 @@ Correlated and anti-correlated loci will be visually represented in the `autocorrelated` Hi-C map in red and blue pixels, respectively. ::: {.callout-note} -## Note + +#### Note Here we have illustrated how to compute an autocorrelation matrix from a `HiCExperiment` object using the example **yeast** Hi-C experiment. Bear in mind that this is unusual and not very useful, as yeast chromatin @@ -224,6 +229,7 @@ is not segregated in two compartments but rather follows a Rabl conformation (@Duan_2010). An example of autocorrelation map from a vertebrate Hi-C experiment (for which chromatin is segregated in A/B compartments) is shown in [Chapter 10](workflow-chicken.qmd). + ::: ```{r} @@ -237,11 +243,13 @@ plotMatrix( ``` ::: {.callout-note} -## Scale for `autocorrelated` scores + +#### Scale for `autocorrelated` scores - `autocorrelated` scores are in `linear` scale, in general approximately centered around 0. When plotting `autocorrelated` scores, `scale = linear` should be set to prevent the default `log10` scaling. - `limits` should be manually set to `c(-x, x)` (`0 < x <= 1`) to ensure that the color range is effectively centered on `0`. + ::: ### Despeckling (smoothing out) a contact map @@ -265,6 +273,7 @@ results in a smoother Hi-C heatmap, effectively removing the "speckles" observed at longer range. :::{.column-page-right} + ```{r out.width = '100%', fig.asp = .33} library(InteractionSet) loops <- system.file('extdata', 'S288C-loops.bedpe', package = 'HiCExperiment') |> @@ -287,12 +296,15 @@ patchwork::wrap_plots( nrow = 1 ) ``` + ::: ::: {.callout-note} -## Scale for `despeckled` scores + +#### Scale for `despeckled` scores `despeckled` scores are in the same scale than the `scores` they were computed from. + ::: ## Operations between multiple matrices @@ -352,3 +364,5 @@ cowplot::plot_grid( ) ) ``` + +# References {-} diff --git a/parsing.qmd b/inst/pages/parsing.qmd similarity index 97% rename from parsing.qmd rename to inst/pages/parsing.qmd index 5b5b798..24914db 100644 --- a/parsing.qmd +++ b/inst/pages/parsing.qmd @@ -1,10 +1,3 @@ ---- -filters: - - _extensions/pandoc-ext/section-bibliographies/section-bibliographies.lua -reference-section-title: References -bibliography: bibliography.bib ---- - # Manipulating Hi-C data in R ```{r} @@ -12,7 +5,6 @@ bibliography: bibliography.bib #| results: "hide" #| message: false #| warning: false -source("_common.R") library(ggplot2) library(GenomicRanges) library(InteractionSet) @@ -24,23 +16,28 @@ pairsf <- HiContactsData('yeast_wt', 'pairs.gz') ``` ::: {.callout-note} + ## Aims This chapter focuses on: - Modifying information associated with an existing `HiCExperiment` object - Subsetting a `HiCExperiment` object - Coercing a `HiCExperiment` object in a base data structure + ::: ::: {.callout-important} + ## Important reminder - An `HiCExperiment` object allows random access parsing of a disk-stored contact matrix. - An `HiCExperiment` object operates by wrapping together (1) a `ContactFile` (i.e. a connection to a disk-stored data file) and (2) a `GInteractions` generated by parsing the data file. + ::: ::: {.callout-warning collapse="true"} + ## Recap on `HiCExperiment` objects πŸ‘‡ - Creating a connection to a disk-stored contact matrix: @@ -66,9 +63,11 @@ hic ```{r} interactions(hic) ``` + ::: ::: {.callout-tip collapse="true"} + ## Generating the example `hic` object πŸ‘‡ To demonstrate how to manipulate a `HiCExperiment` object, we will create @@ -90,6 +89,7 @@ cf hic <- import(cf, focus = 'II:300001-813184', resolution = 2000) hic ``` + ::: ## Subsetting a contact matrix @@ -134,7 +134,8 @@ parsing `HiCExperiment` data, as disk-stored contact matrices allow ``` ::: {.callout-important collapse="true"} -## More examples for import with `focus` argument πŸ‘‡ + +#### More examples for import with `focus` argument πŸ‘‡ - Subsetting to a specific **on-diagonal** genomic location using standard UCSC coordinates query: @@ -165,6 +166,7 @@ import(cf, focus = 'II|III', resolution = 2000) ```{r} import(cf, focus = 'II:300001-800000|V:1-500000', resolution = 2000) ``` + :::