X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FModellerDescription.java;h=a56f2af0b1165c911f9f89eaff30e0b8b0ccc688;hb=9c127c47a7bf73c3e538815635f525fe59f7faba;hp=cc9b966feec9a46bbe5e3face354a6bcdfd38da6;hpb=ab43013b7e357b84b4abade0dba949668dfb2a0e;p=jalview.git diff --git a/src/jalview/io/ModellerDescription.java b/src/jalview/io/ModellerDescription.java index cc9b966..a56f2af 100755 --- a/src/jalview/io/ModellerDescription.java +++ b/src/jalview/io/ModellerDescription.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2b1) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,7 +20,12 @@ */ package jalview.io; -import jalview.datamodel.*; +import jalview.datamodel.DBRefEntry; +import jalview.datamodel.SequenceI; + +import java.util.List; + +import com.stevesoft.pat.Regex; public class ModellerDescription { @@ -29,13 +34,12 @@ public class ModellerDescription * single line, and sequence start/end and other properties. See PIRFile IO * for its use. */ - final String[] seqTypes = - { "sequence", "structure", "structureX", "structureN" }; + final String[] seqTypes = { "sequence", "structure", "structureX", + "structureN" }; - final String[] Fields = - { "objectType", "objectId", "startField", "startCode", "endField", - "endCode", "description1", "description2", "resolutionField", - "tailField" }; + final String[] Fields = { "objectType", "objectId", "startField", + "startCode", "endField", "endCode", "description1", "description2", + "resolutionField", "tailField" }; final int TYPE = 0; @@ -60,11 +64,10 @@ public class ModellerDescription /** * 0 is free text or empty 1 is something that parses to an integer, or \@ */ - final int Types[] = - { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 }; + final int Types[] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0 }; - final char Padding[] = - { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.' }; + final char Padding[] = { ' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', + '.' }; java.util.Hashtable fields = new java.util.Hashtable(); @@ -87,7 +90,7 @@ public class ModellerDescription resCode(int v) { - val = new Integer(v); + val = Integer.valueOf(v); field = val.toString(); } }; @@ -95,7 +98,7 @@ public class ModellerDescription private resCode validResidueCode(String field) { Integer val = null; - com.stevesoft.pat.Regex r = new com.stevesoft.pat.Regex( + Regex r = new Regex( "\\s*((([-0-9]+).?)|FIRST|LAST|@)"); if (!r.search(field)) @@ -247,15 +250,15 @@ public class ModellerDescription { // Set start and end before we update the type (in the case of a // synthesized field set) - if (getStartCode() == null - || (getStartNum() != seq.getStart() && getStartCode().val != null)) + if (getStartCode() == null || (getStartNum() != seq.getStart() + && getStartCode().val != null)) { // unset or user updated sequence start position setStartCode(seq.getStart()); } - if (getEndCode() == null - || (getEndNum() != seq.getEnd() && getStartCode() != null && getStartCode().val != null)) + if (getEndCode() == null || (getEndNum() != seq.getEnd() + && getStartCode() != null && getStartCode().val != null)) { setEndCode(seq.getEnd()); } @@ -271,23 +274,22 @@ public class ModellerDescription // sets the local reference field int t = 0; // sequence if (seq.getDatasetSequence() != null - && seq.getDatasetSequence().getDBRef() != null) + && seq.getDatasetSequence().getDBRefs() != null) { - jalview.datamodel.DBRefEntry[] dbr = seq.getDatasetSequence() - .getDBRef(); - int i, j; - for (i = 0, j = dbr.length; i < j; i++) + List dbr = seq.getDatasetSequence().getDBRefs(); + for (int i = 0, ni = dbr.size(); i < ni; i++) { - if (dbr[i] != null) + DBRefEntry dbri = dbr.get(i); + if (dbri != null) { // JBPNote PDB dbRefEntry needs properties to propagate onto // ModellerField // JBPNote Need to get info from the user about whether the sequence // is the one being modelled, or if it is a template. - if (dbr[i].getSource() + if (dbri.getSource() .equals(jalview.datamodel.DBRefSource.PDB)) { - fields.put(Fields[LOCALID], dbr[i].getAccessionId()); + fields.put(Fields[LOCALID], dbri.getAccessionId()); t = 2; break; }