import jalview.xml.binding.sifts.Entry.Entity.Segment.ListMapRegion.MapRegion;
import jalview.xml.binding.sifts.Entry.Entity.Segment.ListResidue.Residue;
import jalview.xml.binding.sifts.Entry.Entity.Segment.ListResidue.Residue.CrossRefDb;
+import jalview.xml.binding.sifts.Entry.Entity.Segment.ListResidue.Residue.ResidueDetail;
import jalview.xml.binding.sifts.Entry.ListDB.Db;
import java.io.File;
return name;
}
};
-
+
+ public enum ResidueDetailType
+ {
+ NAME_SEC_STRUCTURE("nameSecondaryStructure"), CODE_SEC_STRUCTURE(
+ "codeSecondaryStructure"), ANNOTATION("Annotation");
+ private String code;
+
+ private ResidueDetailType(String code)
+ {
+ this.code = code;
+ }
+
+ public String getCode()
+ {
+ return code;
+ }
+ };
+
/**
* Fetch SIFTs file for the given PDB Id and construct an instance of
* SiftsClient
} catch (JAXBException e)
{
e.printStackTrace();
+ throw new SiftsException(e.getMessage());
} catch (FileNotFoundException e)
{
e.printStackTrace();
+ throw new SiftsException(e.getMessage());
} catch (XMLStreamException e)
{
e.printStackTrace();
+ throw new SiftsException(e.getMessage());
} catch (FactoryConfigurationError e)
{
e.printStackTrace();
+ throw new SiftsException(e.getMessage());
} catch (IOException e)
{
e.printStackTrace();
+ throw new SiftsException(e.getMessage());
}
- throw new SiftsException("Error parsing siftFile");
}
/**
*
* @param pdbId
* @return SIFTs XML file
+ * @throws SiftsException
*/
- public static File getSiftsFile(String pdbId)
+ public static File getSiftsFile(String pdbId) throws SiftsException
{
File siftsFile = new File(SIFTS_DOWNLOAD_DIR + pdbId.toLowerCase()
+ ".xml.gz");
*
* @param pdbId
* @return downloaded SIFTs XML file
+ * @throws SiftsException
*/
- public static File downloadSiftsFile(String pdbId)
+ public static File downloadSiftsFile(String pdbId) throws SiftsException
{
String siftFile = pdbId + ".xml.gz";
String siftsFileFTPURL = SIFTS_FTP_BASE_URL + siftFile;
System.out.println(">>> File downloaded : " + downloadedSiftsFile);
} catch (IOException ex)
{
- ex.printStackTrace();
+ throw new SiftsException(ex.getMessage());
}
return new File(downloadedSiftsFile);
}
java.io.PrintStream os)
throws SiftsException
{
-
System.out.println("Generating mappings for : " + entityId);
Entity entity = null;
entity = getEntityById(entityId);
residuePos[PDB_RES_POS] = UNASSIGNED;
residuePos[PDB_ATOM_POS] = UNASSIGNED;
}
-
TreeMap<Integer, String> resNumMap = new TreeMap<Integer, String>();
List<Segment> segments = entity.getSegment();
for (Segment segment : segments)
}
try
{
- mapping[currSeqIndex][PDB_RES_POS] = Integer.valueOf(resNum);
+ mapping[currSeqIndex][PDB_RES_POS] = Integer
+ .valueOf(resNum);
} catch (ArrayIndexOutOfBoundsException e)
{
// do nothing..
return mapping;
}
+ private boolean isResidueObserved(Residue residue)
+ {
+ String annotation = getResidueAnnotaiton(residue,
+ ResidueDetailType.ANNOTATION);
+ if (annotation == null)
+ {
+ return true;
+ }
+ if (!annotation.equalsIgnoreCase("Not_Found")
+ && annotation.equalsIgnoreCase("Not_Observed"))
+ {
+ return false;
+ }
+ return true;
+ }
+
+ private String getResidueAnnotaiton(Residue residue,
+ ResidueDetailType type)
+ {
+ List<ResidueDetail> resDetails = residue.getResidueDetail();
+ for (ResidueDetail resDetail : resDetails)
+ {
+ if (resDetail.getProperty().equalsIgnoreCase(type.getCode()))
+ {
+ return resDetail.getContent();
+ }
+ }
+ return "Not_Found";
+ }
+
private boolean hasAccessionId(String accession)
{
boolean isStrictMatch = true;