git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-1479 refactored DBRef fetching code to StructureChooser to enable applet build
[jalview.git]
/
src
/
jalview
/
ws
/
sifts
/
SiftsClient.java
diff --git
a/src/jalview/ws/sifts/SiftsClient.java
b/src/jalview/ws/sifts/SiftsClient.java
index
106a66e
..
00da2fc
100644
(file)
--- a/
src/jalview/ws/sifts/SiftsClient.java
+++ b/
src/jalview/ws/sifts/SiftsClient.java
@@
-96,14
+96,6
@@
public class SiftsClient implements SiftsClientI
private static final String SIFTS_FTP_BASE_URL = "ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
private static final String SIFTS_FTP_BASE_URL = "ftp://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
- public static final String DEFAULT_SIFTS_DOWNLOAD_DIR = System
- .getProperty("user.home")
- + File.separatorChar
- + ".sifts_downloads" + File.separatorChar;
-
- public static final String SIFTS_DOWNLOAD_DIR = jalview.bin.Cache
- .getDefault("sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR);
-
private final static String NEWLINE = System.lineSeparator();
private String curSourceDBRef;
private final static String NEWLINE = System.lineSeparator();
private String curSourceDBRef;
@@
-185,12
+177,11
@@
public class SiftsClient implements SiftsClientI
*/
private Entry parseSIFTs(File siftFile) throws SiftsException
{
*/
private Entry parseSIFTs(File siftFile) throws SiftsException
{
- try
+ try (InputStream in = new FileInputStream(siftFile);
+ GZIPInputStream gzis = new GZIPInputStream(in);)
{
System.out.println("File : " + siftFile.getAbsolutePath());
JAXBContext jc = JAXBContext.newInstance("jalview.xml.binding.sifts");
{
System.out.println("File : " + siftFile.getAbsolutePath());
JAXBContext jc = JAXBContext.newInstance("jalview.xml.binding.sifts");
- InputStream in = new FileInputStream(siftFile);
- GZIPInputStream gzis = new GZIPInputStream(in);
XMLStreamReader streamReader = XMLInputFactory.newInstance()
.createXMLStreamReader(gzis);
Unmarshaller um = jc.createUnmarshaller();
XMLStreamReader streamReader = XMLInputFactory.newInstance()
.createXMLStreamReader(gzis);
Unmarshaller um = jc.createUnmarshaller();
@@
-228,7
+219,8
@@
public class SiftsClient implements SiftsClientI
*/
public static File getSiftsFile(String pdbId) throws SiftsException
{
*/
public static File getSiftsFile(String pdbId) throws SiftsException
{
- File siftsFile = new File(SIFTS_DOWNLOAD_DIR + pdbId.toLowerCase()
+ File siftsFile = new File(SiftsSettings.getSiftDownloadDirectory()
+ + pdbId.toLowerCase()
+ ".xml.gz");
if (siftsFile.exists())
{
+ ".xml.gz");
if (siftsFile.exists())
{
@@
-253,8
+245,10
@@
public class SiftsClient implements SiftsClientI
{
String siftFile = pdbId + ".xml.gz";
String siftsFileFTPURL = SIFTS_FTP_BASE_URL + siftFile;
{
String siftFile = pdbId + ".xml.gz";
String siftsFileFTPURL = SIFTS_FTP_BASE_URL + siftFile;
- String downloadedSiftsFile = SIFTS_DOWNLOAD_DIR + siftFile;
- File siftsDownloadDir = new File(SIFTS_DOWNLOAD_DIR);
+ String downloadedSiftsFile = SiftsSettings.getSiftDownloadDirectory()
+ + siftFile;
+ File siftsDownloadDir = new File(
+ SiftsSettings.getSiftDownloadDirectory());
if (!siftsDownloadDir.exists())
{
siftsDownloadDir.mkdirs();
if (!siftsDownloadDir.exists())
{
siftsDownloadDir.mkdirs();
@@
-292,7
+286,8
@@
public class SiftsClient implements SiftsClientI
*/
public static boolean deleteSiftsFileByPDBId(String pdbId)
{
*/
public static boolean deleteSiftsFileByPDBId(String pdbId)
{
- File siftsFile = new File(SIFTS_DOWNLOAD_DIR + pdbId.toLowerCase()
+ File siftsFile = new File(SiftsSettings.getSiftDownloadDirectory()
+ + pdbId.toLowerCase()
+ ".xml.gz");
if (siftsFile.exists())
{
+ ".xml.gz");
if (siftsFile.exists())
{
@@
-325,14
+320,6
@@
public class SiftsClient implements SiftsClientI
DBRefEntry[] dbRefs = seq.getDBRefs();
if (dbRefs == null || dbRefs.length < 1)
{
DBRefEntry[] dbRefs = seq.getDBRefs();
if (dbRefs == null || dbRefs.length < 1)
{
- final SequenceI[] seqs = new SequenceI[] { seq };
- new jalview.ws.DBRefFetcher(seqs, null, null, null, false)
- .fetchDBRefs(true);
- dbRefs = seq.getDBRefs();
- }
-
- if (dbRefs == null || dbRefs.length < 1)
- {
throw new SiftsException("Could not get source DB Ref");
}
throw new SiftsException("Could not get source DB Ref");
}