Giter Site home page Giter Site logo

Comments (5)

gcuster1991 avatar gcuster1991 commented on June 15, 2024

Following.

from fungaltraits.

matevzl533 avatar matevzl533 commented on June 15, 2024

you could use dplyr filter function to filter through the db with a vector of your taxa eg:

db %>%
filter(., genus %in% taxa$genus)

db...object with funfun db
taxa...object with you taxonomies

from fungaltraits.

sandipansamaddar avatar sandipansamaddar commented on June 15, 2024

Thanks for the reply but sorry @matevzl533 that I couldn't understand it. Right now I have a count file (counts.tsv) and a taxonomy file (taxa.tsv). So how shall I proceed if I want to use FungalTraits with my data. Can I assign functions to each ASV ? Can you write the code in a bit detail. I am not an expert in R so its difficult for me to understand and I apologize for that.

Appreciate your help.

Sandipan

from fungaltraits.

matevzl533 avatar matevzl533 commented on June 15, 2024

ok.

Funfun db
db is the object into which you have loaded the fungal traits file with:

db <- fungal _traits()

Genus is the column in db that contains the fungal genera. You can check it with:

db$Genus

Your taxonomy file
taxa is the object into which you load taxa.tsv file - I guess it has columns with different taxonomic levels (eg. family, genus, species)`. With taxa$genus you select the column in taxa object that contains fungal genera.

Filtering method
then you just run the code from above:

db %>%
 filter(., Genus %in% taxa$genus)

this will list the fungal traits db, but only rows that contain the same fungal genera as your taxa object.

Possible additional problem
If your taxonomic names are clean eg. Glomus, then it works as described above. If you have additional parts denominating taxonomic level like f__Glomeraceae, g__Glomus (GreenGenes format), then you have to remove the first part with something like:

taxa <- taxa %>%
 mutate(genus = str_split_fixed(genus, “__”, 2)[2]

str_split_fixed is a function from library stringr. filter and mutate functions are from dplyr library.

from fungaltraits.

sandipansamaddar avatar sandipansamaddar commented on June 15, 2024

WOW @matevzl533 . That worked. Thank you so much. I appreciate your help.

Sandipan

from fungaltraits.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.