import jalview.appletgui.SequenceRenderer;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.io.StructureFile;
import jalview.structure.AtomSpec;
import jalview.structure.StructureListener;
import jalview.structure.StructureMapping;
int my = 0;
- public PDBfile pdb;
+ public StructureFile pdb;
PDBEntry pdbentry;
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
{
+ @Override
public void print(String x)
{
mappingDetails.append(x);
}
+ @Override
public void println()
{
mappingDetails.append("\n");
addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
doKeyPressed(evt);
centre[2] = ztot / (2 * (float) bsize);
}
+ @Override
public void paint(Graphics g)
{
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
pdbAction = true;
dragging = false;
}
+ @Override
public void mouseMoved(MouseEvent e)
{
pdbAction = true;
}
}
+ @Override
public void mouseClicked(MouseEvent e)
{
}
+ @Override
public void mouseEntered(MouseEvent e)
{
}
+ @Override
public void mouseExited(MouseEvent e)
{
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
int x = evt.getX();
repaint();
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
dragging = false;
return fatom;
}
+ @Override
public void update(Graphics g)
{
paint(g);
// ////////////////////////////////
// /StructureListener
+ @Override
public String[] getPdbFile()
{
return new String[] { pdbentry.getFile() };
// return new Color(viewer.getAtomArgb(atomIndex));
}
+ @Override
public void updateColours(Object source)
{
colourBySequence();
import jalview.gui.AlignmentPanel;
import jalview.gui.FeatureRenderer;
import jalview.gui.SequenceRenderer;
+import jalview.io.StructureFile;
import jalview.structure.AtomSpec;
import jalview.structure.StructureListener;
import jalview.structure.StructureMapping;
int my = 0;
- public PDBfile pdb;
+ public StructureFile pdb;
PDBEntry pdbentry;
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
{
+ @Override
public void print(String x)
{
mappingDetails.append(x);
}
+ @Override
public void println()
{
mappingDetails.append("\n");
addKeyListener(new KeyAdapter()
{
+ @Override
public void keyPressed(KeyEvent evt)
{
keyPressed(evt);
centre[2] = ztot / (2 * (float) bsize);
}
+ @Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
}
}
+ @Override
public void mousePressed(MouseEvent e)
{
pdbAction = true;
dragging = false;
}
+ @Override
public void mouseMoved(MouseEvent e)
{
pdbAction = true;
}
}
+ @Override
public void mouseClicked(MouseEvent e)
{
}
+ @Override
public void mouseEntered(MouseEvent e)
{
}
+ @Override
public void mouseExited(MouseEvent e)
{
}
+ @Override
public void mouseDragged(MouseEvent evt)
{
int x = evt.getX();
repaint();
}
+ @Override
public void mouseReleased(MouseEvent evt)
{
dragging = false;
// ////////////////////////////////
// /StructureListener
+ @Override
public String[] getPdbFile()
{
return new String[] { pdbentry.getFile() };
// return new Color(viewer.getAtomArgb(atomIndex));
}
+ @Override
public void updateColours(Object source)
{
colourBySequence();
{
EBIFetchClient ebi = new EBIFetchClient();
String query = "pdb:" + pdbentry.getId();
- pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "raw")
+ pdbentry.setFile(ebi.fetchDataAsFile(query, "default", "raw", ".xml")
.getAbsolutePath());
if (pdbentry.getFile() != null)
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
import jalview.io.FileParse;
+import jalview.io.StructureFile;
import jalview.schemes.BuriedColourScheme;
import jalview.schemes.HelixColourScheme;
import jalview.schemes.HydrophobicColourScheme;
String alreadyMapped = StructureSelectionManager
.getStructureSelectionManager(ap.av.applet)
.alreadyMappedToFile(pdbentry.getId());
- MCview.PDBfile reader = null;
+ StructureFile reader = null;
if (alreadyMapped != null)
{
reader = StructureSelectionManager.getStructureSelectionManager(
this.addWindowListener(new WindowAdapter()
{
+ @Override
public void windowClosing(WindowEvent evt)
{
closeViewer();
this.setVisible(false);
}
+ @Override
public void actionPerformed(ActionEvent evt)
{
if (evt.getSource() == mappingMenuItem)
jmb.setColourBySequence(itm == seqColour);
}
+ @Override
public void itemStateChanged(ItemEvent evt)
{
if (evt.getSource() == jmolColour)
}
}
+ @Override
public void keyPressed(KeyEvent evt)
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER && scriptWindow.isVisible())
}
+ @Override
public void keyTyped(KeyEvent evt)
{
}
+ @Override
public void keyReleased(KeyEvent evt)
{
}
{
Dimension currentSize = new Dimension();
+ @Override
public void update(Graphics g)
{
paint(g);
}
+ @Override
public void paint(Graphics g)
{
currentSize = this.getSize();
*/
package jalview.bin;
+import jalview.datamodel.DBRefSource;
+import jalview.ws.dbsources.Pdb;
import jalview.ws.dbsources.das.api.DasSourceRegistryI;
import jalview.ws.dbsources.das.datamodel.DasSourceRegistry;
import jalview.ws.sifts.SiftsSettings;
private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
+ private final static String DEFAULT_STRUCTURE_FOMART = DBRefSource.MMCIF;
+
/**
* Initialises the Jalview Application Log
*/
System.out
.println("Jalview Version: " + codeVersion + codeInstallation);
+ Pdb.setCurrentDefaultFomart(jalview.bin.Cache.getDefault(
+ "DEFAULT_STRUCTURE_FOMART", DEFAULT_STRUCTURE_FOMART));
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
if (jnlpVersion == null
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
+import jalview.io.StructureFile;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ResidueProperties;
import jalview.structure.AtomSpec;
{
String fileName = modelfilenames[modelnum];
boolean foundEntry = false;
- MCview.PDBfile pdb = null;
+ StructureFile pdb = null;
String pdbfile = null;
// model was probably loaded inline - so check the pdb file hashcode
if (loadedInline)
import jalview.api.StructureSelectionManagerProvider;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.SequenceI;
+import jalview.io.StructureFile;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
StructureSelectionManagerProvider ssmp)
{
PDBEntry entry = new PDBEntry();
- MCview.PDBfile pdbfile = null;
+ StructureFile pdbfile = null;
pdbfile = StructureSelectionManager.getStructureSelectionManager(ssmp)
.setMapping(false, new SequenceI[] { sequence }, null, choice,
protocol);
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Objects;
+import java.util.Vector;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
SequenceI selectedSeq = (SequenceI) tbl_summary.getValueAt(row,
refSeqColIndex);
selectedSeqsToView.add(selectedSeq);
- PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
+ PDBEntry pdbEntry = selectedSeq.getPDBEntry(pdbIdStr);
+ if (pdbEntry == null)
+ {
+ pdbEntry = getFindEntry(pdbIdStr,
+ selectedSeq.getAllPDBEntries());
+ }
if (pdbEntry == null)
{
pdbEntry = new PDBEntry();
}).start();
}
+ private PDBEntry getFindEntry(String id, Vector<PDBEntry> pdbEntries)
+ {
+ Objects.requireNonNull(id);
+ Objects.requireNonNull(pdbEntries);
+ PDBEntry foundEntry = null;
+ for (PDBEntry entry : pdbEntries)
+ {
+ if (entry.getId().equalsIgnoreCase(id))
+ {
+ return entry;
+ }
+ }
+ return foundEntry;
+ }
+
private void launchStructureViewer(StructureSelectionManager ssm,
final PDBEntry[] pdbEntriesToView,
final AlignmentPanel alignPanel, SequenceI[] sequences)
import jalview.datamodel.SequenceI;
import jalview.gui.IProgressIndicator;
import jalview.io.AppletFormatAdapter;
+import jalview.io.StructureFile;
import jalview.util.MappingUtils;
import jalview.util.MessageManager;
import jalview.ws.sifts.SiftsClient;
* - how to resolve data from resource
* @return null or the structure data parsed as a pdb file
*/
- synchronized public PDBfile setMapping(SequenceI[] sequence,
+ synchronized public StructureFile setMapping(SequenceI[] sequence,
String[] targetChains, String pdbFile, String protocol)
{
return setMapping(true, sequence, targetChains, pdbFile, protocol);
}
+
/**
* create sequence structure mappings between each sequence and the given
* pdbFile (retrieved via the given protocol).
* - how to resolve data from resource
* @return null or the structure data parsed as a pdb file
*/
- synchronized public PDBfile setMapping(boolean forStructureView,
+ synchronized public StructureFile setMapping(boolean forStructureView,
SequenceI[] sequenceArray, String[] targetChainIds,
String pdbFile,
String protocol)
}
}
}
- PDBfile pdb = null;
+ StructureFile pdb = null;
boolean isMapUsingSIFTs = SiftsSettings.isMapWithSifts();
try
{
- pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices,
- pdbFile, protocol);
+
+ if (pdbFile != null && isCIFFile(pdbFile))
+ {
+ pdb = new jalview.ext.jmol.JmolParser(addTempFacAnnot, parseSecStr,
+ secStructServices, pdbFile, protocol);
+ }
+ else
+ {
+ pdb = new PDBfile(addTempFacAnnot, parseSecStr, secStructServices,
+ pdbFile, protocol);
+ }
if (pdb.getId() != null && pdb.getId().trim().length() > 0
&& AppletFormatAdapter.FILE.equals(protocol))
return pdb;
}
+ private boolean isCIFFile(String filename)
+ {
+ String fileExt = filename.substring(filename.lastIndexOf(".") + 1,
+ filename.length());
+ return "cif".equalsIgnoreCase(fileExt);
+ }
+
private StructureMapping getStructureMapping(SequenceI seq,
- String pdbFile, String targetChainId, PDBfile pdb,
+ String pdbFile, String targetChainId, StructureFile pdb,
PDBChain maxChain, jalview.datamodel.Mapping sqmpping,
AlignSeq maxAlignseq)
{
private StructureMapping getNWMappings(SequenceI seq,
String pdbFile,
- String maxChainId, PDBChain maxChain, PDBfile pdb,
+ String maxChainId, PDBChain maxChain, StructureFile pdb,
AlignSeq maxAlignseq)
{
final StringBuilder mappingDetails = new StringBuilder(128);
try
{
reply = dbFetch.fetchDataAsFile(
- emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null);
+ emprefx.toLowerCase() + ":" + query.trim(), "emblxml", null,
+ ".xml");
} catch (Exception e)
{
stopQuery();
super();
}
+ private static String currentDefaultFomart = DBRefSource.MMCIF;
+
/*
* (non-Javadoc)
*
stopQuery();
return null;
}
+ String ext = getCurrentDefaultFomart().equalsIgnoreCase("mmcif") ? ".cif"
+ : ".xml";
EBIFetchClient ebi = new EBIFetchClient();
- file = ebi.fetchDataAsFile("pdb:" + id, "pdb", "raw").getAbsolutePath();
+ file = ebi.fetchDataAsFile("pdb:" + id,
+ getCurrentDefaultFomart().toLowerCase(), "raw", ext)
+ .getAbsolutePath();
stopQuery();
if (file == null)
{
{
pdbAlignment = new FormatAdapter().readFile(file,
- jalview.io.AppletFormatAdapter.FILE, "PDB");
+ jalview.io.AppletFormatAdapter.FILE,
+ getCurrentDefaultFomart());
if (pdbAlignment != null)
{
List<SequenceI> toremove = new ArrayList<SequenceI>();
{
return 0;
}
+
+ public static String getCurrentDefaultFomart()
+ {
+ return currentDefaultFomart;
+ }
+
+ public static void setCurrentDefaultFomart(String currentDefaultFomart)
+ {
+ Pdb.currentDefaultFomart = currentDefaultFomart;
+ }
}
// uniprotxml parameter required since december 2007
// uniprotkb dbname changed introduced december 2008
File file = ebi.fetchDataAsFile("uniprotkb:" + queries, "uniprotxml",
- null);
+ null, ".xml");
Vector<UniprotEntry> entries = getUniprotEntries(new FileReader(file));
if (entries != null)
* @return the file holding the response
* @throws OutOfMemoryError
*/
- public File fetchDataAsFile(String ids, String f, String s)
+ public File fetchDataAsFile(String ids, String f, String s, String ext)
throws OutOfMemoryError
{
File outFile = null;
try
{
- outFile = File.createTempFile("jalview", ".xml");
+ outFile = File.createTempFile("jalview", ext);
outFile.deleteOnExit();
fetchData(ids, f, s, outFile);
if (outFile.length() == 0)
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.SequenceI;
+import jalview.io.StructureFile;
import jalview.schemes.ResidueProperties;
import jalview.structure.StructureMapping;
import jalview.util.Format;
{
private Entry siftsEntry;
- private PDBfile pdb;
+ private StructureFile pdb;
private String pdbId;
* @param pdbId
* @throws SiftsException
*/
- public SiftsClient(PDBfile pdb) throws SiftsException
+ public SiftsClient(StructureFile pdb) throws SiftsException
{
this.pdb = pdb;
this.pdbId = pdb.getId();
import jalview.gui.AlignFrame;
import jalview.io.FileLoader;
import jalview.io.FormatAdapter;
+import jalview.io.StructureFile;
import org.testng.Assert;
import org.testng.AssertJUnit;
import org.testng.annotations.Test;
-import MCview.PDBfile;
-
public class Mapping
{
{ 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 };
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
- PDBfile pmap = ssm.setMapping(true, new SequenceI[] { uprot },
+ StructureFile pmap = ssm.setMapping(true, new SequenceI[] { uprot },
new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb",
jalview.io.FormatAdapter.FILE);
assertTrue(pmap != null);
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
// Associate the 1GAQ pdb file with the subsequence 'imported' from another
// source
- PDBfile pde = ssm.setMapping(true, new SequenceI[] { sq }, new String[]
+ StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq },
+ new String[]
{ "A" }, inFile = "examples/1gaq.txt", jalview.io.FormatAdapter.FILE);
assertTrue("PDB File couldn't be found", pde != null);
StructureMapping[] mp = ssm.getMapping(inFile);
FormatAdapter.PASTE, "FASTA");
SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0);
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
- PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
+ StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
new String[] { null }, "examples/3W5V.pdb",
jalview.io.FormatAdapter.FILE);
if (pmap == null)
StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
ssm.setProcessSecondaryStructure(true);
ssm.setAddTempFacAnnot(true);
- PDBfile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
+ StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
new String[] { null }, "test/jalview/ext/jmol/1QCF.pdb",
jalview.io.FormatAdapter.FILE);
assertTrue(pmap != null);
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
import jalview.io.FormatAdapter;
+import jalview.io.StructureFile;
import java.util.ArrayList;
import java.util.List;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import MCview.PDBfile;
-
public class StructureSelectionManagerTest
{
private StructureSelectionManager ssm;
StructureSelectionManager sm = new StructureSelectionManager();
sm.setProcessSecondaryStructure(true);
sm.setAddTempFacAnnot(true);
- PDBfile pmap = sm.setMapping(true, new SequenceI[] { seq },
+ StructureFile pmap = sm.setMapping(true, new SequenceI[] { seq },
new String[] { null }, "examples/1gaq.txt", FormatAdapter.FILE);
assertTrue(pmap != null);