<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>paprica &#8211; The Bowman Lab</title>
	<atom:link href="https://www.polarmicrobes.org/category/paprica/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.polarmicrobes.org</link>
	<description>Marine Microbial Ecology</description>
	<lastBuildDate>Sun, 08 Oct 2023 17:52:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>
<site xmlns="com-wordpress:feed-additions:1">188265837</site>	<item>
		<title>Tutorial: Basic heatmaps and ordination with paprica output</title>
		<link>https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/</link>
					<comments>https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Mon, 11 Mar 2019 11:15:46 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=2491</guid>

					<description><![CDATA[The output from our paprica pipeline for microbial community structure analysis and metabolic inference has changed quite a lot over the last few months. In response to some recent requests here&#8217;s a tutorial that walks through an ordination and a &#8230; <a href="https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[
<p>The output from our <a href="https://github.com/bowmanjeffs/paprica">paprica</a> pipeline for microbial community structure analysis and metabolic inference has changed quite a lot over the last few months.  In response to some recent requests here&#8217;s a tutorial that walks through an ordination and a few basic plots with the paprica output.  The tutorial assumes that you&#8217;ve completed <a href="https://www.polarmicrobes.org/analysis-with-paprica/">this tutorial</a> which runs paprica on the samples associated with our recent <a href="https://www.elementascience.org/articles/10.1525/elementa.350/">seagrass paper</a>.</p>



<p>For our analysis lets bring the pertinent files into R and do some pre-processing:</p>



<pre class="wp-block-code"><code>## read in the edge and unique abundance tables. Note that it's going to take a bit to load the unique_tally file because you have a lot of variables!

tally &lt;- read.csv('2017.07.03_seagrass.bacteria.edge_tally.csv', header = T, row.names = 1)
unique &lt;- read.csv('2017.07.03_seagrass.bacteria.unique_tally.csv', header = T, row.names = 1)

## read in edge_data and taxon_map and seq_edge_map

data &lt;- read.csv('2017.07.03_seagrass.bacteria.edge_data.csv', header = T, row.names = 1)
taxa &lt;- read.csv('2017.07.03_seagrass.bacteria.taxon_map.csv', header = T, row.names = 1, sep = ',', as.is = T)
map &lt;- read.csv('2017.07.03_seagrass.bacteria.seq_edge_map.csv', header = T, row.names = 1)

## convert all na's to 0, then check for low abundance samples

tally&#91;is.na(tally)] &lt;- 0
unique&#91;is.na(unique)] &lt;- 0
rowSums(tally)

## remove any low abundance samples (i.e. bad library builds), and also
## low abundance reads.  This latter step is optional, but I find it useful
## unless you have a particular interest in the rare biosphere.  Note that
## even with subsampling your least abundant reads are noise, so at a minimum
## exclude everything that appears only once.

tally.select &lt;- tally&#91;rowSums(tally) &gt; 5000,]
tally.select &lt;- tally.select&#91;,colSums(tally.select) &gt; 1000]

unique.select &lt;- unique&#91;rowSums(unique) &gt; 5000,]
unique.select &lt;- unique.select&#91;,colSums(unique.select) &gt; 1000]</code></pre>



<p>If your experiment is based on factors (i.e. you want to test for differences between categories of samples) you may want to use DESeq2, otherwise I suggest normalizing by sample abundance.</p>



<pre class="wp-block-code"><code>## normalize

tally.select &lt;- tally.select/rowSums(tally.select)
unique.select &lt;- unique.select/rowSums(unique.select)</code></pre>



<p>Now we&#8217;re going to do something tricky.  For both unique.select and tally.select, rows are observations and columns are variables (edges or unique reads).  Those likely don&#8217;t mean much to you unless you&#8217;re intimately familiar with the reference tree.  We can map the edge numbers to taxa using &#8220;taxa&#8221; dataframe, but first we need to remove the &#8220;X&#8221; added by R to make the numbers legal column names.  For the unique read labels, we need to split on &#8220;_&#8221;, which divides the unique read identified from the edge number.</p>



<pre class="wp-block-code"><code>## get edge numbers associated with columns, and map to taxa names.
## If the entry in taxon is empty it means the read could not be classifed below
## the level of the domain Bacteria, and is labeled as "Bacteria"

tally.lab.Row &lt;- taxa&#91;colnames(tally.select), 'taxon']
tally.lab.Row&#91;tally.lab.Row == ""] &lt;- 'Bacteria'

unique.lab.Row &lt;- map&#91;colnames(unique.select), 'global_edge_num']
unique.lab.Row &lt;- taxa&#91;unique.lab.Row, 'taxon']
unique.lab.Row&#91;unique.lab.Row == ""] &lt;- 'Bacteria'
unique.lab.Row&#91;is.na(unique.lab.Row)] &lt;- 'Bacteria'</code></pre>



<p>In the above block of code I labeled the new variables as [tally|unique].lab.Row, because we&#8217;ll first use them to label the rows of a heatmap.  Heatmaps are a great way to start getting familiar with your data.</p>



<pre class="wp-block-code"><code>## make a heatmap of edge abundance

heat.col &lt;- colorRampPalette(c('white', 'lightgoldenrod1', 'darkgreen'))(100)

heatmap(t(data.matrix(tally.select)),
        scale = NULL,
        col = heat.col,
        labRow = tally.lab.Row,
        margins = c(10, 10))</code></pre>



<figure class="wp-block-image"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="640" height="574" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282-1024x918.png?resize=640%2C574&#038;ssl=1" alt="" class="wp-image-2496" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282.png?resize=1024%2C918&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282.png?resize=300%2C269&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282.png?resize=768%2C688&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282.png?w=1445&amp;ssl=1 1445w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/edge_heatmap-1-e1552290116282.png?w=1280&amp;ssl=1 1280w" sizes="(max-width: 640px) 100vw, 640px" /></figure>



<pre class="wp-block-code"><code>heatmap(t(data.matrix(unique.select)),
        scale = NULL,
        col = heat.col,
        labRow = unique.lab.Row,
        margins = c(10, 10))</code></pre>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" width="640" height="574" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781-1024x918.png?resize=640%2C574&#038;ssl=1" alt="" class="wp-image-2499" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781.png?resize=1024%2C918&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781.png?resize=300%2C269&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781.png?resize=768%2C688&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781.png?w=1445&amp;ssl=1 1445w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/unique_heatmap-e1552290867781.png?w=1280&amp;ssl=1 1280w" sizes="(max-width: 640px) 100vw, 640px" /></figure>



<p>Heatmaps are great for visualizing broad trends in the data, but they aren&#8217;t a good entry point for quantitative analysis.  A good next step is to carry out some kind of ordination (NMDS, PCoA, PCA, CA).  Not all ordination methods will work well for all types of data.  Here we&#8217;ll use correspondence analysis (CA) on the relative abundance of the unique reads.  CA will be carried out with the package &#8220;ca&#8221;, while &#8220;factoextra&#8221; will be used to parse the CA output and calculate key additional information.  You can find a nice in-depth tutorial on correspondence analysis in R <a href="http://www.sthda.com/english/articles/31-principal-component-methods-in-r-practical-guide/113-ca-correspondence-analysis-in-r-essentials/">here</a>.</p>



<pre class="wp-block-code"><code>library(ca)
library(factoextra)

unique.select.ca &lt;- ca(unique.select)
unique.select.ca.var &lt;- get_eigenvalue(unique.select.ca)
unique.select.ca.res &lt;- get_ca_col(unique.select.ca)

species.x &lt;- unique.select.ca$colcoord&#91;,1]
species.y &lt;- unique.select.ca$colcoord&#91;,2]

samples.x &lt;- unique.select.ca$rowcoord&#91;,1]
samples.y &lt;- unique.select.ca$rowcoord&#91;,2]

dim.1.var &lt;- round(unique.select.ca.var$variance.percent&#91;1], 1)
dim.2.var &lt;- round(unique.select.ca.var$variance.percent&#91;2], 2)

plot(species.x, species.y,
     ylab = paste0('Dim 2: ', dim.2.var, '%'),
     xlab = paste0('Dim 1: ', dim.1.var, '%'),
     pch = 3,
     col = 'red')

points(samples.x, samples.y,
       pch = 19)

legend('topleft',
       legend = c('Samples', 'Unique reads'),
       pch = c(19, 3),
       col = c('black', 'red'))</code></pre>



<figure class="wp-block-image"><img data-recalc-dims="1" decoding="async" width="640" height="640" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/CA.png?resize=640%2C640&#038;ssl=1" alt="" class="wp-image-2500" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/CA.png?w=687&amp;ssl=1 687w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/CA.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/CA.png?resize=300%2C300&amp;ssl=1 300w" sizes="(max-width: 640px) 100vw, 640px" /></figure>



<p>At this point you&#8217;re ready to crack open the unique.select.ca object and start doing some hypothesis testing.  There&#8217;s one more visualization, however, that can help with initial interpretation; a heatmap of the top unique edges contributing to the first two dimensions (which account for nearly all of the variance between samples).</p>



<pre class="wp-block-code"><code>species.contr &lt;- unique.select.ca.res$contrib&#91;,1:2]
species.contr.ordered &lt;- species.contr&#91;order(rowSums(species.contr), decreasing = T),]
species.contr.top &lt;- species.contr.ordered&#91;1:10,]

species.contr.lab &lt;- unique.lab.Row&#91;order(rowSums(abs(species.contr)), decreasing = T)]

heatmap(species.contr.top,
        scale = 'none',
        col = heat.col,
        Colv = NA,
        margins = c(10, 20),
        labRow = species.contr.lab&#91;1:10],
        labCol = c('Dim 1', 'Dim 2'),
        cexCol = 1.5)</code></pre>



<figure class="wp-block-image"><img data-recalc-dims="1" loading="lazy" decoding="async" width="640" height="415" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/dim_contr-1.png?resize=640%2C415&#038;ssl=1" alt="" class="wp-image-2503" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/dim_contr-1.png?w=687&amp;ssl=1 687w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2019/03/dim_contr-1.png?resize=300%2C194&amp;ssl=1 300w" sizes="auto, (max-width: 640px) 100vw, 640px" /></figure>



<p>From this plot we see that quite a few different taxa are contributing approximately equally to Dim 1 (which accounts for much of the variance between samples), including several different <em>Pelagibacter</em> and <em>Rhodobacteracea</em> strains.  That makes sense as the dominant environmental gradient in the study was inside vs. outside of San Diego Bay and we would expect these strains to be organized along such a gradient.  Dim 2 is different with unique reads associated with <em>Tropheryma whipplei</em> and <em>Rhodoluna lacicola</em> contributing most.  These aren&#8217;t typical marine strains, and if we look back at the original data we see that these taxa are very abundant in just two samples.  These samples are the obvious outliers along Dim 2 in the CA plot.</p>



<p>In this tutorial we covered just the community structure output from paprica, but of course the real benefit to using paprica is its estimation of metabolic potential.  These data are found in the *.ec_tally.csv and *path_tally.csv files, and organized in the same way as the edge and unique read abundance tables.  Because of this they can be plotted and analyzed in the same way.</p>



<p><br></p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-basic-heatmaps-and-ordination-with-paprica-output%2F&amp;linkname=Tutorial%3A%20Basic%20heatmaps%20and%20ordination%20with%20paprica%20output" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-basic-heatmaps-and-ordination-with-paprica-output%2F&amp;linkname=Tutorial%3A%20Basic%20heatmaps%20and%20ordination%20with%20paprica%20output" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-basic-heatmaps-and-ordination-with-paprica-output%2F&amp;linkname=Tutorial%3A%20Basic%20heatmaps%20and%20ordination%20with%20paprica%20output" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-basic-heatmaps-and-ordination-with-paprica-output%2F&#038;title=Tutorial%3A%20Basic%20heatmaps%20and%20ordination%20with%20paprica%20output" data-a2a-url="https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/" data-a2a-title="Tutorial: Basic heatmaps and ordination with paprica output"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2491</post-id>	</item>
		<item>
		<title>Separating bacterial and archaeal reads for analysis with paprica</title>
		<link>https://www.polarmicrobes.org/separating-bacterial-and-archaeal-reads-for-analysis-with-paprica/</link>
					<comments>https://www.polarmicrobes.org/separating-bacterial-and-archaeal-reads-for-analysis-with-paprica/#comments</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Fri, 07 Sep 2018 13:50:31 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=2302</guid>

					<description><![CDATA[One of the most popular primer sets for 16S rRNA gene amplicon analysis right now is the 515F/806R set. One of the advantages of this pair is that it amplifies broadly across the domains Archaea and Bacteria. This reduces by &#8230; <a href="https://www.polarmicrobes.org/separating-bacterial-and-archaeal-reads-for-analysis-with-paprica/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>One of the most popular primer sets for 16S rRNA gene amplicon analysis right now is the 515F/806R set. One of the advantages of this pair is that it amplifies broadly across the domains Archaea and Bacteria. This reduces by half the amount of work required to characterize prokaryotic community structure, and allows a comparison of the relative (or absolute, if you have counts) abundance of bacteria and archaea.  However, paprica and many other analysis tools aren&#8217;t designed to simultaneously analyze reads from both domains.  Different reference alignments or covariance models, for example, might be required.  Thus it&#8217;s useful to split an input fasta file into separate bacterial and archaeal files.</p>
<p>We like to use the <a href="http://eddylab.org/infernal/">Infernal</a> tool cmscan for this purpose.  First, you&#8217;ll need to acquire covariance models for the 16S/18S rRNA genes from all three domains of life.  You can find those on the <a href="http://rfam.xfam.org/">Rfam</a> website, they are also included in <a href="https://github.com/bowmanjeffs/paprica/tree/master/models">paprica/models</a> if you&#8217;ve downloaded paprica.  Copy the models to new subdirectory in your working directory while combining them into a single file:</p>
<pre>mkdir cms
cat ../paprica/models/*cm &gt; cms/all_domains.cm
cd cms</pre>
<p>Now you need to compress and index the covariance models using the cmpress utility provided by Infernal.  This takes a while.</p>
<pre>cmpress all_domains.cm</pre>
<p>Pretty simple.  Now you&#8217;re ready to do some work.  The whole Infernal suite of tools has pretty awesome built-in parallelization, but with only three covariance models in the file you won&#8217;t get much out of it.  Best to minimize cmscan&#8217;s use of cores and instead push lots of files through it at once.  This is easily done with the Gnu Parallel command:</p>
<pre>ls *.fasta | parallel -u cmscan --cpu 1 --tblout {}.txt cmscan/all_domains.cm {} &gt; /dev/nul</pre>
<p>Next comes the secret sauce.  The command above produces an easy-to-parse, easy-to-read table with classification stats for each of the covariance models that we searched against.  Paprica contains a utility in paprica/utilities/pick_16S_domain.py to parse the table and figure out which model scored best for each read, then make three new fasta files for each of domains Bacteria, Archaea, and Eukarya (the primers will typically pick up a few euks).  We&#8217;ll parallelize the script just as we did for cmscan.</p>
<pre>ls *.fasta | parallel -u python pick_16S_domain_2.py -prefix {} -out {}</pre>
<p>Now you have domain-specific files that you can analyze in paprica or your amplicon analysis tool of choice!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fseparating-bacterial-and-archaeal-reads-for-analysis-with-paprica%2F&amp;linkname=Separating%20bacterial%20and%20archaeal%20reads%20for%20analysis%20with%20paprica" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fseparating-bacterial-and-archaeal-reads-for-analysis-with-paprica%2F&amp;linkname=Separating%20bacterial%20and%20archaeal%20reads%20for%20analysis%20with%20paprica" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fseparating-bacterial-and-archaeal-reads-for-analysis-with-paprica%2F&amp;linkname=Separating%20bacterial%20and%20archaeal%20reads%20for%20analysis%20with%20paprica" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fseparating-bacterial-and-archaeal-reads-for-analysis-with-paprica%2F&#038;title=Separating%20bacterial%20and%20archaeal%20reads%20for%20analysis%20with%20paprica" data-a2a-url="https://www.polarmicrobes.org/separating-bacterial-and-archaeal-reads-for-analysis-with-paprica/" data-a2a-title="Separating bacterial and archaeal reads for analysis with paprica"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/separating-bacterial-and-archaeal-reads-for-analysis-with-paprica/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2302</post-id>	</item>
		<item>
		<title>paprica v0.4.0</title>
		<link>https://www.polarmicrobes.org/paprica-v0-4-0/</link>
					<comments>https://www.polarmicrobes.org/paprica-v0-4-0/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Sun, 08 Jan 2017 20:04:40 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1879</guid>

					<description><![CDATA[I&#8217;m happy to announce the release of paprica v0.4.0.  This release adds a number of new features to our pipeline for evaluating microbial community and metabolic structure.  These include: NCBI taxonomy information for each point of placement on the reference &#8230; <a href="https://www.polarmicrobes.org/paprica-v0-4-0/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>I&#8217;m happy to announce the release of <a href="https://github.com/bowmanjeffs/paprica/releases/latest">paprica v0.4.0</a>.  This release adds a number of new features to our pipeline for evaluating microbial community and metabolic structure.  These include:</p>
<ul>
<li>NCBI taxonomy information for each point of placement on the reference tree, including internal nodes.</li>
<li>Inclusion of the domain Eukarya.  This was a bit tricky and requires some further explanation.</li>
</ul>
<p><div id="attachment_1881" style="width: 650px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1881" class="size-large wp-image-1881" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?resize=640%2C512&#038;ssl=1" alt="" width="640" height="512" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?resize=1024%2C819&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?resize=300%2C240&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?resize=768%2C614&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2017/01/terminal_path_distribution-1.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1881" class="wp-caption-text">The distribution of metabolic pathways, predicted during the creation of the paprica Eukarya database, across transcriptomes in the MMETSP.</p></div></p>
<p>Eukaryotic genomes are a totally different beast than their archaeal and bacterial counterparts.  First and foremost they are massive.  Because of these there aren&#8217;t very many completed eukaryotic genomes out there, particularly for singled celled eukaryotes.  While a single investigator can now sequence, assemble, and annotate a bacterial or archaeal genome in very little time, eukaryotic genomes still require major efforts by consortia and lots of $$.</p>
<p>One way to get around this scale problem is to focus on eukaryotic <em>transcriptomes</em> instead of <em>genomes</em>.  Because much of the eukaryotic genome is noncoding this greatly reduces sequencing volume.  Since there is no such thing as a contiguous transcriptome, this approach also implies that no assembly (beyond open reading frames) will be attempted.  The Moore Foundation-funded <a href="http://marinemicroeukaryotes.org/">Marine Microbial Eukaryotic Transcriptome Sequencing Project</a> (MMETSP) was an initial effort to use this approach to address the problem of unknown eukaryotic genetic diversity.  The MMETSP sequenced transcriptomes from several hundred different strains.  The taxonomic breadth of the strains sequenced is pretty good, even if (predictably) the taxonomic resolution is not.  Thus, as for archaea, the phylogenetic tree and metabolic inferences should be treated with caution.  For eukaryotes there are the additional caveats that 1) not all genes coded in a genome will be represented in the transcriptome 2) the database contains only strains from the marine environment and 3) eukaryotic 18S trees are kind of messy.  Considerable effort went into making a decent tree, but you&#8217;ve been warned.</p>
<p>Because the underlying data is in a different format, not all genome parameters are calculated for the eukaryotes.  18S gene copy number is not determined (and thus community and metabolic structure are not normalized), the phi parameter, GC content, etc. are also not calculated.  However, eukaryotic community structure is evaluated and metabolic structure inferred in the same way as for the domains bacteria and archaea:</p>
<pre>./paprica-run.sh test.eukarya eukarya</pre>
<p>As always you can install paprica v0.4.0 by following the instructions <a href="https://www.polarmicrobes.org/installing-paprica-on-mac-osx/">here</a>, or you can use the <a href="https://www.polarmicrobes.org/extras/paprica-demo.ova">virtual box</a> or <a href="https://www.polarmicrobes.org/paprica-on-the-cloud/">Amazon Web Service machine instance</a>.</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-v0-4-0%2F&amp;linkname=paprica%20v0.4.0" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-v0-4-0%2F&amp;linkname=paprica%20v0.4.0" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-v0-4-0%2F&amp;linkname=paprica%20v0.4.0" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-v0-4-0%2F&#038;title=paprica%20v0.4.0" data-a2a-url="https://www.polarmicrobes.org/paprica-v0-4-0/" data-a2a-title="paprica v0.4.0"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/paprica-v0-4-0/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1879</post-id>	</item>
		<item>
		<title>paprica on the cloud</title>
		<link>https://www.polarmicrobes.org/paprica-on-the-cloud/</link>
					<comments>https://www.polarmicrobes.org/paprica-on-the-cloud/#comments</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Sat, 26 Nov 2016 03:15:16 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1801</guid>

					<description><![CDATA[This is a quick post to announce that paprica, our pipeline to evaluate community structure and conduct metabolic inference, is now available on the cloud as an Amazon Machine Instance (AMI).  The AMI comes with all dependencies required to execute &#8230; <a href="https://www.polarmicrobes.org/paprica-on-the-cloud/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>This is a quick post to announce that <a href="https://github.com/bowmanjeffs/paprica">paprica</a>, our pipeline to evaluate community structure and conduct metabolic inference, is now available on the cloud as an Amazon Machine Instance (AMI).  The AMI comes with all dependencies required to execute the paprica-run.sh script pre-installed.  If you want to use it for paprica-build.sh you&#8217;ll have to install pathway-tools and a few additional dependencies.  I&#8217;m new to the <a href="https://aws.amazon.com/ec2/">Amazon EC2</a> environment, so please let me know if you have any issues using the AMI.</p>
<p>If you are new to Amazon Web Services (AWS) the basic way this works is:</p>
<ul>
<li>Sign up for Amazon EC2 using your normal Amazon log-in</li>
<li>From the AWS console, make sure that your region is N. Virginia (community AMI&#8217;s are only available in the region they were created in)</li>
<li>From your EC2 dashboard, scroll down to &#8220;Create Instance&#8221; and click &#8220;Launch Instance&#8221;</li>
<li>Now select the &#8220;Community AMIs&#8221;</li>
<li>Search for &#8220;paprica-ec2&#8221;, then select the AMI corresponding to the latest version of paprica (0.4.0 at the time of writing).</li>
<li>Choose the type of instance you would like to run the AMI on.  This is the real power of AWS; you can tailor the instance to the analysis you would like to run.  For testing choose the free t2.micro instance.  This is sufficient to execute the test files or run a small analysis (hundreds of reads).  To use paprica&#8217;s parallel features select an instance with the desired number of cores and sufficient memory.</li>
<li>Click &#8220;Review and Launch&#8221;, and finish setting up the instance as appropriate.</li>
<li>Log onto the instance, navigate to the paprica directory, execute the test file(s) as described in the <a href="https://www.polarmicrobes.org/?p=1473">paprica tutorial</a>.  The AMI is not updated as often as paprica, so you may wish to reclone the github repository, or download the latest stable release.</li>
</ul>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-on-the-cloud%2F&amp;linkname=paprica%20on%20the%20cloud" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-on-the-cloud%2F&amp;linkname=paprica%20on%20the%20cloud" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-on-the-cloud%2F&amp;linkname=paprica%20on%20the%20cloud" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fpaprica-on-the-cloud%2F&#038;title=paprica%20on%20the%20cloud" data-a2a-url="https://www.polarmicrobes.org/paprica-on-the-cloud/" data-a2a-title="paprica on the cloud"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/paprica-on-the-cloud/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1801</post-id>	</item>
		<item>
		<title>Exploring genome content and genomic character with paprica and R</title>
		<link>https://www.polarmicrobes.org/exploring-genome-content-and-genomic-character-with-paprica-and-r/</link>
					<comments>https://www.polarmicrobes.org/exploring-genome-content-and-genomic-character-with-paprica-and-r/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Thu, 07 Jul 2016 17:07:24 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1699</guid>

					<description><![CDATA[The paprica pipeline was designed to infer the genomic content and genomic characteristics of a set of 16S rRNA gene reads.  To enable this the paprica database organizes this information by phylogeny for many of the completed genomes in Genbank.  &#8230; <a href="https://www.polarmicrobes.org/exploring-genome-content-and-genomic-character-with-paprica-and-r/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>The <a href="https://github.com/bowmanjeffs/paprica">paprica pipeline</a> was designed to infer the genomic content and genomic characteristics of a set of 16S rRNA gene reads.  To enable this the paprica database organizes this information by phylogeny for many of the completed genomes in Genbank.  In addition to metabolic inference this provides an opportunity to explore how genome content and genomic characteristics are organized phylogenetically.  The following is a brief analysis of some genomic features using the paprica database and R.  If you aren&#8217;t familiar with the paprica database this exercise will also familiarize you with some of its content and its organization.</p>
<p>The paprica pipeline and database can be obtained from Github <a href="https://github.com/bowmanjeffs/paprica">here</a>.  In this post I&#8217;ll be using the database associated with version 0.3.1.  The necessary files from the bacteria database (one could also conduct this analysis on the much smaller archaeal database) can be read into R as such:</p>
<pre>## Read in the pathways associated with the terminal nodes on the reference tree
path &lt;- read.csv('paprica/ref_genome_database/bacteria/terminal_paths.csv', row.names = 1)
path[is.na(path)] &lt;- 0

## Read in the data associated with all completed genomes in Genbank
data &lt;- read.csv('paprica/ref_genome_database/bacteria/genome_data.final.csv', row.names = 1)

## During database creation genomes with duplicate 16S rRNA genes were removed,
## so limit to those that were retained
data &lt;- data[row.names(data) %in% row.names(path),]

## "path" is ordered by clade, meaning it is in top to bottom order of the reference tree,
## however, "data" is not, so order it here
data &lt;- data[order(data$clade),]</pre>
<p>One fun thing to do at this point is to look at the distribution of metabolic pathways across the database.  To develop a sensible view it is best to cluster the pathways according to which genomes they are found in.</p>
<pre>## The pathway file in the database is binary, so we use Jaccard for distance
library('vegan')
path.dist &lt;- vegdist(t(path), method = 'jaccard') # distance between pathways (not samples!)
path.clust &lt;- hclust(path.dist)</pre>
<p>The heatmap function is a bit cumbersome for this large matrix, so the visualization can be made using the image function.</p>
<pre>## Set a binary color scheme
image.col &lt;- colorRampPalette(c('white', 'blue'))(2)

## Image will order matrix in ascending order, which is not what we want here!
image(t(data.matrix(path))[rev(path.clust$order),length(row.names(path)):1],
      col = image.col,
      ylab = 'Genome',
      xlab = 'Pathway',
      xaxt = 'n',
      yaxt = 'n')

box()</pre>
<p><div id="attachment_1701" style="width: 650px" class="wp-caption alignright"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1701" class="size-large wp-image-1701" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?resize=640%2C512&#038;ssl=1" alt="The distribution of metabolic pathways across all 3,036 genomes in the v0.3.1 paprica database." width="640" height="512" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?resize=1024%2C819&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?resize=300%2C240&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?resize=768%2C614&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/terminal_path_distribution.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1701" class="wp-caption-text">The distribution of metabolic pathways across all 3,036 genomes in the v0.3.1 paprica database.</p></div></p>
<p>There are a couple of interesting things to note in this plot.  First, we can see the expected distribution of core pathways present in nearly all genomes, and the interesting clusters of pathways that are unique to a specific lineage.  For clarity row names have been omitted from the above plot, but from within R you can pull out the taxa or pathways that interest you easily enough.  Second, there are some genomes that have very few pathways.  There are a couple of possible reasons for this that can be explored with a little more effort.  One possibility is that these are poorly annotated genomes, or at least the annotation didn&#8217;t associate many or any coding sequences with either EC numbers or GO terms &#8211; the two pieces of information Pathway-Tools uses to predict pathways during database construction.  Another possibility is that these genomes belong to obligate symbionts (either parasites or beneficial symbionts).  Obligate symbionts often have highly streamlined genomes and few complete pathways.  We can compare the number of pathways in each genome to other genome characteristics for additional clues.</p>
<p>A reasonable assumption is that the number of pathways in each genome should scale with the size of the genome.  Large genomes with few predicted pathways might indicate places where the annotation isn&#8217;t compatible with the pathway prediction methods.</p>
<pre>## Plot the number of pathways as a function of genome size
plot(rowSums(path) ~ data$genome_size,
     ylab = 'nPaths',
     xlab = 'Genome size')

## Plot P. ubique as a reference point
select &lt;- grep('Pelagibacter ubique HTCC1062', data$organism_name)
points(rowSums(path)[select] ~ data$genome_size[select],
       pch = 19,
       col = 'red')</pre>
<p><div id="attachment_1704" style="width: 650px" class="wp-caption alignright"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1704" class="size-large wp-image-1704" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?resize=640%2C512&#038;ssl=1" alt="The number of metabolic pathways predicted as a function of genome size for the genomes in the paprica database." width="640" height="512" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?resize=1024%2C819&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?resize=300%2C240&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?resize=768%2C614&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/npaths_genome_size.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1704" class="wp-caption-text">The number of metabolic pathways predicted as a function of genome size for the genomes in the paprica database.</p></div></p>
<p>That looks pretty good.  For the most part more metabolic pathways were predicted for larger genomes, however, there are some exceptions.  The red point gives the location of <em>Pelagibacter ubique</em> HTCC1062.  This marine bacterium is optimized for life under energy-limited conditions.  Among its adaptations are a highly efficient and streamlined genome.  In fact it has the smallest genome of any known free-living bacterium.  All the points below it on the x-axis are obligate symbionts; these are dependent on their host for some of their metabolic needs.  There are a few larger genomes that have very few (or even no) pathways predicted.  These are the genomes with bad, or at least incompatible annotations (or particularly peculiar biochemistry).</p>
<p>The other genome parameters in paprica are the number of coding sequences identified (nCDS), the number of genetic elements (nge), the number of 16S rRNA gene copies (n16S), GC content (GC), and phi; a measure of genomic plasticity.  We can make another plot to show the distribution of these parameters with respect to phylogeny.</p>
<pre>## Grab only the data columns we want
data.select &lt;- data[,c('n16S', 'nge', 'ncds', 'genome_size', 'phi', 'GC')]

## Make the units somewhat comparable on the same scale, a more
## careful approach would log-normalize some of the units first
data.select.norm &lt;- decostand(data.select, method = 'standardize')
data.select.norm &lt;- decostand(data.select.norm, method = 'range')

## Plot with a heatmap
heat.col &lt;- colorRampPalette(c('blue', 'white', 'red'))(100)
heatmap(data.matrix(data.select.norm),
      margins = c(10, 20),
      col = heat.col,
      Rowv = NA,
      Colv = NA,
      scale = NULL,
      labRow = 'n',
      cexCol = 0.8)
</pre>
<p><div id="attachment_1705" style="width: 213px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/parameter_heatmap.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1705" class="wp-image-1705 size-large" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/parameter_heatmap.png?resize=203%2C1024&#038;ssl=1" alt="Genomic parameters organized by phylogeny." width="203" height="1024" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/parameter_heatmap.png?resize=203%2C1024&amp;ssl=1 203w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/parameter_heatmap.png?resize=768%2C3875&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/parameter_heatmap.png?w=1056&amp;ssl=1 1056w" sizes="auto, (max-width: 203px) 100vw, 203px" /></a><p id="caption-attachment-1705" class="wp-caption-text">Genomic parameters organized by phylogeny.</p></div></p>
<p>Squinting at this plot it looks like GC content and phi are potentially negatively correlated, which could be quite interesting.  These two parameters can be plotted to get a better view:</p>
<pre>plot(data.select$phi ~ data.select$GC,
     xlab = 'GC',
     ylab = 'phi')</pre>
<p><div id="attachment_1707" style="width: 650px" class="wp-caption alignright"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1707" class="size-large wp-image-1707" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?resize=640%2C512&#038;ssl=1" alt="The phi parameter of genomic plasticity as a function of GC content." width="640" height="512" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?resize=1024%2C819&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?resize=300%2C240&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?resize=768%2C614&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1707" class="wp-caption-text">The phi parameter of genomic plasticity as a function of GC content.</p></div></p>
<p>Okay, not so much&#8230; but I think the pattern here is pretty interesting.  Above a GC content of 50 % there appears to be no relationship, but these parameters do seem correlated for low GC genomes.  This can be evaluated with linear models for genomes above and below 50 % GC.</p>
<pre>gc.phi.above50 &lt;- lm(data.select$phi[which(data.select$GC &gt;= 50)] ~ data.select$GC[which(data.select$GC &gt;= 50)])
gc.phi.below50 &lt;- lm(data.select$phi[which(data.select$GC &lt; 50)] ~ data.select$GC[which(data.select$GC &lt; 50)])

summary(gc.phi.above50)
summary(gc.phi.below50)

plot(data.select$phi ~ data.select$GC,
     xlab = 'GC',
     ylab = 'phi',
     type = 'n')

points(data.select$phi[which(data.select$GC &gt;= 50)] ~ data.select$GC[which(data.select$GC &gt;= 50)],
       col = 'blue')

points(data.select$phi[which(data.select$GC &lt; 50)] ~ data.select$GC[which(data.select$GC &lt; 50)],
       col = 'red')

abline(gc.phi.above50,
       col = 'blue')

abline(gc.phi.below50,
       col = 'red')

legend('bottomleft',
       bg = 'white',
       legend = c('GC &gt;= 50',
                  'GC &lt; 50'),
       col = c('blue', 'red'),
       pch = 1)

</pre>
<p><div id="attachment_1709" style="width: 650px" class="wp-caption alignright"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1709" class="wp-image-1709 size-large" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?resize=640%2C512&#038;ssl=1" width="640" height="512" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?resize=1024%2C819&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?resize=300%2C240&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?resize=768%2C614&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/07/phi_v_GC_cor-1.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1709" class="wp-caption-text">Genomic plasticity (phi) as a function of GC content for all bacterial genomes in the paprica database.</p></div></p>
<p>As expected there is no correlation between genomic plasticity and GC content for the high GC genomes (R<sup>2</sup> = 0) and a highly significant correlation for the low GC genomes (albeit with weak predictive power; R<sup>2</sup> = 0.106, p = 0).  So what&#8217;s going on here?  Low GC content is associated with particular microbial lineages but also with certain ecologies.  The free-living low-energy specialist <em>P. ubique</em> HTCC1062 has a low GC content genome for example, as do many obligate symbionts regardless of their taxonomy (I don&#8217;t recall if it is known why this is).  Both groups are associated with a high degree of genomic modification, including genome streamlining and horizontal gene transfer.</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fexploring-genome-content-and-genomic-character-with-paprica-and-r%2F&amp;linkname=Exploring%20genome%20content%20and%20genomic%20character%20with%20paprica%20and%20R" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fexploring-genome-content-and-genomic-character-with-paprica-and-r%2F&amp;linkname=Exploring%20genome%20content%20and%20genomic%20character%20with%20paprica%20and%20R" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fexploring-genome-content-and-genomic-character-with-paprica-and-r%2F&amp;linkname=Exploring%20genome%20content%20and%20genomic%20character%20with%20paprica%20and%20R" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fexploring-genome-content-and-genomic-character-with-paprica-and-r%2F&#038;title=Exploring%20genome%20content%20and%20genomic%20character%20with%20paprica%20and%20R" data-a2a-url="https://www.polarmicrobes.org/exploring-genome-content-and-genomic-character-with-paprica-and-r/" data-a2a-title="Exploring genome content and genomic character with paprica and R"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/exploring-genome-content-and-genomic-character-with-paprica-and-r/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1699</post-id>	</item>
		<item>
		<title>Tutorial: Annotating metagenomes with paprica-mg</title>
		<link>https://www.polarmicrobes.org/tutorial-annotating-metagenomes-with-paprica-mg/</link>
					<comments>https://www.polarmicrobes.org/tutorial-annotating-metagenomes-with-paprica-mg/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Sat, 26 Mar 2016 07:00:46 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1596</guid>

					<description><![CDATA[This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment. Starting with version 3.0.0 paprica contains a metagenomic annotation module.  This &#8230; <a href="https://www.polarmicrobes.org/tutorial-annotating-metagenomes-with-paprica-mg/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment.</strong></p>
<p>Starting with version 3.0.0<a href="https://github.com/bowmanjeffs/paprica"> paprica</a> contains a metagenomic annotation module.  This module takes as input a fasta or fasta.gz file containing the QC&#8217;d reads from a shotgun metagenome and uses <a href="http://ab.inf.uni-tuebingen.de/software/diamond/">DIAMOND Blastx</a> to classify these reads against a database derived from the paprica database.  The module produces as output:</p>
<ol>
<li> Classification for each read in the form of an EC number (obviously this applies only to reads associated with genes coding for enzymes).</li>
<li>A tally of the occurrence of each EC number in the sample, with some useful supporting information.</li>
<li>Optionally, the metabolic pathways likely to be present within the sample.</li>
</ol>
<p>In addition to the normal <a href="https://www.polarmicrobes.org/?p=1477">paprica-run.sh dependencies</a> paprica-mg requires <a href="http://ab.inf.uni-tuebingen.de/software/diamond/">DIAMOND Blastx</a>.  Follow the instructions in the DIAMOND manual, and be sure to add the location of the DIAMOND executables to your PATH.  If you want to predict metabolic pathways on your metagenome you will need to also download the pathway-tools software.  See the notes <a href="https://www.polarmicrobes.org/?p=1543">here</a>.</p>
<p><span style="text-decoration: underline;"><strong>Obtain the paprica-mg database</strong></span></p>
<p>There are two ways to obtain the paprica-mg database.  You can obtain a pre-made version of the database by downloading the files <a href="https://www.polarmicrobes.org/extras/paprica-mg.dmnd">paprica-mg.dmnd</a> and <a href="https://www.polarmicrobes.org/extras/paprica-mg.ec.csv.gz">paprica-mg.ec.csv.gz</a> (large!) to the ref_genome_database directory in the paprica directory.  Be sure to gunzip paprica-mg.ec.csv.gz before continuing.</p>
<pre>## Navigate to wherever you installed the paprica database
cd ~/paprica/ref_genome_database

## Download the tarball the contains the paprica-mgt database
wget https://www.polarmicrobes.org/extras/paprica-mgt.database.tgz

## Untar
tar -xzvf paprica-mgt.database.tgz</pre>
<p>Alternatively, if you wish to build the paprica-mg database from scratch, perhaps because you&#8217;ve customized that database or are building it more frequently than the release cycle, you will need to first <a href="https://www.polarmicrobes.org/?p=1543">build the regular paprica database</a>.  Then build the paprica-mgt database as such:</p>
<pre>paprica-mgt_build.py -ref_dir ref_genome_database</pre>
<p>If you&#8217;ve set paprica up in the standard way you can be execute this command from anywhere on your system; the paprica directory is already in your PATH, and the script will look for the directory &#8220;ref_genome_database&#8221; relative to itself.  Likewise you don&#8217;t need to be in the paprica directory to execute the paprica-mg_run.py script.</p>
<p><strong><span style="text-decoration: underline;">Annotate a metagenome</span></strong></p>
<p>Once you&#8217;ve downloaded or  built the database you can run your analysis.  It is worth spending a little time with the DIAMOND manual and considering the parameters of your system.  To try things out you can download a &#8220;smallish&#8221; QC&#8217;d metagenome from the <a href="https://www.ebi.ac.uk/ena/data/view/ERP001736">Tara Oceans Expedition</a> (selected randomly for convenient size):</p>
<pre>## Download a test metagenome
wget https://www.polarmicrobes.org/extras/ERR318619_1.qc.fasta.gz

## Execute paprica-mg for EC annotation only
paprica-mg_run.py -i ERR318619_1.qc.fasta.gz -o test -ref_dir ref_genome_database -pathways F</pre>
<p>This will produce the following output:</p>
<p>test.annotation.csv: The number of hits in the metagenome, by EC number.  See the paprica manual for a complete explanation of columns.</p>
<p>test.paprica-mg.nr.daa: The DIAMOND format results file.  Only one hit per read is reported.</p>
<p>test.paprica-mg.nr.txt: A text file of the DIAMOND results.  Only one hit per read is reported.</p>
<p>Predicting pathways on a metagenome is very time intensive and it isn&#8217;t clear what the &#8220;correct&#8221; way is to do this.  I&#8217;ve tried to balance speed with accuracy in paprica-mg.  If you execute with -pathways T, DIAMOND is executed twice; once for the EC number annotation as above (reporting only a single hit for each read), and once to collect data for pathway prediction.  On that search DIAMOND reports as many hits for each read as there are genomes in the paprica database.  Of course most reads will have far fewer (if any) hits.  The reason for this approach is to try and reconstruct as best as possible the actual genomes that are present.  For example, let&#8217;s say that a given read has a significant hit to an enzyme in genome A and genome B.  When aggregating information for pathway-tools the enzyme in genome A and genome B will be presented to pathway-tools in separate Genbank files representing separate genetic elements.  Because a missing enzyme in either genome A or genome B could cause a negative prediction for the pathway, we want the best chance of capturing the whole pathway.  So a second enzyme, critical to the prediction of that pathway, might get predicted for only genome A or genome B.  The idea is that the incomplete pathways will get washed out at the end of the analysis, and since pathway prediction is by its nature non-redundant (each pathway can only be predicted once) over-prediction is minimized.  To predict pathways during annotation:</p>
<pre>## execute paprica-mg for EC annotation and pathway prediction
paprica-mg_run.py -i ERR318619_1.qc.fasta.gz -o test -ref_dir ref_genome_database -pathways T -pgdb_dir /location/of/ptools-local</pre>
<p>In addition to the files already mentioned, you will see:</p>
<p>test_mg.pathologic: a directory containing all the information that pathway-tools needs for pathway prediction.</p>
<p>test.pathways.txt: A simple text file of all the pathways that were predicted.</p>
<p>test.paprica-mg.txt: A very large text file of all hits for each read.  You probably want to delete this right away to save space.</p>
<p>test.paprica-mg.daa: A very large DIAMOND results file of all hits for each read.  You probably want to delete this right away to save space.</p>
<p>testcyc: A directory in ptools-local/pgdbs/local containing the PGDB and prediction reports.  It is worth spending some time here, and interacting with the PGDB using the pathway-tools GUI.</p>
<p>&nbsp;</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-annotating-metagenomes-with-paprica-mg%2F&amp;linkname=Tutorial%3A%20Annotating%20metagenomes%20with%20paprica-mg" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-annotating-metagenomes-with-paprica-mg%2F&amp;linkname=Tutorial%3A%20Annotating%20metagenomes%20with%20paprica-mg" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-annotating-metagenomes-with-paprica-mg%2F&amp;linkname=Tutorial%3A%20Annotating%20metagenomes%20with%20paprica-mg" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Ftutorial-annotating-metagenomes-with-paprica-mg%2F&#038;title=Tutorial%3A%20Annotating%20metagenomes%20with%20paprica-mg" data-a2a-url="https://www.polarmicrobes.org/tutorial-annotating-metagenomes-with-paprica-mg/" data-a2a-title="Tutorial: Annotating metagenomes with paprica-mg"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/tutorial-annotating-metagenomes-with-paprica-mg/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1596</post-id>	</item>
		<item>
		<title>Tutorial: Building the paprica database</title>
		<link>https://www.polarmicrobes.org/building-the-paprica-database/</link>
					<comments>https://www.polarmicrobes.org/building-the-paprica-database/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Fri, 11 Mar 2016 16:04:12 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1543</guid>

					<description><![CDATA[This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment. Building the paprica database provides maximum flexibility but involves more moving &#8230; <a href="https://www.polarmicrobes.org/building-the-paprica-database/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><strong>This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment.</strong></p>
<p>Building the paprica database provides maximum flexibility but involves more moving parts and resources than using the provided database.  Basic instructions for using the paprica-build.sh script are provided in the manual, this tutorial is intended to provide an even more detailed step-by-step guide.</p>
<p><span style="text-decoration: underline;"><strong>Requirements</strong></span></p>
<p>While a laptop running Linux, Windows with VirtualBox, or OSX is perfectly adequate for analysis with paprica, you&#8217;ll need something a little beefier for building the database (unless you&#8217;re <em>really</em> patient).  A high performance cluster is overkill; I build the provided database on a basic 12 core Linux workstation with 32 Gb RAM (&lt; $5k).  Something in this ballpark should work fine, of course more cores will get the job done faster (but keep an eye on memory useage).</p>
<p>Once you&#8217;ve got the hardware requirements sorted out you need to download the dependencies.  I recommend first following <a href="https://www.polarmicrobes.org/?p=1473">all the instructions for the paprica-run.sh script</a>, then installing <a href="http://sco.h-its.org/exelixis/web/software/raxml/index.html">RAxML,</a> <a href="http://bioinformatics.ai.sri.com/ptools/">pathway-tools</a>, and <a href="https://github.com/fhcrc/taxtastic">taxtastic</a>.  The rest of this tutorial assumes you&#8217;ve done just that, including running the test.bacteria.fasta file against the bacteria database:</p>
<pre>./paprica-run.sh test.bacteria bacteria</pre>
<p><span style="text-decoration: underline;"><strong>Install Remaining Dependencies</strong></span></p>
<p>In addition to all the dependencies required by paprica-run.sh, you need pathway-tools and RAxML.  These are very mainstream programs, but that doesn&#8217;t necessarily mean installation is easy.  In particular pathway-tools requires that you request a license (free for academic users).  This takes about 24 hours after which you&#8217;ll receive a link to download the installer.  Regardless of whether you&#8217;re sitting at the workstation or accessing it via SSH, a GUI will pop up and guide you through the installation.  In general you can accept the defaults, however, the GUI will ask you where pathway-tools should create the ptools-local directory.  This is where the program will create the pathway-genome databases that describe (among other things) the metabolic pathways in each genome.  By the time you are done creating the database this directory will be &gt; 100 Gb, so pick a location with plenty of space!  This might not be your home directory (the default location).  For example on my system my home directory is housed on a small SSD.  To keep the home directory from becoming bloated I opted to locate ptools-local on a separate drive.</p>
<p>You will receive a number of download options from the pathway-tools development team.  I recommend that you conduct only the basic installation of pathway-tools (this is the EcoCyc and MetaCyc option), and do not download and install additional PGDBs.  Nothing wrong with installing these additional, well-curated PGDBs other than increased space and time, but they become ponderous.  You can always add them later if you want to become a metabolic modeling rock star.</p>
<p>Once you&#8217;ve installed pathway-tools you should be sure to add the program to your PATH, following standard methods.  Once you&#8217;ve done this re-source .profile and type pathway-tools in a bash shell.  The GUI should open.</p>
<p>RAxML is the one piece of software used by paprica that requires compilation.  Fortunately the RAxML folks generally build good software, so compiling isn&#8217;t likely to be a problem.  RAxML comes in several flavors and paprica is a bit particular about the version of RAxML it expects to find.  RAxML gets called in two scripts; paprica-get_ref.py and paprica-place_it.py.  These scripts call &#8220;raxmlHPC-PTHREADS-AVX2&#8221;, so you need to make sure you build the parallel threaded AVX2 version, i.e.:</p>
<pre>make -f Makefile.AVX2.PTHREADS.gcc</pre>
<p>If you need to not do that due to hardware limitations (a very old workstation or some such) you&#8217;ll need to modify those scripts accordingly or actually name the working RAxML command raxmlHPC-PTHREADS-AVX2 (I cringe at this suggestion, but it is the simplest solution).  Get in contact with me if you have issues.  As with all dependencies, after you build raxmlHPC-PTHREADS-AVX2 you need to add the RAxML directory to your PATH, re-source .profile, and test the installation by typing raxmlHPC-PTHREADS-AVX2 in a bash shell.  If RAxML yells at you with a warning it installed correctly and you&#8217;re good to go.</p>
<p><strong><span style="text-decoration: underline;">Test paprica-build.sh</span><br />
</strong></p>
<p>There are a lot of moving parts in paprica-build.sh.  Because of this, and because of the amount of time certain steps take to complete, troubleshooting can be a little frustrating.  To make things easier you can download a fake ref_genome_database directory <a href="https://www.polarmicrobes.org/extras/ref_genome_database.tgz">here</a> with 11 genomes pre-loaded (10 in the bacteria/refseq and 1 in user/bacteria).  Download, remove the old ref_genome_database directory that came with paprica, and untar the new one:</p>
<pre>rm -r ref_genome_database
wget https://www.polarmicrobes.org/extras/ref_genome_database.tgz
tar -xzvf ref_genome_database.tgz</pre>
<p>At this point in time it is absolutely essential that you open paprica-build.sh and switch the -download flag in the paprica-make_ref.py line from &#8220;T&#8221; to &#8220;test&#8221;.  If you don&#8217;t do this you will initiate a fresh download of all the completed genomes in Genbank.  Make sure you switch this flag back to T when you are done testing and ready to actually build the database.</p>
<p>Once you&#8217;ve downloaded the test ref_genome_database directory and switched the flag simply execute the script:</p>
<pre>./paprica-build.sh bacteria</pre>
<p>You&#8217;ll see lots of output flash by on the screen.  Keep an eye out for error messages that could indicate something amiss.  If something goes wrong the error messages should be quite obvious as the later steps will fail completely.  I have noticed that for reasons which are not yet clear, when building the full database the script sometimes hangs after PGDB creation.  If that happens use control-c to exit the bash script, and re-execute the paprica-build_core_genomes.py script.  You can re-execute the whole bash script if you like, but it takes some time and isn&#8217;t necessary.  If you start seeing messages like:</p>
<pre>collecting data for internal node 13, 1 of 9
collecting data for internal node 19, 2 of 9
collecting data for internal node 16, 3 of 9
collecting data for internal node 6, 4 of 9
collecting data for internal node 2, 5 of 9
collecting data for internal node 5, 6 of 9
collecting data for internal node 15, 7 of 9
collecting data for internal node 9, 8 of 9
collecting data for internal node 14, 9 of 9</pre>
<p>&#8230;you can relax, you&#8217;re at the end and nothing went amiss.  This small collection of genomes includes the CCG for the reads in test.bacteria.fasta, so you can even test your new &#8220;database&#8221; with paprica-run.sh:</p>
<pre>./paprica-run.sh test.bacteria bacteria</pre>
<p><strong><span style="text-decoration: underline;">Add Custom Draft Genomes (Optional)</span><br />
</strong></p>
<p>V0.3.0 of paprica introduced the ability to add custom draft genomes.  These genomes add additional CCGs to your reference tree and increase the accuracy of the metabolic inference.  Because they are not necessarily complete however, they are not used to calculate genome parameters such as the number of 16S rRNA genes or the length of the genome.  Placements to these edges should produce NA values in the edge_data.csv file produced by paprica-run.sh.  If you don&#8217;t want to add custom draft genomes you don&#8217;t need to do anything at this point.  If you want to add draft genomes you should create a unique directory for each, based on accession number, in ref_genome_database/user/bacteria or ref_genome_database/user/archaea (as appropriate).  For example, to add several draft <em>Sulfitobacter</em> genomes my directory structure looks like this:</p>
<pre>me@computer:/home/me/paprica/ref_genome_database/user/bacteria$ls
draft.combined_16S.fasta  GCF_000152645.1  GCF_000622325.1  GCF_000622365.1  GCF_000622405.1  GCF_000647675.1  GCF_000735125.1
GCF_000152605.1           GCF_000620505.1  GCF_000622345.1  GCF_000622385.1  GCF_000622425.1  GCF_000712315.1</pre>
<p>Inside each of these directories are the .fna file for the draft genome and the genomic .gbff file (use that extension, not .gbk).  So like this:</p>
<pre>me@computer:/home/me/paprica/ref_genome_database/user/bacteria/GCF_000152645.1$ ls
GCF_000152645.1_ASM15264v1_genomic.fna  GCF_000152645.1_ASM15264v1_genomic.gbff</pre>
<p>When you build the database paprica-make_ref.py will automatically look in the user directory and attempt to use anything it finds there.  Your draft genome must have a 16S rRNA gene, which not all of them do.  If it does not the build will continue without your draft genome.</p>
<p><span style="text-decoration: underline;"><strong>Add Custom EC Numbers</strong></span></p>
<p>If EC numbers are reported for genomes that you&#8217;re pretty sure should be there (annotations aren&#8217;t perfect) you can let paprica know about this by modifying the user_ec.csv file in ref_genome_database/user.  Open the file in a text editor and you should see this:</p>
<pre>##    This file can be used to indicate enzymes by EC number that you
##    believe should be in a genome, but do not appear in the genome.
##    These EC numbers will propagate to internal nodes, but will not
##    be used in pathway prediction.  The first row of this file is a
##    header and should not be modified.  Rows should be numbered
##    sequentially.
##
##    Example rows:
##    1,GCF12345,1.1.1.1,happy enzyme
##    2,GCF54321,2.3.4.5,sad enzyme
##
,GI_number,EC_number,product</pre>
<p>Follow the instructions to add new enzymes to your database.  These enzymes will propagate to internal nodes every time you update your database, but they will not be used in pathway prediction.</p>
<p><span style="text-decoration: underline;"><strong>Build the Database</strong></span></p>
<p>If you tested paprica-build.sh as described above (you should!) make sure you switch the -download flag back to T.  This will tell paprica to initiate a fresh download of genomes from Genbank.  Don&#8217;t worry about the ref_genome_database directory you used for testing, it is fully compatible with the new download.  Once you&#8217;ve done this initiate a build of the real database:</p>
<pre>./paprica-build.sh bacteria</pre>
<p>Of course if you wanted to build the archaeal database you would replace &#8220;bacteria&#8221; with &#8220;archaea&#8221;.</p>
<p><span style="text-decoration: underline;"><strong>Cautionary Notes</strong></span></p>
<p>One of the particularly time consuming steps in paprica-build.sh is pathway prediction by pathway-tools.  In addition to taking some time (it has a lot of work to do) pathway-tools needs to send you graphical messages.  You can ignore these, but if you close the SSH session progress will stop because pathway-tools has no place to send the messages.</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fbuilding-the-paprica-database%2F&amp;linkname=Tutorial%3A%20Building%20the%20paprica%20database" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fbuilding-the-paprica-database%2F&amp;linkname=Tutorial%3A%20Building%20the%20paprica%20database" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fbuilding-the-paprica-database%2F&amp;linkname=Tutorial%3A%20Building%20the%20paprica%20database" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fbuilding-the-paprica-database%2F&#038;title=Tutorial%3A%20Building%20the%20paprica%20database" data-a2a-url="https://www.polarmicrobes.org/building-the-paprica-database/" data-a2a-title="Tutorial: Building the paprica database"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/building-the-paprica-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1543</post-id>	</item>
		<item>
		<title>Correctly evaluating metabolic inference methods</title>
		<link>https://www.polarmicrobes.org/correctly-evaluating-metabolic-inference-methods/</link>
					<comments>https://www.polarmicrobes.org/correctly-evaluating-metabolic-inference-methods/#respond</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Fri, 04 Mar 2016 16:47:08 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1519</guid>

					<description><![CDATA[Last week I gave a talk at the biennial Ocean Sciences Meeting that included some results from analysis with paprica.  Since paprica is a relatively new method I showed the below figure to demonstrate that paprica works.  The figure shows &#8230; <a href="https://www.polarmicrobes.org/correctly-evaluating-metabolic-inference-methods/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>Last week I gave a talk at the biennial Ocean Sciences Meeting that included some results from analysis with <a href="https://github.com/bowmanjeffs/paprica">paprica</a>.  Since paprica is a relatively new method I showed the below figure to demonstrate that paprica works.  The figure shows a strong correlation for four metagenomes between observed enzyme abundance and enzyme abundance predicted with paprica (from 16S rRNA gene reads extracted from the metagenome).  This is similar to the approach used to validate <a href="http://picrust.github.io/picrust/">PICRUSt</a> and <a href="http://tax4fun.gobics.de/">Tax4Fun</a>.</p>
<p><div id="attachment_1520" style="width: 650px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?ssl=1" rel="attachment wp-att-1520"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1520" class="size-large wp-image-1520" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?resize=640%2C640&#038;ssl=1" alt="Spearman's correlation between predicted and observed enzyme abundance in four marine metagenomes." width="640" height="640" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?resize=1024%2C1024&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/mg_paprica_compare.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1520" class="wp-caption-text">Spearman&#8217;s correlation between predicted and observed enzyme abundance in four marine metagenomes.</p></div></p>
<p>The correlation looks decent, right?  It&#8217;s not perfect, but most enzymes are being predicted at close to their observed abundance (excepting the green points where enzyme abundance is over-predicted because metagenome coverage is lower).</p>
<p>After the talk I was approached by a well known microbial ecologist who suggested that I compare these correlations to correlations with a random collection of enzymes.  His concern was that because many enzymes (or genes, or metabolic pathways) are widely shared across genomes any random collection of genomes looks sort of like a metagenome.  I gave this a shot and here are the results for one of the metagenomes used in the figure above.</p>
<p><div id="attachment_1521" style="width: 650px" class="wp-caption aligncenter"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?ssl=1" rel="attachment wp-att-1521"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1521" class="size-large wp-image-1521" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?resize=640%2C640&#038;ssl=1" alt="Correlation between predicted and observed (red) and random and observed (black) enzyme abundances." width="640" height="640" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?resize=1024%2C1024&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/PAL_0003.1.mg_paprica_compare.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a><p id="caption-attachment-1521" class="wp-caption-text">Correlation between predicted and observed (red) and random and observed (black) enzyme abundances.</p></div></p>
<p>Uh oh.  The correlation <em>is</em> better for predicted than random enzyme abundance, but rho = 0.7 is a really good correlation for the random dataset!  If you think about it however, this makes sense.  For this test I generated the random dataset by randomly selecting genomes from the paprica database until the total number of enzymes equaled the number predicted for the metagenome.  Because there are only 2,468 genomes in the current paprica database (fewer than the total number of completed genomes because only one genome is used for each unique 16S rRNA gene sequence) the database gets pretty well sampled during random selection.  As a result rare enzymes (which are also usually rare in the metagenome) are rare in the random sample, and common enzymes (also typically common in the metagenome) are common.  So random ends up looking a lot like observed.</p>
<p>It was further suggested that I try and remove core enzymes for this kind of test.  Here are the results for different definitions of &#8220;core&#8221;, ranging from enzymes that appear in less than 100 % of genomes (i.e. all enzymes, since no EC numbers appeared in all genomes) to those that appear in less than 1 % of genomes.</p>
<p><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?ssl=1" rel="attachment wp-att-1522"><img data-recalc-dims="1" loading="lazy" decoding="async" class="aligncenter wp-image-1523 size-large" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?resize=640%2C640&#038;ssl=1" alt="" width="640" height="640" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?resize=1024%2C1024&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/random_predicted_correlations.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a></p>
<p>The difference between the random and predicted correlations does change as the definition of the core group of enzymes changes.  Here&#8217;s the data aggregated for all four metagenomes in the form of a sad little Excel plot (error bars give standard deviation).</p>
<p><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?ssl=1" rel="attachment wp-att-1524"><img data-recalc-dims="1" loading="lazy" decoding="async" class="aligncenter size-large wp-image-1524" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?resize=640%2C372&#038;ssl=1" alt="delta_correlation" width="640" height="372" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?resize=1024%2C595&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?resize=300%2C174&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?resize=768%2C447&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?w=1280&amp;ssl=1 1280w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/03/delta_correlation.png?w=1920&amp;ssl=1 1920w" sizes="auto, (max-width: 640px) 100vw, 640px" /></a>This suggests to me a couple of things.  First, although I was initially surprised at the high correlation between a random and observed set of enzymes, I&#8217;m heartened that paprica consistently does better.  There&#8217;s plenty of room for improvement (and each new build of the database <em>does</em> improve as additional genomes are completed &#8211; the last build added 78 new genomes, see the current development version) but the method does work.  Second, that we obtain maximum &#8220;sensitivity&#8221;, defined as improvement over the random correlation, for enzymes that are present in fewer than 10 % of the genomes in that database.  Above that and the correlation is inflated (but not invalidated) by common enzymes, below that we start to lose predictive power.  This can be seen in the sharp drop in the predicted-random rho (Δrho: is it bad form to mix greek letters with the English version of same?) for enzymes present in less than 1 % of genomes.  Because lots of interesting enzymes are not very common this is where we have to focus our future efforts.  As I mentioned earlier some improvement in this area is automatic; each newly completed genome improves our resolution.</p>
<p>Some additional thoughts on this.  There are parameters in paprica that might improve Δrho.  The contents of <a href="https://www.polarmicrobes.org/?p=1473">closest estimated genomes</a> are determined by a cutoff value &#8211; the fraction of descendant genomes a pathway or enzyme appears in.  I redid the Δrho calculations for different cutoff values, ranging from 0.9 to 0.1.  Surprisingly this had only a minor impact on Δrho.  The reason for this is that most of the 16S reads extracted from the metagenomes placed to <a href="https://www.polarmicrobes.org/?p=1473">closest completed genomes</a> (for which cutoff is meaningless) rather than closest estimated genomes.  An additional consideration is that I did all of these calculations for enzyme predictions/observations instead of metabolic pathways.  The reason for this is that predicting metabolic pathways on metagenomes is rather complicated (but <a href="https://www.polarmicrobes.org/?p=1206">doable</a>).  Pathways have the advantage of being more conserved than enzymes however, so I expect to see an improved Δrho when I get around to redoing these calculations with pathways.</p>
<p>Something else that&#8217;s bugging me a bit&#8230; metagenomes aren&#8217;t sets of randomly distributed genomes.  Bacterial community structure is usually logarithmic, with a few dominant taxa and a long tail of rare taxa.  The metabolic inference methods by their nature capture this distribution.  A more interesting test might be to create a logarithmically distributed random population of genomes, but this adds all kinds of additional complexities.  Chief among them being the need to create many random datasets with different (randomly selected) dominant taxa.  That seems entirely too cumbersome for this purpose&#8230;</p>
<p>So to summarize&#8230;</p>
<ol>
<li> Metabolic inference definitively outperforms random selection.  This is good, but I&#8217;d like the difference (Δrho) to be larger than it is.</li>
<li>It is not adequate to validate a metabolic inference technique using correlation with a metagenome alone.  The improvement over a randomly generated dataset should be used instead.</li>
<li>paprica, and probably other metabolic inference techniques, have poor predictive power for rare (i.e. very taxonomically constrained) enzymes/pathways.  This shouldn&#8217;t surprise anyone.</li>
<li>Alternate validation techniques might be more useful than correlating with the abundance of enzymes/pathways in metagenomes.  Alternatives include correlating the distance in metabolic structure between samples with distance in community structure, as we did in <a href="http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0135868">this paper</a>, or correlating predictions for draft genomes.  In that case it would be necessary to generate a distribution of correlation values for the draft genome against the paprica (or other method&#8217;s) database, and see where the correlation for the inferred metabolism falls in that distribution.  Because the contents of a draft genome are a little more constrained than the contents of a metagenome I think I&#8217;m going to spend some time working on this approach&#8230;</li>
</ol>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fcorrectly-evaluating-metabolic-inference-methods%2F&amp;linkname=Correctly%20evaluating%20metabolic%20inference%20methods" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fcorrectly-evaluating-metabolic-inference-methods%2F&amp;linkname=Correctly%20evaluating%20metabolic%20inference%20methods" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fcorrectly-evaluating-metabolic-inference-methods%2F&amp;linkname=Correctly%20evaluating%20metabolic%20inference%20methods" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fcorrectly-evaluating-metabolic-inference-methods%2F&#038;title=Correctly%20evaluating%20metabolic%20inference%20methods" data-a2a-url="https://www.polarmicrobes.org/correctly-evaluating-metabolic-inference-methods/" data-a2a-title="Correctly evaluating metabolic inference methods"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/correctly-evaluating-metabolic-inference-methods/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1519</post-id>	</item>
		<item>
		<title>Tutorial: Analysis with paprica</title>
		<link>https://www.polarmicrobes.org/analysis-with-paprica/</link>
					<comments>https://www.polarmicrobes.org/analysis-with-paprica/#comments</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Mon, 25 Jan 2016 17:42:11 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1473</guid>

					<description><![CDATA[This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment. Getting Started I&#8217;ve been making a lot of improvements to paprica, &#8230; <a href="https://www.polarmicrobes.org/analysis-with-paprica/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p><div id="attachment_1489" style="width: 310px" class="wp-caption alignright"><a href="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?ssl=1" rel="attachment wp-att-1489"><img data-recalc-dims="1" loading="lazy" decoding="async" aria-describedby="caption-attachment-1489" class="wp-image-1489 size-medium" src="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?resize=300%2C300&#038;ssl=1" alt="paprika" width="300" height="300" srcset="https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?resize=300%2C300&amp;ssl=1 300w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?resize=150%2C150&amp;ssl=1 150w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?resize=768%2C768&amp;ssl=1 768w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?resize=1024%2C1024&amp;ssl=1 1024w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?w=1600&amp;ssl=1 1600w, https://i0.wp.com/www.polarmicrobes.org/wp-content/uploads/2016/01/paprika.jpeg?w=1280&amp;ssl=1 1280w" sizes="auto, (max-width: 300px) 100vw, 300px" /></a><p id="caption-attachment-1489" class="wp-caption-text">Paprika. Not to be confused with paprica.</p></div></p>
<p><strong>This tutorial is both a work in progress and a living document.  If you see an error, or want something added, please let me know by leaving a comment.</strong></p>
<p><span style="text-decoration: underline;"><strong>Getting Started</strong></span></p>
<p>I&#8217;ve been making a lot of improvements to paprica, our program for conducting metabolic inference on 16S rRNA gene sequence libraries.  The following is a complete analysis example with paprica to clarify the steps described in the <a href="https://github.com/bowmanjeffs/paprica/wiki">wiki</a>, and to highlight some of the recent improvements to the method.  I&#8217;ll continue to update this tutorial as the method evolves.  This tutorial assumes that you have all the dependencies for paprica-run.sh installed and in your PATH.  If you&#8217;re a Mac user you can follow the instructions <a href="https://www.polarmicrobes.org/?p=1477">here</a>.  Linux (including Windows Subsystem for Linux) users should use <a href="https://github.com/bowmanjeffs/paprica/blob/master/linux_install.sh">this script</a> as a guide.  This tutorial has been re-written for the most recent version of paprica, and does not directly apply to v0.6 or earlier.</p>
<p>Although not required for this tutorial, I recommend that you have R installed (probably with RStudio) for downstream analysis, and the <a href="https://sites.google.com/site/cmzmasek/home/software/archaeopteryx">Archaeopteryx</a> tree viewer.  Follow the appropriate instructions for your platform for R and RStudio.  Archaeopteryx is a little more convoluted; after first installing Java, install Archaeopteryx as such:</p>
<pre>## Download the jar file, note that you might need to update this link to reflect the current version.  Visit https://sites.google.com/site/cmzmasek/home/software/archaeopteryx to check.
wget <a href="http://www.phyloxml.org/download/forester/forester_1050.jar">http://www.phyloxml.org/download/forester/forester_1050.jar</a>
mv forester_1050.jar archaeopteryx.jar
## Download the configuration file and rename to something that works
wget http://www.phyloxml.org/download/forester/archaeopteryx/_aptx_configuration_file.txt
mv _aptx_configuration_file.txt aptx_configuration_file
</pre>
<p>Double click on archaeopteryx.jar to start the program.  Finally, this tutorial assumes that you are using the provided database of metabolic pathways and genome data included in the ref_genome_database directory.  If you want to build a custom database you should follow <a href="https://www.polarmicrobes.org/?p=1543">this tutorial</a>.  All the dependencies are installed and tested?  Before we start let&#8217;s get familiar with some terminology.</p>
<p><strong>closest completed genome (CCG)</strong>: One type of edge: the most closely taxonomically related completed genome to a query read.  This term is only applicable for query reads that place to a terminal edge (branch tip) on the reference tree.</p>
<p><strong>closest estimated genome (CEG)</strong>: Another type of edge: the set of genes that are estimated to be found  in all members of a clade originating at a branch point in the reference tree.  This term is only applicable to query reads that place to an internal edge on the reference tree.  The CEG is the point of placement.</p>
<p><strong>community structure</strong>: The taxonomic structure of a bacterial assemblage.</p>
<p><strong>edge</strong>: An edge is a point of placement on a reference tree.  Think of it as a branch of the reference tree.  Edges take the place of OTUs in this workflow, and are ultimately far more interesting and informative than OTUs.  Refer to the pplacer documentation for more.</p>
<p><strong>unique read</strong>: A read from a dataset that has been denoised using (e.g.) <a href="https://github.com/benjjneb/dada2">dada2</a>.</p>
<p><strong>metabolic structure</strong>: The abundance of different metabolic pathways within a bacterial assemblage.</p>
<p><strong>reference tree</strong>: This is the tree of representative 16S rRNA gene sequences from all completed Bacterial genomes in Genbank.  The topology of the tree defines what pathways are predicted for internal branch points.</p>
<p><strong><span style="text-decoration: underline;">Overview</span></strong></p>
<p>The basic steps that paprica takes during analysis are:</p>
<ol>
<li>Identify the reads that belong to the specified domain (bacteria, archaea, eukarya).</li>
<li>Place the reads on a 16S + 23S rRNA gene tree comprised of all completed genomes in RefSeq genomes (Archaea) or representatives from all phyla present in RefSeq genomes (Bacteria).  For bacteria, reads that place to a phylum (i.e. not an internal node) are then placed on a 16S + 23S rRNA gene tree comprised of all completed genomes in RefSeq genomes belonging to that phylum.  The domain Eukarya follows a similar procedure as for Bacteria, except that an 18S rRNA gene tree is used and division is used rather than phylum.  The 18S rRNA gene sequences come from the <a href="https://github.com/pr2database/pr2database">PR2</a> database rather than RefSeq.</li>
<li>For Bacteria and Archaea only, map the enzymes, pathways, and genome parameters present at each point of placement to the query reads.</li>
<li>Use the points of placement to provide a consensus taxonomy for each query read.</li>
</ol>
<p><strong><span style="text-decoration: underline;">Testing the Installation</span></strong></p>
<p>You can test your installation of paprica and its dependencies using the provided test.bacteria.fasta or test.archaea.fasta files.  For test.bacteria.fasta, from the paprica directory:</p>
<pre>./paprica-run.sh test bacteria</pre>
<p>The first argument specifies the name of the input fasta file (test.bacteria.fasta) without the extension.  The second argument specified which domain you are analyzing for.  Executing the command produces a variety of output files in the paprica directory:</p>
<pre>ls test*
temp.bacteria
test.archaea.fasta
test.archaeal16S.reads.txt
test.bacteria.clean.fasta
test.bacteria.clean.unique.align.sto
test.bacteria.clean.unique.count
test.bacteria.clean.unique.fasta
test.bacteria.combined_16S.bacteria.tax.placements.csv
test.bacteria.ec.csv
test.bacteria.edge_data.csv
test.bacteria.fasta
test.bacteria.pathways.csv
test.bacteria.sample_data.txt
test.bacteria.sum_ec.csv
test.bacteria.sum_pathways.csv
test.bacteria.unique_seqs.csv
test.bacterial16S.reads.txt
test.eukarya.fasta
test.eukaryote18S.reads.txt
test.fasta
test.unique.count
test.unique.fasta</pre>
<p>Each sample fasta file that you run will produce similar output.  These files are described in detail in the Wiki <a href="https://github.com/bowmanjeffs/paprica/wiki">here</a>, with the following being particularly useful to you:</p>
<p><strong>test.bacteria</strong>: Because multiple jplace and other intermediate files are created for the domains Bacteria and Eukarya the number of files quickly gets out of control.  Some of these files are useful for downstream analysis and troubleshooting, however, so they are retained in a directory with the sample name.</p>
<p><strong>test.bacteria.combined_16S.bacteria.tax.placements.csv</strong>: The *placements.csv file represents a summary of the placement data for each unique query read and is the result of parsing the jplace file(s) produced by epa-ng.  For Bacteria and Eukarya, which have multiple reference trees, this file contains the phylogenetic placement results for all the reference trees for a given sample.</p>
<p><strong>test.bacteria.bacteria.edge_data.csv</strong>: This is a csv format file containing data on edge location in the reference tree that received a placement, such as the number of reads that placed, predicted 16S rRNA gene copies, number of reads placed normalized to 16S rRNA gene copies, GC content, etc.  This file describes the taxonomic structure of your sample.</p>
<p><strong>test.bacteria.unique_seqs.csv</strong>: This is a csv file that contains the abundance and normalized abundance of unique sequences. Each sequence is identified by a unique hash<br />
(to allow tallying across multiple samples) and the name of a representative read is also provided.</p>
<p><strong>test.bacteria.bacteria.sum_pathways.csv</strong>: This is a csv file of all the metabolic pathways inferred for test.bacteria.fasta, by edge.  All possible metabolic pathways are listed (meaning all metabolic pathways that are represented in the database), the number attributed to each edge is given in the column for that edge.</p>
<p><strong>test.bacteria.bacteria.sum_ec.csv</strong>: This is a csv file of all the enzymes with EC numbers inferred for test.bacteria.fasta, by edge. The file is structured the same as test.bacteria.bacteria.sum_pathways.csv.</p>
<p><strong>test.bacteria.bacteria.sample_data.txt</strong>: This file described some basic information for the sample, such as the database version that was used to make the metabolic inference, the confidence score, total reads used, etc.</p>
<p><strong>test.bacteria.bacteria.sum_pathways.csv</strong>: This csv format file describes the metabolic structure of the sample, i.e. pathway abundance across all edges.</p>
<p>If you want to run an analysis with archaeal 16S rRNA or eukaryotic 18S rRNA gene reads you can test the same way.  Note that there is no metabolic inference for the domain eukarya, but you the reads are placed on an extensive set of reference trees that are useful for classification and phylogenetic analysis.</p>
<pre>./paprica-run.sh test archaea
./paprica-run.sh test eukarya</pre>
<p><strong><span style="text-decoration: underline;">Conducting an Analysis &#8211; read QC<br />
</span></strong></p>
<p>Okay, that was all well and good for the test.fasta file, which has placements only for a single edge and is not particularly exciting.  Let&#8217;s try something a bit more advanced that mimics what you would do for an actual analysis.  First we need to get some data.  In this case we&#8217;ll use a set of samples from a recent publication, <a href="https://www.elementascience.org/articles/10.1525/elementa.350/">Webb et al. 2019</a>.  You can acquire these data from the NCBI SRA site using prefetch.  First, create a file titled SRA_select_Run.txt, then populate the file with these accession numbers:</p>
<pre>SRX4496910
SRX4496911
SRX4496912
SRX4496913
SRX4496914
SRX4496915
SRX4496916
SRX4496917
SRX4496918
SRX4496919
SRX4496920
SRX4496921
SRX4496922
SRX4496923
SRX4496924
SRX4496925
SRX4496926
SRX4496927
SRX4496928
SRX4496929
SRX4496930
SRX4496931
SRX4496932
SRX4496933
SRX4496934
SRX4496935
SRX4496936
SRX4496937
SRX4496938
SRX4496939
SRX4496940
SRX4496941
SRX4496942
SRX4496943
SRX4496944
SRX4496945
SRX4496946
SRX4496947
SRX4496948
SRX4496949
SRX4496950
SRX4496951
SRX4496952
SRX4496953
SRX4496954</pre>
<p>Then execute the following command (if you don&#8217;t have it already, install Gnu parallel with your package manger of choice):</p>
<pre>parallel fastq-dump --split-files --skip-technical {} &lt; SRA_select_Run.txt</pre>
<p>Now you&#8217;ll want to QC, denoise, and merge the reads.  I&#8217;m not going to cover that here, but strongly recommend using dada2.  You can use <a href="https://github.com/bowmanlab/seq_data_scripts/blob/master/dada2.r">this R script</a>, which is a modification of the tutorial on the <a href="https://benjjneb.github.io/dada2/tutorial.html">dada2 site</a>.  Merged reads should be inflated to redundant fasta files before analysis with paprica.  You can use our <a href="https://github.com/bowmanlab/seq_data_scripts/blob/master/deunique_dada2.py">deunique_dada2.py</a> script for that.</p>
<p><strong>Conducting an Analysis &#8211; running paprica<br />
</strong></p>
<p>Previously you executed paprica on just a test file (test.fasta).  Here we have a larger number of samples, and we need to construct a loop to run paprica on all of them.  First, copy the paprica/paprica-run.sh file into your working directory:</p>
<pre>cp ~/paprica/paprica-run.sh paprica-run.sh
</pre>
<p>Paprica is pretty fast, and the key parts are already parallelized, so it doesn&#8217;t make sense to run the samples in parallel.  We can loop across multiple input files like this, specifying the file to run without the &#8220;.fasta&#8221; extension:</p>
<pre>for f in *exp.fasta;do NAME=$(basename $f .fasta); ./paprica-run.sh $NAME bacteria; done</pre>
<p>At this point you have individual analysis files for all your samples.  These can be quite useful, but most useful are classic abundance tables for edges, unique reads, enzymes, and pathways.  You can create these using the paprica-combine_results.py script.  This used to be a separate utility but is now a core part of paprica.  That means the script should reside in your paprica directory, and you call it from your working directory:</p>
<pre>paprica-combine_results.py -domain bacteria -o 2017.07.03_seagrass</pre>
<p>This produces several files, note that the prefix in the file names is set by the -o flag in the command above, and reflects the nature of these example reads:</p>
<p><strong>2017.07.03_seagrass_bacteria.taxon_map.txt</strong>: This file maps edge numbers to the name of the lowest consensus taxonomy (for CEGs) or strain name (for CCGs).</p>
<p><strong>2017.07.03_seagrass_bacteria.seq_edge_map.txt</strong>: This file maps unique sequences to the edge it most frequently places to across samples.  The vast majority of reads will place to only a single sample, however, the more samples you have and the more abundant a read is, the more likely it is that you&#8217;ll place to more than one edge.</p>
<p><strong>2017.07.03_seagrass_bacteria.edge_data.csv</strong>: These are the mean genome parameters for each sample.  Lots of good stuff in here, see the column labels.</p>
<p><strong>2017.07.03_seagrass_bacteria.edge_tally.csv</strong>: Edge abundance for each sample (corrected for 16S rRNA gene copy).  This is your community structure, and is equivalent to an OTU table (but much better!).</p>
<p><strong>2017.07.03_seagrass_bacteria.unique_tally.csv</strong>: The abundance and normalized abundance of unique sequences.</p>
<p><strong>2017.07.03_seagrass_bacteria.ec_tally.csv</strong>: Enzyme abundance for each sample.</p>
<p><strong>2017.07.03_seagrass_bacteria.path_tally.csv</strong>: Metabolic pathway abundance for each sample.</p>
<p>To get familiar with some basic operations on the output files, including exploring the data with heatmaps and correspondence analysis, you can continue with <a href="https://www.polarmicrobes.org/tutorial-basic-heatmaps-and-ordination-with-paprica-output/">this tutorial</a>.</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fanalysis-with-paprica%2F&amp;linkname=Tutorial%3A%20Analysis%20with%20paprica" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fanalysis-with-paprica%2F&amp;linkname=Tutorial%3A%20Analysis%20with%20paprica" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Fanalysis-with-paprica%2F&amp;linkname=Tutorial%3A%20Analysis%20with%20paprica" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Fanalysis-with-paprica%2F&#038;title=Tutorial%3A%20Analysis%20with%20paprica" data-a2a-url="https://www.polarmicrobes.org/analysis-with-paprica/" data-a2a-title="Tutorial: Analysis with paprica"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/analysis-with-paprica/feed/</wfw:commentRss>
			<slash:comments>11</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1473</post-id>	</item>
		<item>
		<title>Tutorial: Installing paprica on Mac OSX</title>
		<link>https://www.polarmicrobes.org/installing-paprica-on-mac-osx/</link>
					<comments>https://www.polarmicrobes.org/installing-paprica-on-mac-osx/#comments</comments>
		
		<dc:creator><![CDATA[Jeff]]></dc:creator>
		<pubDate>Wed, 20 Jan 2016 14:55:38 +0000</pubDate>
				<category><![CDATA[paprica]]></category>
		<guid isPermaLink="false">http://www.polarmicrobes.org/?p=1477</guid>

					<description><![CDATA[The following is a paprica installation tutorial for novice users on Mac OSX (installation on Linux is quite a bit simpler). If you’re comfortable editing your PATH and installing things using bash you probably don’t need to follow this tutorial, &#8230; <a href="https://www.polarmicrobes.org/installing-paprica-on-mac-osx/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>The following is a <a href="https://github.com/bowmanjeffs/paprica">paprica</a> installation tutorial for novice users on Mac OSX (installation on Linux is quite a bit simpler). If you’re comfortable editing your PATH and installing things using bash you probably don’t need to follow this tutorial, just get the dependencies as indicated in the <a href="https://github.com/bowmanjeffs/paprica/wiki/1.-Requirements-and-Installation">install instructions</a> and <a href="https://github.com/bowmanjeffs/paprica/blob/master/linux_install.sh">linux_install.sh</a> script. If command line operations stress you out, and you haven’t dealt with a lot of weird bioinformatics program installs, use this tutorial.</p>
<p><strong>Please note that this tutorial is a work in progress.  If you notice errors, inconsistencies, or omissions please leave a comment and I&#8217;ll be sure to correct them.  This tutorial has been updated for the most recent version of paprica, and will not work for v0.6 or earlier.<br />
</strong></p>
<p><strong>** IMPORTANT ** It is generally considered very poor practice to install anything in the root directory.  You might think, &#8220;but I&#8217;m the only user, so this makes more sense&#8221; or &#8220;but everyone in the lab wants program X, so I should install as root.&#8221;  Don&#8217;t do it.  Install to your home directory.  It will add years to your life.</strong></p>
<p>This tutorial assumes you&#8217;ve followed this advice, and that you are installing all the dependencies in your home directory.</p>
<p><span style="text-decoration: underline;"><strong>Install Python and Python packages</strong></span></p>
<p>paprica is 90 % an elaborate set of wrapper scripts for several core programs written by other groups. The scripts that execute the pipeline are bash scripts, the scripts that do the actual work are Python. Therefore you need Python up and running on your system. If you already have a mainstream v3.0 Python distro going  just make sure that the modules listed below are installed (<em>e.g.</em>, with<strong><code>conda install [package]</code></strong>and not pip3).  Note that Python 3 must be callable on your system as &#8220;python3&#8221; which should be the default.</p>
<p>Install some necessary Python modules, assuming you don&#8217;t already have them:</p>
<pre>pip3 install numpy
pip3 install biopython
pip3 install joblib
pip3 install pandas
pip3 install seqmagick
pip3 install termcolor</pre>
<p>In case you have conflicts with other Python installations, or some other mysterious problems, it’s a good idea to test things out at this point. Open a shell, type “python3”  and:</p>
<pre>import numpy
import Bio
import joblib
import pandas
import termcolor</pre>
<p>If you get any error messages something somewhere is wrong. Burn some incense and try again. If that doesn’t work try holy water.</p>
<p>Seqmagick is a standalone program, not a module, so check the installation by typing:</p>
<pre>seqmagick</pre>
<p>You should get a sensible error that is clearly seqmagick yelling at you and not your computer trying to find seqmagick.</p>
<p><span style="text-decoration: underline;"><strong>Install Homebrew and wget<br />
</strong></span></p>
<p>Older versions of paprica needed the programs pplacer and gappa, which had dependencies that could only be acquired for OSX for a package manager such as Homebrew.  These are no longer needed for paprica but I&#8217;ve left the Homebrew step in here because if you&#8217;re doing anything sciency with your computer you probably want a package manager, and I find wget to be a much more useful file fetching utility than curl.</p>
<p>To download <a href="http://brew.sh/">Homebrew</a> (assuming you don’t already have it) type:</p>
<pre>ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</pre>
<p>Follow the on-screen instructions.</p>
<p>Now install wget.</p>
<pre>brew install wget</pre>
<p><span style="text-decoration: underline;"><strong>Install Infernal, pplacer, and epa-ng</strong></span></p>
<p>Assuming all that went okay go ahead and download the software you need to execute just the paprica-run.sh portion of paprica. First, the excellent aligner <a href="http://eddylab.org/infernal/">Infernal</a>. From your home directory:</p>
<pre>wget http://eddylab.org/infernal/infernal-1.1.1-macosx-intel.tar.gz
tar -xzvf infernal-1.1.1-macosx-intel.tar.gz
mv infernal-1.1.1-macosx-intel infernal</pre>
<p>Then <a href="http://matsen.github.io/pplacer/">gappa</a>:</p>
<p>To install gappa you need <a href="https://www.gnu.org/software/make/">make</a> and <a href="https://cmake.org/">cmake</a>. And a fairly up-to-date  C+++11 compiler.</p>
<pre>brew install make
brew install cmake</pre>
<p>If you try to do the compilation  with AppleClang on MacOSX it will probably fail.  You need OpenMp, but  it is a know issue that AppleClang on MacOSx does not work well with OpenMp. Here we provide two alternatives based on a discussion in gappa&#8217;s page, and you can read about it <a href="https://github.com/lczech/gappa/issues/15">here</a>.</p>
<ol>
<li>Install gappa via conda, instead of compiling on your own (it does not need OpenMp): <a href="https://anaconda.org/bioconda/gappa">https://anaconda.org/bioconda/gappa</a></li>
<li>Instead of AppleClang, use a &#8220;proper&#8221; clang:</li>
</ol>
<pre>brew install llvm libomp</pre>
<p>You&#8217;ll need to set custom paths so that the new clang is used:</p>
<pre>#Example on how to do this:
export PATH="$ (brew --prefix llvm) /bin:$PATH";
export COMPILER=<code>/usr/local/opt/llvm/bin/clang++</code>
export <code>CFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include"</code>
export <code>CXXFLAGS="-I /usr/local/include -I/usr/local/opt/llvm/include"</code>
export <code>LDFLAGS="-L /usr/local/lib -L/usr/local/opt/llvm/lib"</code>
export <code>CXX=${COMPILER}</code>

#Not needed for all MacOS versions
#If you get this error: <code>"ld: unknown option: -platform_version"</code>
#You'll need to add:
export <code>CXXFLAGS="${CXXFLAGS} -mlinker-version=450"</code>
export <code>LDFLAGS="${LDFLAGS} -mlinker-version=450"</code></pre>
<p>And now you should be ready to install gappa:</p>
<pre>git clone --recursive https://github.com/lczech/gappa.git
cd gappa
make
cd ~</pre>
<p>And finally, epa-ng:</p>
<pre>brew install brewsci/bio/epa-ng</pre>
<p><span style="text-decoration: underline;"><strong>Add dependencies to PATH</strong></span></p>
<p>Now comes the tricky bit, you need to add the locations of the executables for these programs to your PATH variable.  This is a pretty important basic computing skill to master.  Try not to screw it up.  It isn’t hard to undo screw-ups, but it will freak you out because bash will suddenly be unable to find programs that it could find before. Before you continue please read the excellent summary of shell startup scripts as they pertain to OSX here:</p>
<p><a href="http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup">http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup</a></p>
<p>This tutorial attempts to provide a broad solution to shell startup scripts by sourcing .profile and .bash_profile in .bashrc.  I recommend you then only modify .bashrc, though this is not strictly necessary.</p>
<pre>## Open .bashrc for editing.

nano .bashrc</pre>
<p>At the top of the file type:</p>
<pre>source .bash_profile
source .profile</pre>
<p>Now navigate to the end of the file and paste the following, modifying as necessary (note: there are lots of syntactic variations for adding a location to PATH, the below commands are a little redundant but clear and easy to modify):</p>
<pre>export PATH=/Users/your-user-name/infernal/binaries:${PATH}
export PATH=/Users/your-user-name/infernal/easel:${PATH}
export PATH=/Users/your-user-name/pplacer:${PATH}
export PATH=/Users/your-user-name/epa-ng/bin:${PATH}
export PATH=/Users/your-user-name/paprica:${PATH}
export PATH=/Users/your-user-name/gappa/bin:${PATH}</pre>
<p>Don’t be the guy or gal who types your-user-name. Replace with your actual user name. Hit ctrl-o to write out the file, enter to save, and ctrl-x to exit nano.</p>
<p>Re-source .bashrc by typing:</p>
<pre>source .bashrc</pre>
<p>Confirm that you can execute the following programs by navigating to your home directory and executing each of the following commands:</p>
<pre>cmalign
esl-alimerge
gappa
epa-ng</pre>
<p>You should get an error message that is clearly from the program, not a bash error like “command not found”.</p>
<p><span style="text-decoration: underline;"><strong>Get paprica</strong></span></p>
<p>Okay, now you are ready to get paprica and do some analysis! You can clone the latest repository <a href="https://github.com/bowmanjeffs/paprica">here</a> :</p>
<pre>git clone https://github.com/bowmanjeffs/paprica.git</pre>
<p>Now make paprica-run.sh and python scripts executable.</p>
<pre>cd paprica 
chmod a+x paprica-run.sh 
chmod a+x *py</pre>
<p>At this point you should be ready to rock. Take a deep breath and type:</p>
<pre>./paprica-run.sh test bacteria</pre>
<p>This analyzes the file test.fasta against the bacteria database.  You should see a lot of output flash by on the screen, and you should see a number of new files in the directory with the prefix &#8220;test.&#8221;  Checkout the <a href="https://www.polarmicrobes.org/?p=1473">paprica analysis tutorial</a> and <a href="https://github.com/bowmanjeffs/paprica/wiki">manual</a> for more info on these files.</p>
<p>To run your own analysis, say on amazing_sample.fasta against the bacteria database, simply type:</p>
<pre>./paprica-run.sh amazing_sample bacteria</pre>
<p>Please, please, please, read the <a href="https://github.com/bowmanjeffs/paprica/wiki">manual</a> for further details. Remember that the fasta file you input should contain only reads that are properly QC’d (i.e. low quality ends and adapters and barcodes and such trimmed away) and denoised (<em>e.g.</em>, with dada2).</p>
<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Finstalling-paprica-on-mac-osx%2F&amp;linkname=Tutorial%3A%20Installing%20paprica%20on%20Mac%20OSX" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_mastodon" href="https://www.addtoany.com/add_to/mastodon?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Finstalling-paprica-on-mac-osx%2F&amp;linkname=Tutorial%3A%20Installing%20paprica%20on%20Mac%20OSX" title="Mastodon" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_email" href="https://www.addtoany.com/add_to/email?linkurl=https%3A%2F%2Fwww.polarmicrobes.org%2Finstalling-paprica-on-mac-osx%2F&amp;linkname=Tutorial%3A%20Installing%20paprica%20on%20Mac%20OSX" title="Email" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.polarmicrobes.org%2Finstalling-paprica-on-mac-osx%2F&#038;title=Tutorial%3A%20Installing%20paprica%20on%20Mac%20OSX" data-a2a-url="https://www.polarmicrobes.org/installing-paprica-on-mac-osx/" data-a2a-title="Tutorial: Installing paprica on Mac OSX"></a></p>]]></content:encoded>
					
					<wfw:commentRss>https://www.polarmicrobes.org/installing-paprica-on-mac-osx/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1477</post-id>	</item>
	</channel>
</rss>
