Class UniprotTaxonomy
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 Summary
-
Constructor Summary
Constructors Constructor Description UniprotTaxonomy()
Constructor. -
Method Summary
Modifier and Type Method Description void
downloadMapping(String name)
Downloads the mapping for the given species name from UniProt and saves it to the mapping file.static void
downloadTaxonomyFile(File destinationFile)
Downloads the UniProt taxonomy mapping to the given file.String
getCommonName(Integer id)
Returns the common name corresponding to the given NCBI taxon.Integer
getId(String name, boolean query)
Returns the NCBI taxon corresponding to the given species name.String
getLatinName(Integer id)
Returns the Latin name corresponding to the given NCBI taxon.void
loadMapping(File speciesFile)
Loads the species mapping from a file.
-
Field Details
-
SEPARATOR
The separator used to separate line contents.- See Also:
- Constant Field Values
-
-
Constructor Details
-
UniprotTaxonomy
public UniprotTaxonomy()Constructor.
-
-
Method Details
-
loadMapping
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, IOExceptionDownloads 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 malformedorg.apache.commons.httpclient.URIException
- exception thrown whenever an error occurred while downloading the mappingIOException
- 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, IOExceptionReturns the NCBI taxon corresponding to the given species name. Null if not found.- Parameters:
name
- the species namequery
- 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 malformedorg.apache.commons.httpclient.URIException
- exception thrown whenever an error occurred while downloading the mappingIOException
- exception thrown whenever an error occurred while downloading the mapping
-
getLatinName
Returns the Latin name corresponding to the given NCBI taxon.- Parameters:
id
- the NCBI taxon- Returns:
- the Latin name
-
getCommonName
Returns the common name corresponding to the given NCBI taxon.- Parameters:
id
- the NCBI taxon- Returns:
- the common name
-
downloadTaxonomyFile
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.
-