formatting otu.biom for picante/vegan

859 views
Skip to first unread message

Bil Landesman

unread,
Mar 13, 2013, 8:31:08 PM3/13/13
to qiime...@googlegroups.com
One more question for today...Does someone know how I can convert an OTU.biom table into a "community data" table that is formatted for use in the Picante and Vegan packages in R?

Jai Ram Rideout

unread,
Mar 13, 2013, 8:38:53 PM3/13/13
to qiime...@googlegroups.com
Hi Bil,

You can convert the .biom file to "classic" tab-separated format following the instructions on this page:


From there you can import that into R using the qiime/support_files/R/loaddata.r module (specifically the load.qiime.otu.table() function).

Hope this helps,
Jai


On Wed, Mar 13, 2013 at 5:31 PM, Bil Landesman <betterc...@gmail.com> wrote:
One more question for today...Does someone know how I can convert an OTU.biom table into a "community data" table that is formatted for use in the Picante and Vegan packages in R?

--
 
---
You received this message because you are subscribed to the Google Groups "Qiime Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qiime-forum...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Bil Landesman

unread,
Mar 14, 2013, 2:49:50 PM3/14/13
to qiime...@googlegroups.com
Thanks Jai. I will give this a shot! 

Bil Landesman

unread,
Mar 28, 2013, 3:19:18 PM3/28/13
to qiime...@googlegroups.com
I am finally getting around to trying this but it turns out that I might need you to walk me through this one. What I'm trying to do here is take an OTU table (right now it's in classic form) and convert it into the community data format used in picante/vegan. What I need are the sample names as row and the OTUs as columns. Thanks. 

Jai Ram Rideout

unread,
Mar 28, 2013, 3:48:27 PM3/28/13
to qiime...@googlegroups.com
Hi Bil,

Were you able to find the loaddata.r file that I mentioned? If not, I can point you to that.

The load.qiime.otu.table() function within that file will get you a table that is samples (rows) x OTUs (columns).You will need to load that function into R and then you can use it. For example, from within your R script:

source('/path/to/your/qiime/directory/qiime/support_files/R/loaddata.r')
otu.table <- load.qiime.otu.table('/path/to/your/otu/table')

Hope this helps,
Jai


On Thu, Mar 28, 2013 at 12:19 PM, Bil Landesman <betterc...@gmail.com> wrote:
I am finally getting around to trying this but it turns out that I might need you to walk me through this one. What I'm trying to do here is take an OTU table (right now it's in classic form) and convert it into the community data format used in picante/vegan. What I need are the sample names as row and the OTUs as columns. Thanks. 

--

Bil Landesman

unread,
Mar 28, 2013, 6:33:03 PM3/28/13
to qiime...@googlegroups.com
OK, this helps a lot. I found the load.R file. However, I am not sure how to point to it when in R. I am using R in Windows 7 and normally point to files by following some path within the C drive. Do I need to somehow share the qiime folder with Windows? I have only ever shared going in the opposite direction. from Windows to Qiime.

Jai Ram Rideout

unread,
Mar 28, 2013, 6:43:51 PM3/28/13
to qiime...@googlegroups.com
Hi Bil,

You might try running R from within the QIIME VirtualBox image. From the command line, run the "R" command (without quotes), which will bring up an R interpreter. You can then enter the commands that I previously gave you, though make sure to update the paths to reference the loaddata.r file and your OTU table.

Alternatively, you can try copying the contents of loaddata.r into a file that is accessible in Windows, and then run the commands in R on Windows. Note that I haven't tested any of this stuff on Windows, so there's no guarantees that it will work.

-Jai


On Thu, Mar 28, 2013 at 3:33 PM, Bil Landesman <betterc...@gmail.com> wrote:
OK, this helps a lot. I found the load.R file. However, I am not sure how to point to it when in R. I am using R in Windows 7 and normally point to files by following some path within the C drive. Do I need to somehow share the qiime folder with Windows? I have only ever shared going in the opposite direction. from Windows to Qiime.

--

Bil Landesman

unread,
Mar 28, 2013, 7:27:15 PM3/28/13
to qiime...@googlegroups.com
Yes! That did the trick. Thanks for walking me through it. By the way, what is "r" (lowercase)? I installed that before realizing that I needed to enter "R". 

Jai Ram Rideout

unread,
Mar 28, 2013, 7:32:35 PM3/28/13
to qiime...@googlegroups.com
Hi Bil,

On my machine (Mac OS X), both "r" and "R" commands are symlinks to the same R interpreter (so executing either one is equivalent). I'm not sure if your setup is the same though. Glad to hear it's working for you!

-Jai


On Thu, Mar 28, 2013 at 4:27 PM, Bil Landesman <betterc...@gmail.com> wrote:
Yes! That did the trick. Thanks for walking me through it. By the way, what is "r" (lowercase)? I installed that before realizing that I needed to enter "R". 

--

shashank gupta

unread,
Jan 21, 2015, 1:30:21 AM1/21/15
to qiime...@googlegroups.com
Hi,
i guess i am having the same problem. i have a biom file which i converted to the text file by using command
biom convert -i F16.biom -o F16_1.txt --table-type="OTU table" -b
i am trying to use Vegan package, but i am unable to import the file.

the command i am using in Veagn (R studio) is

> Vegan <- F16_1.txt
Error: object 'F16_1.txt' not found

and i tried to use other command as well

>  load.qiime.otu.table(F16_1.txt)
Error: could not find function "load.qiime.otu.table"

how can i import the file in Vegan ?

Best!
Shashank

zech xu

unread,
Jan 21, 2015, 2:36:22 AM1/21/15
to qiime...@googlegroups.com
It mentioned in this thread:

source('/path/to/your/qiime/directory/qiime/support_files/R/loaddata.r')
otu.table <- load.qiime.otu.table('/path/to/your/otu/table')

And you can also use read.table() in R to do that.

shashank gupta

unread,
Jan 30, 2015, 5:37:22 AM1/30/15
to qiime...@googlegroups.com
i  tried the command you mentioned above.

read.table(F16.biom)
and
read.table(F16.txt)


its not working.

Best !
Shashank

Sophie

unread,
Jan 30, 2015, 7:13:10 AM1/30/15
to qiime...@googlegroups.com
Hi Shashank,
biom convert -i /path/to/otu_table.biom -o /path/to/otu_table.txt --table-type="OTU table" --to-tsv --header-key taxonomy --output-metadata-id "Consensus Lineage"

in R:
source('/path/to/your/qiime/directory/qiime/support_files/R/loaddata.r')
otu.table <- load.qiime.otu.table('/path/to/your/otu_table.txt')

This should work.  You can also use the biom package in R, as long as your otu table is json formatted.
Thanks,
Sophie
Reply all
Reply to author
Forward
0 new messages