X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fsifts%2FSiftsClient.java;fp=src%2Fjalview%2Fws%2Fsifts%2FSiftsClient.java;h=68af7c3f570f36ca3b9ce35b39eb9ee9c89b57f0;hb=be762d8d9c71a7aa3121e845c45911c7192b7827;hp=2ff4a8b3922fc6e1f3ee6d1a98addf68430b32b4;hpb=d1bb7a31fc091606aedbc255a5766ac79e36fa91;p=jalview.git diff --git a/src/jalview/ws/sifts/SiftsClient.java b/src/jalview/ws/sifts/SiftsClient.java index 2ff4a8b..68af7c3 100644 --- a/src/jalview/ws/sifts/SiftsClient.java +++ b/src/jalview/ws/sifts/SiftsClient.java @@ -128,8 +128,8 @@ public class SiftsClient implements SiftsClientI private enum ResidueDetailType { - NAME_SEC_STRUCTURE("nameSecondaryStructure"), CODE_SEC_STRUCTURE( - "codeSecondaryStructure"), ANNOTATION("Annotation"); + NAME_SEC_STRUCTURE("nameSecondaryStructure"), + CODE_SEC_STRUCTURE("codeSecondaryStructure"), ANNOTATION("Annotation"); private String code; private ResidueDetailType(String code) @@ -261,8 +261,9 @@ public class SiftsClient implements SiftsClientI try { attr = Files.readAttributes(filePath, BasicFileAttributes.class); - diffInDays = (int) ((new Date().getTime() - attr.lastModifiedTime() - .toMillis()) / (1000 * 60 * 60 * 24)); + diffInDays = (int) ((new Date().getTime() + - attr.lastModifiedTime().toMillis()) + / (1000 * 60 * 60 * 24)); // System.out.println("Diff in days : " + diffInDays); } catch (IOException e) { @@ -279,8 +280,8 @@ public class SiftsClient implements SiftsClientI * @throws SiftsException * @throws IOException */ - public static File downloadSiftsFile(String pdbId) throws SiftsException, - IOException + public static File downloadSiftsFile(String pdbId) + throws SiftsException, IOException { if (pdbId.contains(".cif")) { @@ -311,8 +312,8 @@ public class SiftsClient implements SiftsClientI } outputStream.close(); inputStream.close(); -// System.out.println(">>> File downloaded : " + downloadedSiftsFile -// + " took " + (System.currentTimeMillis() - now) + "ms"); + // System.out.println(">>> File downloaded : " + downloadedSiftsFile + // + " took " + (System.currentTimeMillis() - now) + "ms"); return new File(downloadedSiftsFile); } @@ -360,11 +361,11 @@ public class SiftsClient implements SiftsClientI { continue; } - String canonicalSource = DBRefUtils.getCanonicalName(dbRef - .getSource()); + String canonicalSource = DBRefUtils + .getCanonicalName(dbRef.getSource()); if (isValidDBRefEntry(dbRef) - && (canonicalSource.equalsIgnoreCase(DBRefSource.UNIPROT) || canonicalSource - .equalsIgnoreCase(DBRefSource.PDB))) + && (canonicalSource.equalsIgnoreCase(DBRefSource.UNIPROT) + || canonicalSource.equalsIgnoreCase(DBRefSource.PDB))) { return dbRef; } @@ -511,8 +512,9 @@ public class SiftsClient implements SiftsClientI int orignalSeqStart = seq.getStart(); if (orignalSeqStart >= 1) { - int subSeqStart = (seqStart >= orignalSeqStart) ? seqStart - - orignalSeqStart : 0; + int subSeqStart = (seqStart >= orignalSeqStart) + ? seqStart - orignalSeqStart + : 0; int subSeqEnd = seqEnd - (orignalSeqStart - 1); subSeqEnd = originalSeq.length() < subSeqEnd ? originalSeq.length() : subSeqEnd; @@ -573,12 +575,11 @@ public class SiftsClient implements SiftsClientI { pdbRefDb = cRefDb; } - if (cRefDb.getDbCoordSys() - .equalsIgnoreCase(seqCoordSys.getName()) + if (cRefDb.getDbCoordSys().equalsIgnoreCase(seqCoordSys.getName()) && isAccessionMatched(cRefDb.getDbAccessionId())) { - currSeqIndex = getLeadingIntegerValue( - cRefDb.getDbResNum(), UNASSIGNED); + currSeqIndex = getLeadingIntegerValue(cRefDb.getDbResNum(), + UNASSIGNED); if (pdbRefDb != null) { break;// exit loop if pdb and uniprot are already found @@ -592,8 +593,9 @@ public class SiftsClient implements SiftsClientI if (currSeqIndex >= seq.getStart() && currSeqIndex <= seq.getEnd()) { - int resNum = (pdbRefDb == null) ? getLeadingIntegerValue( - residue.getDbResNum(), UNASSIGNED) + int resNum = (pdbRefDb == null) + ? getLeadingIntegerValue(residue.getDbResNum(), + UNASSIGNED) : getLeadingIntegerValue(pdbRefDb.getDbResNum(), UNASSIGNED); @@ -610,8 +612,9 @@ public class SiftsClient implements SiftsClientI omitNonObserved.add(currSeqIndex); ++nonObservedShiftIndex; } - mapping.put(currSeqIndex - nonObservedShiftIndex, new int[] { - Integer.valueOf(resNum), UNASSIGNED }); + mapping.put(currSeqIndex - nonObservedShiftIndex, + new int[] + { Integer.valueOf(resNum), UNASSIGNED }); } } } @@ -640,7 +643,6 @@ public class SiftsClient implements SiftsClientI return failValue; } - /** * * @param chainId @@ -815,7 +817,8 @@ public class SiftsClient implements SiftsClientI */ public Entity getEntityByMostOptimalMatchedId(String chainId) { - // System.out.println("---> advanced greedy entityId matching block entered.."); + // System.out.println("---> advanced greedy entityId matching block + // entered.."); List entities = siftsEntry.getEntity(); SiftsEntitySortPojo[] sPojo = new SiftsEntitySortPojo[entities.size()]; int count = 0; @@ -871,8 +874,8 @@ public class SiftsClient implements SiftsClientI return null; } - private class SiftsEntitySortPojo implements - Comparable + private class SiftsEntitySortPojo + implements Comparable { public String entityId; @@ -901,8 +904,7 @@ public class SiftsClient implements SiftsClientI private int nonObservedShiftIndex; - public SegmentHelperPojo(SequenceI seq, - HashMap mapping, + public SegmentHelperPojo(SequenceI seq, HashMap mapping, TreeMap resNumMap, List omitNonObserved, int nonObservedShiftIndex) { @@ -989,8 +991,8 @@ public class SiftsClient implements SiftsClientI // output mappings StringBuilder output = new StringBuilder(512); output.append(NEWLINE); - output.append("Sequence \u27f7 Structure mapping details").append( - NEWLINE); + output.append("Sequence \u27f7 Structure mapping details") + .append(NEWLINE); output.append("Method: SIFTS"); output.append(NEWLINE).append(NEWLINE); @@ -1013,8 +1015,8 @@ public class SiftsClient implements SiftsClientI for (int j = 0; j < nochunks; j++) { // Print the first aligned sequence - output.append(new Format("%" + (maxid) + "s").form(seqName)).append( - " "); + output.append(new Format("%" + (maxid) + "s").form(seqName)) + .append(" "); for (int i = 0; i < len; i++) { @@ -1086,8 +1088,8 @@ public class SiftsClient implements SiftsClientI { throw new SiftsException(">>> Low PID detected for SIFTs mapping..."); } - output.append("Length of alignment = " + seqRes.length()).append( - NEWLINE); + output.append("Length of alignment = " + seqRes.length()) + .append(NEWLINE); output.append(new Format("Percentage ID = %2.2f").form(pid)); return output; }