.getProperty("user.home")
+ File.separatorChar
+ ".sifts_downloads" + File.separatorChar;
+
+ private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
+
+ private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
+
/**
* Initialises the Jalview Application Log
*/
SiftsSettings.setSiftDownloadDirectory(jalview.bin.Cache.getDefault(
"sifts_download_dir", DEFAULT_SIFTS_DOWNLOAD_DIR));
+ SiftsSettings.setFailSafePIDThreshold(jalview.bin.Cache.getDefault(
+ "sifts_fail_safe_pid_threshold",
+ DEFAULT_FAIL_SAFE_PID_THRESHOLD));
+
+ SiftsSettings.setCacheThresholdInDays(jalview.bin.Cache.getDefault(
+ "sifts_cache_threshold_in_days",
+ DEFAULT_CACHE_THRESHOLD_IN_DAYS));
+
System.out
.println("Jalview Version: " + codeVersion + codeInstallation);
}
} catch (SiftsException e)
{
- e.printStackTrace();
+ System.err.println(e.getMessage());
System.err
- .println(">>>>>>> SIFTs mapping could not be obtained... Now mapping with NW alignment");
+ .println(">>> Now switching mapping with NW alignment...");
setProgressBar(null);
- setProgressBar("SIFTs mapping could not be obtained... Now mapping with NW alignment");
+ setProgressBar(">>> Now switching mapping with NW alignment...");
seqToStrucMapping = getNWMappings(seq, pdbFile, maxChainId,
maxChain, pdb, maxAlignseq);
}
private final static String NEWLINE = System.lineSeparator();
- private final static int THRESHOLD_IN_DAYS = 2;
+ // private final static int CACHE_THRESHOLD_IN_DAYS = 2;
+ //
+ // private final static int FAIL_SAFE_PID_THRESHOLD = 30;
private String curSourceDBRef;
// The line below is required for unit testing... don't comment it out!!!
System.out.println(">>> SIFTS File already downloaded for " + pdbId);
- if (isFileOlderThanThreshold(siftsFile, THRESHOLD_IN_DAYS))
+ if (isFileOlderThanThreshold(siftsFile,
+ SiftsSettings.getCacheThresholdInDays()))
{
// System.out.println("Downloaded file is out of date, hence re-downloading...");
siftsFile = downloadSiftsFile(pdbId.toLowerCase());
Integer[] keys = mapping.keySet().toArray(new Integer[0]);
Arrays.sort(keys);
+ if (keys.length < 1)
+ {
+ throw new SiftsException(">>> Empty SIFTS mapping generated!!");
+ }
seqStart = keys[0];
seqEnd = keys[keys.length - 1];
output.append(NEWLINE).append(NEWLINE);
}
float pid = (float) matchedSeqCount / seqRes.length() * 100;
- if (pid < 2)
+ if (pid < SiftsSettings.getFailSafePIDThreshold())
{
- throw new SiftsException("Low PID detected for SIFTs mapping...");
+ throw new SiftsException(
+">>> Low PID detected for SIFTs mapping...");
}
output.append("Length of alignment = " + seqRes.length()).append(
NEWLINE);
package jalview.ws.sifts;
+import java.util.Objects;
+
public class SiftsSettings
{
private static boolean mapWithSifts = false;
private static String siftDownloadDirectory;
+ private static int cacheThresholdInDays;
+
+ private static int failSafePIDThreshold;
+
public static boolean isMapWithSifts()
{
return mapWithSifts;
{
SiftsSettings.siftDownloadDirectory = siftDownloadDirectory;
}
+
+ public static int getCacheThresholdInDays()
+ {
+ return cacheThresholdInDays;
+ }
+
+ public static void setCacheThresholdInDays(String cacheThresholdInDays)
+ {
+ Objects.requireNonNull(cacheThresholdInDays);
+ SiftsSettings.cacheThresholdInDays = Integer
+ .valueOf(cacheThresholdInDays);
+ }
+
+ public static int getFailSafePIDThreshold()
+ {
+ return failSafePIDThreshold;
+ }
+
+ public static void setFailSafePIDThreshold(String failSafePIDThreshold)
+ {
+ Objects.requireNonNull(failSafePIDThreshold);
+ SiftsSettings.failSafePIDThreshold = Integer
+ .valueOf(failSafePIDThreshold);
+ }
}