public class GeneFactory extends Object
Modifier and Type | Field and Description |
---|---|
static String |
GENE_MAPPING_FILE_SUFFIX
The suffix to use for files containing gene mappings.
|
static String |
GO_MAPPING_FILE_SUFFIX
The suffix to use for files containing GO mappings.
|
static String |
SEPARATOR
The separator used to separate line contents.
|
Modifier and Type | Method and Description |
---|---|
void |
createDefaultGeneMappingFiles(File aEnsemblVersionsFile,
File aGoDomainsFile,
File aDefaultSpeciesGoMappingsFile,
File aDefaultSpeciesGeneMappingFile,
boolean updateEqualVersion)
Copies the given gene mapping files to the gene mappings folder.
|
void |
downloadGeneMappings(String ensemblType,
String ensemblSchemaName,
String ensemblDatasetName,
String ensemblVersion,
WaitingHandler waitingHandler)
Download the gene mappings.
|
boolean |
downloadGeneSequences(File destinationFile,
String ensemblType,
String ensemblSchemaName,
String ensemblDbName,
WaitingHandler waitingHandler)
Download the gene sequences mappings.
|
boolean |
downloadGoMappings(String ensemblType,
String ensemblSchemaName,
String ensemblDbName,
boolean swissProtMapping,
WaitingHandler waitingHandler)
Download the GO mappings.
|
boolean |
downloadMappings(WaitingHandler waitingHandler,
Integer taxon)
Try to download the gene and GO mappings for the currently selected
species.
|
String |
getEnsemblVersion(Integer taxon)
Returns the Ensembl version for a given species.
|
Integer |
getEnsemblVersionFromFile(File ensemblVersionsFile,
String species)
Gets the Ensembl version of a given species from a file.
|
static File |
getEnsemblVersionsFile()
Returns the Ensembl version file.
|
static File |
getGeneMappingFile(String ensemblDatasetName)
Returns the gene mapping file.
|
static File |
getGeneMappingFolder()
Returns the path to the folder containing the gene mapping files.
|
GeneMaps |
getGeneMaps(GenePreferences genePreferences,
WaitingHandler waitingHandler)
Returns the gene maps for the FASTA file loaded in the factory.
|
static File |
getGoDomainsFile()
Returns the GO domains file.
|
static File |
getGoMappingFile(String ensemblDatasetName)
Returns the GO mapping file.
|
static GeneFactory |
getInstance()
Static method returning the instance of the factory.
|
void |
initialize(String jarFilePath)
Initializes the factory.
|
void |
loadEnsemblSpeciesVersions(File ensemblVersionsFile)
Loads the given Ensembl species file.
|
boolean |
newVersionExists(Integer taxon)
Returns true if a newer version of the species mapping exists in Ensembl.
|
boolean |
queryEnsembl(String requestXml,
File destinationFile,
String ensemblType)
Sends an XML query to Ensembl and writes the result in a text file.
|
boolean |
queryEnsembl(String requestXml,
File destinationFile,
String ensemblType,
WaitingHandler waitingHandler)
Sends an XML query to Ensembl and writes the result in a text file.
|
boolean |
queryEnsembl(String requestXml,
String waitingText,
File destinationFile,
String ensemblType,
WaitingHandler waitingHandler)
Sends an XML query to Ensembl and writes the result in a text file.
|
static void |
setGeneMappingFolder(String geneMappingFolder)
Sets the folder where gene mappings are saved.
|
void |
updateEnsemblVersion(String ensemblDatasetName,
String ensemblVersion)
Update the Ensembl version for the given species in the local map and in
the Ensembl versions file.
|
public static final String SEPARATOR
public static final String GENE_MAPPING_FILE_SUFFIX
public static final String GO_MAPPING_FILE_SUFFIX
public static GeneFactory getInstance()
public void initialize(String jarFilePath) throws IOException
jarFilePath
- the path to the jar fileIOException
- Exception thrown if an error occurs while
reading the species mappingpublic GeneMaps getGeneMaps(GenePreferences genePreferences, WaitingHandler waitingHandler) throws IOException
genePreferences
- the gene preferenceswaitingHandler
- waiting handler displaying progress for the
download and allowing canceling of the progress.IOException
- thrown whenever an error occurs while reading
or writing data.public boolean downloadGeneSequences(File destinationFile, String ensemblType, String ensemblSchemaName, String ensemblDbName, WaitingHandler waitingHandler) throws MalformedURLException, IOException
destinationFile
- the destination file where to save the gene
sequencesensemblType
- the Ensembl type, e.g., default or plantsensemblSchemaName
- the Ensembl schema name, e.g., default or
plants_mart_18ensemblDbName
- the Ensembl DB name of the selected specieswaitingHandler
- waiting handler displaying progress and allowing
canceling the processMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occurspublic boolean downloadGoMappings(String ensemblType, String ensemblSchemaName, String ensemblDbName, boolean swissProtMapping, WaitingHandler waitingHandler) throws MalformedURLException, IOException
ensemblType
- the Ensembl type, e.g., default or plantsensemblSchemaName
- the Ensembl schema name, e.g., default or
plants_mart_18ensemblDbName
- the Ensembl db name of the selected speciesswissProtMapping
- if true, use the uniprot_swissprot_accession
parameter, if false use the uniprot_sptrembl parameterwaitingHandler
- waiting handler displaying progress and allowing
canceling the processMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occurspublic boolean queryEnsembl(String requestXml, File destinationFile, String ensemblType) throws MalformedURLException, IOException
requestXml
- the XML requestdestinationFile
- the file where to save the resultsensemblType
- the Ensembl type, e.g., default or plantsMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occurspublic boolean queryEnsembl(String requestXml, File destinationFile, String ensemblType, WaitingHandler waitingHandler) throws MalformedURLException, IOException
requestXml
- the XML requestdestinationFile
- the file where to save the resultsensemblType
- the Ensembl type, e.g., default or plantswaitingHandler
- waiting handler displaying progress and allowing
canceling the processMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occurspublic boolean queryEnsembl(String requestXml, String waitingText, File destinationFile, String ensemblType, WaitingHandler waitingHandler) throws MalformedURLException, IOException
requestXml
- the XML requestdestinationFile
- the file where to save the resultsensemblType
- the Ensembl type, e.g., default or plantswaitingHandler
- waiting handler displaying progress and allowing
canceling the processwaitingText
- the text to write in case a progress dialog is usedMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occurspublic void downloadGeneMappings(String ensemblType, String ensemblSchemaName, String ensemblDatasetName, String ensemblVersion, WaitingHandler waitingHandler) throws MalformedURLException, IOException, IllegalArgumentException
ensemblType
- the Ensembl type, e.g., default or plantsensemblSchemaName
- the Ensembl schema name, e.g., default or
plants_mart_18ensemblDatasetName
- the Ensembl dataset name of the selected
speciesensemblVersion
- the Ensembl versionwaitingHandler
- the waiting handlerMalformedURLException
- if an MalformedURLException occursIOException
- if an IOException occursIllegalArgumentException
- if an IllegalArgumentException occurspublic static File getGeneMappingFolder()
public static void setGeneMappingFolder(String geneMappingFolder)
geneMappingFolder
- the folder where gene mappings are savedpublic void createDefaultGeneMappingFiles(File aEnsemblVersionsFile, File aGoDomainsFile, File aDefaultSpeciesGoMappingsFile, File aDefaultSpeciesGeneMappingFile, boolean updateEqualVersion)
aEnsemblVersionsFile
- the Ensembl versions fileaGoDomainsFile
- the GO domains fileaDefaultSpeciesGoMappingsFile
- the default species GO mappings fileaDefaultSpeciesGeneMappingFile
- the default species gene mappings
fileupdateEqualVersion
- if true, the version is updated with equal
version numbers, false, only update if the new version is newerpublic void updateEnsemblVersion(String ensemblDatasetName, String ensemblVersion) throws IOException
ensemblDatasetName
- the dataset name of the species to update,
e.g., hsapiens_gene_ensemblensemblVersion
- the new Ensembl versionIOException
- if an IOException occurspublic Integer getEnsemblVersionFromFile(File ensemblVersionsFile, String species) throws IOException
ensemblVersionsFile
- the Ensembl versions filespecies
- the species of interestIOException
- thrown whenever an error occurred while reading the
filepublic void loadEnsemblSpeciesVersions(File ensemblVersionsFile) throws FileNotFoundException, IOException
ensemblVersionsFile
- the Ensembl species file to loadFileNotFoundException
- if an FileNotFoundException occursIOException
- if an IOException occurspublic boolean downloadMappings(WaitingHandler waitingHandler, Integer taxon) throws IOException
waitingHandler
- the waiting handlertaxon
- the NCBI taxon of the speciesIOException
- exception thrown whenever an error occurred
while reading the mapping filespublic static File getGeneMappingFile(String ensemblDatasetName)
ensemblDatasetName
- the Ensembl dataset namepublic static File getGoMappingFile(String ensemblDatasetName)
ensemblDatasetName
- the Ensembl dataset namepublic static File getEnsemblVersionsFile()
public static File getGoDomainsFile()
public String getEnsemblVersion(Integer taxon)
taxon
- the NCBI taxon of the speciespublic boolean newVersionExists(Integer taxon)
taxon
- the NCBI taxon of the speciesCopyright © 2016. All rights reserved.