Skip to content

Commit f65234f

Browse files
committed
source commit: 1d7f1be
0 parents  commit f65234f

File tree

64 files changed

+7397
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+7397
-0
lines changed

00-introduction.md

+568
Large diffs are not rendered by default.

01-r-basics.md

+1,167
Large diffs are not rendered by default.

02-data-prelude.md

+173
Large diffs are not rendered by default.

03-basics-factors-dataframes.md

+1,446
Large diffs are not rendered by default.

04-bioconductor-vcfr.md

+148
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
---
2+
title: Using packages from Bioconductor
3+
teaching: 10
4+
exercises: 3
5+
source: Rmd
6+
---
7+
8+
::::::::::::::::::::::::::::::::::::::: objectives
9+
10+
- Describe what the Bioconductor repository is and what it is used for
11+
- Describe how Bioconductor differs from CRAN
12+
- Search Bioconductor for relevant packages
13+
- Install a package from Bioconductor
14+
15+
::::::::::::::::::::::::::::::::::::::::::::::::::
16+
17+
:::::::::::::::::::::::::::::::::::::::: questions
18+
19+
- How do I use packages from the Bioconductor repository?
20+
21+
::::::::::::::::::::::::::::::::::::::::::::::::::
22+
23+
24+
25+
## Installing packages from somewhere else besides CRAN?
26+
27+
So far we have told you about using packages that are included in the base installation of R (this is what comes with R 'out of the box'), and packages that you can install from [CRAN](https://cran.r-project.org/) (the Comprehensive R Archive Network), which is the primary place many people look for supplemental R packages to install. However, not all R packages are available on CRAN. For bioinformatics-related packages in particular, there is another repository that has many powerful packages that you can install. It is called [Bioconductor](https://bioconductor.org/) and it is a repository specifically focused on bioinformatics packages. [Bioconductor](https://bioconductor.org/) has a mission of "promot[ing] the statistical analysis and comprehension of current and emerging high-throughput biological assays." This means that many if not all of the packages available on Bioconductor are focused on the analysis of biological data, and that it can be a great place to look for tools to help you analyze your -omics datasets!
28+
29+
## So how do I use it?
30+
31+
Since access to the [Bioconductor](https://bioconductor.org/) repository is not built in to base R 'out of the box', there are a couple steps needed to install packages from this alternative source. We will work through the steps (only 2!) to install a package to help with the VCF analysis we are working on, but you can use the same approach to install any of the many thousands of available packages.
32+
33+
![](fig/bioconductor_website_screenshot.jpg){alt='screenshot of bioconductor homepage'}
34+
35+
## First, install the `BiocManager` package
36+
37+
The first step is to install a package that *is* on CRAN, `BiocManager`. This package will allow us to use it to install packages from Bioconductor. You can think of Bioconductor kind of like an alternative app store for your phone, except instead of apps you are installing packages, and instead of your phone it's your local R package library.
38+
39+
40+
``` r
41+
# install the BiocManager from CRAN using the base R install.packages() function
42+
install.packages("BiocManager")
43+
```
44+
45+
To check if this worked (and also so you can make a note of the version for reproducibility purposes), you can run `BiocManager::version()` and it should give you the version number.
46+
47+
48+
``` r
49+
# to make sure it worked, check the version
50+
BiocManager::version()
51+
```
52+
53+
## Second, install the vcfR package from Bioconductor using `BiocManager`
54+
55+
::::::::::::::::::::::::::::::::::::::::: callout
56+
57+
## Head's Up: Installing vcfR may take a while due to numerous dependencies
58+
59+
Just be aware that installing packages that have many dependencies can take a while.
60+
61+
::::::::::::::::::::::::::::::::::::::::::::::::::
62+
63+
64+
``` r
65+
# install the vcfR package from bioconductor using BiocManager::install()
66+
BiocManager::install("vcfR")
67+
```
68+
69+
Depending on your particular system, you may need to also allow it to install some dependencies or update installed packages in order to successfully complete the process.
70+
71+
::::::::::::::::::::::::::::::::::::::::: callout
72+
73+
## Note: Installing packages from Bioconductor vs from CRAN
74+
75+
Some packages begin by being available only on Bioconductor, and then later
76+
move to CRAN. `vcfR` is one such package, which originally was only available
77+
from Bioconductor, but is currently available from CRAN. The other thing to
78+
know is that `BiocManager::install()` will also install packages from CRAN (it
79+
is a wrapper around `install.packages()` that adds some extra features). There
80+
are [other benefits to using `BiocManager::install()` for Bioconductor
81+
packages](https://www.bioconductor.org/install/).
82+
In short, Bioconductor packages
83+
have a release cycle that is different from CRAN and the `install()` function
84+
is aware of that difference, so it helps to keep package versions in line with
85+
one another in a way that doesn't generally happen with the base R
86+
`install.packages()`.
87+
88+
::::::::::::::::::::::::::::::::::::::::::::::::::
89+
90+
## Search for Bioconductor packages based on your analysis needs
91+
92+
While we are only focusing in this workshop on VCF analyses, there are hundreds or thousands of different types of data and analyses that bioinformaticians may want to work with. Sometimes you may get a new dataset and not know exactly where to start with analyzing or visualizing it. The Bioconductor package search view can be a great way to browse through the packages that are available.
93+
94+
![](fig/bioconductor_search.jpg){alt='screenshot of bioconductor search'}
95+
96+
::::::::::::::::::::::::::::::::::::::::: callout
97+
98+
## Tip: Searching for packages on the Bioconductor website
99+
100+
There are several thousand packages available through the Bioconductor website.
101+
It can be a bit of a challenge to find what you want, but one helpful resource
102+
is the [package search page](https://bioconductor.org/packages/release/BiocViews.html#___Software).
103+
104+
::::::::::::::::::::::::::::::::::::::::::::::::::
105+
106+
In bioinformatics, there are often many different tools that can be used in a
107+
particular instance. The authors of `vcfR` have [compiled some of
108+
them](https://github.com/knausb/vcfR#software-that-produce-vcf-files). One of
109+
those packages that [is available from
110+
Bioconductor](https://bioconductor.org/packages/release/bioc/html/VariantAnnotation.html)
111+
is called `VariantAnnotation` and may also be of interest to those working with
112+
vcf files in R.
113+
114+
::::::::::::::::::::::::::::::::::::::: challenge
115+
116+
## Challenge
117+
118+
- Use the `BiocManager::available()` function to see what packages are available matching a search term.
119+
- Use the [biocViews](https://bioconductor.org/packages/release/BiocViews.html#___Software) interface to search for packages of interest.
120+
121+
You may or may not want to try installing the package, since not all dependencies always install easily. However, this will at least let you see what is available.
122+
123+
124+
::::::::::::::::::::::::::::::::::::::::::::::::::
125+
126+
::::::::::::::::::::::::::::::::::::::::: callout
127+
128+
## Tip: Refreshing the RStudio package view after installing
129+
130+
If you install a package from Bioconductor, you may need to refresh the RStudio package view to see it in your list. You can do this by clicking the "Refresh" button in the Packages pane of RStudio.
131+
132+
::::::::::::::::::::::::::::::::::::::::::::::::::
133+
134+
## Resources
135+
136+
- [Bioconductor](https://bioconductor.org/)
137+
- [Bioconductor package search](https://bioconductor.org/packages/release/BiocViews.html#___Software)
138+
- [CRAN](https://cran.r-project.org/)
139+
140+
:::::::::::::::::::::::::::::::::::::::: keypoints
141+
142+
- Bioconductor is an alternative package repository for bioinformatics packages.
143+
- Installing packages from Bioconductor requires a new method, since it is not compatible with the `install.packages()` function used for CRAN.
144+
- Check Bioconductor to see if there is a package relevant to your analysis before writing code yourself.
145+
146+
::::::::::::::::::::::::::::::::::::::::::::::::::
147+
148+

0 commit comments

Comments
 (0)