Comments (4)
Hi. You can use the kreport2mpa.py script from bracken (https://github.com/jenniferlu717/Bracken) to generate mpa reports and you can merge them using one of the metaphlan2 script and then load everything into phyloseq :)
from centrifuge.
I am also interested in that ... Very easy then to process the data with phyloseq
from centrifuge.
I was able to generate the mpa reports and merge them using MetaPhlAn2/utils/merge_metaphlan_tables.py but don't know how to import them using phyloseq R library. Please help.
from centrifuge.
This is a way to do it. Not sure if this is efficient.
It is heavily based from this page:
https://joey711.github.io/phyloseq/import-data.html
#This assumes you have access to Linux/Mac or other similar computing environment
#This needs to be done on Bash
# Create file for the OTU count
Computer:~$ cut -f2- Merged_File.txt > Merged_file_OTU.txt
#Create file for Taxonomy
Computer:~$ cut -f1 Merged_File.txt > Merged_file_TAX.txt
Remove “ID” from the taxonomy file before loading it in the R (This is the on the exterme top left of the screen
#Now in the R Environment
library(phyloseq)
otumat=read.table("Merged_file_OTU.txt",fill=TRUE,header=TRUE,check.names = F)
#Convert table to matrix
otumat<-as.matrix(otumat)
#Count the depth of taxonomy
nc<-max(count.fields("Merged_file_TAX.txt",sep="|"))
#Use the count in previous step to fill in the RANKS as R1,R2 and so forth
tax<-read.table(" Merged_file_TAX.txt",sep="|",col.names = paste("R",1:nc,sep=""),fill=T)
#Convert table to matrix
taxmat<-as.matrix(tax)
#Number your rows as OTUs
rownames(otumat)<-paste0("OTU",1:nrow(otumat))
#This makes sure that both the OTUs and Taxnomy have same row ids
rownames(taxmat)<-rownames(otumat)
#Creates OTU table for Phyloseq
OTU<-otu_table(otumat,taxa_are_rows = T)
#Create taxnomy table for phyloseq
TAX<-tax_table(taxmat)
#This is where you get the phyloseq object
physeq=phyloseq(OTU,TAX)
#Load optional meta data (This is must for anything meaningful)
samat=read.table("Metadata.tsv")
#Merge sample metadata with the phyloseq object
physeq_with_samples<-merge_phyloseq(physeq,sample_data(data.frame(samat)))
#Save the data for later use so we don't have to repeat the above steps
save(physeq_with_samples,file="phyobject.rda")
Thanks!
from centrifuge.
Related Issues (20)
- Error in centrifuge-download HOT 2
- centrifuge k-report not conforming to pavian HOT 2
- viral bacteria and archaea DB now very large >60G HOT 3
- Database download for Centrifuge HOT 222
- Print (un)classified sequences HOT 1
- (ERR): centrifuge-class exited with value 1 HOT 4
- Centrifuge Database Download Error HOT 6
- number of cpus detection :: possible oversubcribe problems HOT 2
- Classification filtering only virus/archaea sequences HOT 1
- Issues with --nodc, --justref and --noref parameters
- Warning: Encountered reference sequence with only gaps HOT 2
- Error compiling on macOS ventura HOT 1
- Unable to use sudo make install prefix=/usr/local HOT 4
- Unusual abundance results with custom classifier index HOT 6
- Calculate abundance without genome size taken into account
- make p_compressed = "could not find jellyfish" HOT 1
- Where are you Sulfobacillus? HOT 33
- error in make
- Custom database including only specific organisms for reads separation?
- Error when executing centrifuge "Argument list too long" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from centrifuge.