public class UniprotTaxonomy extends Object
Modifier and Type | Field and Description |
---|---|
static String |
SEPARATOR
The separator used to separate line contents.
|
Constructor and Description |
---|
UniprotTaxonomy()
Constructor.
|
Modifier and Type | Method and 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.
|
public static final String SEPARATOR
public void loadMapping(File speciesFile) throws IOException
speciesFile
- the species fileIOException
- exception thrown whenever an error occurred while
reading the file.public void downloadMapping(String name) throws MalformedURLException, org.apache.commons.httpclient.URIException, IOException
name
- the name of the species to queryMalformedURLException
- 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 mappingpublic Integer getId(String name, boolean query) throws MalformedURLException, org.apache.commons.httpclient.URIException, IOException
name
- the species namequery
- boolean indicating whether UniProt should be queried if the
species is not foundMalformedURLException
- 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 mappingpublic String getLatinName(Integer id)
id
- the NCBI taxonpublic String getCommonName(Integer id)
id
- the NCBI taxonpublic static void downloadTaxonomyFile(File destinationFile) throws IOException
destinationFile
- the file where to write the taxonomy fileIOException
- Exception thrown whenever an error occurred while
reading or writing data.Copyright © 2016. All rights reserved.