java.lang.Object
com.compomics.util.experiment.biology.taxonomy.mappings.UniprotTaxonomy

public class UniprotTaxonomy
extends Object
Mapping of the UniProt taxonomy.
Author:
Marc Vaudel
  • Field Details

  • Constructor Details

  • Method Details

    • loadMapping

      public void loadMapping​(File speciesFile) throws IOException
      Loads the species mapping from a file. Previous mapping will be overwritten.
      Parameters:
      speciesFile - the species file
      Throws:
      IOException - exception thrown whenever an error occurred while reading the file.
    • downloadMapping

      public void downloadMapping​(String name) throws MalformedURLException, org.apache.commons.httpclient.URIException, IOException
      Downloads the mapping for the given species name from UniProt and saves it to the mapping file.
      Parameters:
      name - the name of the species to query
      Throws:
      MalformedURLException - exception thrown whenever the query URL is malformed
      org.apache.commons.httpclient.URIException - exception thrown whenever an error occurred while downloading the mapping
      IOException - exception thrown whenever an error occurred while downloading the mapping
    • getId

      public Integer getId​(String name, boolean query) throws MalformedURLException, org.apache.commons.httpclient.URIException, IOException
      Returns the NCBI taxon corresponding to the given species name. Null if not found.
      Parameters:
      name - the species name
      query - boolean indicating whether UniProt should be queried if the species is not found
      Returns:
      the taxon
      Throws:
      MalformedURLException - exception thrown whenever the query URL is malformed
      org.apache.commons.httpclient.URIException - exception thrown whenever an error occurred while downloading the mapping
      IOException - exception thrown whenever an error occurred while downloading the mapping
    • getLatinName

      public String getLatinName​(Integer id)
      Returns the Latin name corresponding to the given NCBI taxon.
      Parameters:
      id - the NCBI taxon
      Returns:
      the Latin name
    • getCommonName

      public String getCommonName​(Integer id)
      Returns the common name corresponding to the given NCBI taxon.
      Parameters:
      id - the NCBI taxon
      Returns:
      the common name
    • downloadTaxonomyFile

      public static void downloadTaxonomyFile​(File destinationFile) throws IOException
      Downloads the UniProt taxonomy mapping to the given file.
      Parameters:
      destinationFile - the file where to write the taxonomy file
      Throws:
      IOException - Exception thrown whenever an error occurred while reading or writing data.