<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Matlab usage</title><link>https://sourceforge.net/p/quikr/wiki/Matlab%2520usage/</link><description>Recent changes to Matlab usage</description><atom:link href="https://sourceforge.net/p/quikr/wiki/Matlab%20usage/feed" rel="self"/><language>en</language><lastBuildDate>Mon, 20 May 2013 15:21:01 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/quikr/wiki/Matlab%20usage/feed" rel="self" type="application/rss+xml"/><item><title>Matlab usage modified by David Koslicki</title><link>https://sourceforge.net/p/quikr/wiki/Matlab%2520usage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Koslicki</dc:creator><pubDate>Mon, 20 May 2013 15:21:01 -0000</pubDate><guid>https://sourceforge.net6465c73d4d70a8312e1981498ae921a877fdddb6</guid></item><item><title>Matlab usage modified by David Koslicki</title><link>https://sourceforge.net/p/quikr/wiki/Matlab%2520usage/</link><description>&lt;div class="markdown_content"&gt;&lt;h1 id="quikrs-matlab-implementation"&gt;Quikr's Matlab Implementation&lt;/h1&gt;
&lt;p&gt;The Quikr implementation works in Matlab and also works in Octave, but the&lt;br /&gt;
Octave version will run much slower&lt;/p&gt;
&lt;h2 id="quikr-example"&gt;Quikr Example&lt;/h2&gt;
&lt;p&gt;This is an example of how to run Quikr. Before you try the example please make&lt;br /&gt;
make sure that you are in the quikr's matlab directory (src/matlab/):&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;cd&lt;/span&gt; &lt;span class="n"&gt;quikr&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;matlab&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h3 id="using-quikr-with-the-default-databse"&gt;Using Quikr with the default databse&lt;/h3&gt;
&lt;p&gt;This is the full path name to your data file:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;fastafilename&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'/path/to/quikr-code/testfastafile.fa'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This will give the predicted reconstruction frequencies using the default&lt;br /&gt;
training database trainset7_112011.fa from RDP version 2.4 Xstar will be on the&lt;br /&gt;
same basis as trainset7_112011.fa, so to get the sequences that are predicted&lt;br /&gt;
to be present in your sample:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;quikr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fastafilename&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Read in the training database.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Note fastaread is not by default included in Octave. The fastaread.m file is&lt;br /&gt;
included in the Quikr download directory and is directly compatible with&lt;br /&gt;
Matlab.&lt;/em&gt;&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="p"&gt;]=&lt;/span&gt;&lt;span class="n"&gt;fastaread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'trainset7\_112011.fa'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the indicies of the sequences quikr predicts are in your sample&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Convert the concentrations into a cell array&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;proportionscell&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;num2cell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the names of the sequences&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;namescell&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This cell array contains the (unsorted) names of the reconstructed sequences and&lt;br /&gt;
their concentrations (in the first and second columns respectively) so to find&lt;br /&gt;
which sequence is the most abundant in your mixture:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;namesandproportions&lt;/span&gt;&lt;span class="p"&gt;={&lt;/span&gt;&lt;span class="n"&gt;namescell&lt;/span&gt;&lt;span class="p"&gt;{:};&lt;/span&gt; &lt;span class="n"&gt;proportionscell&lt;/span&gt;&lt;span class="p"&gt;{:}};&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the maximum value and it's position&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;]=&lt;/span&gt;&lt;span class="n"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Note that this does not imply this specific strain or species is in your sample,&lt;br /&gt;
just that phylum/class/order/family/genus this species belongs to is in your&lt;br /&gt;
sample.&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;namesandproportions&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;1&lt;span class="p"&gt;:&lt;/span&gt;2&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;ind&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h3 id="using-quikr-with-a-custom-trained-database"&gt;Using Quikr With A Custom Trained Database&lt;/h3&gt;
&lt;p&gt;If you would like to use a custom training database, follow the following steps:&lt;/p&gt;
&lt;p&gt;Full path name to your data file: &lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;fastafilename&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'/path/to/your/fastafile.fasta'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Full path to the FASTA file you wish to use as a training database&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;trainingdatabasefilename&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'/path/to/your/trainingdatabase.fasta'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Pick a k-mer size (typically 6 )&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;6&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This will return the training database then to do the reconstruction&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;trainingmatrix&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;quikrTrain&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trainingdatabasefilename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Pick a lambda (larger lambda -&amp;gt; theoretically predicted concentrations are&lt;br /&gt;
closer to actual concentrations), this depends on k-mer size picked, also size&lt;br /&gt;
and condition of the TrainingMatrix&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;10000&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the predicted reconstruction frequencies&lt;br /&gt;
Again, xstar is on the same basis as the TrainingMatrix, so to get the sequences&lt;br /&gt;
that are predicted to be present in your sample:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;quikrCustomTrained&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trainingmatrix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;fastafilename&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="n"&gt;lambda&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Read in the training database&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="p"&gt;]=&lt;/span&gt;&lt;span class="n"&gt;fastaread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;trainingdatabasefilename&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the indices of the sequences quikr predicts are in your sample&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Convert the concentrations into a cell array&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;proportionscell&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;num2cell&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;xstar&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Get the names of the sequences&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;namescell&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nonzeroentries&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This cell array contains the (unsorted) names of the reconstructed sequences and&lt;br /&gt;
their concentrations (in the first and second columns respectively)&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;namesandproportions&lt;/span&gt;&lt;span class="p"&gt;={&lt;/span&gt;&lt;span class="n"&gt;namescell&lt;/span&gt;&lt;span class="p"&gt;{:};&lt;/span&gt; &lt;span class="n"&gt;proportionscell&lt;/span&gt;&lt;span class="p"&gt;{:}};&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;


&lt;h3 id="using-multifasta2otum"&gt;Using Multifasta2otu.m&lt;/h3&gt;
&lt;p&gt;Usage tips:&lt;br /&gt;
&lt;em&gt; Please name fasta files of sample reads with .fa&amp;lt;&lt;/em&gt;&amp;gt; and place them&lt;br /&gt;
  into one directory without any other f ile in that directory (for example, no&lt;br /&gt;
  hidden files that the operating system may generate, are allowed in that&lt;br /&gt;
  direct ory)&lt;br /&gt;
&lt;em&gt; Note: When making your QIIME Metadata file, the sample id's must match the&lt;br /&gt;
  fasta file prefix names&lt;/em&gt; Fasta files of reads must have a suffix that starts with .fa (e.g.: .fasta and&lt;br /&gt;
  .fa are valid while .fna is NOT)&lt;br /&gt;
* Modify the top of the Matlab/Octave scripts for ,&lt;br /&gt;
  , , and &lt;/p&gt;
&lt;p&gt;To use with QIIME, one must run the QIIME conversion tool on our OTU table&lt;br /&gt;
output:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span class="n"&gt;convert_biom&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;py&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nb"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;quikr_otu_table&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;txt&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;quikr_otu&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;biom&lt;/span&gt;
&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;biom_table_type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&amp;quot;&lt;span class="n"&gt;otu&lt;/span&gt; &lt;span class="n"&gt;table&lt;/span&gt;&amp;quot;
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;4-step QIIME procedure after using Quikr to obtain 3D PCoA graphs:&lt;br /&gt;
(Note: Our code works much better with WEIGHTED Unifrac as opposed to&lt;br /&gt;
Unweighted.)&lt;/p&gt;
&lt;p&gt;Pre-requisites:&lt;br /&gt;
1. &lt;br /&gt;
2. the tree of the database sequences that were used (e.g.  dp7_mafft.fasttree,&lt;br /&gt;
   gg_94_otus_4feb2011.tre, etc.)&lt;br /&gt;
3. your-defined &lt;/p&gt;
&lt;p&gt;The QIIME procedue:&lt;br /&gt;
    convert_biom.py -i  -o .biom --biom_table_type="otu table"&lt;br /&gt;
    beta_diversity.py -i .biom -m weighted_unifrac -o beta_div -t  (example: rdp7_mafft.fasttree)&amp;gt;&lt;br /&gt;
    principal_coordinates.py -i beta_div/weighted_unifrac_.txt -o _weighted.txt&lt;br /&gt;
    make_3d_plots.py -i _weighted.txt -o &amp;lt;3d_pcoa_plotdirectory&amp;gt; -m &lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">David Koslicki</dc:creator><pubDate>Wed, 15 May 2013 16:47:43 -0000</pubDate><guid>https://sourceforge.net40787d64f0cf230007e713bfb93b801119f0a554</guid></item></channel></rss>