+ /**
+ * Checks if the residue instance is marked 'Not_observed' or not
+ *
+ * @param residue
+ * @return
+ */
+ private boolean isResidueObserved(Residue residue)
+ {
+ Set<String> annotations = getResidueAnnotaitons(residue,
+ ResidueDetailType.ANNOTATION);
+ if (annotations == null || annotations.isEmpty())
+ {
+ return true;
+ }
+ for (String annotation : annotations)
+ {
+ if (annotation.equalsIgnoreCase(NOT_OBSERVED))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Get annotation String for a given residue and annotation type
+ *
+ * @param residue
+ * @param type
+ * @return
+ */
+ private Set<String> getResidueAnnotaitons(Residue residue,
+ ResidueDetailType type)
+ {
+ HashSet<String> foundAnnotations = new HashSet<String>();
+ List<ResidueDetail> resDetails = residue.getResidueDetail();
+ for (ResidueDetail resDetail : resDetails)
+ {
+ if (resDetail.getProperty().equalsIgnoreCase(type.getCode()))
+ {
+ foundAnnotations.add(resDetail.getContent());
+ }
+ }
+ return foundAnnotations;
+ }
+
+ @Override
+ public boolean isAccessionMatched(String accession)
+ {
+ boolean isStrictMatch = true;
+ return isStrictMatch ? curSourceDBRef.equalsIgnoreCase(accession)
+ : curDBRefAccessionIdsString.contains(accession.toLowerCase());
+ }
+
+ private boolean isFoundInSiftsEntry(String accessionId)
+ {
+ Set<String> siftsDBRefs = getAllMappingAccession();
+ return accessionId != null
+ && siftsDBRefs.contains(accessionId.toLowerCase());
+ }
+
+ /**
+ * Pad omitted residue positions in PDB sequence with gaps
+ *
+ * @param resNumMap
+ */
+ void padWithGaps(Map<Integer, String> resNumMap,
+ List<Integer> omitNonObserved)
+ {
+ if (resNumMap == null || resNumMap.isEmpty())
+ {
+ return;
+ }
+ Integer[] keys = resNumMap.keySet().toArray(new Integer[0]);
+ // Arrays.sort(keys);
+ int firstIndex = keys[0];
+ int lastIndex = keys[keys.length - 1];
+ // System.out.println("Min value " + firstIndex);
+ // System.out.println("Max value " + lastIndex);
+ for (int x = firstIndex; x <= lastIndex; x++)
+ {
+ if (!resNumMap.containsKey(x) && !omitNonObserved.contains(x))
+ {
+ resNumMap.put(x, "-");
+ }
+ }
+ }
+