import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureMapping;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import java.awt.Color;
import java.util.List;
// System.out.println("PDB Sequence is :\nSequence = " + seq);
// System.out.println("No of residues = " + residues.size());
- if (StructureViewSettings.isShowSeqFeatures())
+ if (StructureImportSettings.isShowSeqFeatures())
{
for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
{
import jalview.datamodel.SequenceI;
import jalview.io.FileParse;
import jalview.io.StructureFile;
+import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
import java.io.IOException;
}
public PDBfile(boolean addAlignmentAnnotations, boolean predictSecStr,
- boolean externalSecStr, String file, String protocol)
+ boolean externalSecStr, String dataObject, String protocol)
throws IOException
{
- super(false, file, protocol);
+ super(false, dataObject, protocol);
addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
doParse();
}
break;
}
if (line.indexOf("ATOM") == 0
- || (line.indexOf("HETATM") == 0 && !terFlag))
+ || (StructureImportSettings.isProcessHETATMs()
+ && line.indexOf("HETATM") == 0 && !terFlag))
{
terFlag = false;
package jalview.bin;
import jalview.datamodel.DBRefSource;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
import jalview.ws.sifts.SiftsSettings;
System.out
.println("Jalview Version: " + codeVersion + codeInstallation);
- StructureViewSettings.setCurrentDefaultFormat(jalview.bin.Cache
+ StructureImportSettings.setCurrentDefaultFormat(jalview.bin.Cache
.getDefault(
"DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT));
+
+ StructureImportSettings.setProcessHETATMs(jalview.bin.Cache.getDefault(
+ "PROCESS_HETATM", false));
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
if (jnlpVersion == null
import jalview.io.FileParse;
import jalview.io.StructureFile;
import jalview.schemes.ResidueProperties;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
import java.io.IOException;
prot.add(chainseq);
}
- if (StructureViewSettings.isPredictSecondaryStructure())
+ if (StructureImportSettings.isPredictSecondaryStructure())
{
createAnnotation(chainseq, chain, ms.at);
}
{
// System.out.println("Seq Id : " + atom.getSeqID());
// System.out.println("To String : " + atom.toString());
- if (atom.isHetero())
+ if (!StructureImportSettings.isProcessHETATMs() && atom.isHetero())
{
continue;
}
/**
* Constructor which parses the data from a file of some specified type.
*
- * @param inFile
- * Filename to read from.
+ * @param dataObject
+ * Filename, URL or Pasted String to read from.
* @param type
- * What type of file to read from (File, URL)
+ * What type of file to read from (File, URL, Pasted String)
*/
- public AlignFile(String inFile, String type) throws IOException
+ public AlignFile(String dataObject, String type) throws IOException
{
- this(true, inFile, type);
+ this(true, dataObject, type);
}
/**
*
* @param parseImmediately
* if false, need to call 'doParse()' to begin parsing data
- * @param inFile
- * Filename to read from.
+ * @param dataObject
+ * Filename, URL or Pasted String to read from.
* @param type
* What type of file to read from (File, URL)
* @throws IOException
*/
- public AlignFile(boolean parseImmediately, String inFile, String type)
+ public AlignFile(boolean parseImmediately, String dataObject, String type)
throws IOException
{
- super(inFile, type);
+ super(dataObject, type);
initData();
if (parseImmediately)
{
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.AlignmentView;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
import java.io.File;
{
// TODO obtain config value from preference settings.
// Set value to 'true' to test PDB processing with Jmol: JAL-1213
- boolean isParseWithJMOL = !StructureViewSettings
+ boolean isParseWithJMOL = !StructureImportSettings
.getCurrentDefaultFormat().equalsIgnoreCase("PDB");
if (isParseWithJMOL)
{
- StructureViewSettings.addSettings(annotFromStructure,
+ StructureImportSettings.addSettings(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
}
else
{
- StructureViewSettings.addSettings(annotFromStructure,
+ StructureImportSettings.addSettings(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct);
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
type);
}
else if (format.equals("mmCIF"))
{
- StructureViewSettings.addSettings(annotFromStructure,
+ StructureImportSettings.addSettings(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile, type);
boolean isParseWithJMOL = false;
if (isParseWithJMOL)
{
- StructureViewSettings.addSettings(annotFromStructure,
+ StructureImportSettings.addSettings(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
else
{
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
}
}
else if (format.equals("mmCIF"))
{
- StructureViewSettings.addSettings(annotFromStructure,
+ StructureImportSettings.addSettings(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct);
alignFile = new jalview.ext.jmol.JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, source);
import jalview.datamodel.DBRefSource;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import java.awt.Color;
import java.io.IOException;
public void xferSettings()
{
- this.visibleChainAnnotation = StructureViewSettings
+ this.visibleChainAnnotation = StructureImportSettings
.isVisibleChainAnnotation();
- this.predictSecondaryStructure = StructureViewSettings
+ this.predictSecondaryStructure = StructureImportSettings
.isPredictSecondaryStructure();
- this.externalSecondaryStructure = StructureViewSettings
+ this.externalSecondaryStructure = StructureImportSettings
.isExternalSecondaryStructure();
}
- public StructureFile(boolean parseImmediately, String inFile, String type)
+ public StructureFile(boolean parseImmediately, String dataObject, String type)
throws IOException
{
- super(parseImmediately, inFile, type);
+ super(parseImmediately, dataObject, type);
}
public StructureFile(boolean a, FileParse fp) throws IOException
predictSecondaryStructure, externalSecondaryStructure,
new FileParse(getDataName(), type) };
- StructureViewSettings.setShowSeqFeatures(false);
- StructureViewSettings.setVisibleChainAnnotation(false);
- StructureViewSettings
+ StructureImportSettings.setShowSeqFeatures(false);
+ StructureImportSettings.setVisibleChainAnnotation(false);
+ StructureImportSettings
.setPredictSecondaryStructure(predictSecondaryStructure);
- StructureViewSettings
+ StructureImportSettings
.setExternalSecondaryStructure(externalSecondaryStructure);
Object jmf = constructor.newInstance(args);
AlignmentI al = new Alignment((SequenceI[]) cl.getMethod(
} catch (ClassNotFoundException q)
{
}
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
}
public PDBChain findChain(String id) throws Exception
import jalview.datamodel.DBRefSource;
-public class StructureViewSettings
+public class StructureImportSettings
{
- private String dbRefType;
-
/**
* set to true to add derived sequence annotations (temp factor read from
* file, or computed secondary structure) to the alignment
private static boolean showSeqFeatures = true;
+ private static boolean processHETATMs = false;
+
private static String currentDefaultFormat = DBRefSource.PDB;
public static void addSettings(boolean addAlignmentAnnotations,
boolean predictSecStr, boolean externalSecStr)
{
- StructureViewSettings.visibleChainAnnotation = addAlignmentAnnotations;
- StructureViewSettings.predictSecStr = predictSecStr;
- StructureViewSettings.externalSecondaryStructure = externalSecStr;
- StructureViewSettings.showSeqFeatures = true;
+ StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
+ StructureImportSettings.predictSecStr = predictSecStr;
+ StructureImportSettings.externalSecondaryStructure = externalSecStr;
+ StructureImportSettings.showSeqFeatures = true;
}
public static boolean isVisibleChainAnnotation()
public static void setVisibleChainAnnotation(
boolean visibleChainAnnotation)
{
- StructureViewSettings.visibleChainAnnotation = visibleChainAnnotation;
+ StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
}
public static boolean isPredictSecondaryStructure()
public static void setPredictSecondaryStructure(
boolean predictSecondaryStructure)
{
- StructureViewSettings.predictSecStr = predictSecondaryStructure;
+ StructureImportSettings.predictSecStr = predictSecondaryStructure;
}
public static boolean isExternalSecondaryStructure()
public static void setExternalSecondaryStructure(
boolean externalSecondaryStructure)
{
- StructureViewSettings.externalSecondaryStructure = externalSecondaryStructure;
+ StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
}
public static boolean isShowSeqFeatures()
public static void setShowSeqFeatures(boolean showSeqFeatures)
{
- StructureViewSettings.showSeqFeatures = showSeqFeatures;
+ StructureImportSettings.showSeqFeatures = showSeqFeatures;
}
public static String getCurrentDefaultFormat()
public static void setCurrentDefaultFormat(String currentDefaultFormat)
{
- StructureViewSettings.currentDefaultFormat = currentDefaultFormat;
+ StructureImportSettings.currentDefaultFormat = currentDefaultFormat;
+ }
+
+ public static boolean isProcessHETATMs()
+ {
+ return processHETATMs;
+ }
+
+ public static void setProcessHETATMs(boolean processHETATMs)
+ {
+ StructureImportSettings.processHETATMs = processHETATMs;
}
}
import jalview.datamodel.SequenceI;
import jalview.io.FormatAdapter;
import jalview.io.PDBFeatureSettings;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import jalview.util.MessageManager;
import jalview.ws.ebi.EBIFetchClient;
stopQuery();
return null;
}
- String ext = StructureViewSettings.getCurrentDefaultFormat()
+ String ext = StructureImportSettings.getCurrentDefaultFormat()
.equalsIgnoreCase("mmcif") ? ".cif"
: ".xml";
EBIFetchClient ebi = new EBIFetchClient();
file = ebi.fetchDataAsFile("pdb:" + id,
- StructureViewSettings.getCurrentDefaultFormat().toLowerCase(),
+ StructureImportSettings.getCurrentDefaultFormat().toLowerCase(),
ext)
.getAbsolutePath();
stopQuery();
pdbAlignment = new FormatAdapter().readFile(file,
jalview.io.AppletFormatAdapter.FILE,
- StructureViewSettings.getCurrentDefaultFormat());
+ StructureImportSettings.getCurrentDefaultFormat());
if (pdbAlignment != null)
{
List<SequenceI> toremove = new ArrayList<SequenceI>();
import jalview.datamodel.SequenceI;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.TaylorColourScheme;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import java.awt.Color;
import java.util.Vector;
public void setUp()
{
System.out.println("setup");
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
c = new PDBChain("1GAQ", "A");
}
import jalview.gui.AlignFrame;
import jalview.io.AppletFormatAdapter;
import jalview.io.FileLoader;
+import jalview.structure.StructureImportSettings;
import java.util.Vector;
//@formatter:off
// a modified and very cut-down extract of 4UJ4
- String pdbWithChainBreak =
+ String pastePDBDataWithChainBreak =
"HEADER TRANSPORT PROTEIN 08-APR-15 4UJ4\n" +
// chain B has missing residues; these should all go in the same sequence:
"ATOM 1909 CA VAL B 358 21.329 -19.739 -67.740 1.00201.05 C\n" +
@Test(groups = { "Functional" })
public void testFileParser() throws Exception
{
+ StructureImportSettings.setProcessHETATMs(false);
+ for (String pdbStr : testFile)
+ {
+ PDBfile mctest = new PDBfile(false, false, false, pdbStr,
+ AppletFormatAdapter.FILE);
+ JmolParser jtest = new JmolParser(false, false, false, pdbStr,
+ jalview.io.AppletFormatAdapter.FILE);
+ Vector<SequenceI> seqs = jtest.getSeqs(), mcseqs = mctest.getSeqs();
+
+ assertTrue(
+ "No sequences extracted from testfile\n"
+ + (jtest.hasWarningMessage() ? jtest.getWarningMessage()
+ : "(No warnings raised)"), seqs != null
+ && seqs.size() > 0);
+ for (SequenceI sq : seqs)
+ {
+ assertEquals("JMol didn't process " + pdbStr
+ + " to the same sequence as MCView",
+ sq.getSequenceAsString(), mcseqs.remove(0)
+ .getSequenceAsString());
+ AlignmentI al = new Alignment(new SequenceI[] { sq });
+ validateSecStrRows(al);
+ }
+ }
+ StructureImportSettings.setProcessHETATMs(true);
for (String pdbStr : testFile)
{
PDBfile mctest = new PDBfile(false, false, false, pdbStr,
@Test(groups = { "Functional" })
public void testParse_missingResidues() throws Exception
{
- PDBfile mctest = new PDBfile(false, false, false, pdbWithChainBreak,
+ PDBfile mctest = new PDBfile(false, false, false,
+ pastePDBDataWithChainBreak,
AppletFormatAdapter.PASTE);
boolean annotFromStructure = false;
boolean localSecondaryStruct = false;
boolean serviceSecondaryStruct = false;
JmolParser jtest = new JmolParser(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct,
- pdbWithChainBreak,
+ pastePDBDataWithChainBreak,
jalview.io.AppletFormatAdapter.PASTE);
Vector<SequenceI> seqs = jtest.getSeqs();
Vector<SequenceI> mcseqs = mctest.getSeqs();
/*
* Set up sequence pdb ids
*/
- PDBEntry pdb1 = new PDBEntry("1ABC", "A", Type.PDB, "1ABC.pdb");
- PDBEntry pdb2 = new PDBEntry("2ABC", "A", Type.PDB, "2ABC.pdb");
- PDBEntry pdb3 = new PDBEntry("3ABC", "A", Type.PDB, "3ABC.pdb");
+ PDBEntry pdb1 = new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb");
+ PDBEntry pdb2 = new PDBEntry("2ABC", "C", Type.PDB, "2ABC.pdb");
+ PDBEntry pdb3 = new PDBEntry("3ABC", "D", Type.PDB, "3ABC.pdb");
/*
- * seq1 and seq3 refer to 1ABC, seq2 to 2ABC, none to 3ABC
+ * seq1 and seq3 refer to 1abcB, seq2 to 2abcC, none to 3abcD
*/
al.getSequenceAt(0).getDatasetSequence()
.addPDBId(new PDBEntry("1ABC", "B", Type.PDB, "1ABC.pdb"));
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.gui.AlignFrame;
+import jalview.structure.StructureImportSettings;
import java.io.File;
al = af.getViewport().getAlignment();
pdbId = al.getSequenceAt(0).getDatasetSequence().getAllPDBEntries()
.get(0).getId();
+ StructureImportSettings.setCurrentDefaultFormat("PDB");
}
@Test(groups = { "Functional" })
@Test(groups = { "Functional" })
public void compareTransferredToRefPDBAnnot() throws Exception
{
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
AlignFrame ref = new FileLoader(false)
.LoadFileWaitTillLoaded("test/jalview/ext/jmol/1QCF.pdb",
jalview.io.FormatAdapter.FILE);
@BeforeMethod(alwaysRun = true)
public void setUp()
{
- StructureViewSettings.setShowSeqFeatures(true);
+ StructureImportSettings.setShowSeqFeatures(true);
ssm = new StructureSelectionManager();
}
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
-import jalview.structure.StructureViewSettings;
+import jalview.structure.StructureImportSettings;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.List;
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- StructureViewSettings.setCurrentDefaultFormat("PDB");
+ StructureImportSettings.setCurrentDefaultFormat("PDB");
testRetrieveProteinSeqFromPDB();
}
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- StructureViewSettings.setCurrentDefaultFormat("mmCIF");
+ StructureImportSettings.setCurrentDefaultFormat("mmCIF");
testRetrieveProteinSeqFromPDB();
}