From 32ce9ddb7ce1a68add53dd81785ae428ca136a83 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 24 Nov 2005 12:16:09 +0000 Subject: [PATCH] Don't parse input id, leave it as it is --- src/jalview/analysis/AlignSeq.java | 31 +++++++++++ src/jalview/analysis/AlignmentSorter.java | 4 +- src/jalview/appletgui/AlignFrame.java | 19 +------ src/jalview/appletgui/AlignViewport.java | 11 ---- src/jalview/appletgui/AlignmentPanel.java | 2 +- src/jalview/appletgui/IdCanvas.java | 8 +-- src/jalview/appletgui/TreePanel.java | 32 ----------- src/jalview/bin/JalviewLite.java | 3 +- src/jalview/datamodel/Alignment.java | 19 +------ src/jalview/datamodel/AlignmentI.java | 2 - src/jalview/datamodel/Sequence.java | 64 +++------------------- src/jalview/datamodel/SequenceI.java | 4 +- src/jalview/gui/AlignFrame.java | 11 +--- src/jalview/gui/AlignViewport.java | 21 ------- src/jalview/gui/AlignmentPanel.java | 6 +- src/jalview/gui/IdCanvas.java | 5 +- src/jalview/gui/IdPanel.java | 2 +- src/jalview/gui/PopupMenu.java | 16 +++--- src/jalview/gui/Preferences.java | 14 ----- src/jalview/gui/SeqCanvas.java | 11 ++-- src/jalview/gui/SequenceFetcher.java | 27 ++++++--- src/jalview/gui/TreePanel.java | 28 ---------- src/jalview/io/AlignFile.java | 13 +---- src/jalview/io/AppletFormatAdapter.java | 2 - src/jalview/io/FormatAdapter.java | 14 ----- src/jalview/io/HTMLOutput.java | 4 +- src/jalview/io/SequenceFeatureFetcher.java | 10 ++-- src/jalview/jbgui/GAlignFrame.java | 12 ---- src/jalview/jbgui/GPreferences.java | 82 ++++++---------------------- src/jalview/jbgui/GTreePanel.java | 11 ---- 30 files changed, 115 insertions(+), 373 deletions(-) diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index 661857f..1b7351b 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -403,6 +403,37 @@ public class AlignSeq } } + public int [] getExactMapping() + { + // Print out the matching chars + int [] mapping = new int[astr1.length()]; + int agap=0, bgap=0; + boolean gap; + for(int i=0; i idWidth) { diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index 7bcc987..9773019 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -74,9 +74,8 @@ public class IdCanvas gg.setColor(Color.black); } - String string = s.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); - gg.drawString(string, 0, + gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0, ((i - starty) * charHeight) + ypos + charHeight - (charHeight / 5)); @@ -256,10 +255,9 @@ public class IdCanvas av.charHeight); gg.setColor(currentTextColor); - String string = av.alignment.getSequenceAt(i) - .getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); - gg.drawString(string, 0, + gg.drawString(av.alignment.getSequenceAt(i) + .getDisplayId(av.getShowJVSuffix()), 0, ((i - starty) * av.charHeight) + av.charHeight - (av.charHeight / 5)); } diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index 03662ab..6eeb3d8 100755 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -220,7 +220,6 @@ public class TreePanel extends Frame protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem(); Menu fileMenu = new Menu(); MenuItem newickOutput = new MenuItem(); - CheckboxMenuItem fullId = new CheckboxMenuItem(); private void jbInit() throws Exception { setLayout(borderLayout1); @@ -265,14 +264,6 @@ public class TreePanel extends Frame newickOutput_actionPerformed(actionEvent); } }); - fullId.setLabel("Show Full Id"); - fullId.addItemListener(new ItemListener() - { - public void itemStateChanged(ItemEvent itemEvent) - { - fullId_itemStateChanged(itemEvent); - } - }); add(scrollPane, BorderLayout.CENTER); jMenuBar1.add(fileMenu); @@ -282,30 +273,7 @@ public class TreePanel extends Frame jMenu2.add(distanceMenu); jMenu2.add(bootstrapMenu); jMenu2.add(placeholdersMenu); - jMenu2.add(fullId); - fullId.setState(true); fileMenu.add(newickOutput); } - - public void fullId_itemStateChanged(ItemEvent itemEvent) - { - tree.findHeight(tree.getTopNode()); - - // Now have to calculate longest name based on the leaves - Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector()); - - treeCanvas.longestName=""; - for (int i = 0; i < leaves.size(); i++) - { - SequenceNode lf = (SequenceNode) leaves.elementAt(i); - Sequence seq = (Sequence) lf.element(); - lf.setName(seq.getDisplayId(fullId.getState(), false)); - if(lf.getName().length() > treeCanvas.longestName.length()) - treeCanvas.longestName = lf.getName(); - } - - treeCanvas.repaint(); - } - } diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 7057e3c..de1ca61 100755 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -171,8 +171,7 @@ public class JalviewLite extends Applet boolean seqlimits = suffix.equalsIgnoreCase("true"); String reply = new AppletFormatAdapter().formatSequences(format, - currentAlignFrame.viewport.getAlignment().getSequences(), - true, seqlimits); + currentAlignFrame.viewport.getAlignment().getSequences(), seqlimits); return reply; } catch (Exception ex) diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 67864e8..3a1b44a 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -451,23 +451,6 @@ public class Alignment implements AlignmentI } } - public SequenceI findShortName(String name) - { - int i = 0; - - while (i < sequences.size()) - { - if (getSequenceAt(i).getShortName().equals(name)) - { - return getSequenceAt(i); - } - - i++; - } - - return null; - } - /** */ public SequenceI findName(String name) { @@ -720,7 +703,7 @@ public class Alignment implements AlignmentI for (int i = 0; i < getHeight(); i++) { - seqs[i] = new Sequence(getSequenceAt(i).getDisplayId(true,true), + seqs[i] = new Sequence(getSequenceAt(i).getDisplayId(true), AlignSeq.extractGaps( jalview.util.Comparison.GapChars, getSequenceAt(i).getSequence() diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index ed1ec4e..4f3e38c 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -125,8 +125,6 @@ public interface AlignmentI */ public SequenceI findName(String name); - public SequenceI findShortName(String name); - /** * Finds index of a given sequence in the alignment. diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index df7345a..dce2e51 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -33,7 +33,6 @@ public class Sequence implements SequenceI { SequenceI datasetSequence; String name; - String shortName; String sequence; String description; int start; @@ -69,57 +68,26 @@ public class Sequence implements SequenceI void parseId() { - // Read in any DB refs first - StringTokenizer st = new StringTokenizer(name, "|"); - if(st.countTokens()<1) - { - shortName = name; - return; - } - - while (st.countTokens() > 1) - { - String a = st.nextToken(); - String b = st.nextToken(); - addDBRef(new DBRefEntry(a, "0", b)); - } - - if (st.hasMoreTokens()) - shortName = st.nextToken(); - // Remove /start-end from sequence - if (shortName.indexOf("/") > 0) + if (name.indexOf("/") > 0) { - st = new StringTokenizer(shortName, "/"); - String limits = null; + String limits = name.substring(name.lastIndexOf("/")+1); try { - if (st.countTokens() == 2) - { - - shortName = st.nextToken(); - - limits = st.nextToken(); - - st = new StringTokenizer(limits, "-"); + StringTokenizer st = new StringTokenizer(limits, "-"); if (st.countTokens() == 2) { setStart(Integer.valueOf(st.nextToken()).intValue()); setEnd(Integer.valueOf(st.nextToken()).intValue()); } - } // If we're still in this loop, parsing of start and end was ok // Therefore remove it from the sequence name name = name.substring(0, name.lastIndexOf("/")); } catch (NumberFormatException ex) - { - // Problem parsing sequence limits. Just add it back to the - // Id so we dont lose this info - shortName += "/" + limits; - } + { } } } @@ -230,20 +198,9 @@ public class Sequence implements SequenceI * * @return DOCUMENT ME! */ - public String getDisplayId(boolean dbref, boolean jvsuffix) + public String getDisplayId(boolean jvsuffix) { - StringBuffer result = new StringBuffer(); - if (dbref && dbrefs != null) - { - for (int i = 0; i < dbrefs.size(); i++) - { - DBRefEntry entry = (DBRefEntry) dbrefs.elementAt(i); - result.append(entry.getSource() + "|" + entry.getAccessionId() + "|"); - } - } - - result.append(shortName); - + StringBuffer result = new StringBuffer(name); if (jvsuffix) { result.append("/" + start + "-" + end); @@ -455,9 +412,7 @@ public class Sequence implements SequenceI while ((j < i) && (j < sequence.length())) { - char c = sequence.charAt(j); - - if (!jalview.util.Comparison.isGap((c))) + if (!jalview.util.Comparison.isGap((sequence.charAt(j)))) { pos++; } @@ -628,9 +583,4 @@ public class Sequence implements SequenceI return datasetSequence; } - public String getShortName() - { - return shortName; - } - } diff --git a/src/jalview/datamodel/SequenceI.java b/src/jalview/datamodel/SequenceI.java index 4887ae5..82d38b4 100755 --- a/src/jalview/datamodel/SequenceI.java +++ b/src/jalview/datamodel/SequenceI.java @@ -45,7 +45,7 @@ public interface SequenceI */ public String getName(); - public String getShortName(); + /** * DOCUMENT ME! * @@ -65,7 +65,7 @@ public interface SequenceI * * @return DOCUMENT ME! */ - public String getDisplayId(boolean dbref, boolean jvsuffix); + public String getDisplayId(boolean jvsuffix); /** * DOCUMENT ME! diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 74f081b..786f5f9 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -736,7 +736,6 @@ public class AlignFrame } FastaFile ff = new FastaFile(); - ff.addDBPrefix( viewport.showDBPrefix ); ff.addJVSuffix( viewport.showJVSuffix ); c.setContents(new StringSelection( ff.print(seqs)), this); Desktop.jalviewClipboard = new Object[]{seqs, viewport.alignment.getDataset()}; @@ -1322,14 +1321,6 @@ public class AlignFrame alignPanel.repaint(); } - public void seqDBRef_actionPerformed(ActionEvent e) - { - viewport.setShowDBPrefix(seqDBRef.isSelected()); - - alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth()); - alignPanel.repaint(); - } - /** * DOCUMENT ME! @@ -1918,7 +1909,7 @@ public class AlignFrame { addHistoryItem(new HistoryItem("ID Sort", viewport.alignment, HistoryItem.SORT)); - AlignmentSorter.sortByID(viewport.getAlignment(), viewport.showDBPrefix); + AlignmentSorter.sortByID(viewport.getAlignment()); alignPanel.repaint(); } diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 4fd39a3..7f86753 100755 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -43,7 +43,6 @@ public class AlignViewport int endRes; int startSeq; int endSeq; - boolean showDBPrefix = true; boolean showJVSuffix = true; boolean showText = true; boolean showColourText = false; @@ -114,7 +113,6 @@ public class AlignViewport this.startSeq = 0; this.endSeq = alignment.getHeight() - 1; - showDBPrefix = Cache.getDefault("SHOW_DBPREFIX", true); showJVSuffix = Cache.getDefault("SHOW_JVSUFFIX", true); showAnnotation = Cache.getDefault("SHOW_ANNOTATIONS", true); showConservation = Cache.getDefault("SHOW_CONSERVATION", true); @@ -939,25 +937,6 @@ public class AlignViewport showJVSuffix = b; } - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public boolean getShowDBPrefix() - { - return showDBPrefix; - } - - /** - * DOCUMENT ME! - * - * @param b DOCUMENT ME! - */ - public void setShowDBPrefix(boolean b) - { - showDBPrefix = b; - } /** * DOCUMENT ME! diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index e5d3db1..43fb5fa 100755 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -204,7 +204,7 @@ public class AlignmentPanel extends GAlignmentPanel { SequenceI s = al.getSequenceAt(i); - id = s.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); + id = s.getDisplayId(av.getShowJVSuffix()); if (fm.stringWidth(id) > idWidth) { @@ -679,7 +679,7 @@ public class AlignmentPanel extends GAlignmentPanel pg.setColor(currentTextColor); String string = av.getAlignment().getSequenceAt(i).getDisplayId - (av.getShowDBPrefix(), av.getShowJVSuffix()); + ( av.getShowJVSuffix()); pg.drawString(string, 0, ( ( (i - startSeq) * av.charHeight) + av.getCharHeight()) - @@ -765,7 +765,7 @@ public class AlignmentPanel extends GAlignmentPanel for (int i = 0; i < av.alignment.getHeight(); i++) { SequenceI s = av.alignment.getSequenceAt(i); - String string = s.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); + String string = s.getDisplayId( av.getShowJVSuffix()); pg.drawString(string, 0, ( (i * av.charHeight) + ypos + av.charHeight) - diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 5314ade..0c6da36 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -94,7 +94,7 @@ public class IdCanvas extends JPanel } - gg.drawString( s.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()), + gg.drawString( s.getDisplayId(av.getShowJVSuffix()), 0, (((i - starty + 1) * charHeight) + ypos) - (charHeight / 5)); } @@ -284,8 +284,7 @@ public class IdCanvas extends JPanel gg.setColor(currentTextColor); - String string = av.alignment.getSequenceAt(i).getDisplayId( - av.getShowDBPrefix(), av.getShowJVSuffix()); + String string = av.alignment.getSequenceAt(i).getDisplayId( av.getShowJVSuffix()); gg.drawString(string, 0, (((i - starty) * av.charHeight) + av.charHeight) - diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 4a4ea63..2d9c4f3 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -80,7 +80,7 @@ public class IdPanel extends JPanel implements MouseListener, if(seq!=-1) { StringBuffer tip = new StringBuffer(""); - tip.append(av.alignment.getSequenceAt(seq).getDisplayId(true, true)); + tip.append(av.alignment.getSequenceAt(seq).getDisplayId(true)); if (av.alignment.getSequenceAt(seq).getDescription() != null) { tip.append(""); @@ -217,7 +217,7 @@ public class HTMLOutput startPos = seq.findPosition( startRes ); endPos = seq.findPosition( endRes )-1; - String id = seq.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); + String id = seq.getDisplayId(av.getShowJVSuffix()); out.println(""); diff --git a/src/jalview/io/SequenceFeatureFetcher.java b/src/jalview/io/SequenceFeatureFetcher.java index a70aaef..b3de0f3 100755 --- a/src/jalview/io/SequenceFeatureFetcher.java +++ b/src/jalview/io/SequenceFeatureFetcher.java @@ -109,9 +109,9 @@ public class SequenceFeatureFetcher implements Runnable seqIndex++, i++) { SequenceI sequence = (SequenceI) sequences.get(seqIndex); - if(!ids.contains(sequence.getShortName())) + if(!ids.contains(sequence.getName())) { - ids.add(sequence.getShortName()); + ids.add(sequence.getName()); unknownSequences.add(sequence); } } @@ -205,13 +205,13 @@ public class SequenceFeatureFetcher implements Runnable { entry = (UniprotEntry) entries.elementAt(i); String idmatch = entry.getAccession().elementAt(0).toString(); - sequence = dataset.findShortName(idmatch); + sequence = dataset.findName(idmatch); if (sequence == null) { //Sequence maybe Name, not Accession - idmatch = entry.getName().elementAt(0).toString();; - sequence = dataset.findShortName(idmatch); + idmatch = entry.getName().elementAt(0).toString(); + sequence = dataset.findName(idmatch); } if (sequence == null) diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index f7b1342..bb69a54 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -21,7 +21,6 @@ package jalview.jbgui; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import javax.swing.event.*; import jalview.schemes.*; @@ -117,7 +116,6 @@ public class GAlignFrame protected JCheckBoxMenuItem showTranslation = new JCheckBoxMenuItem(); //protected JTabbedPane tabbedPane = new JTabbedPane(); public JMenuItem featureSettings = new JMenuItem(); - public JCheckBoxMenuItem seqDBRef = new JCheckBoxMenuItem(); JMenuItem fetchSequence = new JMenuItem(); public GAlignFrame() @@ -933,15 +931,6 @@ public class GAlignFrame featureSettings_actionPerformed(e); } }); - seqDBRef.setState( jalview.bin.Cache.getDefault("SHOW_DBPREFIX",true)); - seqDBRef.setText("Show Full Sequence Id"); - seqDBRef.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - seqDBRef_actionPerformed(e); - } - }); fetchSequence.setText("Fetch Sequence..."); fetchSequence.addActionListener(new ActionListener() { @@ -990,7 +979,6 @@ public class GAlignFrame viewMenu.add(font); viewMenu.addSeparator(); viewMenu.add(wrapMenuItem); - viewMenu.add(seqDBRef); viewMenu.add(seqLimits); viewMenu.add(scaleAbove); viewMenu.add(scaleLeft); diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index ccca6a6..7cca77c 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -92,28 +92,19 @@ public class GPreferences extends JPanel JLabel epsLabel = new JLabel(); protected JComboBox epsRendering = new JComboBox(); JLabel jLabel1 = new JLabel(); - JLabel jLabel2 = new JLabel(); - protected JCheckBox pileupdb = new JCheckBox(); - protected JCheckBox fastadb = new JCheckBox(); protected JCheckBox blcjv = new JCheckBox(); protected JCheckBox pileupjv = new JCheckBox(); - protected JCheckBox msfdb = new JCheckBox(); - protected JCheckBox pfamdb = new JCheckBox(); protected JCheckBox clustaljv = new JCheckBox(); protected JCheckBox msfjv = new JCheckBox(); - protected JCheckBox blcdb = new JCheckBox(); - protected JCheckBox clustaldb = new JCheckBox(); protected JCheckBox fastajv = new JCheckBox(); protected JCheckBox pfamjv = new JCheckBox(); - JLabel jLabel10 = new JLabel(); JLabel jLabel11 = new JLabel(); FlowLayout flowLayout1 = new FlowLayout(); - protected JCheckBox pirdb = new JCheckBox(); protected JCheckBox pirjv = new JCheckBox(); JPanel jPanel11 = new JPanel(); - GridLayout gridLayout3 = new GridLayout(); Font verdana11 = new java.awt.Font("Verdana", Font.PLAIN, 11); protected JCheckBox seqLimit = new JCheckBox(); + GridLayout gridLayout3 = new GridLayout(); /** * Creates a new GPreferences object. */ @@ -337,70 +328,40 @@ public class GPreferences extends JPanel jLabel1.setFont(verdana11); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); jLabel1.setText("/start-end suffix"); - jLabel2.setFont(verdana11); - jLabel2.setHorizontalAlignment(SwingConstants.RIGHT); - jLabel2.setHorizontalTextPosition(SwingConstants.RIGHT); - jLabel2.setText("Database ref prefix"); jLabel1.setFont(verdana11); - jLabel2.setFont(verdana11); fastajv.setFont(verdana11); - fastajv.setHorizontalAlignment(SwingConstants.CENTER); - jLabel10.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); - jLabel10.setHorizontalAlignment(SwingConstants.RIGHT); - jLabel10.setText("(Uniprot|P02055)"); + fastajv.setHorizontalAlignment(SwingConstants.LEFT); jLabel11.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); jLabel11.setHorizontalAlignment(SwingConstants.CENTER); jLabel11.setText("(/15-380)"); - clustaldb.setFont(verdana11); - clustaldb.setHorizontalAlignment(SwingConstants.RIGHT); - clustaldb.setHorizontalTextPosition(SwingConstants.LEFT); - clustaldb.setText("Clustal "); - blcdb.setFont(verdana11); - blcdb.setHorizontalAlignment(SwingConstants.RIGHT); - blcdb.setHorizontalTextPosition(SwingConstants.LEFT); - blcdb.setText("BLC "); - fastadb.setFont(verdana11); - fastadb.setHorizontalAlignment(SwingConstants.RIGHT); - fastadb.setHorizontalTextPosition(SwingConstants.LEFT); - fastadb.setText("Fasta "); - msfdb.setFont(verdana11); - msfdb.setHorizontalTextPosition(SwingConstants.LEFT); - msfdb.setHorizontalAlignment(SwingConstants.RIGHT); - msfdb.setText("MSF "); - pfamdb.setFont(verdana11); - pfamdb.setHorizontalAlignment(SwingConstants.RIGHT); - pfamdb.setHorizontalTextPosition(SwingConstants.LEFT); - pfamdb.setText("PFAM "); - pileupdb.setFont(verdana11); - pileupdb.setHorizontalAlignment(SwingConstants.RIGHT); - pileupdb.setHorizontalTextPosition(SwingConstants.LEFT); - pileupdb.setText("Pileup "); + clustaljv.setText("Clustal "); + blcjv.setText("BLC "); + fastajv.setText("Fasta "); + msfjv.setText("MSF "); + pfamjv.setText("PFAM "); + pileupjv.setText("Pileup "); msfjv.setFont(verdana11); - msfjv.setHorizontalAlignment(SwingConstants.CENTER); - pirdb.setFont(verdana11); - pirdb.setHorizontalAlignment(SwingConstants.RIGHT); - pirdb.setHorizontalTextPosition(SwingConstants.LEFT); - pirdb.setText("PIR "); + msfjv.setHorizontalAlignment(SwingConstants.LEFT); + pirjv.setText("PIR "); jPanel11.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); jPanel11.setBorder(titledBorder2); - jPanel11.setBounds(new Rectangle(18, 72, 325, 182)); + jPanel11.setBounds(new Rectangle(63, 70, 137, 182)); jPanel11.setLayout(gridLayout3); - gridLayout3.setColumns(2); - gridLayout3.setRows(9); blcjv.setFont(verdana11); - blcjv.setHorizontalAlignment(SwingConstants.CENTER); + blcjv.setHorizontalAlignment(SwingConstants.LEFT); clustaljv.setFont(verdana11); - clustaljv.setHorizontalAlignment(SwingConstants.CENTER); + clustaljv.setHorizontalAlignment(SwingConstants.LEFT); pfamjv.setFont(verdana11); - pfamjv.setHorizontalAlignment(SwingConstants.CENTER); + pfamjv.setHorizontalAlignment(SwingConstants.LEFT); pileupjv.setFont(verdana11); - pileupjv.setHorizontalAlignment(SwingConstants.CENTER); + pileupjv.setHorizontalAlignment(SwingConstants.LEFT); pirjv.setFont(verdana11); - pirjv.setHorizontalAlignment(SwingConstants.CENTER); + pirjv.setHorizontalAlignment(SwingConstants.LEFT); seqLimit.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); seqLimit.setHorizontalTextPosition(SwingConstants.LEADING); seqLimit.setText("Sequence Limits (/1-350)"); seqLimit.setBounds(new Rectangle(172, 82, 195, 23)); + gridLayout3.setRows(9); jPanel2.add(fullScreen); jPanel2.add(annotations); jPanel2.add(dbRef); @@ -474,23 +435,14 @@ public class GPreferences extends JPanel tabbedPane.add(visualTab, "Visual"); tabbedPane.add(connectTab,"Connections"); tabbedPane.add(exportTab, "Output"); - jPanel11.add(jLabel2); jPanel11.add(jLabel1); - jPanel11.add(jLabel10); jPanel11.add(jLabel11); - jPanel11.add(blcdb); jPanel11.add(blcjv); - jPanel11.add(clustaldb); jPanel11.add(clustaljv); - jPanel11.add(fastadb); jPanel11.add(fastajv); - jPanel11.add(msfdb); jPanel11.add(msfjv); - jPanel11.add(pfamdb); jPanel11.add(pfamjv); - jPanel11.add(pileupdb); jPanel11.add(pileupjv); - jPanel11.add(pirdb); jPanel11.add(pirjv); exportTab.add(epsLabel); exportTab.add(epsRendering); diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index 8fb952d..a70920c 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -41,8 +41,6 @@ public class GTreePanel JMenuItem epsTree = new JMenuItem(); JMenu saveAsMenu = new JMenu(); JMenuItem textbox = new JMenuItem(); - protected JCheckBoxMenuItem fullid = new JCheckBoxMenuItem(); - public GTreePanel() { try @@ -149,14 +147,6 @@ public class GTreePanel textbox_actionPerformed(e); } }); - fullid.setText("Show Full Sequence Id"); - fullid.addActionListener(new ActionListener() - { - public void actionPerformed(ActionEvent e) - { - fullid_actionPerformed(e); - } - }); this.getContentPane().add(scrollPane, BorderLayout.CENTER); jMenuBar1.add(jMenu1); jMenuBar1.add(jMenu2); @@ -168,7 +158,6 @@ public class GTreePanel jMenu2.add(distanceMenu); jMenu2.add(bootstrapMenu); jMenu2.add(placeholdersMenu); - jMenu2.add(fullid); saveAsMenu.add(saveAsNewick); saveAsMenu.add(epsTree); saveAsMenu.add(pngTree); -- 1.7.10.2
"); diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index f87dcef..ed1e759 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -24,7 +24,6 @@ import jalview.analysis.*; import jalview.datamodel.*; -import jalview.io.*; import jalview.schemes.*; @@ -112,14 +111,17 @@ public class PopupMenu extends JPopupMenu } - if ((seq != null) - && seq.getDatasetSequence().getPDBId() != null) + if ((seq != null)) + // && seq.getDatasetSequence().getPDBId() != null) { - java.util.Enumeration e = seq.getDatasetSequence().getPDBId().elements(); - while(e.hasMoreElements()) + //java.util.Enumeration e = seq.getDatasetSequence().getPDBId().elements(); + // while(e.hasMoreElements()) { + final PDBEntry pdb = new PDBEntry(); + pdb.setId("pdb"); - final PDBEntry pdb = (PDBEntry)e.nextElement(); + + // (PDBEntry)e.nextElement(); JMenuItem pdbMenuItem = new JMenuItem(); pdbMenuItem.setText("View PDB entry: "+pdb.getId()); pdbMenuItem.addActionListener(new java.awt.event.ActionListener() @@ -804,7 +806,7 @@ public class PopupMenu extends JPopupMenu */ void sequenceName_actionPerformed(ActionEvent e) { - String id = sequence.getDisplayId(false, false); + String id = sequence.getName(); String s = (String) JOptionPane.showInternalInputDialog(ap, "Edit sequence name", "Edit sequence name (" + sequence.getName() + ")", diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 8915f6f..1e157cd 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -141,19 +141,12 @@ public class Preferences extends GPreferences epsRendering.addItem("Text"); epsRendering.setSelectedItem( Cache.getDefault("EPS_RENDERING", "Prompt each time")); - blcdb.setSelected( Cache.getDefault("BLC_DBPREFIX", false) ); blcjv.setSelected( Cache.getDefault("BLC_JVSUFFIX", true) ); - clustaldb.setSelected( Cache.getDefault("CLUSTAL_DBPREFIX", false) ); clustaljv.setSelected( Cache.getDefault("CLUSTAL_JVSUFFIX", true) ); - fastadb.setSelected( Cache.getDefault("FASTA_DBPREFIX", false) ); fastajv.setSelected( Cache.getDefault("FASTA_JVSUFFIX", true) ); - msfdb.setSelected( Cache.getDefault("MSF_DBPREFIX", false) ); msfjv.setSelected( Cache.getDefault("MSF_JVSUFFIX", true) ); - pfamdb.setSelected( Cache.getDefault("PFAM_DBPREFIX", false) ); pfamjv.setSelected( Cache.getDefault("PFAM_JVSUFFIX", true) ); - pileupdb.setSelected( Cache.getDefault("PILEUP_DBPREFIX", false) ); pileupjv.setSelected( Cache.getDefault("PILEUP_JVSUFFIX", true) ); - pirdb.setSelected( Cache.getDefault("PIR_DBPREFIX", false) ); pirjv.setSelected( Cache.getDefault("PIR_JVSUFFIX", true) ); /**************************************************** @@ -274,19 +267,12 @@ public class Preferences extends GPreferences } - Cache.applicationProperties.setProperty("BLC_DBPREFIX", Boolean.toString(blcdb.isSelected()) ); Cache.applicationProperties.setProperty("BLC_JVSUFFIX", Boolean.toString(blcjv.isSelected()) ); - Cache.applicationProperties.setProperty("CLUSTAL_DBPREFIX", Boolean.toString(clustaldb.isSelected()) ); Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX", Boolean.toString(clustaljv.isSelected()) ); - Cache.applicationProperties.setProperty("FASTA_DBPREFIX", Boolean.toString(fastadb.isSelected()) ); Cache.applicationProperties.setProperty("FASTA_JVSUFFIX", Boolean.toString(fastajv.isSelected()) ); - Cache.applicationProperties.setProperty("MSF_DBPREFIX", Boolean.toString(msfdb.isSelected()) ); Cache.applicationProperties.setProperty("MSF_JVSUFFIX", Boolean.toString(msfjv.isSelected()) ); - Cache.applicationProperties.setProperty("PFAM_DBPREFIX", Boolean.toString(pfamdb.isSelected()) ); Cache.applicationProperties.setProperty("PFAM_JVSUFFIX", Boolean.toString(pfamjv.isSelected()) ); - Cache.applicationProperties.setProperty("PILEUP_DBPREFIX", Boolean.toString(pileupdb.isSelected()) ); Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX", Boolean.toString(pileupjv.isSelected()) ); - Cache.applicationProperties.setProperty("PIR_DBPREFIX", Boolean.toString(pirdb.isSelected()) ); Cache.applicationProperties.setProperty("PIR_JVSUFFIX", Boolean.toString(pirjv.isSelected()) ); diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index fcec1ac..42424d9 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -279,10 +279,13 @@ public class SeqCanvas extends JComponent // Set this to false to force a full panel paint public void paintComponent(Graphics g) { + super.paintComponent(g); + sr.renderGaps(av.renderGaps); - if ((img != null) && - (fastPaint && getVisibleRect() != g.getClipBounds())) + if ( img != null && (fastPaint + || (getVisibleRect().width != g.getClipBounds().width) + || (getVisibleRect().height != g.getClipBounds().height))) { g.drawImage(img, 0, 0, this); fastPaint = false; @@ -290,8 +293,6 @@ public class SeqCanvas extends JComponent } - - // this draws the whole of the alignment imgWidth = getWidth(); imgHeight = getHeight(); @@ -328,7 +329,7 @@ public class SeqCanvas extends JComponent if (pdbCanvas != null) { - pdbCanvas.updateSeqColours(); + pdbCanvas.updateSeqColours(); } } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 1e331b2..b0476ce 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -39,7 +39,10 @@ public class SequenceFetcher frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, "Sequence Fetcher", 390, 120); + if(System.getProperty("os.name").startsWith("Mac")) + Desktop.addInternalFrame(frame, "Sequence Fetcher", 390, 135); + else + Desktop.addInternalFrame(frame, "Sequence Fetcher", 390, 120); } private void jbInit() @@ -113,8 +116,7 @@ public class SequenceFetcher public void ok_actionPerformed(ActionEvent e) { - frame.setTitle("Sequence Fetcher - Fetching Sequence from " + - database.getSelectedItem()); + frame.setTitle("WSDBfetch@EBI Sequence Fetcher - Fetching Sequence..."); database.setEnabled(false); textfield.setEnabled(false); ok.setEnabled(false); @@ -122,7 +124,6 @@ public class SequenceFetcher Thread worker = new Thread(this); worker.start(); - } public void run() @@ -144,14 +145,24 @@ public class SequenceFetcher } else if (database.getSelectedItem().equals("PDB")) { + String id = textfield.getText().toUpperCase(); + String chain=null; + if(id.indexOf(":")>-1) + { + chain = id.substring(id.indexOf(":")+1); + id = id.substring(0,id.indexOf(":")); + System.out.println(id+" "+chain); + } + EBIFetchClient ebi = new EBIFetchClient(); - String[] reply = ebi.fetchData("pdb:" + textfield.getText(), "pdb", + String[] reply = ebi.fetchData("pdb:" + id, "pdb", "raw"); try{ PDBfile pdbfile = new PDBfile(reply); for (int i = 0; i < pdbfile.chains.size(); i++) { - result.append("\n>PDB|" + textfield.getText()+"|"+ + if( chain == null || ((PDBChain)pdbfile.chains.elementAt(i)).id.toUpperCase().equals(chain)) + result.append("\n>PDB|" + id+"|"+ ( (PDBChain) pdbfile.chains.elementAt(i)).sequence. getName() + "\n" @@ -241,9 +252,7 @@ public class SequenceFetcher textfield.setEnabled(true); ok.setEnabled(true); cancel.setEnabled(true); - frame.setTitle("Sequence Fetcher"); - - + frame.setTitle("WSDBfetch@EBI Sequence Fetcher"); } void showErrorMessage(String error) diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 1c70c24..bd619a3 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -165,13 +165,6 @@ public class TreePanel extends GTreePanel treeCanvas.setTree(tree); treeCanvas.repaint(); - - - fullid.setState(treeCanvas.av.showDBPrefix); - if(!treeCanvas.av.showDBPrefix) - { - fullid_actionPerformed(null); - } } } @@ -359,27 +352,6 @@ public class TreePanel extends GTreePanel } - public void fullid_actionPerformed(ActionEvent e) - { - tree.findHeight(tree.getTopNode()); - - // Now have to calculate longest name based on the leaves - Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector()); - - treeCanvas.longestName=""; - for (int i = 0; i < leaves.size(); i++) - { - SequenceNode lf = (SequenceNode) leaves.elementAt(i); - Sequence seq = (Sequence) lf.element(); - lf.setName(seq.getDisplayId(fullid.getState(), false)); - if(lf.getName().length() > treeCanvas.longestName.length()) - treeCanvas.longestName = lf.getName(); - } - - treeCanvas.repaint(); - } - - /** * DOCUMENT ME! * diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 1ec2805..f933961 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -39,7 +39,6 @@ public abstract class AlignFile extends FileParse Vector headers; long start; long end; - boolean dbPrefix = true; boolean jvSuffix = true; /** @@ -152,20 +151,13 @@ public abstract class AlignFile extends FileParse */ public abstract String print(); - public void addDBPrefix(boolean b) - { - dbPrefix = b; - } - public void addJVSuffix(boolean b) { jvSuffix = b; } /** - * A general parser for ids. Will look for dbrefs in - * Uniprot format source|id - * And also Jalview /start-end + * A general parser for ids. * * @String id Id to be parsed */ @@ -184,7 +176,6 @@ public abstract class AlignFile extends FileParse seq = new Sequence(id, ""); } - return seq; } @@ -197,7 +188,7 @@ public abstract class AlignFile extends FileParse */ String printId(SequenceI seq) { - return seq.getDisplayId(dbPrefix, jvSuffix); + return seq.getDisplayId(jvSuffix); } } diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 0354f35..f8b809e 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -126,7 +126,6 @@ */ public String formatSequences(String format, Vector seqs, - boolean dbref, boolean jvsuffix) { SequenceI[] s = new SequenceI[seqs.size()]; @@ -167,7 +166,6 @@ afile = new PfamFile(); } - afile.addDBPrefix(dbref); afile.addJVSuffix(jvsuffix); afile.setSeqs(s); diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 64f33cd..0c8554a 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -53,56 +53,42 @@ public class FormatAdapter extends AppletFormatAdapter if (format.equalsIgnoreCase("FASTA")) { afile = new FastaFile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("FASTA_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("FASTA_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("MSF")) { afile = new MSFfile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("MSF_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("MSF_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PileUp")) { afile = new PileUpfile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("PILEUP_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("PILEUP_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("CLUSTAL")) { afile = new ClustalFile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("CLUSTAL_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("CLUSTAL_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("BLC")) { afile = new BLCFile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("BLC_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("BLC_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PIR")) { afile = new PIRFile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("PIR_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("PIR_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PFAM")) { afile = new PfamFile(); - afile.addDBPrefix( - jalview.bin.Cache.getDefault("PFAM_DBPREFIX", false)); afile.addJVSuffix( jalview.bin.Cache.getDefault("PFAM_JVSUFFIX", true)); } diff --git a/src/jalview/io/HTMLOutput.java b/src/jalview/io/HTMLOutput.java index 7290828..00c7364 100755 --- a/src/jalview/io/HTMLOutput.java +++ b/src/jalview/io/HTMLOutput.java @@ -133,7 +133,7 @@ public class HTMLOutput { seq = alignment.getSequenceAt(i); - String id = seq.getDisplayId(av.getShowDBPrefix(), av.getShowJVSuffix()); + String id = seq.getDisplayId(av.getShowJVSuffix()); out.println("
" + id + "  " + id + "