JAL-1919 JAL-2148 regularise use of jalview.datamodel.PDBEntry.Type for PDB/mmCIF file type
JAL-1919 JAL-2148 use new enum jalview.structure.StructureImportSettings.StructureParser
public void setVersion(String version);
/**
- *
- * @param startRes
- * index of start residue in the source DB
- */
- public void setStartRes(int startRes);
-
- /**
- *
- * @return index of start residue in the source DB
- */
- public int getStartRes();
-
- /**
- *
- * @param endRes
- * index of end residue in the source DB
- */
- public void setEndRes(int endRes);
-
- /**
- *
- * @return index of end residue in the source DB
- */
- public int getEndRes();
-
- /**
* access a mapping, if present that can be used to map positions from the
* associated dataset sequence to the DBRef's sequence frame.
*
*/
package jalview.bin;
+import jalview.datamodel.PDBEntry;
import jalview.structure.StructureImportSettings;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
-
- private final static String DEFAULT_STRUCTURE_FORMAT = StructureImportSettings.MMCIF;
- private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.JMOL_PARSER;
+ /**
+ * Allowed values are PDB or mmCIF
+ */
+ private final static String DEFAULT_STRUCTURE_FORMAT = PDBEntry.Type.MMCIF
+ .toString();
+
+ private final static String DEFAULT_PDB_FILE_PARSER = StructureImportSettings.StructureParser.JMOL_PARSER
+ .toString();
/**
* Initialises the Jalview Application Log
public class DBRefEntry implements DBRefEntryI
{
String source = "", version = "", accessionId = "";
-
- private int startRes, endRes;
/**
* maps from associated sequence to the database sequence's coordinate system
*/
{
return getSrcAccString();
}
-
- @Override
- public int getStartRes()
- {
- return startRes;
- }
-
- @Override
- public void setStartRes(int startRes)
- {
- this.startRes = startRes;
- }
-
- @Override
- public int getEndRes()
- {
- return endRes;
- }
-
- @Override
- public void setEndRes(int endRes)
- {
- this.endRes = endRes;
- }
}
prot.add(chainseq);
}
- if (StructureImportSettings.isPredictSecondaryStructure())
+ if (StructureImportSettings.isProcessSecondaryStructure())
{
createAnnotation(chainseq, chain, ms.at);
}
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
+import jalview.datamodel.PDBEntry.Type;
import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
// TODO obtain config value from preference settings.
// Set value to 'true' to test PDB processing with Jmol: JAL-1213
boolean isParseWithJMOL = StructureImportSettings
- .getDefaultPDBFileParser().equalsIgnoreCase(
- StructureImportSettings.JMOL_PARSER);
+ .getDefaultPDBFileParser()
+ .equals(StructureImportSettings.StructureParser.JMOL_PARSER);
if (isParseWithJMOL)
{
StructureImportSettings.addSettings(annotFromStructure,
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
- ((StructureFile) alignFile)
- .setDbRefType(StructureImportSettings.PDB);
+ ((StructureFile) alignFile).setDbRefType(Type.PDB);
}
else if (format.equals("mmCIF"))
{
localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
- ((StructureFile) alignFile)
- .setDbRefType(StructureImportSettings.MMCIF);
+ ((StructureFile) alignFile).setDbRefType(Type.MMCIF);
}
else if (format.equals("STH"))
{
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
+import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceI;
import jalview.structure.StructureImportSettings;
private String id;
- private String dbRefType;
+ private PDBEntry.Type dbRefType;
/**
* set to true to add derived sequence annotations (temp factor read from
this.visibleChainAnnotation = StructureImportSettings
.isVisibleChainAnnotation();
this.predictSecondaryStructure = StructureImportSettings
- .isPredictSecondaryStructure();
+ .isProcessSecondaryStructure();
this.externalSecondaryStructure = StructureImportSettings
.isExternalSecondaryStructure();
DBRefEntry sourceDBRef = new DBRefEntry();
sourceDBRef.setAccessionId(getId());
sourceDBRef.setSource(DBRefSource.PDB);
- sourceDBRef.setStartRes(pdbSequence.getStart());
- sourceDBRef.setEndRes(pdbSequence.getEnd());
pdbSequence.setSourceDBRef(sourceDBRef);
pdbSequence.addPDBId(entry);
pdbSequence.addDBRef(sourceDBRef);
StructureImportSettings.setShowSeqFeatures(false);
StructureImportSettings.setVisibleChainAnnotation(false);
StructureImportSettings
- .setPredictSecondaryStructure(predictSecondaryStructure);
+ .setProcessSecondaryStructure(predictSecondaryStructure);
StructureImportSettings
.setExternalSecondaryStructure(externalSecondaryStructure);
Object jmf = constructor.newInstance(args);
this.chains = chains;
}
- public String getDbRefType()
+ public Type getDbRefType()
{
return dbRefType;
}
public void setDbRefType(String dbRefType)
{
+ this.dbRefType = Type.valueOf(dbRefType);
+ }
+
+ public void setDbRefType(Type dbRefType)
+ {
this.dbRefType = dbRefType;
}
package jalview.structure;
-import jalview.datamodel.DBRefSource;
-
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.PDBEntry.Type;
+
+/**
+ * bean holding settings for structure IO. TODO: tests for validation of values
+ *
+ * @author tcofoegbu
+ *
+ */
public class StructureImportSettings
{
/**
* Set true to predict secondary structure (using JMol for protein, Annotate3D
* for RNA)
*/
- private static boolean predictSecStr = false;
+ private static boolean processSecStr = false;
/**
* Set true (with predictSecondaryStructure=true) to predict secondary
private static boolean processHETATMs = false;
- public static final String JMOL_PARSER = "JMolParser";
-
- public static final String JALVIEW_PARSER = "JalViewParser";
-
- public static final String MMCIF = "mmCIF";
+ public enum StructureParser
+ {
+ JMOL_PARSER, JALVIEW_PARSER
+ }
- public static final String PDB = "PDB";
/**
* Determines the default file format for structure files to be downloaded
* from the PDB sequence fetcher. Possible options include: PDB|mmCIF
*/
- private static String defaultStructureFileFormat = DBRefSource.PDB;
+ private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
/**
* Determines the parser used for parsing PDB format file. Possible options
* are : JMolParser|JalveiwParser
*/
- private static String defaultPDBFileParser = JMOL_PARSER;
+ private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
public static void addSettings(boolean addAlignmentAnnotations,
- boolean predictSecStr, boolean externalSecStr)
+ boolean processSecStr, boolean externalSecStr)
{
StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
- StructureImportSettings.predictSecStr = predictSecStr;
+ StructureImportSettings.processSecStr = processSecStr;
StructureImportSettings.externalSecondaryStructure = externalSecStr;
StructureImportSettings.showSeqFeatures = true;
}
StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
}
- public static boolean isPredictSecondaryStructure()
+ public static boolean isProcessSecondaryStructure()
{
- return predictSecStr;
+ return processSecStr;
}
- public static void setPredictSecondaryStructure(
- boolean predictSecondaryStructure)
+ public static void setProcessSecondaryStructure(
+ boolean processSecondaryStructure)
{
- StructureImportSettings.predictSecStr = predictSecondaryStructure;
+ StructureImportSettings.processSecStr = processSecondaryStructure;
}
public static boolean isExternalSecondaryStructure()
public static String getDefaultStructureFileFormat()
{
- return defaultStructureFileFormat;
+ return defaultStructureFileFormat.toString();
}
public static void setDefaultStructureFileFormat(
String defaultStructureFileFormat)
{
- StructureImportSettings.defaultStructureFileFormat = defaultStructureFileFormat;
+ StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
+ .valueOf(defaultStructureFileFormat);
}
public static boolean isProcessHETATMs()
public static String getDefaultPDBFileParser()
{
- return defaultPDBFileParser;
+ return defaultPDBFileParser.toString();
}
- public static void setDefaultPDBFileParser(String defaultPDBFileParser)
+ public static void setDefaultPDBFileParser(
+ StructureParser defaultPDBFileParser)
{
StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
}
+ public static void setDefaultPDBFileParser(String defaultPDBFileParser)
+ {
+ StructureImportSettings.defaultPDBFileParser = StructureParser
+ .valueOf(defaultPDBFileParser);
+ }
+
}
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
+import jalview.datamodel.PDBEntry.Type;
import jalview.datamodel.SequenceI;
import jalview.io.FormatAdapter;
import jalview.io.PDBFeatureSettings;
return null;
}
String ext = StructureImportSettings.getDefaultStructureFileFormat()
- .equalsIgnoreCase("mmcif") ? ".cif"
- : ".xml";
+ .equals(Type.MMCIF) ? ".cif" : ".xml";
EBIFetchClient ebi = new EBIFetchClient();
file = ebi.fetchDataAsFile("pdb:" + id,
StructureImportSettings.getDefaultStructureFileFormat().toLowerCase(),
import jalview.io.AppletFormatAdapter;
import jalview.io.FileLoader;
import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.StructureParser;
import java.util.Vector;
Boolean.TRUE.toString());
StructureImportSettings.setDefaultStructureFileFormat("PDB");
StructureImportSettings
- .setDefaultPDBFileParser(StructureImportSettings.JALVIEW_PARSER);
+ .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER);
}
@Test(groups = { "Functional" })
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.StructureParser;
import java.io.File;
.get(0).getId();
StructureImportSettings.setDefaultStructureFileFormat("PDB");
StructureImportSettings
- .setDefaultPDBFileParser(StructureImportSettings.JALVIEW_PARSER);
+ .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER);
}
@Test(groups = { "Functional" })
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
import jalview.structure.StructureImportSettings;
+import jalview.structure.StructureImportSettings.StructureParser;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.List;
Boolean.TRUE.toString());
StructureImportSettings.setDefaultStructureFileFormat("PDB");
StructureImportSettings
- .setDefaultPDBFileParser(StructureImportSettings.JALVIEW_PARSER);
+ .setDefaultPDBFileParser(StructureParser.JALVIEW_PARSER);
testRetrieveProteinSeqFromPDB();
}
// TODO delete when auto-fetching of DBRefEntry is implemented
DBRefEntry dbRef = new DBRefEntry("uniprot", "", "P00221");
- dbRef.setStartRes(1);
- dbRef.setEndRes(147);
testSeq.addDBRef(dbRef);
// testSeq.setSourceDBRef(dbRef);
DBRefEntryI expectedDBRef = new DBRefEntry();
expectedDBRef.setSource(DBRefSource.UNIPROT);
expectedDBRef.setAccessionId("P00221");
- expectedDBRef.setStartRes(1);
- expectedDBRef.setEndRes(147);
expectedDBRef.setVersion("");
Assert.assertEquals(actualValidSrcDBRef, expectedDBRef);
} catch (Exception e)
DBRefEntryI validDBRef = new DBRefEntry();
validDBRef.setSource(DBRefSource.UNIPROT);
validDBRef.setAccessionId("P00221");
- validDBRef.setStartRes(1);
- validDBRef.setEndRes(147);
validDBRef.setVersion("");
Assert.assertTrue(siftsClient.isValidDBRefEntry(validDBRef));
}