public PDBChain(String pdbid, String id)
{
- this.pdbid = pdbid.toLowerCase();
+ this.pdbid = pdbid == null ? pdbid : pdbid.toLowerCase();
this.id = id;
}
else
{
- // boolean baseDetected = false;
- // for (Atom resAtom : resAtoms)
- // {
- // if (resAtom.insCode == ' ')
- // {
- // baseDetected = true;
- // }
- // }
- // if (!baseDetected)
- // {
- // continue;
- // }
// Make a new Residue object with the new atoms vector
residues.addElement(new Residue(resAtoms, resNumber - 1, count));
SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName
+ ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
+ count, offset + count, pdbid);
- // MCview.PDBChain.PDBFILEFEATURE);
resFeatures.addElement(sf);
resAnnotation.addElement(new Annotation(tmpat.tfactor));
// Keep totting up the sequence
package jalview.bin;
import jalview.datamodel.DBRefSource;
-import jalview.ws.dbsources.Pdb;
+import jalview.structure.StructureViewSettings;
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);
- Pdb.setCurrentDefaultFormat(jalview.bin.Cache.getDefault(
+ StructureViewSettings.setCurrentDefaultFormat(jalview.bin.Cache
+ .getDefault(
"DEFAULT_STRUCTURE_FORMAT", DEFAULT_STRUCTURE_FORMAT));
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
List<Atom> significantAtoms = new ArrayList<Atom>();
for (org.jmol.modelset.Atom atom : ms.at)
{
+ // System.out.println("Seq Id : " + atom.getSeqID());
+ // System.out.println("To String : " + atom.toString());
+ if (atom.isHetero())
+ {
+ continue;
+ }
if (atom.getAtomName().equalsIgnoreCase("CA")
|| atom.getAtomName().equalsIgnoreCase("P"))
{
package jalview.fts.api;
+import java.util.Map;
+
import javax.swing.JTable;
/**
* @param isEnabled
*/
public void setNextPageButtonEnabled(boolean isEnabled);
+
+ /**
+ * The HashMap used to store user preferences for summary table columns,
+ * window size and position
+ *
+ * @return
+ */
+ public Map<String, Integer> getTempUserPrefs();
}
import jalview.fts.api.FTSDataColumnI;
import java.util.Collection;
+import java.util.Map;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
}
public static void configureTableColumn(JTable tbl_summary,
- Collection<FTSDataColumnI> wantedFields)
+ Collection<FTSDataColumnI> wantedFields,
+ Map<String, Integer> columnPrefs)
{
for (FTSDataColumnI wantedField : wantedFields)
{
wantedField.getMinWidth());
tbl_summary.getColumn(wantedField.getName()).setMaxWidth(
wantedField.getMaxWidth());
+ int prefedWidth = columnPrefs.get(wantedField.getName()) == null ? wantedField
+ .getPreferredWidth() : columnPrefs.get(wantedField
+ .getName());
tbl_summary.getColumn(wantedField.getName()).setPreferredWidth(
- wantedField.getPreferredWidth());
+ prefedWidth);
} catch (Exception e)
{
e.printStackTrace();
if (wantedField.getDataType().getDataTypeClass() == Double.class)
{
DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
- wantedField.getDataType().isFormtted(),
- wantedField.getDataType().getSignificantFigures());
+ wantedField.getDataType().isFormtted(), wantedField
+ .getDataType().getSignificantFigures());
tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
}
else if (wantedField.getDataType().getDataTypeClass() == Integer.class)
{
DecimalFormatTableCellRenderer dfr = new DecimalFormatTableCellRenderer(
- wantedField.getDataType().isFormtted(),
- wantedField.getDataType().getSignificantFigures());
+ wantedField.getDataType().isFormtted(), wantedField
+ .getDataType().getSignificantFigures());
tbl_summary.getColumn(wantedField.getName()).setCellRenderer(dfr);
}
}
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.event.InternalFrameEvent;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
protected static final DecimalFormat totalNumberformatter = new DecimalFormat(
"###,###");
-
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
&& !inLayout)
{
resizingColumn.setPreferredWidth(resizingColumn.getWidth());
+ String colHeader = resizingColumn.getHeaderValue().toString();
+ getTempUserPrefs().put(colHeader, resizingColumn.getWidth());
}
resizeAndRepaint();
}
*/
private void jbInit() throws Exception
{
+ Integer width = getTempUserPrefs().get("FTSPanel.width") == null ? 800
+ : getTempUserPrefs().get("FTSPanel.width");
+ Integer height = getTempUserPrefs().get("FTSPanel.height") == null ? 400
+ : getTempUserPrefs().get("FTSPanel.height");
lbl_warning.setVisible(false);
lbl_warning.setFont(new java.awt.Font("Verdana", 0, 12));
lbl_loading.setVisible(false);
}
}
});
- scrl_searchResult.setPreferredSize(new Dimension(800, 400));
+ scrl_searchResult.setPreferredSize(new Dimension(width, height));
cmb_searchTarget.setFont(new java.awt.Font("Verdana", 0, 12));
cmb_searchTarget.addActionListener(new ActionListener()
}
};
tabbedPane.addChangeListener(changeListener);
- tabbedPane.setPreferredSize(new Dimension(800, 400));
+ tabbedPane.setPreferredSize(new Dimension(width, height));
tabbedPane.add(searchTabTitle, scrl_searchResult);
tabbedPane.add(configureCols, new FTSDataColumnPreferences(
PreferenceSource.SEARCH_SUMMARY, getFTSRestClient()));
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), 900, 500);
+ mainFrame
+ .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
+ mainFrame.setVisible(true);
+ mainFrame.setContentPane(this);
+ mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ Integer x = getTempUserPrefs().get("FTSPanel.x");
+ Integer y = getTempUserPrefs().get("FTSPanel.y");
+ if (x != null && y != null)
+ {
+ mainFrame.setLocation(x, y);
+ }
+ Desktop.addInternalFrame(mainFrame, getFTSFrameTitle(), width, height);
}
+ protected void closeAction()
+ {
+ // System.out.println(">>>>>>>>>> closing internal frame!!!");
+ // System.out.println("width : " + this.getWidth());
+ // System.out.println("heigh : " + this.getHeight());
+ // System.out.println("x : " + mainFrame.getX());
+ // System.out.println("y : " + mainFrame.getY());
+ getTempUserPrefs().put("FTSPanel.width", this.getWidth());
+ getTempUserPrefs().put("FTSPanel.height", pnl_results.getHeight());
+ getTempUserPrefs().put("FTSPanel.x", mainFrame.getX());
+ getTempUserPrefs().put("FTSPanel.y", mainFrame.getY());
+ mainFrame.dispose();
+ }
public class DeferredTextInputListener implements DocumentListener
{
private final Timer swingTimer;
protected void btn_back_ActionPerformed()
{
- mainFrame.dispose();
+ closeAction();
new SequenceFetcher(progressIdicator);
}
protected void btn_cancel_ActionPerformed()
{
- mainFrame.dispose();
+ closeAction();
}
/**
import jalview.gui.SequenceFetcher;
import jalview.util.MessageManager;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
@SuppressWarnings("serial")
public class PDBFTSPanel extends GFTSPanel
private String ftsFrameTitle = defaultFTSFrameTitle;
+ private static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+
public PDBFTSPanel(SequenceFetcher seqFetcher)
{
pageLimit = PDBFTSRestClient.getInstance().getDefaultResponsePageSize();
FTSRestResponse.getTableModel(request,
resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().setVisible(true);
}
return true;
}
+ @Override
+ public Map<String, Integer> getTempUserPrefs()
+ {
+ return tempUserPrefs;
+ }
+
}
import jalview.gui.SequenceFetcher;
import jalview.util.MessageManager;
+import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
@SuppressWarnings("serial")
public class UniprotFTSPanel extends GFTSPanel
private String ftsFrameTitle = defaultFTSFrameTitle;
-
+ private static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
public UniprotFTSPanel(SequenceFetcher seqFetcher)
{
FTSRestResponse.getTableModel(request,
resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().setVisible(true);
}
return ftsFrameTitle;
}
+ @Override
+ public Map<String, Integer> getTempUserPrefs()
+ {
+ return tempUserPrefs;
+ }
+
}
lastPdbRequest, reorderedStructuresSet));
FTSRestResponse.configureTableColumn(getResultTable(),
- wantedFields);
+ wantedFields, tempUserPrefs);
getResultTable().getColumn("Ref Sequence").setPreferredWidth(120);
getResultTable().getColumn("Ref Sequence").setMinWidth(100);
getResultTable().getColumn("Ref Sequence").setMaxWidth(200);
launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap,
new SequenceI[] { selectedSequence });
}
- mainFrame.dispose();
+ closeAction();
}
}).start();
}
{
// TODO obtain config value from preference settings.
// Set value to 'true' to test PDB processing with Jmol: JAL-1213
- boolean isParseWithJMOL = false;
+ boolean isParseWithJMOL = !StructureViewSettings
+ .getCurrentDefaultFormat().equalsIgnoreCase("PDB");
if (isParseWithJMOL)
{
StructureViewSettings.addSettings(annotFromStructure,
}
else
{
+ StructureViewSettings.addSettings(annotFromStructure,
+ localSecondaryStruct, serviceSecondaryStruct);
StructureViewSettings.setShowSeqFeatures(true);
alignFile = new MCview.PDBfile(annotFromStructure,
localSecondaryStruct, serviceSecondaryStruct, inFile,
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.event.InternalFrameEvent;
import javax.swing.table.TableColumn;
@SuppressWarnings("serial")
protected FTSDataColumnI[] previousWantedFields;
+ protected static Map<String, Integer> tempUserPrefs = new HashMap<String, Integer>();
+
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
&& !inLayout)
{
resizingColumn.setPreferredWidth(resizingColumn.getWidth());
+ String colHeader = resizingColumn.getHeaderValue().toString();
+ tempUserPrefs.put(colHeader, resizingColumn.getWidth());
}
resizeAndRepaint();
}
*/
private void jbInit() throws Exception
{
+ Integer width = tempUserPrefs.get("structureChooser.width") == null ? 800
+ : tempUserPrefs.get("structureChooser.width");
+ Integer height = tempUserPrefs.get("structureChooser.height") == null ? 400
+ : tempUserPrefs.get("structureChooser.height");
tbl_summary.setAutoCreateRowSorter(true);
tbl_summary.getTableHeader().setReorderingAllowed(false);
tbl_summary.addMouseListener(new MouseAdapter()
@Override
public void actionPerformed(ActionEvent e)
{
- mainFrame.dispose();
+ closeAction();
}
});
btn_cancel.addKeyListener(new KeyAdapter()
{
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
- mainFrame.dispose();
+ closeAction();
}
}
});
}
});
- scrl_foundStructures.setPreferredSize(new Dimension(800, 400));
+ scrl_foundStructures.setPreferredSize(new Dimension(width, height));
- scrl_localPDB.setPreferredSize(new Dimension(800, 400));
+ scrl_localPDB.setPreferredSize(new Dimension(width, height));
scrl_localPDB
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
}
};
pnl_filter.addChangeListener(changeListener);
- pnl_filter.setPreferredSize(new Dimension(800, 400));
+ pnl_filter.setPreferredSize(new Dimension(width, height));
pnl_filter.add(foundStructureSummary, scrl_foundStructures);
pnl_filter.add(configureCols, pdbDocFieldPrefs);
statusPanel.add(statusBar, null);
this.add(pnl_actionsAndStatus, java.awt.BorderLayout.SOUTH);
+ mainFrame
+ .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosing(InternalFrameEvent e)
+ {
+ closeAction();
+ }
+ });
mainFrame.setVisible(true);
mainFrame.setContentPane(this);
mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- Desktop.addInternalFrame(mainFrame, frameTitle, 900, 500);
+ Integer x = tempUserPrefs.get("structureChooser.x");
+ Integer y = tempUserPrefs.get("structureChooser.y");
+ if (x != null && y != null)
+ {
+ mainFrame.setLocation(x, y);
+ }
+ Desktop.addInternalFrame(mainFrame, frameTitle, width, height);
}
+ protected void closeAction()
+ {
+ // System.out.println(">>>>>>>>>> closing internal frame!!!");
+ // System.out.println("width : " + mainFrame.getWidth());
+ // System.out.println("heigh : " + mainFrame.getHeight());
+ // System.out.println("x : " + mainFrame.getX());
+ // System.out.println("y : " + mainFrame.getY());
+ tempUserPrefs.put("structureChooser.width", pnl_filter.getWidth());
+ tempUserPrefs.put("structureChooser.height", pnl_filter.getHeight());
+ tempUserPrefs.put("structureChooser.x", mainFrame.getX());
+ tempUserPrefs.put("structureChooser.y", mainFrame.getY());
+ mainFrame.dispose();
+ }
public boolean wantedFieldsUpdated()
{
if (previousWantedFields == null)
package jalview.structure;
+import jalview.datamodel.DBRefSource;
+
public class StructureViewSettings
{
private String dbRefType;
private static boolean showSeqFeatures = true;
+ private static String currentDefaultFormat = DBRefSource.PDB;
+
public static void addSettings(boolean addAlignmentAnnotations,
boolean predictSecStr, boolean externalSecStr)
{
StructureViewSettings.showSeqFeatures = showSeqFeatures;
}
+ public static String getCurrentDefaultFormat()
+ {
+ return currentDefaultFormat;
+ }
+
+ public static void setCurrentDefaultFormat(String currentDefaultFormat)
+ {
+ StructureViewSettings.currentDefaultFormat = currentDefaultFormat;
+ }
+
}
import jalview.datamodel.SequenceI;
import jalview.io.FormatAdapter;
import jalview.io.PDBFeatureSettings;
+import jalview.structure.StructureViewSettings;
import jalview.util.MessageManager;
import jalview.ws.ebi.EBIFetchClient;
public static final String FEATURE_RES_NUM = "RESNUM";
- private static String currentDefaultFormat = DBRefSource.PDB;
-
/*
* (non-Javadoc)
*
stopQuery();
return null;
}
- String ext = getCurrentDefaultFormat().equalsIgnoreCase("mmcif") ? ".cif"
+ String ext = StructureViewSettings.getCurrentDefaultFormat()
+ .equalsIgnoreCase("mmcif") ? ".cif"
: ".xml";
EBIFetchClient ebi = new EBIFetchClient();
file = ebi.fetchDataAsFile("pdb:" + id,
- getCurrentDefaultFormat().toLowerCase(), ext)
+ StructureViewSettings.getCurrentDefaultFormat().toLowerCase(),
+ ext)
.getAbsolutePath();
stopQuery();
if (file == null)
pdbAlignment = new FormatAdapter().readFile(file,
jalview.io.AppletFormatAdapter.FILE,
- getCurrentDefaultFormat());
+ StructureViewSettings.getCurrentDefaultFormat());
if (pdbAlignment != null)
{
List<SequenceI> toremove = new ArrayList<SequenceI>();
return 0;
}
- public static String getCurrentDefaultFormat()
- {
- return currentDefaultFormat;
- }
-
- public static void setCurrentDefaultFormat(String currentDefaultFomart)
- {
- Pdb.currentDefaultFormat = currentDefaultFomart;
- }
/**
* Returns a descriptor for suitable feature display settings with
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.SequenceI;
+import jalview.structure.StructureViewSettings;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.util.List;
@Test(groups = { "Network" }, enabled = true)
public void testRnaSeqRetrieve() throws Exception
{
+ Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Boolean.TRUE.toString());
+ Cache.applicationProperties.setProperty("DEFAULT_STRUCTURE_FORMAT",
+ "PDB");
List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
AlignmentI response = sps.get(0).getSequenceRecords("2GIS");
assertTrue(response != null);
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
+ StructureViewSettings.setCurrentDefaultFormat("PDB");
+
testRetrieveProteinSeqFromPDB();
}
public void testmmCifSeqRetrieve() throws Exception
{
Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
- Boolean.FALSE.toString());
+ Boolean.TRUE.toString());
+ StructureViewSettings.setCurrentDefaultFormat("mmCIF");
testRetrieveProteinSeqFromPDB();
}