X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=6f266dd3aa6da9930a6053511b0c6d438bef80d3;hb=ee198b3ca3687f18a2ee186f4e7c7330f4ea30f0;hp=b9fb8f336a5ba95e33ebf0c4d32b91b4dcc732b4;hpb=409fd993c6e32e999b24082aae107a043a590f8f;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index b9fb8f3..6f266dd 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -1,3 +1,4 @@ + /* * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) * Copyright (C) $$Year-Rel$$ The Jalview Authors @@ -20,6 +21,7 @@ */ package jalview.ws.dbsources; +import jalview.api.FeatureSettingsModelI; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; @@ -27,6 +29,8 @@ import jalview.datamodel.DBRefSource; import jalview.datamodel.PDBEntry; import jalview.datamodel.SequenceI; import jalview.io.FormatAdapter; +import jalview.io.PDBFeatureSettings; +import jalview.structure.StructureImportSettings; import jalview.util.MessageManager; import jalview.ws.ebi.EBIFetchClient; @@ -47,6 +51,10 @@ public class Pdb extends EbiFileRetrievedProxy super(); } + public static final String FEATURE_INSERTION = "INSERTION"; + + public static final String FEATURE_RES_NUM = "RESNUM"; + /* * (non-Javadoc) * @@ -100,7 +108,7 @@ public class Pdb extends EbiFileRetrievedProxy @Override public AlignmentI getSequenceRecords(String queries) throws Exception { - AlignmentI pdbfile = null; + AlignmentI pdbAlignment = null; Vector result = new Vector(); String chain = null; String id = null; @@ -124,8 +132,14 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); return null; } + String ext = StructureImportSettings.getCurrentDefaultFormat() + .equalsIgnoreCase("mmcif") ? ".cif" + : ".xml"; EBIFetchClient ebi = new EBIFetchClient(); - file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath(); + file = ebi.fetchDataAsFile("pdb:" + id, + StructureImportSettings.getCurrentDefaultFormat().toLowerCase(), + ext) + .getAbsolutePath(); stopQuery(); if (file == null) { @@ -134,12 +148,13 @@ public class Pdb extends EbiFileRetrievedProxy try { - pdbfile = new FormatAdapter().readFile(file, - jalview.io.AppletFormatAdapter.FILE, "PDB"); - if (pdbfile != null) + pdbAlignment = new FormatAdapter().readFile(file, + jalview.io.DataSourceType.FILE, + StructureImportSettings.getCurrentDefaultFormat()); + if (pdbAlignment != null) { List toremove = new ArrayList(); - for (SequenceI pdbcs : pdbfile.getSequences()) + for (SequenceI pdbcs : pdbAlignment.getSequences()) { String chid = null; // Mapping map=null; @@ -191,18 +206,18 @@ public class Pdb extends EbiFileRetrievedProxy // now remove marked sequences for (SequenceI pdbcs : toremove) { - pdbfile.deleteSequence(pdbcs); + pdbAlignment.deleteSequence(pdbcs); if (pdbcs.getAnnotation() != null) { for (AlignmentAnnotation aa : pdbcs.getAnnotation()) { - pdbfile.deleteAnnotation(aa); + pdbAlignment.deleteAnnotation(aa); } } } } - if (pdbfile == null || pdbfile.getHeight() < 1) + if (pdbAlignment == null || pdbAlignment.getHeight() < 1) { throw new Exception(MessageManager.formatMessage( "exception.no_pdb_records_for_chain", new String[] { id, @@ -214,7 +229,7 @@ public class Pdb extends EbiFileRetrievedProxy stopQuery(); throw (ex); } - return pdbfile; + return pdbAlignment; } /* @@ -230,12 +245,12 @@ public class Pdb extends EbiFileRetrievedProxy } /** - * obtain human glyoxalase chain A sequence + * human glyoxalase */ @Override public String getTestQuery() { - return "1QIPA"; + return "1QIP"; } @Override @@ -249,4 +264,20 @@ public class Pdb extends EbiFileRetrievedProxy { return 0; } + + + /** + * Returns a descriptor for suitable feature display settings with + * + */ + @Override + public FeatureSettingsModelI getFeatureColourScheme() + { + return new PDBFeatureSettings(); + } }