<div><br>

<div>  
<div>
<h1>Annotating sets of genomic intervals with genomic annotations such as chromHMM</h1>
</div>
<p>Genomation is an R package to summarize, annotate and visualize genomic intervals. It contains a collection of tools for visualizing and analyzing genome-wide data sets, i.e. RNA-seq, bisulfite sequencing or chromatin-immunoprecipitation followed by sequencing (ChIP-seq) data.</p>
<p>Recently we added new features to genomation The new functionalities are available in the latest version of genomation that can be found on its github website.</p>
<p> 
<p>This demo shows the new annotation functions in genomation. The functions can be used to annotate target regions or a list of target regions with a given set of genomic features. The genomic features to be used should be in named GRangesList format.</p>
<div>
<h2>Get data to R</h2>
<p>We will get p300, SP1 and Nanog peaks,and chromHMM annotations from ENCODE. We wil use the H1-Esc cells. The aim is to annotate the peaks with chromHMM annotations.</p>
<p>  </div>
<div>
<h2>The new functions</h2>
<p>here are the new functions <code>annotateWithFeatures</code> and <code>heatTargetAnnotation</code>. These functions are available as of version 1.5.6. There were similar functions within the package before but these are more generalized versions of the old ones.</p>
<p><code>annotateWithFeatures()</code> will calculate the percentage of overlaps in a given GRanges object with a GRangesList object where each element correspods to a different category of genomic features such as promoters, exons and introns.</p>
<p><code>heatTargetAnnotation()</code> will plot a heatmap of annotations returned from <code>annotateWithFeatures()</code> or can return the matrix that is used the create the heatmap.</p>
</div>
<div>
<h2>Annotate peaks with chromHMM segments</h2>
<p>We can annote a given peak set like this:</p>
<p> 
<pre><code>## summary of target set annotation with feature annotation:</code></pre>
<pre><code>## Rows in target set: 8934</code></pre>
<pre><code>## ----------------------------</code></pre>
<pre><code>## percentage of target elements overlapping with features:</code></pre>
<pre><code>## 1_Active_Promoter 10_Txn_Elongation       11_Weak_Txn      12_Repressed <br>##             28.16              0.07              2.10              1.33 <br>## 13_Heterochrom/lo 14_Repetitive/CNV 15_Repetitive/CNV   2_Weak_Promoter <br>##              2.74              0.08              0.18             23.86 <br>## 3_Poised_Promoter 4_Strong_Enhancer 5_Strong_Enhancer   6_Weak_Enhancer <br>##              8.69             11.91             16.33             32.65 <br>##   7_Weak_Enhancer       8_Insulator  9_Txn_Transition <br>##              8.03              5.72              1.00</code></pre>
<pre><code>## </code></pre>
<pre><code>## percentage of feature elements overlapping with target:</code></pre>
<pre><code>## 1_Active_Promoter 10_Txn_Elongation       11_Weak_Txn      12_Repressed <br>##             19.81              0.04              0.16              0.68 <br>## 13_Heterochrom/lo 14_Repetitive/CNV 15_Repetitive/CNV   2_Weak_Promoter <br>##              0.27              0.19              0.57              6.76 <br>## 3_Poised_Promoter 4_Strong_Enhancer 5_Strong_Enhancer   6_Weak_Enhancer <br>##              6.45             20.36             11.49              3.46 <br>##   7_Weak_Enhancer       8_Insulator  9_Txn_Transition <br>##              0.53              0.84              0.71</code></pre>
<pre><code>## </code></pre>
<p>We can annotate the GRangesList of different peak sets like this:</p>
<p> 
<pre><code>## Working on: p300</code></pre>
<pre><code>## Working on: SP1</code></pre>
<pre><code>## Working on: NANOG</code></pre>
</div>
<div>
<h2>Make a heatmap of percentage of peaks overlapping with different chromHMM annotations</h2>
<p>We can make a heatmap using <code>heatTargetAnnotation()</code> function. The function also returns a ggplot2 object, so it can be further manipulated via ggplot2.</p>
<p> 
<p><img src="https://i1.wp.com/www.dropbox.com/s/wqw6hxgevj1fayp/unnamed-chunk-3-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
<p>We can also get the matrix that is used to make the heatmap and use it in other heatmap functions.</p>
<p> 
<p><img src="https://i2.wp.com/www.dropbox.com/s/x2994z6vw8vqbwf/unnamed-chunk-5-1.png?w=456&ssl=1" data-recalc-dims="1"></p>
</div>
<div>
<h1>sessionInfo()</h1>
<pre><code>sessionInfo()</code></pre>
<pre><code>## R version 3.3.0 (2016-05-03)<br>## Platform: x86_64-apple-darwin13.4.0 (64-bit)<br>## Running under: OS X 10.11.5 (El Capitan)<br>## <br>## locale:<br>## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8<br>## <br>## attached base packages:<br>## [1] grid      stats     graphics  grDevices utils     datasets  methods  <br>## [8] base     <br>## <br>## other attached packages:<br>## [1] devtools_1.11.1  gplots_3.0.1     genomation_1.5.6<br>## <br>## loaded via a namespace (and not attached):<br>##  [1] Rcpp_0.12.6                formatR_1.4               <br>##  [3] GenomeInfoDb_1.8.3         plyr_1.8.4                <br>##  [5] XVector_0.12.1             bitops_1.0-6              <br>##  [7] tools_3.3.0                zlibbioc_1.18.0           <br>##  [9] digest_0.6.10              memoise_1.0.0             <br>## [11] tibble_1.1                 evaluate_0.9              <br>## [13] gtable_0.2.0               BSgenome_1.40.1           <br>## [15] gridBase_0.4-7             yaml_2.1.13               <br>## [17] parallel_3.3.0             withr_1.0.1               <br>## [19] rtracklayer_1.32.2         stringr_1.0.0             <br>## [21] knitr_1.13.1               caTools_1.17.1            <br>## [23] gtools_3.5.0               Biostrings_2.40.2         <br>## [25] S4Vectors_0.10.2           IRanges_2.6.1             <br>## [27] stats4_3.3.0               Biobase_2.32.0            <br>## [29] data.table_1.9.6           impute_1.46.0             <br>## [31] plotrix_3.6-3              XML_3.98-1.4              <br>## [33] BiocParallel_1.6.5         seqPattern_1.4.0          <br>## [35] rmarkdown_0.9.6            gdata_2.17.0              <br>## [37] reshape2_1.4.1             readr_1.0.0               <br>## [39] ggplot2_2.1.0              magrittr_1.5              <br>## [41] codetools_0.2-14           matrixStats_0.50.2        <br>## [43] Rsamtools_1.24.0           scales_0.4.0              <br>## [45] htmltools_0.3.5            BiocGenerics_0.18.0       <br>## [47] GenomicRanges_1.24.2       GenomicAlignments_1.8.4   <br>## [49] assertthat_0.1             SummarizedExperiment_1.2.3<br>## [51] colorspace_1.2-6           labeling_0.3              <br>## [53] KernSmooth_2.23-15         stringi_1.1.1             <br>## [55] RCurl_1.95-4.8             munsell_0.4.3             <br>## [57] chron_2.3-47</code></pre>
</div></div>
<p>   </p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="https://www.r-bloggers.com/annotating-sets-of-genomic-intervals-with-genomic-annotations-such-as-chromhmm/"></div></div><div><a data-url="https://www.r-bloggers.com/annotating-sets-of-genomic-intervals-with-genomic-annotations-such-as-chromhmm/" data-counturl="https://www.r-bloggers.com/annotating-sets-of-genomic-intervals-with-genomic-annotations-such-as-chromhmm/" data-count="vertical" data-text="Annotating sets of genomic intervals with genomic annotations such as chromHMM" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://zvfak.blogspot.com/2016/08/annotating-sets-of-genomic-intervals_12.html"> Recipes, scripts and genomics</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/MEDuVB7Lqhs"></a></div></div>