X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;fp=src%2Fjalview%2Fws%2Fdbsources%2FPdb.java;h=a50ed143888938e947a845a1007f549e719acbee;hb=4d9ad51dc8a445c2f1fb02b997e13bd945fa8ad2;hp=04c23a27ebc185ee20bd8181e0a7afbb53094852;hpb=bac4802486edabc43143c926c0615f8fb577b1b5;p=jalview.git diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index 04c23a2..a50ed14 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -37,7 +37,6 @@ import jalview.ws.ebi.EBIFetchClient; import java.util.ArrayList; import java.util.List; -import java.util.Vector; import com.stevesoft.pat.Regex; @@ -47,15 +46,16 @@ import com.stevesoft.pat.Regex; */ public class Pdb extends EbiFileRetrievedProxy { + private static final String SEPARATOR = "|"; + private static final String COLON = ":"; + private static final int PDB_ID_LENGTH = 4; + + public Pdb() { super(); } - public static final String FEATURE_INSERTION = "INSERTION"; - - public static final String FEATURE_RES_NUM = "RESNUM"; - /* * (non-Javadoc) * @@ -64,7 +64,6 @@ public class Pdb extends EbiFileRetrievedProxy @Override public String getAccessionSeparator() { - // TODO Auto-generated method stub return null; } @@ -110,23 +109,28 @@ public class Pdb extends EbiFileRetrievedProxy public AlignmentI getSequenceRecords(String queries) throws Exception { AlignmentI pdbAlignment = null; - Vector result = new Vector(); String chain = null; String id = null; - if (queries.indexOf(":") > -1) + if (queries.indexOf(COLON) > -1) { - chain = queries.substring(queries.indexOf(":") + 1); - id = queries.substring(0, queries.indexOf(":")); + chain = queries.substring(queries.indexOf(COLON) + 1); + id = queries.substring(0, queries.indexOf(COLON)); } else { id = queries; } - if (queries.length() > 4 && chain == null) + + /* + * extract chain code if it is appended to the id and we + * don't already have one + */ + if (queries.length() > PDB_ID_LENGTH && chain == null) { - chain = queries.substring(4, 5); - id = queries.substring(0, 4); + chain = queries.substring(PDB_ID_LENGTH, PDB_ID_LENGTH + 1); + id = queries.substring(0, PDB_ID_LENGTH); } + if (!isValidReference(id)) { System.err.println("Ignoring invalid pdb query: '" + id + "'"); @@ -165,8 +169,6 @@ public class Pdb extends EbiFileRetrievedProxy chid = pid.getChainCode(); } - ; - } if (chain == null || (chid != null && (chid.equals(chain) @@ -175,8 +177,8 @@ public class Pdb extends EbiFileRetrievedProxy { // FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant. // TODO: suggest simplify naming to 1qip|A as default name defined - pdbcs.setName(jalview.datamodel.DBRefSource.PDB + "|" + id - + "|" + pdbcs.getName()); + pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id + + SEPARATOR + pdbcs.getName()); // Might need to add more metadata to the PDBEntry object // like below /*