knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

First, load the rbims package.

library(rbims)

The second thing to do would be to read the KofamKOALA/KofamScan output.

Read the KEGG results

The function that rbims uses to read the raw output from the KofamKOALA/KofamScan data and make a table is read_ko.

?read_ko

rbims contains a test dataset that allow us to test this function. This dataset is saved in objects: ko_bin_table, ko_bin_mapp, and metadata. First download the KofamKOALA/KofamScan example file. It is recommended that you save this file in its own folder since this function will read all the text files in your path and concatenate them. An example of a path input is shown below:

ko_bin_table<-read_ko(data_kofam ="C:/Users/Bins")

The read_ko function will create a table that contains the abundance of each KO within each bin.
The write argument saves the formatted table generated in .tsv extension. When write = F gives you the output but not saves the table in your current directory.

head(ko_bin_table)

Map to the KEGG database

The function mapping_ko can now be used to map the KO and their abundance to the rest of the features of KEGG and rbims database.

ko_bin_mapp<-mapping_ko(ko_bin_table)
head(ko_bin_mapp)

You can export this to a table like this:

write.table(ko_bin_mapp, "KEGG_mapped.tsv", quote = F, sep = "\t", row.names = F, col.names = T)

Or setting write write = T.



mirnavazquez/RbiMs documentation built on Sept. 6, 2024, 1:05 p.m.