Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added values to synonyms table #383

Open
wants to merge 1 commit into
base: ete3
Choose a base branch
from

Conversation

bilalix
Copy link

@bilalix bilalix commented Oct 30, 2018

Added common names and authority values to the synonyms table and created get_synonyms() to retrieve them. Fix #382

@bilalix bilalix changed the title Added values to synonyms table (issue #382) Added values to synonyms table Oct 30, 2018
@cpommier
Copy link

Hi @jhcepas @fransua , any chance to see this merged in ete3? It is a little change that make the library very usefull.
Thanks in advance.

@jhcepas
Copy link
Member

jhcepas commented Mar 20, 2020

yes. Sorry we didn't find time to work on requests for a long time. We are now working on a new release and this addon sounds good. @dengzq1234 could you review and merge if everything is ok? I think we migth need a unitest function before merge though.

@cpommier
Copy link

Thank you!

@Anoosha-Sehar
Copy link

Hi, I'm using ETE3 package for getting common names and scientific names for NCBI id's. Currently, I'm working on extracting synonyms. Is there any chance that you will update it with 'get_synonym'? That would be really helpful.

@chanind
Copy link

chanind commented Jul 24, 2023

Until this is merged, I was able to manually create this as a separate method below:

def get_synonyms(ncbi, taxids):
    id2syn = {}
    # since they could be more than one synonym
    # we first create a dictionary filled with taxonID
    # and have an array of values/synonyms
    for tax in taxids:
        id2syn[tax] = []
    query = ",".join(['"%s"' % v for v in taxids])
    cmd = "select taxid, spname FROM synonym WHERE taxid IN (%s);" % query
    result = ncbi.db.execute(cmd)
    for tax, synonym in result.fetchall():
        if synonym:
            id2syn[tax].append(synonym)
    return id2syn

This works the same as this PR, except you need to pass the ncbi database object as the first parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Getting all synonyms, common names and Genbank common name along with the Scientific name of taxons
6 participants