From: Jim Procter Date: Fri, 6 Jun 2014 09:04:38 +0000 (+0100) Subject: JAL-1517 source formatting X-Git-Tag: Release_2_8_2b1^2~74 X-Git-Url: http://source.jalview.org/gitweb/?p=jalview.git;a=commitdiff_plain;h=7ab5d6b0ba5fec1ea4a4239e79c476d841622485 JAL-1517 source formatting --- diff --git a/src/MCview/AppletPDBCanvas.java b/src/MCview/AppletPDBCanvas.java index 1cf1e83..a1bb272 100644 --- a/src/MCview/AppletPDBCanvas.java +++ b/src/MCview/AppletPDBCanvas.java @@ -472,7 +472,9 @@ public class AppletPDBCanvas extends Panel implements MouseListener, g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.black); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.error_loading_pdb_data"), 50, getSize().height / 2); + g.drawString( + MessageManager.getString("label.error_loading_pdb_data"), 50, + getSize().height / 2); return; } @@ -480,7 +482,8 @@ public class AppletPDBCanvas extends Panel implements MouseListener, { g.setColor(Color.black); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.fetching_pdb_data"), 50, getSize().height / 2); + g.drawString(MessageManager.getString("label.fetching_pdb_data"), 50, + getSize().height / 2); return; } diff --git a/src/MCview/AppletPDBViewer.java b/src/MCview/AppletPDBViewer.java index 587326a..b55dde5 100644 --- a/src/MCview/AppletPDBViewer.java +++ b/src/MCview/AppletPDBViewer.java @@ -64,8 +64,9 @@ public class AppletPDBViewer extends EmbmenuFrame implements false, null); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.pdb_sequence_mapping"), - 500, 600); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.pdb_sequence_mapping"), 500, + 600); cap.setText(pdbcanvas.mappingDetails.toString()); } @@ -170,7 +171,8 @@ public class AppletPDBViewer extends EmbmenuFrame implements chain.addActionListener(this); seqButton.setLabel(MessageManager.getString("action.by_sequence")); seqButton.addActionListener(this); - allchains.setLabel(MessageManager.getString("label.all_chains_visible")); + allchains + .setLabel(MessageManager.getString("label.all_chains_visible")); allchains.addItemListener(this); viewMenu.setLabel(MessageManager.getString("action.view")); zappo.setLabel(MessageManager.getString("label.zappo")); diff --git a/src/MCview/PDBViewer.java b/src/MCview/PDBViewer.java index b802708..eb214ac 100755 --- a/src/MCview/PDBViewer.java +++ b/src/MCview/PDBViewer.java @@ -295,7 +295,8 @@ public class PDBViewer extends JInternalFrame implements Runnable } }); viewMenu.setText(MessageManager.getString("action.view")); - background.setText(MessageManager.getString("label.background_colour") + "..."); + background.setText(MessageManager.getString("label.background_colour") + + "..."); background.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -365,8 +366,10 @@ public class PDBViewer extends JInternalFrame implements Runnable int option = JOptionPane.showInternalConfirmDialog( jalview.gui.Desktop.desktop, - MessageManager.getString("label.remove_from_default_list"), - MessageManager.getString("label.remove_user_defined_colour"), + MessageManager + .getString("label.remove_from_default_list"), + MessageManager + .getString("label.remove_user_defined_colour"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { @@ -567,7 +570,9 @@ public class PDBViewer extends JInternalFrame implements Runnable try { cap.setText(pdbcanvas.mappingDetails.toString()); - Desktop.addInternalFrame(cap, MessageManager.getString("label.pdb_sequence_mapping"), 550, 600); + Desktop.addInternalFrame(cap, + MessageManager.getString("label.pdb_sequence_mapping"), 550, + 600); } catch (OutOfMemoryError oom) { new OOMWarning("Opening sequence to structure mapping report", oom); @@ -630,7 +635,8 @@ public class PDBViewer extends JInternalFrame implements Runnable public void user_actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals(MessageManager.getString("action.user_defined"))) + if (e.getActionCommand().equals( + MessageManager.getString("action.user_defined"))) { // new UserDefinedColours(pdbcanvas, null); } @@ -648,7 +654,8 @@ public class PDBViewer extends JInternalFrame implements Runnable public void background_actionPerformed(ActionEvent e) { java.awt.Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_backgroud_colour"), pdbcanvas.backgroundColour); + MessageManager.getString("label.select_backgroud_colour"), + pdbcanvas.backgroundColour); if (col != null) { diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 4fc8814..302f3b2 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -61,7 +61,7 @@ public class PDBfile extends jalview.io.AlignFile id = safeName(getDataName()); chains = new Vector(); - ArrayList rna=new ArrayList(), prot=new ArrayList(); + ArrayList rna = new ArrayList(), prot = new ArrayList(); PDBChain tmpchain; String line = null; boolean modelFlag = false; @@ -161,8 +161,10 @@ public class PDBfile extends jalview.io.AlignFile PDBEntry entry = new PDBEntry(); entry.setId(id); entry.setProperty(new Hashtable()); - if (((PDBChain)chains.elementAt(i)).id!=null) { - entry.getProperty().put("CHAIN", ((PDBChain)chains.elementAt(i)).id); + if (((PDBChain) chains.elementAt(i)).id != null) + { + entry.getProperty().put("CHAIN", + ((PDBChain) chains.elementAt(i)).id); } if (inFile != null) { @@ -178,52 +180,63 @@ public class PDBfile extends jalview.io.AlignFile // maintain reference to // dataset seqs.addElement(chainseq); - if(isRNA(chainseq)==true) - { - rna.add(chainseq); - } else { - prot.add(chainseq); - } - + if (isRNA(chainseq) == true) + { + rna.add(chainseq); + } + else + { + prot.add(chainseq); + } + AlignmentAnnotation[] chainannot = chainseq.getAnnotation(); - + if (chainannot != null) { for (int ai = 0; ai < chainannot.length; ai++) { - + chainannot[ai].visible = VisibleChainAnnotation; annotations.addElement(chainannot[ai]); } } } - if (rna.size()>0) - try { - processPdbFileWithAnnotate3d(rna); - } catch (Exception x) - { - System.err.println("Exceptions when dealing with RNA in pdb file"); - x.printStackTrace(); - - }; - if (prot.size()>0) - try { - processPdbFileWithJmol(prot); - } catch (Exception x) - { - System.err.println("Exceptions when dealing with RNA in pdb file"); - x.printStackTrace(); - - }; - if (prot.size()>0) - try { - processPdbFileWithJmol(prot); - } catch (Exception x) - { - System.err.println("Exceptions when dealing with RNA in pdb file"); - x.printStackTrace(); - - }; + if (rna.size() > 0) + try + { + processPdbFileWithAnnotate3d(rna); + } catch (Exception x) + { + System.err + .println("Exceptions when dealing with RNA in pdb file"); + x.printStackTrace(); + + } + ; + if (prot.size() > 0) + try + { + processPdbFileWithJmol(prot); + } catch (Exception x) + { + System.err + .println("Exceptions when dealing with RNA in pdb file"); + x.printStackTrace(); + + } + ; + if (prot.size() > 0) + try + { + processPdbFileWithJmol(prot); + } catch (Exception x) + { + System.err + .println("Exceptions when dealing with RNA in pdb file"); + x.printStackTrace(); + + } + ; } catch (OutOfMemoryError er) { System.out.println("OUT OF MEMORY LOADING PDB FILE"); @@ -237,94 +250,125 @@ public class PDBfile extends jalview.io.AlignFile } } } - private void processPdbFileWithJmol(ArrayList prot) throws Exception + + private void processPdbFileWithJmol(ArrayList prot) + throws Exception { - try { + try + { Class cl = Class.forName("jalview.ext.jmol.PDBFileWithJmol"); - if (cl!=null) + if (cl != null) { - Object jmf = cl.getConstructor(new Class[] {FileParse.class}).newInstance(new Object[] {new FileParse(getDataName(),type)}); - Alignment al = new Alignment((SequenceI[]) cl.getMethod("getSeqsAsArray", new Class[] {}).invoke(jmf)); - cl.getMethod("addAnnotations",new Class[] {Alignment.class}).invoke(jmf, al); + Object jmf = cl.getConstructor(new Class[] + { FileParse.class }).newInstance(new Object[] + { new FileParse(getDataName(), type) }); + Alignment al = new Alignment((SequenceI[]) cl.getMethod( + "getSeqsAsArray", new Class[] + {}).invoke(jmf)); + cl.getMethod("addAnnotations", new Class[] + { Alignment.class }).invoke(jmf, al); replaceMatchingSeqsWith(prot, al, AlignSeq.PEP); } } catch (ClassNotFoundException q) - {} - } - private void processPdbFileWithAnnotate3d(ArrayList rna) throws Exception { -// System.out.println("this is a PDB format and RNA sequence"); - // note: we use reflection here so that the applet can compile and run without the HTTPClient bits and pieces needed for accessing Annotate3D web service - try { - Class cl = Class.forName("jalview.ws.jws1.Annotate3D"); - if (cl!=null) { - // TODO: use the PDB ID of the structure if one is available, to save bandwidth and avoid uploading the whole structure to the service - Object annotate3d = cl.getConstructor(new Class[] {}).newInstance(new Object[] {}); - AlignmentI al = ((AlignmentI) cl.getMethod("getRNAMLFor", new Class[] { FileParse.class}).invoke(annotate3d, new Object[] { new FileParse(getDataName(),type)})); - replaceMatchingSeqsWith(rna, al, AlignSeq.DNA); } + } + + private void processPdbFileWithAnnotate3d(ArrayList rna) + throws Exception + { + // System.out.println("this is a PDB format and RNA sequence"); + // note: we use reflection here so that the applet can compile and run + // without the HTTPClient bits and pieces needed for accessing Annotate3D + // web service + try + { + Class cl = Class.forName("jalview.ws.jws1.Annotate3D"); + if (cl != null) + { + // TODO: use the PDB ID of the structure if one is available, to save + // bandwidth and avoid uploading the whole structure to the service + Object annotate3d = cl.getConstructor(new Class[] + {}).newInstance(new Object[] + {}); + AlignmentI al = ((AlignmentI) cl.getMethod("getRNAMLFor", + new Class[] + { FileParse.class }).invoke(annotate3d, new Object[] + { new FileParse(getDataName(), type) })); + replaceMatchingSeqsWith(rna, al, AlignSeq.DNA); + } } catch (ClassNotFoundException x) { - //ignore classnotfounds - occurs in applet - }; + // ignore classnotfounds - occurs in applet + } + ; } - private void replaceMatchingSeqsWith(ArrayList ochains, AlignmentI al, String dnaOrProtein) + + private void replaceMatchingSeqsWith(ArrayList ochains, + AlignmentI al, String dnaOrProtein) { - if (al!=null && al.getHeight()>0) + if (al != null && al.getHeight() > 0) { - ArrayList matches=new ArrayList(); - ArrayList aligns=new ArrayList(); - - for (SequenceI sq:ochains) + ArrayList matches = new ArrayList(); + ArrayList aligns = new ArrayList(); + + for (SequenceI sq : ochains) { - SequenceI bestm=null; - AlignSeq bestaseq=null; - int bestscore=0; - for (SequenceI msq:al.getSequences()) + SequenceI bestm = null; + AlignSeq bestaseq = null; + int bestscore = 0; + for (SequenceI msq : al.getSequences()) { - AlignSeq aseq = AlignSeq.doGlobalNWAlignment(msq, sq, dnaOrProtein); - if (bestm==null || aseq.getMaxScore()>bestscore) + AlignSeq aseq = AlignSeq.doGlobalNWAlignment(msq, sq, + dnaOrProtein); + if (bestm == null || aseq.getMaxScore() > bestscore) { - bestscore=aseq.getMaxScore(); - bestaseq= aseq; - bestm=msq; + bestscore = aseq.getMaxScore(); + bestaseq = aseq; + bestm = msq; } } - System.out.println("Best Score for "+(matches.size()+1)+" :"+bestscore); + System.out.println("Best Score for " + (matches.size() + 1) + " :" + + bestscore); matches.add(bestm); aligns.add(bestaseq); al.deleteSequence(bestm); } - for (int p=0,pSize=seqs.size();p-1) + if ((q = ochains.indexOf(sp)) > -1) { - seqs.set(p, sq=matches.get(q)); + seqs.set(p, sq = matches.get(q)); sq.setName(sp.getName()); sq.setDescription(sp.getDescription()); sq.transferAnnotation(sp, aligns.get(q).getMappingFromS1(false)); - int inspos=-1; - for (int ap=0;ap maxCount) - { - maxResidue = String.valueOf((char) v); - } - else if (values[v] == maxCount) - { - maxResidue += String.valueOf((char) v); + if (values[v] > maxCount) + { + maxResidue = String.valueOf((char) v); + } + else if (values[v] == maxCount) + { + maxResidue += String.valueOf((char) v); + } + maxCount = values[v]; } - maxCount = values[v]; - } } if (maxResidue.length() == 0) { @@ -184,12 +187,13 @@ public class AAFrequency percentage = ((float) maxCount * 100) / jSize; residueHash.put(PID_GAPS, new Float(percentage)); - if (nongap>0) { + if (nongap > 0) + { // calculate for non-gapped too percentage = ((float) maxCount * 100) / nongap; } residueHash.put(PID_NOGAPS, new Float(percentage)); - + result[i] = residueHash; } } @@ -205,7 +209,7 @@ public class AAFrequency * @param width * @param ignoreGapsInConsensusCalculation * @param includeAllConsSymbols - * @param nseq + * @param nseq */ public static void completeConsensus(AlignmentAnnotation consensus, Hashtable[] hconsensus, int iStart, int width, @@ -213,8 +217,9 @@ public class AAFrequency boolean includeAllConsSymbols, long nseq) { completeConsensus(consensus, hconsensus, iStart, width, - ignoreGapsInConsensusCalculation, includeAllConsSymbols, null, nseq); // new - // char[] + ignoreGapsInConsensusCalculation, includeAllConsSymbols, null, + nseq); // new + // char[] // { 'A', 'C', 'G', 'T', 'U' }); } @@ -231,21 +236,24 @@ public class AAFrequency // initialised properly return; } - String fmtstr="%3.1f"; - int precision=0; - while (nseq>=10) { + String fmtstr = "%3.1f"; + int precision = 0; + while (nseq >= 10) + { precision++; - nseq/=10; + nseq /= 10; } final Format fmt; - if (precision>1) + if (precision > 1) { - //if (precision>2) + // if (precision>2) { - fmtstr = "%"+(2+precision)+"."+(precision)+"f"; + fmtstr = "%" + (2 + precision) + "." + (precision) + "f"; } fmt = new Format(fmtstr); - } else { + } + else + { fmt = null; } for (int i = iStart; i < width; i++) @@ -293,7 +301,7 @@ public class AAFrequency tval = profile[0][alphabet[c]] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; mouseOver += ((c == 0) ? "" : "; ") + alphabet[c] + " " - + ((fmt!=null) ? fmt.form(tval) : ((int) tval)) + "%"; + + ((fmt != null) ? fmt.form(tval) : ((int) tval)) + "%"; } } else @@ -316,7 +324,9 @@ public class AAFrequency * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]; mouseOver += ((p == 0) ? "" : "; ") + ((char[]) ca[c])[0] - + " " + ((fmt!=null) ? fmt.form(tval) : ((int) tval)) + "%"; + + " " + + ((fmt != null) ? fmt.form(tval) : ((int) tval)) + + "%"; p++; } @@ -326,7 +336,8 @@ public class AAFrequency } else { - mouseOver += ((fmt!=null) ? fmt.form(value) : ((int) value)) + "%"; + mouseOver += ((fmt != null) ? fmt.form(value) : ((int) value)) + + "%"; } consensus.annotations[i] = new Annotation(maxRes, mouseOver, ' ', value); diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index b9119ed..ab6fae8 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -19,6 +19,7 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.analysis; + import java.util.*; import java.awt.*; @@ -270,10 +271,15 @@ public class AlignSeq /** * Construct score matrix for sequences with standard DNA or PEPTIDE matrix - * @param s1 - sequence 1 - * @param string1 - string to use for s1 - * @param s2 - sequence 2 - * @param string2 - string to use for s2 + * + * @param s1 + * - sequence 1 + * @param string1 + * - string to use for s1 + * @param s2 + * - sequence 2 + * @param string2 + * - string to use for s2 * @param type * DNA or PEPTIDE */ @@ -288,11 +294,17 @@ public class AlignSeq /** * Construct score matrix for sequences with custom substitution matrix - * @param s1 - sequence 1 - * @param string1 - string to use for s1 - * @param s2 - sequence 2 - * @param string2 - string to use for s2 - * @param scoreMatrix - substitution matrix to use for alignment + * + * @param s1 + * - sequence 1 + * @param string1 + * - string to use for s1 + * @param s2 + * - sequence 2 + * @param string2 + * - string to use for s2 + * @param scoreMatrix + * - substitution matrix to use for alignment */ public void SeqInit(SequenceI s1, String string1, SequenceI s2, String string2, ScoreMatrix scoreMatrix) @@ -307,7 +319,7 @@ public class AlignSeq * construct score matrix for string1 and string2 (after removing any existing * gaps * - * @param string1 + * @param string1 * @param string2 */ private void SeqInit(String string1, String string2) @@ -972,7 +984,7 @@ public class AlignSeq { lastmatch = true; // extend mapping interval. - if (lp1 + 1 != alignpos || lp2+1 !=pdbpos) + if (lp1 + 1 != alignpos || lp2 + 1 != pdbpos) { as1.add(Integer.valueOf(alignpos)); as2.add(Integer.valueOf(pdbpos)); diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index 5659d19..2feeb91 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -27,16 +27,19 @@ import jalview.datamodel.SequenceI; import jalview.datamodel.AlignmentI; /** - * grab bag of useful alignment manipulation operations - * Expect these to be refactored elsewhere at some point. + * grab bag of useful alignment manipulation operations Expect these to be + * refactored elsewhere at some point. + * * @author jimp - * + * */ public class AlignmentUtils { /** - * given an existing alignment, create a new alignment including all, or up to flankSize additional symbols from each sequence's dataset sequence + * given an existing alignment, create a new alignment including all, or up to + * flankSize additional symbols from each sequence's dataset sequence + * * @param core * @param flankSize * @return AlignmentI @@ -45,67 +48,79 @@ public class AlignmentUtils { List sq = new ArrayList(); int maxoffset = 0; - for (SequenceI s:core.getSequences()) + for (SequenceI s : core.getSequences()) { SequenceI newSeq = s.deriveSequence(); - if (newSeq.getStart()>maxoffset && newSeq.getDatasetSequence().getStart() maxoffset + && newSeq.getDatasetSequence().getStart() < s.getStart()) { maxoffset = newSeq.getStart(); } sq.add(newSeq); } - if (flankSize>-1) { + if (flankSize > -1) + { maxoffset = flankSize; } // now add offset to create a new expanded alignment - for (SequenceI s:sq) + for (SequenceI s : sq) { SequenceI ds = s; - while (ds.getDatasetSequence()!=null) { - ds=ds.getDatasetSequence(); + while (ds.getDatasetSequence() != null) + { + ds = ds.getDatasetSequence(); } - int s_end = s.findPosition(s.getStart()+s.getLength()); + int s_end = s.findPosition(s.getStart() + s.getLength()); // find available flanking residues for sequence - int ustream_ds=s.getStart()-ds.getStart(),dstream_ds=ds.getEnd()-s_end; - + int ustream_ds = s.getStart() - ds.getStart(), dstream_ds = ds + .getEnd() - s_end; + // build new flanked sequence - + // compute gap padding to start of flanking sequence - int offset=maxoffset - ustream_ds; - + int offset = maxoffset - ustream_ds; + // padding is gapChar x ( maxoffset - min(ustream_ds, flank) - if (flankSize>=0) { - if (flankSize= 0) + { + if (flankSize < ustream_ds) { - // take up to flankSize residues - offset = maxoffset-flankSize; - ustream_ds = flankSize; - } - if (flankSizeskipint[1]) + if (scontigs[vc] > skipint[1]) { // finished editing so break; } - // Edit the contig list to include the skipped region which did not translate + // Edit the contig list to include the skipped region which did + // not translate int[] t; // from : s1 e1 s2 e2 s3 e3 - // to s: s1 e1 s2 k0 k1 e2 s3 e3 - // list increases by one unless one boundary (s2==k0 or e2==k1) matches, and decreases by one if skipint intersects whole visible contig + // to s: s1 e1 s2 k0 k1 e2 s3 e3 + // list increases by one unless one boundary (s2==k0 or e2==k1) + // matches, and decreases by one if skipint intersects whole + // visible contig if (scontigs[vc] <= skipint[0]) { if (skipint[0] == scontigs[vc]) @@ -536,11 +543,11 @@ public class Dna if (scontigs[vc + 1] > skipint[1]) { scontigs[vc] = skipint[1]; - vc+=2; + vc += 2; } else { - if (scontigs[vc+1]==skipint[1]) + if (scontigs[vc + 1] == skipint[1]) { // remove the contig t = new int[scontigs.length - 2]; @@ -551,32 +558,38 @@ public class Dna if (vc + 2 < t.length) { System.arraycopy(scontigs, vc + 2, t, vc, t.length - - vc + 2); + - vc + 2); } - scontigs=t; - } else { + scontigs = t; + } + else + { // truncate contig to before the skipint region - scontigs[vc+1] = skipint[0]-1; - vc+=2; + scontigs[vc + 1] = skipint[0] - 1; + vc += 2; } } } else { // scontig starts before start of skipint - if (scontigs[vc+1] pairHash = new Hashtable(); - - private static final Character[] openingPars = {'(','[','{','<','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; - private static final Character[] closingPars = {')',']','}','>','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; - - private static HashSet openingParsSet = new HashSet(Arrays.asList(openingPars)); - private static HashSet closingParsSet = new HashSet(Arrays.asList(closingPars)); - private static Hashtable closingToOpening = new Hashtable() + + static Hashtable pairHash = new Hashtable(); + + private static final Character[] openingPars = + { '(', '[', '{', '<', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', + 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', + 'Y', 'Z' }; + + private static final Character[] closingPars = + { ')', ']', '}', '>', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', + 'y', 'z' }; + + private static HashSet openingParsSet = new HashSet( + Arrays.asList(openingPars)); + + private static HashSet closingParsSet = new HashSet( + Arrays.asList(closingPars)); + + private static Hashtable closingToOpening = new Hashtable() // Initializing final data structure { - private static final long serialVersionUID = 1L; - { - for(int i=0;i"+openingPars[i]); - put(closingPars[i],openingPars[i]); - } - }}; - + private static final long serialVersionUID = 1L; + { + for (int i = 0; i < openingPars.length; i++) + { + System.out.println(closingPars[i] + "->" + openingPars[i]); + put(closingPars[i], openingPars[i]); + } + } + }; + private static boolean isOpeningParenthesis(char c) { - return openingParsSet.contains(c); + return openingParsSet.contains(c); } - + private static boolean isClosingParenthesis(char c) { - return closingParsSet.contains(c); + return closingParsSet.contains(c); } - private static char matchingOpeningParenthesis(char closingParenthesis) throws WUSSParseException + private static char matchingOpeningParenthesis(char closingParenthesis) + throws WUSSParseException { - if (!isClosingParenthesis(closingParenthesis)) - { - throw new WUSSParseException("Querying matching opening parenthesis for non-closing parenthesis character "+closingParenthesis, -1); - } - - return closingToOpening.get(closingParenthesis); + if (!isClosingParenthesis(closingParenthesis)) + { + throw new WUSSParseException( + "Querying matching opening parenthesis for non-closing parenthesis character " + + closingParenthesis, -1); + } + + return closingToOpening.get(closingParenthesis); } - + /** * Based off of RALEE code ralee-get-base-pairs. Keeps track of open bracket * positions in "stack" vector. When a close bracket is reached, pair this @@ -92,89 +105,96 @@ public class Rna * @return Array of SequenceFeature; type = RNA helix, begin is open base * pair, end is close base pair */ - public static Vector GetSimpleBPs(CharSequence line) throws WUSSParseException + public static Vector GetSimpleBPs(CharSequence line) + throws WUSSParseException { System.out.println(line); - Hashtable> stacks = new Hashtable>(); + Hashtable> stacks = new Hashtable>(); Vector pairs = new Vector(); int i = 0; while (i < line.length()) { char base = line.charAt(i); - + if (isOpeningParenthesis(base)) { - if (!stacks.containsKey(base)){ - stacks.put(base, new Stack()); - } + if (!stacks.containsKey(base)) + { + stacks.put(base, new Stack()); + } stacks.get(base).push(i); - + } else if (isClosingParenthesis(base)) { - - char opening = matchingOpeningParenthesis(base); - - if (!stacks.containsKey(opening)){ - throw new WUSSParseException("Mismatched (unseen) closing character "+base, i); - } - - Stack stack = stacks.get(opening); + + char opening = matchingOpeningParenthesis(base); + + if (!stacks.containsKey(opening)) + { + throw new WUSSParseException( + "Mismatched (unseen) closing character " + base, i); + } + + Stack stack = stacks.get(opening); if (stack.isEmpty()) { // error whilst parsing i'th position. pass back - throw new WUSSParseException("Mismatched closing character "+base, i); + throw new WUSSParseException("Mismatched closing character " + + base, i); } int temp = stack.pop(); - - pairs.add(new SimpleBP(temp,i)); + + pairs.add(new SimpleBP(temp, i)); } i++; } - for(char opening: stacks.keySet()) + for (char opening : stacks.keySet()) { - Stack stack = stacks.get(opening); - if (!stack.empty()) - { - throw new WUSSParseException("Mismatched opening character "+opening+" at "+stack.pop(), i); - } + Stack stack = stacks.get(opening); + if (!stack.empty()) + { + throw new WUSSParseException("Mismatched opening character " + + opening + " at " + stack.pop(), i); + } } return pairs; } - - public static SequenceFeature[] GetBasePairs(CharSequence line) throws WUSSParseException + + public static SequenceFeature[] GetBasePairs(CharSequence line) + throws WUSSParseException { - Vector bps = GetSimpleBPs(line); - SequenceFeature[] outPairs = new SequenceFeature[bps.size()]; + Vector bps = GetSimpleBPs(line); + SequenceFeature[] outPairs = new SequenceFeature[bps.size()]; for (int p = 0; p < bps.size(); p++) { - SimpleBP bp = bps.elementAt(p); - outPairs[p] = new SequenceFeature("RNA helix", "", "", bp.getBP5(),bp.getBP3(), ""); + SimpleBP bp = bps.elementAt(p); + outPairs[p] = new SequenceFeature("RNA helix", "", "", bp.getBP5(), + bp.getBP3(), ""); } return outPairs; } - - - public static ArrayList GetModeleBP(CharSequence line) throws WUSSParseException + + public static ArrayList GetModeleBP(CharSequence line) + throws WUSSParseException { - Vector bps = GetSimpleBPs(line); - return new ArrayList(bps); + Vector bps = GetSimpleBPs(line); + return new ArrayList(bps); } - - + /** * Function to get the end position corresponding to a given start position - * @param indice - start position of a base pair + * + * @param indice + * - start position of a base pair * @return - end position of a base pair */ - /*makes no sense at the moment :( - public int findEnd(int indice){ - //TODO: Probably extend this to find the start to a given end? - //could be done by putting everything twice to the hash - ArrayList pair = new ArrayList(); - return pairHash.get(indice); - }*/ - + /* + * makes no sense at the moment :( public int findEnd(int indice){ //TODO: + * Probably extend this to find the start to a given end? //could be done by + * putting everything twice to the hash ArrayList pair = new + * ArrayList(); return pairHash.get(indice); } + */ /** * Figures out which helix each position belongs to and stores the helix @@ -258,4 +278,3 @@ public class Rna } } } - diff --git a/src/jalview/analysis/SecStrConsensus.java b/src/jalview/analysis/SecStrConsensus.java index 9c3becd..1400a64 100644 --- a/src/jalview/analysis/SecStrConsensus.java +++ b/src/jalview/analysis/SecStrConsensus.java @@ -23,217 +23,232 @@ package jalview.analysis; import java.util.ArrayList; import java.util.Hashtable; +public class SecStrConsensus +{ -public class SecStrConsensus { - - - /** - * Internal class to represent a simple base-pair. - * @author Yawn - * [JBPNote: ^^ is that Anne Menard or Ya(w)nn Ponty, I wonder ! ] - */ - public static class SimpleBP{ - int bp5; - int bp3; - - public SimpleBP() - { - - } - public SimpleBP(int i5, int i3) - { - bp5=i5; - bp3=i3; - } - public void setBP5(int i5) - { - bp5=i5; - } - - public void setBP3(int i3) - { - bp3=i3; - } - - public int getBP5() - { - return bp5; - } - - public int getBP3() - { - return bp3; - } - - public String toString() - { - return "("+bp5+","+bp3+")"; - } - - } - - public static int[] extractConsensus(ArrayList> bps) - { - // We do not currently know the length of the alignment - // => Estimate it as the biggest index of a base-pair plus one. - int maxlength = 0; - for (ArrayList strs : bps) - { - for (SimpleBP bp : strs) - { - - maxlength = Math.max(1+Math.max(bp.bp5, bp.bp3), maxlength); + /** + * Internal class to represent a simple base-pair. + * + * @author Yawn [JBPNote: ^^ is that Anne Menard or Ya(w)nn Ponty, I wonder ! + * ] + */ + public static class SimpleBP + { + int bp5; + + int bp3; + + public SimpleBP() + { + + } + + public SimpleBP(int i5, int i3) + { + bp5 = i5; + bp3 = i3; + } + + public void setBP5(int i5) + { + bp5 = i5; + } + + public void setBP3(int i3) + { + bp3 = i3; + } + + public int getBP5() + { + return bp5; + } + + public int getBP3() + { + return bp3; + } + + public String toString() + { + return "(" + bp5 + "," + bp3 + ")"; + } - } } - // Now we have a good estimate for length, allocate and initialize data - // to be fed to the dynamic programming procedure. - ArrayList> seq = new ArrayList>(); - for (int i=0;i()); } - for (ArrayList strs : bps) + + public static int[] extractConsensus(ArrayList> bps) { - for (SimpleBP bp : strs) - { - int i = bp.bp5; - int j = bp.bp3; - Hashtable h = seq.get(i); - if (!h.containsKey(j)) + // We do not currently know the length of the alignment + // => Estimate it as the biggest index of a base-pair plus one. + int maxlength = 0; + for (ArrayList strs : bps) + { + for (SimpleBP bp : strs) + { + + maxlength = Math.max(1 + Math.max(bp.bp5, bp.bp3), maxlength); + + } + } + // Now we have a good estimate for length, allocate and initialize data + // to be fed to the dynamic programming procedure. + ArrayList> seq = new ArrayList>(); + for (int i = 0; i < maxlength; i++) + { + seq.add(new Hashtable()); + } + for (ArrayList strs : bps) + { + for (SimpleBP bp : strs) + { + int i = bp.bp5; + int j = bp.bp3; + Hashtable h = seq.get(i); + if (!h.containsKey(j)) + { + h.put(j, 0.0); + } + h.put(j, h.get(j) + 1.); + } + } + // At this point, seq contains, at each position i, a hashtable which + // associates, + // to each possible end j, the number of time a base-pair (i,j) occurs in + // the alignment + + // We can now run the dynamic programming procedure on this data + double[][] mat = fillMatrix(seq); + ArrayList res = backtrack(mat, seq); + + // Convert it to an array, ie finalres[i] = j >= 0 iff a base-pair (i,j) is + // present + // in the consensus, or -1 otherwise + int[] finalres = new int[seq.size()]; + for (int i = 0; i < seq.size(); i++) + { + finalres[i] = -1; + } + for (SimpleBP bp : res) { - h.put(j, 0.0); + finalres[bp.bp5] = bp.bp3; + finalres[bp.bp3] = bp.bp5; } - h.put(j, h.get(j)+1.); - } + + return finalres; } - // At this point, seq contains, at each position i, a hashtable which associates, - // to each possible end j, the number of time a base-pair (i,j) occurs in the alignment - - // We can now run the dynamic programming procedure on this data - double[][] mat = fillMatrix(seq); - ArrayList res = backtrack(mat,seq); - - // Convert it to an array, ie finalres[i] = j >= 0 iff a base-pair (i,j) is present - // in the consensus, or -1 otherwise - int[] finalres = new int[seq.size()]; - for (int i=0;i> seq, int i, int k) { - finalres[bp.bp5] = bp.bp3; - finalres[bp.bp3] = bp.bp5; + return seq.get(i).containsKey(k); } - - return finalres; - } - - private static boolean canBasePair(ArrayList> seq, int i, int k) - { - return seq.get(i).containsKey(k); - } - - // Returns the score of a potential base-pair, ie the number of structures in which it is found. - private static double basePairScore(ArrayList> seq, int i, int k) - { - return seq.get(i).get(k); - } - - - private static double[][] fillMatrix(ArrayList> seq) + + // Returns the score of a potential base-pair, ie the number of structures in + // which it is found. + private static double basePairScore( + ArrayList> seq, int i, int k) { - int n = seq.size(); - double[][] tab = new double[n][n]; - for(int m=1;m<=n;m++) + return seq.get(i).get(k); + } + + private static double[][] fillMatrix( + ArrayList> seq) { - for(int i=0;ii+1) - { - fact1 = tab[i+1][k-1]; - } - double fact2 = 0; - if (k i + 1) + { + fact1 = tab[i + 1][k - 1]; + } + double fact2 = 0; + if (k < j) + { + fact2 = tab[k + 1][j]; + } + tab[i][j] = Math.max(tab[i][j], basePairScore(seq, i, k) + + fact1 + fact2); + } + } + } + } + } + return tab; } - return tab; - } - - private static ArrayList backtrack(double[][] tab,ArrayList> seq) + + private static ArrayList backtrack(double[][] tab, + ArrayList> seq) { - return backtrack(tab,seq,0,seq.size()-1); + return backtrack(tab, seq, 0, seq.size() - 1); } - - private static ArrayList backtrack(double[][] tab,ArrayList> seq, int i, int j) + + private static ArrayList backtrack(double[][] tab, + ArrayList> seq, int i, int j) { - ArrayList result = new ArrayList(); - if (i indices = new ArrayList(); - indices.add(-1); - for (int k=i+1;k<=j;k++) - { - indices.add(k); - } - for (int k : indices) - { - if (k==-1) - { - if (tab[i][j] == tab[i+1][j]) + ArrayList result = new ArrayList(); + if (i < j) + { + ArrayList indices = new ArrayList(); + indices.add(-1); + for (int k = i + 1; k <= j; k++) { - result = backtrack(tab, seq, i+1,j); + indices.add(k); } - } - else - { - if (canBasePair(seq,i,k)) + for (int k : indices) { - double fact1 = 0; - if (k>i+1) - { - fact1 = tab[i+1][k-1]; - } - double fact2 = 0; - if (k i + 1) + { + fact1 = tab[i + 1][k - 1]; + } + double fact2 = 0; + if (k < j) + { + fact2 = tab[k + 1][j]; + } + if (tab[i][j] == basePairScore(seq, i, k) + fact1 + fact2) + { + result = backtrack(tab, seq, i + 1, k - 1); + result.addAll(backtrack(tab, seq, k + 1, j)); + result.add(new SimpleBP(i, k)); + } + } + } + } + } + else if (i == j) + { + } + else + { + + } + return result; + } } diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index cc0870a..dc0212e 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -347,18 +347,19 @@ public class StructureFrequency // initialised properly return; } - String fmtstr="%3.1f"; - int precision=2; - while (nseq>100) { + String fmtstr = "%3.1f"; + int precision = 2; + while (nseq > 100) + { precision++; - nseq/=10; + nseq /= 10; } - if (precision>2) + if (precision > 2) { - fmtstr = "%"+(2+precision)+"."+precision+"f"; + fmtstr = "%" + (2 + precision) + "." + precision + "f"; } Format fmt = new Format(fmtstr); - + for (int i = iStart; i < width; i++) { Hashtable hci; @@ -435,7 +436,8 @@ public class StructureFrequency tval = (vl[c] * 100f / profile[1][ignoreGapsInConsensusCalculation ? 1 : 0]); mouseOver += ((p == 0) ? "" : "; ") + (char) ((int[]) ca[c])[0] - + (char) ((int[]) ca[c])[1] + " " + fmt.form(tval) + "%"; + + (char) ((int[]) ca[c])[1] + " " + fmt.form(tval) + + "%"; p++; } diff --git a/src/jalview/analysis/scoremodels/SWScoreModel.java b/src/jalview/analysis/scoremodels/SWScoreModel.java index 6e85b5e..93bb56d 100644 --- a/src/jalview/analysis/scoremodels/SWScoreModel.java +++ b/src/jalview/analysis/scoremodels/SWScoreModel.java @@ -32,24 +32,40 @@ public class SWScoreModel implements ScoreModelI @Override public float[][] findDistances(AlignmentView seqData) { - SequenceI[] sequenceString = seqData - .getVisibleAlignment(Comparison.GapChars.charAt(0)).getSequencesArray(); + SequenceI[] sequenceString = seqData.getVisibleAlignment( + Comparison.GapChars.charAt(0)).getSequencesArray(); int noseqs = sequenceString.length; float[][] distance = new float[noseqs][noseqs]; - - float max = -1; - - for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++) - { AlignSeq as = new AlignSeq(sequenceString[i], sequenceString[j], seqData.isNa() ? "dna" : "pep"); - as.calcScoreMatrix(); as.traceAlignment(); as.printAlignment(System.out); - distance[i][j] = (float) as.maxscore; - - if (max < distance[i][j]) { max = distance[i][j]; } } } - - for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++) - { distance[i][j] = max - distance[i][j]; distance[j][i] = distance[i][j]; - } } - + + float max = -1; + + for (int i = 0; i < (noseqs - 1); i++) + { + for (int j = i; j < noseqs; j++) + { + AlignSeq as = new AlignSeq(sequenceString[i], sequenceString[j], + seqData.isNa() ? "dna" : "pep"); + as.calcScoreMatrix(); + as.traceAlignment(); + as.printAlignment(System.out); + distance[i][j] = (float) as.maxscore; + + if (max < distance[i][j]) + { + max = distance[i][j]; + } + } + } + + for (int i = 0; i < (noseqs - 1); i++) + { + for (int j = i; j < noseqs; j++) + { + distance[i][j] = max - distance[i][j]; + distance[j][i] = distance[i][j]; + } + } + return distance; } @@ -58,17 +74,21 @@ public class SWScoreModel implements ScoreModelI { return "Smith Waterman Score"; } + @Override public boolean isDNA() { return true; } + @Override public boolean isProtein() { return true; } - public String toString() { + + public String toString() + { return "Score between two sequences aligned with Smith Waterman with default Peptide/Nucleotide matrix"; } } diff --git a/src/jalview/api/AlignViewControllerGuiI.java b/src/jalview/api/AlignViewControllerGuiI.java index 32fcd3e..b9638e5 100644 --- a/src/jalview/api/AlignViewControllerGuiI.java +++ b/src/jalview/api/AlignViewControllerGuiI.java @@ -19,16 +19,20 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.api; + /** - * Interface implemented by gui implementations managing a Jalview Alignment View + * Interface implemented by gui implementations managing a Jalview Alignment + * View + * * @author jimp - * + * */ public interface AlignViewControllerGuiI { /** * display the given string in the GUI's status bar + * * @param string */ void setStatus(String string); diff --git a/src/jalview/api/AlignViewControllerI.java b/src/jalview/api/AlignViewControllerI.java index be845bc..fadc09e 100644 --- a/src/jalview/api/AlignViewControllerI.java +++ b/src/jalview/api/AlignViewControllerI.java @@ -22,11 +22,13 @@ package jalview.api; /** * prototype abstract controller for a Jalview alignment view + * * @author jimp * - * All operations should return true if the view has changed as a result of the operation + * All operations should return true if the view has changed as a result + * of the operation * @param - * + * */ public interface AlignViewControllerI { @@ -39,16 +41,24 @@ public interface AlignViewControllerI public boolean deleteGroups(); - public void setViewportAndAlignmentPanel(AlignViewportI viewport, AlignmentViewPanel alignPanel); + public void setViewportAndAlignmentPanel(AlignViewportI viewport, + AlignmentViewPanel alignPanel); /** - * Mark columns in the current column selection according to positions of sequence features - * @param invert - when set, mark all but columns containing given type - * @param extendCurrent - when set, do not clear existing column selection - * @param toggle - rather than explicitly set, toggle selection state - * @param featureType - feature type string + * Mark columns in the current column selection according to positions of + * sequence features + * + * @param invert + * - when set, mark all but columns containing given type + * @param extendCurrent + * - when set, do not clear existing column selection + * @param toggle + * - rather than explicitly set, toggle selection state + * @param featureType + * - feature type string * @return true if operation affected state */ - boolean markColumnsContainingFeatures(boolean invert, boolean extendCurrent, boolean clearColumns, String featureType); + boolean markColumnsContainingFeatures(boolean invert, + boolean extendCurrent, boolean clearColumns, String featureType); } diff --git a/src/jalview/api/AlignViewportI.java b/src/jalview/api/AlignViewportI.java index 8b7a51e..567ae83 100644 --- a/src/jalview/api/AlignViewportI.java +++ b/src/jalview/api/AlignViewportI.java @@ -191,5 +191,4 @@ public interface AlignViewportI void setConservation(Conservation cons); - } diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 2c4eccb..d98e2aa 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -89,15 +89,19 @@ public class APopupMenu extends java.awt.PopupMenu implements Menu editMenu = new Menu(MessageManager.getString("action.edit")); - MenuItem copy = new MenuItem(MessageManager.getString("label.jalview_copy")); + MenuItem copy = new MenuItem( + MessageManager.getString("label.jalview_copy")); MenuItem cut = new MenuItem(MessageManager.getString("label.jalview_cut")); - MenuItem toUpper = new MenuItem(MessageManager.getString("label.to_upper_case")); + MenuItem toUpper = new MenuItem( + MessageManager.getString("label.to_upper_case")); - MenuItem toLower = new MenuItem(MessageManager.getString("label.to_lower_case")); + MenuItem toLower = new MenuItem( + MessageManager.getString("label.to_lower_case")); - MenuItem toggleCase = new MenuItem(MessageManager.getString("label.toggle_case")); + MenuItem toggleCase = new MenuItem( + MessageManager.getString("label.toggle_case")); Menu outputmenu = new Menu(); @@ -109,15 +113,20 @@ public class APopupMenu extends java.awt.PopupMenu implements MenuItem repGroup = new MenuItem(); - MenuItem sequenceName = new MenuItem(MessageManager.getString("label.edit_name_description")); + MenuItem sequenceName = new MenuItem( + MessageManager.getString("label.edit_name_description")); - MenuItem sequenceFeature = new MenuItem(MessageManager.getString("label.create_sequence_feature")); + MenuItem sequenceFeature = new MenuItem( + MessageManager.getString("label.create_sequence_feature")); - MenuItem editSequence = new MenuItem(MessageManager.getString("label.edit_sequence")); + MenuItem editSequence = new MenuItem( + MessageManager.getString("label.edit_sequence")); - MenuItem sequenceDetails = new MenuItem(MessageManager.getString("label.sequence_details") + "..."); + MenuItem sequenceDetails = new MenuItem( + MessageManager.getString("label.sequence_details") + "..."); - MenuItem selSeqDetails = new MenuItem(MessageManager.getString("label.sequence_details") + "..."); + MenuItem selSeqDetails = new MenuItem( + MessageManager.getString("label.sequence_details") + "..."); Sequence seq; @@ -165,7 +174,9 @@ public class APopupMenu extends java.awt.PopupMenu implements if (sg != null && sg.getSize() > 0) { - editGroupName.setLabel(MessageManager.formatMessage("label.name_param", new String[]{sg.getName()})); + editGroupName.setLabel(MessageManager.formatMessage( + "label.name_param", new String[] + { sg.getName() })); showText.setState(sg.getDisplayText()); showColourText.setState(sg.getColourText()); showBoxes.setState(sg.getDisplayBoxes()); @@ -174,7 +185,9 @@ public class APopupMenu extends java.awt.PopupMenu implements { menu1.setLabel(MessageManager.getString("action.edit_new_group")); groupMenu.remove(unGroupMenuItem); - } else { + } + else + { menu1.setLabel(MessageManager.getString("action.edit_group")); groupMenu.remove(createGroupMenuItem); } @@ -310,7 +323,9 @@ public class APopupMenu extends java.awt.PopupMenu implements if (seq != null) { seqMenu.setLabel(seq.getName()); - repGroup.setLabel(MessageManager.formatMessage("label.represent_group_with", new String[]{seq.getName()})); + repGroup.setLabel(MessageManager.formatMessage( + "label.represent_group_with", new String[] + { seq.getName() })); } else { @@ -649,8 +664,9 @@ public class APopupMenu extends java.awt.PopupMenu implements Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, - MessageManager.formatMessage("label.selection_output_command", new String[]{e.getActionCommand()}),600, 500); + jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( + "label.selection_output_command", new String[] + { e.getActionCommand() }), 600, 500); // JBPNote: getSelectionAsNewSequence behaviour has changed - this method // now returns a full copy of sequence data // TODO consider using getSequenceSelection instead here @@ -681,7 +697,9 @@ public class APopupMenu extends java.awt.PopupMenu implements StringBuffer contents = new StringBuffer(); for (SequenceI seq : sequences) { - contents.append(MessageManager.formatMessage("label.annotation_for_displayid",new String[]{seq.getDisplayId(true)})); + contents.append(MessageManager.formatMessage( + "label.annotation_for_displayid", new String[] + { seq.getDisplayId(true) })); new SequenceAnnotationReport(null) .createSequenceAnnotationReport( contents, @@ -698,7 +716,9 @@ public class APopupMenu extends java.awt.PopupMenu implements jalview.bin.JalviewLite.addFrame(frame, "Sequence Details for " + (sequences.length == 1 ? sequences[0].getDisplayId(true) : "Selection"), 600, 500); - cap.setText(MessageManager.formatMessage("label.html_content", new String[]{contents.toString()})); + cap.setText(MessageManager.formatMessage("label.html_content", + new String[] + { contents.toString() })); } void editName() @@ -737,8 +757,9 @@ public class APopupMenu extends java.awt.PopupMenu implements cap.setPDBImport(seq); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, - MessageManager.formatMessage("label.paste_pdb_file_for_sequence", new String[]{seq.getName()}), 400, 300); + jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( + "label.paste_pdb_file_for_sequence", new String[] + { seq.getName() }), 400, 300); } } @@ -748,13 +769,16 @@ public class APopupMenu extends java.awt.PopupMenu implements sequenceFeature.addActionListener(this); editGroupName.addActionListener(this); - unGroupMenuItem.setLabel(MessageManager.getString("action.remove_group")); + unGroupMenuItem.setLabel(MessageManager + .getString("action.remove_group")); unGroupMenuItem.addActionListener(this); - createGroupMenuItem.setLabel(MessageManager.getString("action.create_group")); + createGroupMenuItem.setLabel(MessageManager + .getString("action.create_group")); createGroupMenuItem.addActionListener(this); - nucleotideMenuItem.setLabel(MessageManager.getString("label.nucleotide")); + nucleotideMenuItem.setLabel(MessageManager + .getString("label.nucleotide")); nucleotideMenuItem.addActionListener(this); conservationMenuItem.addItemListener(this); abovePIDColour.addItemListener(this); @@ -765,7 +789,8 @@ public class APopupMenu extends java.awt.PopupMenu implements sequenceName.addActionListener(this); sequenceDetails.addActionListener(this); selSeqDetails.addActionListener(this); - displayNonconserved.setLabel(MessageManager.getString("label.show_non_conversed")); + displayNonconserved.setLabel(MessageManager + .getString("label.show_non_conversed")); displayNonconserved.setState(false); displayNonconserved.addItemListener(this); showText.setLabel(MessageManager.getString("action.text")); @@ -776,10 +801,12 @@ public class APopupMenu extends java.awt.PopupMenu implements seqMenu.setLabel(MessageManager.getString("label.sequence")); pdb.setLabel(MessageManager.getString("label.view_pdb_structure")); hideSeqs.setLabel(MessageManager.getString("action.hide_sequences")); - repGroup.setLabel(MessageManager.formatMessage("label.represent_group_with", new String[]{""})); + repGroup.setLabel(MessageManager.formatMessage( + "label.represent_group_with", new String[] + { "" })); revealAll.setLabel(MessageManager.getString("action.reveal_all")); revealSeq.setLabel(MessageManager.getString("action.reveal_sequences")); - menu1.setLabel(MessageManager.getString("label.group")+":"); + menu1.setLabel(MessageManager.getString("label.group") + ":"); add(groupMenu); this.add(seqMenu); this.add(hideSeqs); diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index a8bd6fd..cc1703c 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -100,6 +100,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, ItemListener, KeyListener, AlignViewControllerGuiI { public AlignViewControllerI avc; + public AlignmentPanel alignPanel; public AlignViewport viewport; @@ -149,7 +150,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } viewport = new AlignViewport(al, applet); alignPanel = new AlignmentPanel(this, viewport); - avc = new jalview.controller.AlignViewController(this, viewport, alignPanel); + avc = new jalview.controller.AlignViewController(this, viewport, + alignPanel); viewport.updateConservation(alignPanel); viewport.updateConsensus(alignPanel); @@ -162,7 +164,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, showSequenceLogo.setState(viewport.isShowSequenceLogo()); normSequenceLogo.setState(viewport.isNormaliseSequenceLogo()); applyToAllGroups.setState(viewport.getColourAppliesToAllGroups()); - + seqLimits.setState(viewport.showJVSuffix); if (applet != null) @@ -308,7 +310,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.featureSettings.refreshTable(); } alignPanel.paintAlignment(true); - statusBar.setText(MessageManager.getString("label.successfully_added_features_alignment")); + statusBar.setText(MessageManager + .getString("label.successfully_added_features_alignment")); } return featuresFile; } @@ -452,7 +455,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText(MessageManager.formatMessage("label.keyboard_editing_mode", new String[]{(viewport.cursorMode ? "on" : "off")})); + statusBar.setText(MessageManager.formatMessage( + "label.keyboard_editing_mode", new String[] + { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; @@ -567,7 +572,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } } break; - + case KeyEvent.VK_U: if (evt.isControlDown()) { @@ -996,8 +1001,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, cap.setText(contents.toString()); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage("label.alignment_properties", new String[]{getTitle()}), - 400, 250); + jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( + "label.alignment_properties", new String[] + { getTitle() }), 400, 250); } else if (source == overviewMenuItem) { @@ -1144,7 +1150,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.input_cut_paste"), 500, 500); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.input_cut_paste"), 500, 500); } protected void outputText_actionPerformed(ActionEvent e) @@ -1152,8 +1159,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, - MessageManager.formatMessage("label.alignment_output_command", new String[]{e.getActionCommand()}),600, 500); + jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( + "label.alignment_output_command", new String[] + { e.getActionCommand() }), 600, 500); cap.setText(new AppletFormatAdapter().formatSequences( e.getActionCommand(), viewport.getAlignment(), viewport.showJVSuffix)); @@ -1162,11 +1170,13 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public void loadAnnotations() { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, this); - cap.setText(MessageManager.getString("label.paste_features_annotations_Tcoffee_here")); + cap.setText(MessageManager + .getString("label.paste_features_annotations_Tcoffee_here")); cap.setAnnotationImport(); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("action.paste_annotations"), 400, 300); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("action.paste_annotations"), 400, 300); } @@ -1183,7 +1193,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, CutAndPasteTransfer cap = new CutAndPasteTransfer(false, this); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.annotations"), 600, 500); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.annotations"), 600, 500); cap.setText(annotation); } @@ -1239,7 +1250,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.features"), 600, 500); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.features"), 600, 500); cap.setText(features); } else @@ -1377,7 +1389,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { undoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.historyList.peek(); - undoMenuItem.setLabel(MessageManager.formatMessage("label.undo_command", new String[]{command.getDescription()})); + undoMenuItem.setLabel(MessageManager.formatMessage( + "label.undo_command", new String[] + { command.getDescription() })); } else { @@ -1390,7 +1404,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, redoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.redoList.peek(); - redoMenuItem.setLabel(MessageManager.formatMessage("label.redo_command", new String[]{command.getDescription()})); + redoMenuItem.setLabel(MessageManager.formatMessage( + "label.redo_command", new String[] + { command.getDescription() })); } else { @@ -1917,7 +1933,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, protected void makeGrpsFromSelection_actionPerformed() { - if (avc.makeGroupsFromSelection()) { + if (avc.makeGroupsFromSelection()) + { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); alignPanel.paintAlignment(true); @@ -1928,6 +1945,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { avc.createGroup(); } + protected void unGroup_actionPerformed() { if (avc.unGroup()) @@ -1935,6 +1953,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, alignPanel.alignmentChanged(); } } + protected void deleteGroups_actionPerformed() { if (avc.deleteGroups()) @@ -2038,7 +2057,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.getSelectionGroup()); } - statusBar.setText(MessageManager.formatMessage("label.removed_columns", new String[]{Integer.valueOf(trimRegion.getSize()).toString()})); + statusBar.setText(MessageManager.formatMessage( + "label.removed_columns", new String[] + { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); for (SequenceGroup sg : viewport.getAlignment().getGroups()) @@ -2078,7 +2099,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, addHistoryItem(removeGapCols); - statusBar.setText(MessageManager.formatMessage("label.removed_empty_columns", new String[]{Integer.valueOf(removeGapCols.getSize()).toString()})); + statusBar.setText(MessageManager.formatMessage( + "label.removed_empty_columns", new String[] + { Integer.valueOf(removeGapCols.getSize()).toString() })); // This is to maintain viewport position on first residue // of first sequence @@ -2305,8 +2328,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, OverviewPanel overview = new OverviewPanel(alignPanel); frame.add(overview); // +50 must allow for applet frame window - jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage("label.overview_params", new String[]{this.getTitle()}), - overview.getPreferredSize().width, + jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( + "label.overview_params", new String[] + { this.getTitle() }), overview.getPreferredSize().width, overview.getPreferredSize().height + 50); frame.pack(); @@ -2335,9 +2359,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { if (viewport.getAbovePIDThreshold()) { - viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel, cs, - "Background")); - } + viewport.setThreshold(SliderPanel.setPIDSliderSource(alignPanel, + cs, "Background")); + } if (viewport.getConservationSelected()) { @@ -2461,7 +2485,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { Frame frame = new Frame(); frame.add(new PairwiseAlignPanel(alignPanel)); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("action.pairwise_alignment"), 600, + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("action.pairwise_alignment"), 600, 500); } } @@ -2563,12 +2588,14 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, cap.setTreeImport(); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.paste_newick_file"), 400, 300); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.paste_newick_file"), 400, 300); } public void loadTree(jalview.io.NewickFile tree, String treeFile) { - TreePanel tp = new TreePanel(alignPanel, treeFile, MessageManager.getString("label.load_tree_from_file"), tree); + TreePanel tp = new TreePanel(alignPanel, treeFile, + MessageManager.getString("label.load_tree_from_file"), tree); jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500); addTreeMenuItem(tp, treeFile); } @@ -2588,8 +2615,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, .sortByTree(viewport.getAlignment(), treePanel.getTree()); // addHistoryItem(new HistoryItem("Sort", viewport.alignment, // HistoryItem.SORT)); - addHistoryItem(new OrderCommand(MessageManager.formatMessage("label.order_by_params", new String[]{title}), oldOrder, - viewport.getAlignment())); + addHistoryItem(new OrderCommand(MessageManager.formatMessage( + "label.order_by_params", new String[] + { title }), oldOrder, viewport.getAlignment())); alignPanel.paintAlignment(true); } @@ -2685,27 +2713,31 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // TODO: update this text for each release or centrally store it for // lite and application g.setFont(new Font("Helvetica", Font.BOLD, 14)); - g.drawString(MessageManager.formatMessage("label.jalviewLite_release", new String[]{version}), x, y += fh); + g.drawString(MessageManager.formatMessage( + "label.jalviewLite_release", new String[] + { version }), x, y += fh); g.setFont(new Font("Helvetica", Font.BOLD, 12)); - g.drawString(MessageManager.formatMessage("label.jaview_build_date", new String[]{builddate}), x, y += fh); + g.drawString(MessageManager.formatMessage( + "label.jaview_build_date", new String[] + { builddate }), x, y += fh); g.setFont(new Font("Helvetica", Font.PLAIN, 12)); - g.drawString( - MessageManager.getString("label.jalview_authors_1"), + g.drawString(MessageManager.getString("label.jalview_authors_1"), x, y += fh * 1.5); - g.drawString(MessageManager.getString("label.jalview_authors_2"), x + 50, y += fh+8); - g.drawString( - MessageManager.getString("label.jalview_dev_managers"), - x, y += fh); + g.drawString(MessageManager.getString("label.jalview_authors_2"), + x + 50, y += fh + 8); g.drawString( - MessageManager.getString("label.jalview_distribution_lists"), - x, y += fh); - g.drawString(MessageManager.getString("label.jalview_please_cite"), x, y += fh + 8); + MessageManager.getString("label.jalview_dev_managers"), x, + y += fh); + g.drawString(MessageManager + .getString("label.jalview_distribution_lists"), x, y += fh); + g.drawString(MessageManager.getString("label.jalview_please_cite"), + x, y += fh + 8); g.drawString( MessageManager.getString("label.jalview_cite_1_authors"), x, y += fh); g.drawString( - MessageManager.getString("label.jalview_cite_1_title"), - x, y += fh); + MessageManager.getString("label.jalview_cite_1_title"), x, + y += fh); g.drawString(MessageManager.getString("label.jalview_cite_1_ref"), x, y += fh); } @@ -2714,7 +2746,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, Frame frame = new Frame(); frame.add(new AboutPanel(JalviewLite.getVersion(), JalviewLite .getBuildDate())); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.jalview"), 580, 220); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.jalview"), 580, 220); } @@ -2737,17 +2770,23 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, Menu fileMenu = new Menu(MessageManager.getString("action.file")); - MenuItem loadApplication = new MenuItem(MessageManager.getString("label.view_full_application")); + MenuItem loadApplication = new MenuItem( + MessageManager.getString("label.view_full_application")); - MenuItem loadTree = new MenuItem(MessageManager.getString("label.load_associated_tree")); + MenuItem loadTree = new MenuItem( + MessageManager.getString("label.load_associated_tree")); - MenuItem loadAnnotations = new MenuItem(MessageManager.getString("label.load_features_annotations")); + MenuItem loadAnnotations = new MenuItem( + MessageManager.getString("label.load_features_annotations")); - MenuItem outputFeatures = new MenuItem(MessageManager.getString("label.export_features")); + MenuItem outputFeatures = new MenuItem( + MessageManager.getString("label.export_features")); - MenuItem outputAnnotations = new MenuItem(MessageManager.getString("label.export_annotations")); + MenuItem outputAnnotations = new MenuItem( + MessageManager.getString("label.export_annotations")); - MenuItem closeMenuItem = new MenuItem(MessageManager.getString("action.close")); + MenuItem closeMenuItem = new MenuItem( + MessageManager.getString("action.close")); Menu editMenu = new Menu(MessageManager.getString("action.edit")); @@ -2755,13 +2794,17 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, Menu colourMenu = new Menu(MessageManager.getString("action.colour")); - Menu calculateMenu = new Menu(MessageManager.getString("action.calculate")); + Menu calculateMenu = new Menu( + MessageManager.getString("action.calculate")); - MenuItem selectAllSequenceMenuItem = new MenuItem(MessageManager.getString("action.select_all")); + MenuItem selectAllSequenceMenuItem = new MenuItem( + MessageManager.getString("action.select_all")); - MenuItem deselectAllSequenceMenuItem = new MenuItem(MessageManager.getString("action.deselect_all")); + MenuItem deselectAllSequenceMenuItem = new MenuItem( + MessageManager.getString("action.deselect_all")); - MenuItem invertSequenceMenuItem = new MenuItem(MessageManager.getString("action.invert_selection")); + MenuItem invertSequenceMenuItem = new MenuItem( + MessageManager.getString("action.invert_selection")); MenuItem remove2LeftMenuItem = new MenuItem(); @@ -2839,7 +2882,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, CheckboxMenuItem displayNonconservedMenuItem = new CheckboxMenuItem(); - MenuItem alProperties = new MenuItem(MessageManager.getString("label.alignment_props")); + MenuItem alProperties = new MenuItem( + MessageManager.getString("label.alignment_props")); MenuItem overviewMenuItem = new MenuItem(); @@ -2970,13 +3014,17 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, selectAllSequenceMenuItem.addActionListener(this); deselectAllSequenceMenuItem.addActionListener(this); invertSequenceMenuItem.addActionListener(this); - remove2LeftMenuItem.setLabel(MessageManager.getString("action.remove_left")); + remove2LeftMenuItem.setLabel(MessageManager + .getString("action.remove_left")); remove2LeftMenuItem.addActionListener(this); - remove2RightMenuItem.setLabel(MessageManager.getString("action.remove_right")); + remove2RightMenuItem.setLabel(MessageManager + .getString("action.remove_right")); remove2RightMenuItem.addActionListener(this); - removeGappedColumnMenuItem.setLabel(MessageManager.getString("action.remove_empty_columns")); + removeGappedColumnMenuItem.setLabel(MessageManager + .getString("action.remove_empty_columns")); removeGappedColumnMenuItem.addActionListener(this); - removeAllGapsMenuItem.setLabel(MessageManager.getString("action.remove_all_gaps")); + removeAllGapsMenuItem.setLabel(MessageManager + .getString("action.remove_all_gaps")); removeAllGapsMenuItem.addActionListener(this); viewBoxesMenuItem.setLabel(MessageManager.getString("action.boxes")); viewBoxesMenuItem.setState(true); @@ -2984,29 +3032,36 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewTextMenuItem.setLabel(MessageManager.getString("action.text")); viewTextMenuItem.setState(true); viewTextMenuItem.addItemListener(this); - sortPairwiseMenuItem.setLabel(MessageManager.getString("action.by_pairwise_id")); + sortPairwiseMenuItem.setLabel(MessageManager + .getString("action.by_pairwise_id")); sortPairwiseMenuItem.addActionListener(this); sortIDMenuItem.setLabel(MessageManager.getString("action.by_id")); sortIDMenuItem.addActionListener(this); - sortLengthMenuItem.setLabel(MessageManager.getString("action.by_length")); + sortLengthMenuItem.setLabel(MessageManager + .getString("action.by_length")); sortLengthMenuItem.addActionListener(this); sortGroupMenuItem.setLabel(MessageManager.getString("action.by_group")); sortGroupMenuItem.addActionListener(this); - removeRedundancyMenuItem.setLabel(MessageManager.getString("action.remove_redundancy")); + removeRedundancyMenuItem.setLabel(MessageManager + .getString("action.remove_redundancy")); removeRedundancyMenuItem.addActionListener(this); - pairwiseAlignmentMenuItem.setLabel(MessageManager.getString("action.pairwise_alignment")); + pairwiseAlignmentMenuItem.setLabel(MessageManager + .getString("action.pairwise_alignment")); pairwiseAlignmentMenuItem.addActionListener(this); - PCAMenuItem.setLabel(MessageManager.getString("label.principal_component_analysis")); + PCAMenuItem.setLabel(MessageManager + .getString("label.principal_component_analysis")); PCAMenuItem.addActionListener(this); - averageDistanceTreeMenuItem - .setLabel(MessageManager.getString("label.average_distance_identity")); + averageDistanceTreeMenuItem.setLabel(MessageManager + .getString("label.average_distance_identity")); averageDistanceTreeMenuItem.addActionListener(this); - neighbourTreeMenuItem.setLabel(MessageManager.getString("label.neighbour_joining_identity")); + neighbourTreeMenuItem.setLabel(MessageManager + .getString("label.neighbour_joining_identity")); neighbourTreeMenuItem.addActionListener(this); statusBar.setBackground(Color.white); statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); statusBar.setText(MessageManager.getString("label.status_bar")); - outputTextboxMenu.setLabel(MessageManager.getString("label.out_to_textbox")); + outputTextboxMenu.setLabel(MessageManager + .getString("label.out_to_textbox")); clustalColour.setLabel(MessageManager.getString("label.clustalx")); clustalColour.addActionListener(this); @@ -3014,45 +3069,60 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, zappoColour.addActionListener(this); taylorColour.setLabel(MessageManager.getString("label.taylor")); taylorColour.addActionListener(this); - hydrophobicityColour.setLabel(MessageManager.getString("label.hydrophobicity")); + hydrophobicityColour.setLabel(MessageManager + .getString("label.hydrophobicity")); hydrophobicityColour.addActionListener(this); - helixColour.setLabel(MessageManager.getString("label.helix_propensity")); + helixColour + .setLabel(MessageManager.getString("label.helix_propensity")); helixColour.addActionListener(this); - strandColour.setLabel(MessageManager.getString("label.strand_propensity")); + strandColour.setLabel(MessageManager + .getString("label.strand_propensity")); strandColour.addActionListener(this); turnColour.setLabel(MessageManager.getString("label.turn_propensity")); turnColour.addActionListener(this); buriedColour.setLabel(MessageManager.getString("label.buried_index")); buriedColour.addActionListener(this); - purinePyrimidineColour.setLabel(MessageManager.getString("label.purine_pyrimidine")); + purinePyrimidineColour.setLabel(MessageManager + .getString("label.purine_pyrimidine")); purinePyrimidineColour.addActionListener(this); - RNAInteractionColour.setLabel(MessageManager.getString("label.rna_interaction")); + RNAInteractionColour.setLabel(MessageManager + .getString("label.rna_interaction")); RNAInteractionColour.addActionListener(this); - RNAHelixColour.setLabel(MessageManager.getString("action.by_rna_helixes")); + RNAHelixColour.setLabel(MessageManager + .getString("action.by_rna_helixes")); RNAHelixColour.addActionListener(this); - userDefinedColour.setLabel(MessageManager.getString("action.user_defined")); + userDefinedColour.setLabel(MessageManager + .getString("action.user_defined")); userDefinedColour.addActionListener(this); - PIDColour.setLabel(MessageManager.getString("label.percentage_identity")); + PIDColour.setLabel(MessageManager + .getString("label.percentage_identity")); PIDColour.addActionListener(this); - BLOSUM62Colour.setLabel(MessageManager.getString("label.blosum62_score")); + BLOSUM62Colour.setLabel(MessageManager + .getString("label.blosum62_score")); BLOSUM62Colour.addActionListener(this); - tcoffeeColour.setLabel(MessageManager.getString("label.tcoffee_scores")); + tcoffeeColour + .setLabel(MessageManager.getString("label.tcoffee_scores")); tcoffeeColour.setEnabled(false); // it will enabled only if a score file is // provided tcoffeeColour.addActionListener(this); - avDistanceTreeBlosumMenuItem - .setLabel(MessageManager.getString("label.average_distance_bloslum62")); + avDistanceTreeBlosumMenuItem.setLabel(MessageManager + .getString("label.average_distance_bloslum62")); avDistanceTreeBlosumMenuItem.addActionListener(this); - njTreeBlosumMenuItem.setLabel(MessageManager.getString("label.neighbour_blosum62")); + njTreeBlosumMenuItem.setLabel(MessageManager + .getString("label.neighbour_blosum62")); njTreeBlosumMenuItem.addActionListener(this); - annotationPanelMenuItem.setLabel(MessageManager.getString("label.show_annotations")); + annotationPanelMenuItem.setLabel(MessageManager + .getString("label.show_annotations")); annotationPanelMenuItem.addItemListener(this); - colourTextMenuItem.setLabel(MessageManager.getString("label.colour_text")); + colourTextMenuItem.setLabel(MessageManager + .getString("label.colour_text")); colourTextMenuItem.addItemListener(this); - displayNonconservedMenuItem.setLabel(MessageManager.getString("label.show_non_conversed")); + displayNonconservedMenuItem.setLabel(MessageManager + .getString("label.show_non_conversed")); displayNonconservedMenuItem.addItemListener(this); alProperties.addActionListener(this); - overviewMenuItem.setLabel(MessageManager.getString("label.overview_window")); + overviewMenuItem.setLabel(MessageManager + .getString("label.overview_window")); overviewMenuItem.addActionListener(this); undoMenuItem.setEnabled(false); undoMenuItem.setLabel(MessageManager.getString("action.undo")); @@ -3060,24 +3130,29 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, redoMenuItem.setEnabled(false); redoMenuItem.setLabel(MessageManager.getString("action.redo")); redoMenuItem.addActionListener(this); - conservationMenuItem.setLabel(MessageManager.getString("action.by_conservation")); + conservationMenuItem.setLabel(MessageManager + .getString("action.by_conservation")); conservationMenuItem.addItemListener(this); noColourmenuItem.setLabel(MessageManager.getString("label.none")); noColourmenuItem.addActionListener(this); wrapMenuItem.setLabel(MessageManager.getString("action.wrap")); wrapMenuItem.addItemListener(this); - renderGapsMenuItem.setLabel(MessageManager.getString("action.show_gaps")); + renderGapsMenuItem.setLabel(MessageManager + .getString("action.show_gaps")); renderGapsMenuItem.setState(true); renderGapsMenuItem.addItemListener(this); findMenuItem.setLabel(MessageManager.getString("action.find")); findMenuItem.addActionListener(this); - abovePIDThreshold.setLabel(MessageManager.getString("label.above_identity_threshold")); + abovePIDThreshold.setLabel(MessageManager + .getString("label.above_identity_threshold")); abovePIDThreshold.addItemListener(this); nucleotideColour.setLabel(MessageManager.getString("label.nucleotide")); nucleotideColour.addActionListener(this); - deleteGroups.setLabel(MessageManager.getString("action.undefine_groups")); + deleteGroups.setLabel(MessageManager + .getString("action.undefine_groups")); deleteGroups.addActionListener(this); - grpsFromSelection.setLabel(MessageManager.getString("action.make_groups_selection")); + grpsFromSelection.setLabel(MessageManager + .getString("action.make_groups_selection")); grpsFromSelection.addActionListener(this); createGroup.setLabel(MessageManager.getString("action.create_group")); unGroup.setLabel(MessageManager.getString("action.remove_group")); @@ -3092,7 +3167,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, pasteNew.addActionListener(this); pasteThis.setLabel(MessageManager.getString("label.to_this_alignment")); pasteThis.addActionListener(this); - applyToAllGroups.setLabel(MessageManager.getString("label.apply_colour_to_all_groups")); + applyToAllGroups.setLabel(MessageManager + .getString("label.apply_colour_to_all_groups")); applyToAllGroups.setState(true); applyToAllGroups.addItemListener(this); font.setLabel(MessageManager.getString("action.font")); @@ -3109,20 +3185,26 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, scaleRight.setState(true); scaleRight.setLabel(MessageManager.getString("action.scale_right")); scaleRight.addItemListener(this); - modifyPID.setLabel(MessageManager.getString("label.modify_identity_thereshold")); + modifyPID.setLabel(MessageManager + .getString("label.modify_identity_thereshold")); modifyPID.addActionListener(this); - modifyConservation.setLabel(MessageManager.getString("label.modify_conservation_thereshold")); + modifyConservation.setLabel(MessageManager + .getString("label.modify_conservation_thereshold")); modifyConservation.addActionListener(this); - sortByTreeMenu.setLabel(MessageManager.getString("action.by_tree_order")); + sortByTreeMenu.setLabel(MessageManager + .getString("action.by_tree_order")); sort.setLabel(MessageManager.getString("action.sort")); calculate.setLabel(MessageManager.getString("action.calculate_tree")); autoCalculate.addItemListener(this); sortByTree.addItemListener(this); - inputText.setLabel(MessageManager.getString("label.input_from_textbox")); + inputText + .setLabel(MessageManager.getString("label.input_from_textbox")); inputText.addActionListener(this); - centreColumnLabelFlag.setLabel(MessageManager.getString("label.centre_column_labels")); + centreColumnLabelFlag.setLabel(MessageManager + .getString("label.centre_column_labels")); centreColumnLabelFlag.addItemListener(this); - followMouseOverFlag.setLabel(MessageManager.getString("label.automatic_scrolling")); + followMouseOverFlag.setLabel(MessageManager + .getString("label.automatic_scrolling")); followMouseOverFlag.addItemListener(this); helpMenu.setLabel(MessageManager.getString("action.help")); documentation.setLabel(MessageManager.getString("label.documentation")); @@ -3131,34 +3213,52 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, about.setLabel(MessageManager.getString("label.about")); about.addActionListener(this); seqLimits.setState(true); - seqLimits.setLabel(MessageManager.getString("label.show_sequence_limits")); + seqLimits.setLabel(MessageManager + .getString("label.show_sequence_limits")); seqLimits.addItemListener(this); - featureSettings.setLabel(MessageManager.getString("label.feature_settings")); + featureSettings.setLabel(MessageManager + .getString("label.feature_settings")); featureSettings.addActionListener(this); - sequenceFeatures.setLabel(MessageManager.getString("label.sequence_features")); + sequenceFeatures.setLabel(MessageManager + .getString("label.sequence_features")); sequenceFeatures.addItemListener(this); sequenceFeatures.setState(false); - annotationColour.setLabel(MessageManager.getString("action.by_annotation")); + annotationColour.setLabel(MessageManager + .getString("action.by_annotation")); annotationColour.addActionListener(this); - invertSequenceMenuItem.setLabel(MessageManager.getString("action.invert_sequence_selection")); - invertColSel.setLabel(MessageManager.getString("action.invert_column_selection")); + invertSequenceMenuItem.setLabel(MessageManager + .getString("action.invert_sequence_selection")); + invertColSel.setLabel(MessageManager + .getString("action.invert_column_selection")); menu1.setLabel(MessageManager.getString("action.show")); showColumns.setLabel(MessageManager.getString("label.all_columns")); showSeqs.setLabel(MessageManager.getString("label.all_sequences")); menu2.setLabel(MessageManager.getString("action.hide")); - hideColumns.setLabel(MessageManager.getString("label.selected_columns")); - hideSequences.setLabel(MessageManager.getString("label.selected_sequences")); - hideAllButSelection.setLabel(MessageManager.getString("label.all_but_selected_region")); - hideAllSelection.setLabel(MessageManager.getString("label.selected_region")); - showAllHidden.setLabel(MessageManager.getString("label.all_sequences_columns")); - showGroupConsensus.setLabel(MessageManager.getString("label.group_consensus")); - showGroupConservation.setLabel(MessageManager.getString("label.group_conservation")); - showConsensusHistogram.setLabel(MessageManager.getString("label.show_consensus_histogram")); - showSequenceLogo.setLabel(MessageManager.getString("label.show_consensus_logo")); - normSequenceLogo.setLabel(MessageManager.getString("label.norm_consensus_logo")); - applyAutoAnnotationSettings.setLabel(MessageManager.getString("label.apply_all_groups")); + hideColumns + .setLabel(MessageManager.getString("label.selected_columns")); + hideSequences.setLabel(MessageManager + .getString("label.selected_sequences")); + hideAllButSelection.setLabel(MessageManager + .getString("label.all_but_selected_region")); + hideAllSelection.setLabel(MessageManager + .getString("label.selected_region")); + showAllHidden.setLabel(MessageManager + .getString("label.all_sequences_columns")); + showGroupConsensus.setLabel(MessageManager + .getString("label.group_consensus")); + showGroupConservation.setLabel(MessageManager + .getString("label.group_conservation")); + showConsensusHistogram.setLabel(MessageManager + .getString("label.show_consensus_histogram")); + showSequenceLogo.setLabel(MessageManager + .getString("label.show_consensus_logo")); + normSequenceLogo.setLabel(MessageManager + .getString("label.norm_consensus_logo")); + applyAutoAnnotationSettings.setLabel(MessageManager + .getString("label.apply_all_groups")); applyAutoAnnotationSettings.setState(true); - autoAnnMenu.setLabel(MessageManager.getString("label.autocalculated_annotation")); + autoAnnMenu.setLabel(MessageManager + .getString("label.autocalculated_annotation")); invertColSel.addActionListener(this); showColumns.addActionListener(this); @@ -3254,7 +3354,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, colourMenu.add(buriedColour); colourMenu.add(nucleotideColour); colourMenu.add(purinePyrimidineColour); - // colourMenu.add(RNAInteractionColour); + // colourMenu.add(RNAInteractionColour); colourMenu.add(tcoffeeColour); colourMenu.add(userDefinedColour); colourMenu.addSeparator(); @@ -3317,8 +3417,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } - - public void setStatus(String string) { + public void setStatus(String string) + { statusBar.setText(string); }; diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index fd03e30..a677eff 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -435,7 +435,9 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { annotationSpaceFillerHolder.setVisible(b); annotationPanelHolder.setVisible(b); - } else { + } + else + { annotationSpaceFillerHolder.setVisible(false); annotationPanelHolder.setVisible(false); } @@ -486,10 +488,12 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, if (adjustPanelHeight) { - // NOTE: this logic is different in the application. Need a better algorithm to define behaviour + // NOTE: this logic is different in the application. Need a better + // algorithm to define behaviour // sets initial preferred height // try and set height according to alignment - float sscaling = (float) ((av.getCharHeight() * av.getAlignment().getHeight())/(1.0*mheight)); + float sscaling = (float) ((av.getCharHeight() * av.getAlignment() + .getHeight()) / (1.0 * mheight)); if (sscaling > 0.5) { // if the alignment is too big then @@ -498,7 +502,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, } else { - // otherwise just set the panel so that one row of sequence is visible + // otherwise just set the panel so that one row of sequence is visible height = -av.getCharHeight() * 1 + (int) (seqandannot * (1 - sscaling)); } @@ -549,7 +553,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, annotationPanelHolder.setVisible(true); annotationSpaceFillerHolder.setVisible(true); } - + idSpaceFillerPanel1.setVisible(!wrap); fontChanged(); // This is so that the scalePanel is resized correctly @@ -825,7 +829,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, seqPanel.seqCanvas.repaint(); idPanel.idCanvas.repaint(); - if (!av.wrapAlignment) + if (!av.wrapAlignment) { if (av.showAnnotation) { @@ -834,7 +838,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, } scalePanel.repaint(); } - + } protected Panel sequenceHolderPanel = new Panel(); diff --git a/src/jalview/appletgui/AnnotationColourChooser.java b/src/jalview/appletgui/AnnotationColourChooser.java index aa3c821..f85a073 100644 --- a/src/jalview/appletgui/AnnotationColourChooser.java +++ b/src/jalview/appletgui/AnnotationColourChooser.java @@ -88,8 +88,9 @@ public class AnnotationColourChooser extends Panel implements if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - currentColours.setState(acg.isPredefinedColours() || acg.getBaseColour()!=null); - if (!acg.isPredefinedColours() && acg.getBaseColour()==null) + currentColours.setState(acg.isPredefinedColours() + || acg.getBaseColour() != null); + if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { minColour.setBackground(acg.getMinColour()); maxColour.setBackground(acg.getMaxColour()); @@ -97,7 +98,6 @@ public class AnnotationColourChooser extends Panel implements // seqAssociated.setState(acg.isSeqAssociated()); } - Vector list = new Vector(); int index = 1; for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) @@ -114,9 +114,12 @@ public class AnnotationColourChooser extends Panel implements annotations.addItem(list.elementAt(i).toString()); } - threshold.addItem(MessageManager.getString("label.threshold_feature_no_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_above_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_below_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); if (oldcs instanceof AnnotationColourGradient) { @@ -147,7 +150,8 @@ public class AnnotationColourChooser extends Panel implements frame = new Frame(); frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.colour_by_annotation"), 560, + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.colour_by_annotation"), 560, 175); validate(); } @@ -202,11 +206,13 @@ public class AnnotationColourChooser extends Panel implements thresholdValue.setEnabled(false); thresholdValue.setColumns(5); currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - currentColours.setLabel(MessageManager.getString("label.use_original_colours")); + currentColours.setLabel(MessageManager + .getString("label.use_original_colours")); currentColours.addItemListener(this); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel(MessageManager.getString("label.threshold_minmax")); + thresholdIsMin.setLabel(MessageManager + .getString("label.threshold_minmax")); this.setLayout(borderLayout1); @@ -404,11 +410,11 @@ public class AnnotationColourChooser extends Panel implements .getSelectedIndex()]; int aboveThreshold = -1; - if (threshold.getSelectedIndex()==1) + if (threshold.getSelectedIndex() == 1) { aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; } - else if (threshold.getSelectedIndex()==2) + else if (threshold.getSelectedIndex() == 2) { aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; } diff --git a/src/jalview/appletgui/AnnotationLabels.java b/src/jalview/appletgui/AnnotationLabels.java index a884c05..a286e06 100755 --- a/src/jalview/appletgui/AnnotationLabels.java +++ b/src/jalview/appletgui/AnnotationLabels.java @@ -412,7 +412,8 @@ public class AnnotationLabels extends Panel implements ActionListener, if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { - PopupMenu popup = new PopupMenu(MessageManager.getString("label.annotations")); + PopupMenu popup = new PopupMenu( + MessageManager.getString("label.annotations")); MenuItem item = new MenuItem(ADDNEW); item.addActionListener(this); @@ -773,7 +774,8 @@ public class AnnotationLabels extends Panel implements ActionListener, { g.setColor(Color.black); g.drawString(MessageManager.getString("label.right_click"), 2, 8); - g.drawString(MessageManager.getString("label.to_add_annotation"), 2, 18); + g.drawString(MessageManager.getString("label.to_add_annotation"), 2, + 18); } } } diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 7ae6b90..4b9fa67 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -240,7 +240,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, aa[activeRow].hasText = true; if (evt.getActionCommand().equals(STEM)) { - aa[activeRow].showAllColLabels=true; + aa[activeRow].showAllColLabels = true; } } @@ -325,7 +325,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, return; } - PopupMenu pop = new PopupMenu(MessageManager.getString("label.structure_type")); + PopupMenu pop = new PopupMenu( + MessageManager.getString("label.structure_type")); MenuItem item; /* * Just display the needed structure options @@ -626,7 +627,8 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, g.setColor(Color.black); if (av.validCharWidth) { - g.drawString(MessageManager.getString("label.alignment_has_no_annotations"), 20, 15); + g.drawString(MessageManager + .getString("label.alignment_has_no_annotations"), 20, 15); } return; @@ -664,16 +666,21 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, { return imgWidth; } + private int[] bounds = new int[2]; + @Override public int[] getVisibleVRange() { - if (ap!=null && ap.alabels!=null) + if (ap != null && ap.alabels != null) { - int sOffset=-ap.alabels.scrollOffset; - int visHeight = sOffset+ap.annotationPanelHolder.getHeight(); - bounds[0] = sOffset; bounds[1]=visHeight; - return bounds; - } else return null; + int sOffset = -ap.alabels.scrollOffset; + int visHeight = sOffset + ap.annotationPanelHolder.getHeight(); + bounds[0] = sOffset; + bounds[1] = visHeight; + return bounds; + } + else + return null; } } diff --git a/src/jalview/appletgui/AppletJmol.java b/src/jalview/appletgui/AppletJmol.java index 480cfd1..3d1d0fb 100644 --- a/src/jalview/appletgui/AppletJmol.java +++ b/src/jalview/appletgui/AppletJmol.java @@ -47,35 +47,47 @@ public class AppletJmol extends EmbmenuFrame implements Menu helpMenu = new Menu(MessageManager.getString("action.help")); - MenuItem mappingMenuItem = new MenuItem(MessageManager.getString("label.view_mapping")); + MenuItem mappingMenuItem = new MenuItem( + MessageManager.getString("label.view_mapping")); - CheckboxMenuItem seqColour = new CheckboxMenuItem(MessageManager.getString("action.by_sequence"), true); + CheckboxMenuItem seqColour = new CheckboxMenuItem( + MessageManager.getString("action.by_sequence"), true); - CheckboxMenuItem jmolColour = new CheckboxMenuItem(MessageManager.getString("action.using_jmol"), false); + CheckboxMenuItem jmolColour = new CheckboxMenuItem( + MessageManager.getString("action.using_jmol"), false); MenuItem chain = new MenuItem(MessageManager.getString("action.by_chain")); - MenuItem charge = new MenuItem(MessageManager.getString("label.charge_cysteine")); + MenuItem charge = new MenuItem( + MessageManager.getString("label.charge_cysteine")); MenuItem zappo = new MenuItem(MessageManager.getString("label.zappo")); MenuItem taylor = new MenuItem(MessageManager.getString("label.taylor")); - MenuItem hydro = new MenuItem(MessageManager.getString("label.hydrophobicity")); + MenuItem hydro = new MenuItem( + MessageManager.getString("label.hydrophobicity")); - MenuItem helix = new MenuItem(MessageManager.getString("label.helix_propensity")); + MenuItem helix = new MenuItem( + MessageManager.getString("label.helix_propensity")); - MenuItem strand = new MenuItem(MessageManager.getString("label.strand_propensity")); + MenuItem strand = new MenuItem( + MessageManager.getString("label.strand_propensity")); - MenuItem turn = new MenuItem(MessageManager.getString("label.turn_propensity")); + MenuItem turn = new MenuItem( + MessageManager.getString("label.turn_propensity")); - MenuItem buried = new MenuItem(MessageManager.getString("label.buried_index")); + MenuItem buried = new MenuItem( + MessageManager.getString("label.buried_index")); - MenuItem purinepyrimidine = new MenuItem(MessageManager.getString("label.purine_pyrimidine")); + MenuItem purinepyrimidine = new MenuItem( + MessageManager.getString("label.purine_pyrimidine")); - MenuItem user = new MenuItem(MessageManager.getString("label.user_defined_colours")); + MenuItem user = new MenuItem( + MessageManager.getString("label.user_defined_colours")); - MenuItem jmolHelp = new MenuItem(MessageManager.getString("label.jmol_help")); + MenuItem jmolHelp = new MenuItem( + MessageManager.getString("label.jmol_help")); Panel scriptWindow; @@ -400,8 +412,9 @@ public class AppletJmol extends EmbmenuFrame implements .println("Out of memory when trying to create dialog box with sequence-structure mapping."); return; } - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.pdb_sequence_mapping"), - 550, 600); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.pdb_sequence_mapping"), 550, + 600); } else if (evt.getSource() == charge) { @@ -619,7 +632,8 @@ public class AppletJmol extends EmbmenuFrame implements g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.retrieving_pdb_data"), 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.retrieving_pdb_data"), + 20, currentSize.height / 2); } else { diff --git a/src/jalview/appletgui/CutAndPasteTransfer.java b/src/jalview/appletgui/CutAndPasteTransfer.java index f183d10..636dd7f 100644 --- a/src/jalview/appletgui/CutAndPasteTransfer.java +++ b/src/jalview/appletgui/CutAndPasteTransfer.java @@ -157,7 +157,9 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, { // TODO: JAL-1102 - should have a warning message in dialog, not simply // overwrite the broken input data with the exception - textarea.setText(MessageManager.formatMessage("label.could_not_parse_newick_file", new String[]{ex.getMessage()})); + textarea.setText(MessageManager.formatMessage( + "label.could_not_parse_newick_file", new String[] + { ex.getMessage() })); return; } } @@ -178,12 +180,17 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, alignFrame.changeColour(new TCoffeeColourScheme( alignFrame.viewport.getAlignment())); alignFrame.statusBar - .setText(MessageManager.getString("label.successfully_pasted_tcoffee_scores_to_alignment")); + .setText(MessageManager + .getString("label.successfully_pasted_tcoffee_scores_to_alignment")); } else { // file valid but didn't get added to alignment for some reason - alignFrame.statusBar.setText(MessageManager.formatMessage("label.failed_add_tcoffee_scores", new String[]{(tcf.getWarningMessage() != null ? tcf.getWarningMessage() : "")})); + alignFrame.statusBar.setText(MessageManager.formatMessage( + "label.failed_add_tcoffee_scores", + new String[] + { (tcf.getWarningMessage() != null ? tcf + .getWarningMessage() : "") })); } } else @@ -203,7 +210,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, alignFrame.alignPanel.fontChanged(); alignFrame.alignPanel.setScrollValues(0, 0); alignFrame.statusBar - .setText(MessageManager.getString("label.successfully_pasted_annotation_to_alignment")); + .setText(MessageManager + .getString("label.successfully_pasted_annotation_to_alignment")); } else @@ -212,7 +220,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, jalview.io.AppletFormatAdapter.PASTE)) { alignFrame.statusBar - .setText(MessageManager.getString("label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file")); + .setText(MessageManager + .getString("label.couldnt_parse_pasted_text_as_valid_annotation_feature_GFF_tcoffee_file")); } } } @@ -238,13 +247,15 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, { AlignFrame af = new AlignFrame(al, alignFrame.viewport.applet, "Cut & Paste input - " + format, false); - af.statusBar.setText(MessageManager.getString("label.successfully_pasted_annotation_to_alignment")); + af.statusBar + .setText(MessageManager + .getString("label.successfully_pasted_annotation_to_alignment")); } else { alignFrame.addSequences(al.getSequencesArray()); - alignFrame.statusBar - .setText(MessageManager.getString("label.successfully_pasted_alignment_file")); + alignFrame.statusBar.setText(MessageManager + .getString("label.successfully_pasted_alignment_file")); } } } @@ -288,7 +299,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, private void jbInit() throws Exception { textarea.setFont(new java.awt.Font("Monospaced", Font.PLAIN, 10)); - textarea.setText(MessageManager.getString("label.paste_your_alignment_file")); + textarea.setText(MessageManager + .getString("label.paste_your_alignment_file")); textarea.addMouseListener(this); this.setLayout(borderLayout1); accept.addActionListener(this); @@ -303,7 +315,8 @@ public class CutAndPasteTransfer extends Panel implements ActionListener, public void mousePressed(MouseEvent evt) { - if (textarea.getText().startsWith(MessageManager.getString("label.paste_your"))) + if (textarea.getText().startsWith( + MessageManager.getString("label.paste_your"))) { textarea.setText(""); } diff --git a/src/jalview/appletgui/FeatureColourChooser.java b/src/jalview/appletgui/FeatureColourChooser.java index edeb74d..32ffdbf 100644 --- a/src/jalview/appletgui/FeatureColourChooser.java +++ b/src/jalview/appletgui/FeatureColourChooser.java @@ -116,8 +116,9 @@ public class FeatureColourChooser extends Panel implements ActionListener, slider.addAdjustmentListener(this); slider.addMouseListener(this); owner = (af != null) ? af : fs.frame; - frame = new JVDialog(owner, MessageManager.formatMessage("label.graduated_color_for_params", new String[]{type}), - true, 480, 248); + frame = new JVDialog(owner, MessageManager.formatMessage( + "label.graduated_color_for_params", new String[] + { type }), true, 480, 248); frame.setMainPanel(this); validate(); frame.setVisible(true); @@ -147,7 +148,8 @@ public class FeatureColourChooser extends Panel implements ActionListener, private void jbInit() throws Exception { - Label minLabel = new Label(MessageManager.getString("label.min")), maxLabel = new Label(MessageManager.getString("label.max")); + Label minLabel = new Label(MessageManager.getString("label.min")), maxLabel = new Label( + MessageManager.getString("label.max")); minLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); maxLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); // minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); @@ -171,9 +173,12 @@ public class FeatureColourChooser extends Panel implements ActionListener, jPanel2.setBackground(Color.white); jPanel4.setBackground(Color.white); threshold.addItemListener(this); - threshold.addItem(MessageManager.getString("label.threshold_feature_no_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_above_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_below_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); thresholdValue.addActionListener(this); slider.setBackground(Color.white); slider.setEnabled(false); @@ -186,11 +191,13 @@ public class FeatureColourChooser extends Panel implements ActionListener, jPanel3.setBackground(Color.white); colourFromLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); - colourFromLabel.setLabel(MessageManager.getString("label.colour_by_label")); + colourFromLabel.setLabel(MessageManager + .getString("label.colour_by_label")); colourFromLabel.setSize(new Dimension(139, 22)); // threshold.setBounds(new Rectangle(11, 3, 139, 22)); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setLabel(MessageManager.getString("label.threshold_minmax")); + thresholdIsMin.setLabel(MessageManager + .getString("label.threshold_minmax")); thresholdIsMin.setSize(new Dimension(135, 23)); // thresholdIsMin.setBounds(new Rectangle(328, 3, 135, 23)); jPanel1.add(minLabel); @@ -333,11 +340,11 @@ public class FeatureColourChooser extends Panel implements ActionListener, } int aboveThreshold = AnnotationColourGradient.NO_THRESHOLD; - if (threshold.getSelectedIndex()==1) + if (threshold.getSelectedIndex() == 1) { aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; } - else if (threshold.getSelectedIndex()==2) + else if (threshold.getSelectedIndex() == 2) { aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; } diff --git a/src/jalview/appletgui/FeatureSettings.java b/src/jalview/appletgui/FeatureSettings.java index 90d4908..f6e7772 100755 --- a/src/jalview/appletgui/FeatureSettings.java +++ b/src/jalview/appletgui/FeatureSettings.java @@ -150,16 +150,22 @@ public class FeatureSettings extends Panel implements ItemListener, height = Math.max(200, height); height = Math.min(400, height); int width = 300; - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.feature_settings"), width, + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.feature_settings"), width, height); } public void paint(Graphics g) { g.setColor(Color.black); - g.drawString(MessageManager.getString("label.no_features_added_to_this_alignment"), 10, 20); - g.drawString(MessageManager.getString("label.features_can_be_added_from_searches_1"), 10, 40); - g.drawString(MessageManager.getString("label.features_can_be_added_from_searches_2"), 10, 60); + g.drawString(MessageManager + .getString("label.no_features_added_to_this_alignment"), 10, 20); + g.drawString(MessageManager + .getString("label.features_can_be_added_from_searches_1"), 10, + 40); + g.drawString(MessageManager + .getString("label.features_can_be_added_from_searches_2"), 10, + 60); } protected void popupSort(final MyCheckbox check, final Hashtable minmax, @@ -167,8 +173,11 @@ public class FeatureSettings extends Panel implements ItemListener, { final String type = check.type; final Object typeCol = fr.getFeatureStyle(type); - java.awt.PopupMenu men = new PopupMenu(MessageManager.formatMessage("label.settings_for_type", new String[]{type})); - java.awt.MenuItem scr = new MenuItem(MessageManager.getString("label.sort_by_score")); + java.awt.PopupMenu men = new PopupMenu(MessageManager.formatMessage( + "label.settings_for_type", new String[] + { type })); + java.awt.MenuItem scr = new MenuItem( + MessageManager.getString("label.sort_by_score")); men.add(scr); final FeatureSettings me = this; scr.addActionListener(new ActionListener() @@ -181,7 +190,8 @@ public class FeatureSettings extends Panel implements ItemListener, } }); - MenuItem dens = new MenuItem(MessageManager.getString("label.sort_by_density")); + MenuItem dens = new MenuItem( + MessageManager.getString("label.sort_by_density")); dens.addActionListener(new ActionListener() { diff --git a/src/jalview/appletgui/Finder.java b/src/jalview/appletgui/Finder.java index c442225..6ca6ddf 100644 --- a/src/jalview/appletgui/Finder.java +++ b/src/jalview/appletgui/Finder.java @@ -57,7 +57,8 @@ public class Finder extends Panel implements ActionListener this.ap = ap; frame = new Frame(); frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("action.find"), 340, 120); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("action.find"), 340, 120); frame.repaint(); frame.addWindowListener(new WindowAdapter() { @@ -167,7 +168,8 @@ public class Finder extends Panel implements ActionListener // 'SelectRegion' selection if (!haveResults) { - ap.alignFrame.statusBar.setText(MessageManager.getString("label.finished_searching")); + ap.alignFrame.statusBar.setText(MessageManager + .getString("label.finished_searching")); resIndex = -1; seqIndex = 0; } @@ -186,13 +188,17 @@ public class Finder extends Panel implements ActionListener { message += searchResults.getSize() + " subsequence matches."; } - ap.alignFrame.statusBar.setText(MessageManager.formatMessage("label.search_results", new String[] {searchString, message})); + ap.alignFrame.statusBar.setText(MessageManager.formatMessage( + "label.search_results", new String[] + { searchString, message })); } else { // TODO: indicate sequence and matching position in status bar - ap.alignFrame.statusBar.setText(MessageManager.formatMessage("label.found_match_for", new String[]{searchString})); + ap.alignFrame.statusBar.setText(MessageManager.formatMessage( + "label.found_match_for", new String[] + { searchString })); } } } diff --git a/src/jalview/appletgui/FontChooser.java b/src/jalview/appletgui/FontChooser.java index 4e27db6..6bc67b5 100644 --- a/src/jalview/appletgui/FontChooser.java +++ b/src/jalview/appletgui/FontChooser.java @@ -92,7 +92,8 @@ public class FontChooser extends Panel implements ActionListener, Frame frame = new Frame(); this.frame = frame; frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("action.change_font"), 440, 115); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("action.change_font"), 440, 115); init = false; } @@ -189,7 +190,9 @@ public class FontChooser extends Panel implements ActionListener, fontName.select(lastSelected.getName()); fontStyle.select(lastSelStyle); fontSize.select("" + lastSelSize); - JVDialog d = new JVDialog(this.frame, MessageManager.getString("label.invalid_font"), true, 350, 200); + JVDialog d = new JVDialog(this.frame, + MessageManager.getString("label.invalid_font"), true, 350, + 200); Panel mp = new Panel(); d.cancel.setVisible(false); mp.setLayout(new FlowLayout()); diff --git a/src/jalview/appletgui/PCAPanel.java b/src/jalview/appletgui/PCAPanel.java index 3df12be..32f02fe 100644 --- a/src/jalview/appletgui/PCAPanel.java +++ b/src/jalview/appletgui/PCAPanel.java @@ -87,7 +87,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, embedMenuIfNeeded(rc); add(rc, BorderLayout.CENTER); - jalview.bin.JalviewLite.addFrame(this, MessageManager.getString("label.principal_component_analysis"), + jalview.bin.JalviewLite.addFrame(this, + MessageManager.getString("label.principal_component_analysis"), 475, 400); Thread worker = new Thread(this); @@ -221,7 +222,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, CutAndPasteTransfer cap = new CutAndPasteTransfer(false, null); Frame frame = new Frame(); frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.pca_details"), 500, 500); + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.pca_details"), 500, 500); cap.setText(pcaModel.getDetails()); } @@ -329,7 +331,8 @@ public class PCAPanel extends EmbmenuFrame implements Runnable, values.setLabel(MessageManager.getString("label.output_values")); values.addActionListener(this); inputData.setLabel(MessageManager.getString("label.input_data")); - nuclSetting.setLabel(MessageManager.getString("label.nucleotide_matrix")); + nuclSetting.setLabel(MessageManager + .getString("label.nucleotide_matrix")); nuclSetting.addItemListener(this); protSetting.setLabel(MessageManager.getString("label.protein_matrix")); protSetting.addItemListener(this); diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java index d3f7a93..9afc70b 100644 --- a/src/jalview/appletgui/PairwiseAlignPanel.java +++ b/src/jalview/appletgui/PairwiseAlignPanel.java @@ -164,7 +164,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener textarea.setFont(new java.awt.Font("Monospaced", 0, 12)); textarea.setText(""); viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); - viewInEditorButton.setLabel(MessageManager.getString("label.view_alignment_editor")); + viewInEditorButton.setLabel(MessageManager + .getString("label.view_alignment_editor")); viewInEditorButton.addActionListener(this); this.add(scrollPane, BorderLayout.CENTER); scrollPane.add(textarea); diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java index d688261..f5e403f 100644 --- a/src/jalview/appletgui/RedundancyPanel.java +++ b/src/jalview/appletgui/RedundancyPanel.java @@ -53,7 +53,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, applyButton.setVisible(true); allGroupsCheck.setVisible(false); - label.setText(MessageManager.getString("label.enter_redundancy_threshold")); + label.setText(MessageManager + .getString("label.enter_redundancy_threshold")); valueField.setText("100"); slider.setVisibleAmount(1); @@ -72,8 +73,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, frame = new Frame(); frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, - MessageManager.getString("label.redundancy_threshold_selection"), 400, 100); + jalview.bin.JalviewLite.addFrame(frame, MessageManager + .getString("label.redundancy_threshold_selection"), 400, 100); frame.addWindowListener(this); @@ -127,7 +128,8 @@ public class RedundancyPanel extends SliderPanel implements Runnable, redundancy = AlignSeq.computeRedundancyMatrix(originalSequences, omitHidden, start, end, false); - label.setText(MessageManager.getString("label.enter_redundancy_threshold")); + label.setText(MessageManager + .getString("label.enter_redundancy_threshold")); slider.setVisible(true); applyButton.setEnabled(true); valueField.setVisible(true); diff --git a/src/jalview/appletgui/RotatableCanvas.java b/src/jalview/appletgui/RotatableCanvas.java index 1089540..5426321 100755 --- a/src/jalview/appletgui/RotatableCanvas.java +++ b/src/jalview/appletgui/RotatableCanvas.java @@ -319,7 +319,8 @@ public class RotatableCanvas extends Panel implements MouseListener, if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString(MessageManager.getString("label.calculating_pca") + "....", 20, getSize().height / 2); + g.drawString(MessageManager.getString("label.calculating_pca") + + "....", 20, getSize().height / 2); } else { diff --git a/src/jalview/appletgui/ScalePanel.java b/src/jalview/appletgui/ScalePanel.java index d37b494..60d89aa 100755 --- a/src/jalview/appletgui/ScalePanel.java +++ b/src/jalview/appletgui/ScalePanel.java @@ -80,7 +80,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, PopupMenu pop = new PopupMenu(); if (reveal != null) { - MenuItem item = new MenuItem(MessageManager.getString("label.reveal")); + MenuItem item = new MenuItem( + MessageManager.getString("label.reveal")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -119,7 +120,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, } else if (av.getColumnSelection().contains(res)) { - MenuItem item = new MenuItem(MessageManager.getString("label.hide_columns")); + MenuItem item = new MenuItem( + MessageManager.getString("label.hide_columns")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -451,7 +453,8 @@ public class ScalePanel extends Panel implements MouseMotionListener, if (reveal != null && reveal[0] > startx && reveal[0] < endx) { - gg.drawString(MessageManager.getString("label.reveal_columns"), reveal[0] * av.charWidth, 0); + gg.drawString(MessageManager.getString("label.reveal_columns"), + reveal[0] * av.charWidth, 0); } } diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 4550622..5ba22b6 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -345,35 +345,41 @@ public class SeqPanel extends Panel implements MouseMotionListener, keyboardNo1.append(value); } } + int getKeyboardNo1() { - try { - if (keyboardNo1 != null) + try { - int value = Integer.parseInt(keyboardNo1.toString()); - keyboardNo1 = null; - return value; - } + if (keyboardNo1 != null) + { + int value = Integer.parseInt(keyboardNo1.toString()); + keyboardNo1 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo1 = null; return 1; } int getKeyboardNo2() { - try { - if (keyboardNo2!=null){ - int value = Integer.parseInt(keyboardNo2.toString()); - keyboardNo2 = null; - return value; - } + try + { + if (keyboardNo2 != null) + { + int value = Integer.parseInt(keyboardNo2.toString()); + keyboardNo2 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo2 = null; return 1; } - + void setStatusMessage(SequenceI sequence, int res, int seq) { StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " diff --git a/src/jalview/appletgui/SliderPanel.java b/src/jalview/appletgui/SliderPanel.java index 1af2c5d..14fab4e 100644 --- a/src/jalview/appletgui/SliderPanel.java +++ b/src/jalview/appletgui/SliderPanel.java @@ -171,14 +171,16 @@ public class SliderPanel extends Panel implements ActionListener, applyButton.setVisible(false); if (forConservation) { - label.setText(MessageManager.getString("label.modify_conservation_visibility")); + label.setText(MessageManager + .getString("label.modify_conservation_visibility")); slider.setMinimum(0); slider.setMaximum(50 + slider.getVisibleAmount()); slider.setUnitIncrement(1); } else { - label.setText(MessageManager.getString("label.colour_residues_above_occurence")); + label.setText(MessageManager + .getString("label.colour_residues_above_occurence")); slider.setMinimum(0); slider.setMaximum(100 + slider.getVisibleAmount()); slider.setBlockIncrement(1); @@ -318,7 +320,7 @@ public class SliderPanel extends Panel implements ActionListener, slider.setOrientation(0); valueField.setFont(new java.awt.Font("Verdana", 0, 11)); valueField.setText(" "); - valueField.addActionListener(this); + valueField.addActionListener(this); valueField.setColumns(3); label.setFont(new java.awt.Font("Verdana", 0, 11)); label.setText(MessageManager.getString("label.set_this_label_text")); @@ -333,8 +335,10 @@ public class SliderPanel extends Panel implements ActionListener, undoButton.addActionListener(this); allGroupsCheck.setEnabled(false); allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); - allGroupsCheck.setLabel(MessageManager.getString("action.apply_threshold_all_groups")); - allGroupsCheck.setName(MessageManager.getString("action.apply_all_groups")); + allGroupsCheck.setLabel(MessageManager + .getString("action.apply_threshold_all_groups")); + allGroupsCheck.setName(MessageManager + .getString("action.apply_all_groups")); this.setBackground(Color.white); this.setForeground(Color.black); jPanel2.add(label, null); diff --git a/src/jalview/appletgui/TreePanel.java b/src/jalview/appletgui/TreePanel.java index f50c1e8..b7c766a 100644 --- a/src/jalview/appletgui/TreePanel.java +++ b/src/jalview/appletgui/TreePanel.java @@ -358,11 +358,13 @@ public class TreePanel extends EmbmenuFrame implements ActionListener, jMenu2.setLabel(MessageManager.getString("action.view")); fontSize.setLabel(MessageManager.getString("action.font")); fontSize.addActionListener(this); - bootstrapMenu.setLabel(MessageManager.getString("label.show_bootstrap_values")); + bootstrapMenu.setLabel(MessageManager + .getString("label.show_bootstrap_values")); bootstrapMenu.addItemListener(this); distanceMenu.setLabel(MessageManager.getString("label.show_distances")); distanceMenu.addItemListener(this); - placeholdersMenu.setLabel(MessageManager.getString("label.mark_unassociated_leaves")); + placeholdersMenu.setLabel(MessageManager + .getString("label.mark_unassociated_leaves")); placeholdersMenu.addItemListener(this); fitToWindow.setState(true); fitToWindow.setLabel(MessageManager.getString("label.fit_to_window")); diff --git a/src/jalview/appletgui/UserDefinedColours.java b/src/jalview/appletgui/UserDefinedColours.java index a59a772..0b18688 100644 --- a/src/jalview/appletgui/UserDefinedColours.java +++ b/src/jalview/appletgui/UserDefinedColours.java @@ -278,7 +278,8 @@ public class UserDefinedColours extends Panel implements ActionListener, } frame = new Frame(); frame.add(this); - jalview.bin.JalviewLite.addFrame(frame, MessageManager.getString("label.user_defined_colours"), 420, + jalview.bin.JalviewLite.addFrame(frame, + MessageManager.getString("label.user_defined_colours"), 420, 345); if (seqGroup != null) diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index b0e9333..b6d6d3f 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -73,11 +73,11 @@ public class Jalview } }); } + /** * Put protein=true for get a protein example */ - private static boolean protein=false; - + private static boolean protein = false; /** * main class for Jalview application @@ -140,10 +140,11 @@ public class Jalview + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n"); System.exit(0); } - if (aparser.contains("nodisplay") || aparser.contains("nogui") || aparser.contains("headless")) + if (aparser.contains("nodisplay") || aparser.contains("nogui") + || aparser.contains("headless")) { System.setProperty("java.awt.headless", "true"); - headless=true; + headless = true; } Cache.loadProperties(aparser.getValue("props")); // must do this before // anything else! @@ -169,7 +170,8 @@ public class Jalview { headless = true; } - System.setProperty("http.agent", "Jalview Desktop/"+Cache.getDefault("VERSION", "Unknown")); + System.setProperty("http.agent", + "Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown")); try { Cache.initLogger(); @@ -528,15 +530,10 @@ public class Jalview // We'll only open the default file if the desktop is visible. // And the user // //////////////////// - - - - - - if (!headless && file == null && vamsasImport == null - && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) && protein == true) + && jalview.bin.Cache.getDefault("SHOW_STARTUP_FILE", true) + && protein == true) { file = jalview.bin.Cache.getDefault( "STARTUP_FILE", @@ -609,8 +606,7 @@ public class Jalview desktop.setInBatchMode(false); } } - - + private static void startUsageStats(final Desktop desktop) { /** @@ -923,18 +919,21 @@ public class Jalview * */ -class rnabuttonlistener implements ActionListener{ - public void actionPerformed(ActionEvent arg0) { - System.out.println("Good idea ! "); +class rnabuttonlistener implements ActionListener +{ + public void actionPerformed(ActionEvent arg0) + { + System.out.println("Good idea ! "); - } + } } -class pbuttonlistener implements ActionListener{ - public void actionPerformed(ActionEvent arg0) { - - - } +class pbuttonlistener implements ActionListener +{ + public void actionPerformed(ActionEvent arg0) + { + + } } class ArgsParser @@ -1075,7 +1074,5 @@ class FeatureFetcher { return queued == 0 && running == 0; } - - - + }; diff --git a/src/jalview/bin/JalviewLite.java b/src/jalview/bin/JalviewLite.java index 16f95cd..4e02984 100644 --- a/src/jalview/bin/JalviewLite.java +++ b/src/jalview/bin/JalviewLite.java @@ -1482,36 +1482,44 @@ public class JalviewLite extends Applet implements callInitCallback(); } } + private void initLiveConnect() { // try really hard to get the liveConnect thing working - boolean notFailed=false; - int tries=0; - while (!notFailed && tries<10) { - if (tries>0) + boolean notFailed = false; + int tries = 0; + while (!notFailed && tries < 10) + { + if (tries > 0) { System.err.println("LiveConnect request thread going to sleep."); } - try { - Thread.sleep(700*(1+tries)); + try + { + Thread.sleep(700 * (1 + tries)); + } catch (InterruptedException q) + { } - catch (InterruptedException q) {}; - if (tries++>0) + ; + if (tries++ > 0) { System.err.println("LiveConnect request thread woken up."); } - try { + try + { JSObject scriptObject = JSObject.getWindow(this); - if (scriptObject.eval("navigator")!=null) + if (scriptObject.eval("navigator") != null) { - notFailed=true; + notFailed = true; } } catch (JSException jsex) { - System.err.println("Attempt "+tries+" to access LiveConnect javascript failed."); + System.err.println("Attempt " + tries + + " to access LiveConnect javascript failed."); } } } + private void callInitCallback() { String initjscallback = getParameter("oninit"); @@ -1530,7 +1538,7 @@ public class JalviewLite extends Applet implements { } ; - // try really hard to let the browser plugin know we want liveconnect + // try really hard to let the browser plugin know we want liveconnect initLiveConnect(); if (scriptObject != null) @@ -1647,15 +1655,19 @@ public class JalviewLite extends Applet implements g.setColor(Color.cyan); g.fillRect(0, 0, getSize().width, getSize().height); g.setColor(Color.red); - g.drawString(MessageManager.getString("label.jalview_cannot_open_file"), 5, 15); + g.drawString( + MessageManager.getString("label.jalview_cannot_open_file"), + 5, 15); g.drawString("\"" + file + "\"", 5, 30); } else if (embedded) { g.setColor(Color.black); g.setFont(new Font("Arial", Font.BOLD, 24)); - g.drawString(MessageManager.getString("label.jalview_applet"), 50, getSize().height / 2 - 30); - g.drawString(MessageManager.getString("label.loading_data") + "...", 50, getSize().height / 2); + g.drawString(MessageManager.getString("label.jalview_applet"), 50, + getSize().height / 2 - 30); + g.drawString(MessageManager.getString("label.loading_data") + "...", + 50, getSize().height / 2); } } @@ -1862,10 +1874,14 @@ public class JalviewLite extends Applet implements if (protocol == jalview.io.AppletFormatAdapter.PASTE) { - newAlignFrame.setTitle(MessageManager.formatMessage("label.sequences_from", new String[]{applet.getDocumentBase().toString()})); + newAlignFrame.setTitle(MessageManager.formatMessage( + "label.sequences_from", new String[] + { applet.getDocumentBase().toString() })); } - newAlignFrame.statusBar.setText(MessageManager.formatMessage("label.successfully_loaded_file", new String []{file})); + newAlignFrame.statusBar.setText(MessageManager.formatMessage( + "label.successfully_loaded_file", new String[] + { file })); String treeFile = applet.getParameter("tree"); if (treeFile == null) diff --git a/src/jalview/controller/AlignViewController.java b/src/jalview/controller/AlignViewController.java index 74161c8..077f9cd 100644 --- a/src/jalview/controller/AlignViewController.java +++ b/src/jalview/controller/AlignViewController.java @@ -38,33 +38,40 @@ import jalview.datamodel.SequenceI; public class AlignViewController implements AlignViewControllerI { - AlignViewportI viewport=null; - AlignmentViewPanel alignPanel=null; + AlignViewportI viewport = null; + + AlignmentViewPanel alignPanel = null; + /** * the GUI container that is handling interactions with the user */ private AlignViewControllerGuiI avcg; + @Override - protected void finalize() throws Throwable { + protected void finalize() throws Throwable + { viewport = null; alignPanel = null; avcg = null; }; - - public AlignViewController(AlignViewControllerGuiI alignFrame, AlignViewportI viewport, - AlignmentViewPanel alignPanel) + + public AlignViewController(AlignViewControllerGuiI alignFrame, + AlignViewportI viewport, AlignmentViewPanel alignPanel) { this.avcg = alignFrame; - this.viewport=viewport; + this.viewport = viewport; this.alignPanel = alignPanel; } + @Override - public void setViewportAndAlignmentPanel(AlignViewportI viewport,AlignmentViewPanel alignPanel) + public void setViewportAndAlignmentPanel(AlignViewportI viewport, + AlignmentViewPanel alignPanel) { this.alignPanel = alignPanel; this.viewport = viewport; - + } + @Override public boolean makeGroupsFromSelection() { @@ -94,53 +101,59 @@ public class AlignViewController implements AlignViewControllerI return true; } return false; -} + } + @Override public boolean createGroup() { SequenceGroup sg = viewport.getSelectionGroup(); - if (sg!=null) + if (sg != null) { - viewport.getAlignment().addGroup(sg); - return true; - } + viewport.getAlignment().addGroup(sg); + return true; + } return false; } + @Override public boolean unGroup() { SequenceGroup sg = viewport.getSelectionGroup(); - if (sg!=null) + if (sg != null) { - viewport.getAlignment().deleteGroup(sg); - return true; + viewport.getAlignment().deleteGroup(sg); + return true; } return false; } + @Override public boolean deleteGroups() { - if (viewport.getAlignment().getGroups()!=null && viewport.getAlignment().getGroups().size()>0) + if (viewport.getAlignment().getGroups() != null + && viewport.getAlignment().getGroups().size() > 0) { - viewport.getAlignment().deleteAllGroups(); - viewport.clearSequenceColours(); - viewport.setSelectionGroup(null); - return true; + viewport.getAlignment().deleteAllGroups(); + viewport.clearSequenceColours(); + viewport.setSelectionGroup(null); + return true; } return false; } - + @Override - public boolean markColumnsContainingFeatures(boolean invert, boolean extendCurrent, boolean toggle, String featureType) + public boolean markColumnsContainingFeatures(boolean invert, + boolean extendCurrent, boolean toggle, String featureType) { // JBPNote this routine could also mark rows, not just columns. // need a decent query structure to allow all types of feature searches BitSet bs = new BitSet(); - int alw,alStart; - SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null ? viewport.getAlignment() : viewport.getSelectionGroup()); + int alw, alStart; + SequenceCollectionI sqcol = (viewport.getSelectionGroup() == null ? viewport + .getAlignment() : viewport.getSelectionGroup()); alStart = sqcol.getStartRes(); - alw = sqcol.getEndRes()+1; + alw = sqcol.getEndRes() + 1; List seqs = sqcol.getSequences(); int nseq = 0; for (SequenceI sq : seqs) @@ -159,7 +172,7 @@ public class AlignViewController implements AlignViewControllerI { int ist = sq.findIndex(sq.getStart()); int iend = sq.findIndex(sq.getEnd()); - if (iend < alStart || ist> alw) + if (iend < alStart || ist > alw) { // sequence not in region continue; @@ -177,7 +190,7 @@ public class AlignViewController implements AlignViewControllerI int i = sq.findIndex(sfpos.getBegin()); int j = sq.findIndex(sfpos.getEnd()); - if (jalw) + if (j < alStart || i > alw) { // feature is outside selected region continue; @@ -186,7 +199,8 @@ public class AlignViewController implements AlignViewControllerI { i = alStart; } - if (i< ist) { + if (i < ist) + { i = ist; } if (j > alw) @@ -213,7 +227,9 @@ public class AlignViewController implements AlignViewControllerI if (cs == null) { cs = new ColumnSelection(); - } else { + } + else + { if (!extendCurrent) { cs.clear(); @@ -228,12 +244,13 @@ public class AlignViewController implements AlignViewControllerI if (ibs < 0 || i < ibs) { if (toggle && cs.contains(i)) - { - cs.removeElement(i++); - } else - { - cs.addElement(i++); - } + { + cs.removeElement(i++); + } + else + { + cs.addElement(i++); + } } else { @@ -244,12 +261,14 @@ public class AlignViewController implements AlignViewControllerI } else { - for (int i = bs.nextSetBit(alStart); i >= alStart; i = bs.nextSetBit(i + 1)) + for (int i = bs.nextSetBit(alStart); i >= alStart; i = bs + .nextSetBit(i + 1)) { if (toggle && cs.contains(i)) { cs.removeElement(i); - } else + } + else { cs.addElement(i); } @@ -257,16 +276,17 @@ public class AlignViewController implements AlignViewControllerI } viewport.setColumnSelection(cs); alignPanel.paintAlignment(true); - avcg.setStatus((toggle ? "Toggled ": "Marked ") - + (invert ? (alw-alStart) - bs.cardinality() : bs.cardinality()) - + " columns "+(invert ? "not " : "") + "containing features of type " + featureType - + " across " + nseq + " sequence(s)"); + avcg.setStatus((toggle ? "Toggled " : "Marked ") + + (invert ? (alw - alStart) - bs.cardinality() : bs + .cardinality()) + " columns " + + (invert ? "not " : "") + "containing features of type " + + featureType + " across " + nseq + " sequence(s)"); return true; } else { avcg.setStatus("No features of type " + featureType + " found."); - if (!extendCurrent && cs!=null) + if (!extendCurrent && cs != null) { cs.clear(); alignPanel.paintAlignment(true); diff --git a/src/jalview/datamodel/AlignedCodonFrame.java b/src/jalview/datamodel/AlignedCodonFrame.java index 4bff3a7..3fc08d1 100644 --- a/src/jalview/datamodel/AlignedCodonFrame.java +++ b/src/jalview/datamodel/AlignedCodonFrame.java @@ -123,7 +123,8 @@ public class AlignedCodonFrame if (aspos < aaWidth) { aaWidth++; - System.arraycopy(codons, aspos, codons, aspos + 1, codons.length - aspos - 1); + System.arraycopy(codons, aspos, codons, aspos + 1, codons.length + - aspos - 1); codons[aspos] = null; // clear so new codon position can be marked. } } diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 62de7e8..ad7cdd2 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -448,7 +448,8 @@ public class Alignment implements AlignmentI { removeAnnotationForGroup(null); } - for (SequenceGroup sg:groups) { + for (SequenceGroup sg : groups) + { sg.setContext(null); } groups.clear(); @@ -1486,32 +1487,38 @@ public class Alignment implements AlignmentI } } - @Override - public void validateAnnotation(AlignmentAnnotation alignmentAnnotation) - { - alignmentAnnotation.validateRangeAndDisplay(); - if (isNucleotide() && alignmentAnnotation.isValidStruc()) - { - hasRNAStructure = true; - } - } - @Override -public int getEndRes() -{ - return getWidth()-1; -}@Override -public int getStartRes() -{ - return 0; -} -/* In the case of AlignmentI - returns the dataset for the alignment, if set - * (non-Javadoc) - * @see jalview.datamodel.AnnotatedCollectionI#getContext() - */ -@Override -public AnnotatedCollectionI getContext() -{ - return dataset; -} + @Override + public void validateAnnotation(AlignmentAnnotation alignmentAnnotation) + { + alignmentAnnotation.validateRangeAndDisplay(); + if (isNucleotide() && alignmentAnnotation.isValidStruc()) + { + hasRNAStructure = true; + } + } + + @Override + public int getEndRes() + { + return getWidth() - 1; + } + + @Override + public int getStartRes() + { + return 0; + } + + /* + * In the case of AlignmentI - returns the dataset for the alignment, if set + * (non-Javadoc) + * + * @see jalview.datamodel.AnnotatedCollectionI#getContext() + */ + @Override + public AnnotatedCollectionI getContext() + { + return dataset; + } } diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 4c6e2a5..989d62a 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -57,10 +57,9 @@ public class AlignmentAnnotation /** DOCUMENT ME!! */ public Annotation[] annotations; - - - public ArrayList bps=null; + public ArrayList bps = null; + /** * RNA secondary structure contact positions */ @@ -79,15 +78,15 @@ public class AlignmentAnnotation */ private void _updateRnaSecStr(CharSequence RNAannot) { - try { - _rnasecstr = Rna.GetBasePairs(RNAannot); - bps = Rna.GetModeleBP(RNAannot); - invalidrnastruc=-1; - } - catch (WUSSParseException px) + try + { + _rnasecstr = Rna.GetBasePairs(RNAannot); + bps = Rna.GetModeleBP(RNAannot); + invalidrnastruc = -1; + } catch (WUSSParseException px) { // DEBUG System.out.println(px); - invalidrnastruc=px.getProblemPos(); + invalidrnastruc = px.getProblemPos(); } if (invalidrnastruc > -1) { @@ -205,11 +204,13 @@ public class AlignmentAnnotation return NO_GRAPH; } } - // JBPNote: what does this do ? + + // JBPNote: what does this do ? public void ConcenStru(CharSequence RNAannot) throws WUSSParseException { - bps = Rna.GetModeleBP(RNAannot); + bps = Rna.GetModeleBP(RNAannot); } + /** * Creates a new AlignmentAnnotation object. * @@ -257,37 +258,37 @@ public class AlignmentAnnotation else // Check for RNA secondary structure { - //System.out.println(annotations[i].secondaryStructure); + // System.out.println(annotations[i].secondaryStructure); if (annotations[i].secondaryStructure == '(' - || annotations[i].secondaryStructure == '[' - || annotations[i].secondaryStructure == '<' - || annotations[i].secondaryStructure == '{' - || annotations[i].secondaryStructure == 'A' - || annotations[i].secondaryStructure == 'B' - || annotations[i].secondaryStructure == 'C' - || annotations[i].secondaryStructure == 'D' - || annotations[i].secondaryStructure == 'E' - || annotations[i].secondaryStructure == 'F' - || annotations[i].secondaryStructure == 'G' - || annotations[i].secondaryStructure == 'H' - || annotations[i].secondaryStructure == 'I' - || annotations[i].secondaryStructure == 'J' - || annotations[i].secondaryStructure == 'K' - || annotations[i].secondaryStructure == 'L' - || annotations[i].secondaryStructure == 'M' - || annotations[i].secondaryStructure == 'N' - || annotations[i].secondaryStructure == 'O' - || annotations[i].secondaryStructure == 'P' - || annotations[i].secondaryStructure == 'Q' - || annotations[i].secondaryStructure == 'R' - || annotations[i].secondaryStructure == 'S' - || annotations[i].secondaryStructure == 'T' - || annotations[i].secondaryStructure == 'U' - || annotations[i].secondaryStructure == 'V' - || annotations[i].secondaryStructure == 'W' - || annotations[i].secondaryStructure == 'X' - || annotations[i].secondaryStructure == 'Y' - || annotations[i].secondaryStructure == 'Z') + || annotations[i].secondaryStructure == '[' + || annotations[i].secondaryStructure == '<' + || annotations[i].secondaryStructure == '{' + || annotations[i].secondaryStructure == 'A' + || annotations[i].secondaryStructure == 'B' + || annotations[i].secondaryStructure == 'C' + || annotations[i].secondaryStructure == 'D' + || annotations[i].secondaryStructure == 'E' + || annotations[i].secondaryStructure == 'F' + || annotations[i].secondaryStructure == 'G' + || annotations[i].secondaryStructure == 'H' + || annotations[i].secondaryStructure == 'I' + || annotations[i].secondaryStructure == 'J' + || annotations[i].secondaryStructure == 'K' + || annotations[i].secondaryStructure == 'L' + || annotations[i].secondaryStructure == 'M' + || annotations[i].secondaryStructure == 'N' + || annotations[i].secondaryStructure == 'O' + || annotations[i].secondaryStructure == 'P' + || annotations[i].secondaryStructure == 'Q' + || annotations[i].secondaryStructure == 'R' + || annotations[i].secondaryStructure == 'S' + || annotations[i].secondaryStructure == 'T' + || annotations[i].secondaryStructure == 'U' + || annotations[i].secondaryStructure == 'V' + || annotations[i].secondaryStructure == 'W' + || annotations[i].secondaryStructure == 'X' + || annotations[i].secondaryStructure == 'Y' + || annotations[i].secondaryStructure == 'Z') { hasIcons |= true; isrna |= true; @@ -319,7 +320,9 @@ public class AlignmentAnnotation // annotations[i].displayCharacter.charAt(0)==annotations[i].secondaryStructure firstChar != ' ' && firstChar != '$' - && firstChar != '�' // JBPNote should explicitly express as unicode number to avoid source code translation problems + && firstChar != '�' // JBPNote should explicitly express as + // unicode number to avoid source code + // translation problems && firstChar != '(' && firstChar != '[' && firstChar != '>' @@ -1049,7 +1052,7 @@ public class AlignmentAnnotation { if (annotations[i] == null) annotations[i] = new Annotation(String.valueOf(gapchar), null, - ' ', 0f,null); + ' ', 0f, null); else if (annotations[i].displayCharacter == null || annotations[i].displayCharacter.equals(" ")) annotations[i].displayCharacter = String.valueOf(gapchar); diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index a30e678..d141697 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -474,7 +474,9 @@ public interface AlignmentI extends AnnotatedCollectionI Map map, boolean up); /** - * validate annotation after an edit and update any alignment state flags accordingly + * validate annotation after an edit and update any alignment state flags + * accordingly + * * @param alignmentAnnotation */ public void validateAnnotation(AlignmentAnnotation alignmentAnnotation); diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java index b61420c..6c4cfae 100644 --- a/src/jalview/datamodel/AlignmentView.java +++ b/src/jalview/datamodel/AlignmentView.java @@ -48,9 +48,11 @@ public class AlignmentView */ private Vector scGroups; - private boolean isNa=false; + private boolean isNa = false; + /** * false if the view concerns peptides + * * @return */ public boolean isNa() diff --git a/src/jalview/datamodel/AnnotatedCollectionI.java b/src/jalview/datamodel/AnnotatedCollectionI.java index abe9332..0b4c117 100644 --- a/src/jalview/datamodel/AnnotatedCollectionI.java +++ b/src/jalview/datamodel/AnnotatedCollectionI.java @@ -35,7 +35,9 @@ public interface AnnotatedCollectionI extends SequenceCollectionI /** * context for this annotated collection - * @return null or the collection upon which this collection is defined (e.g. alignment, parent group). + * + * @return null or the collection upon which this collection is defined (e.g. + * alignment, parent group). */ AnnotatedCollectionI getContext(); } diff --git a/src/jalview/datamodel/Annotation.java b/src/jalview/datamodel/Annotation.java index e3588b0..26dc0fa 100755 --- a/src/jalview/datamodel/Annotation.java +++ b/src/jalview/datamodel/Annotation.java @@ -47,7 +47,7 @@ public class Annotation /** Score for the position - used in histograms, line graphs and for shading */ public float value; - + /** Colour for position */ public Color colour; @@ -69,7 +69,7 @@ public class Annotation description = desc; secondaryStructure = ss; value = val; - + } /** @@ -124,15 +124,15 @@ public class Annotation */ public Annotation(float val) { - this(null, null, ' ', val,null); + this(null, null, ' ', val, null); } /** * human readable representation of an annotation row element. - * + * * Format is 'display Char','secondary Structure * Char',"description",score,[colourstring] - * + * * fields may be missing if they are null, whitespace, or equivalent to * Float.NaN */ diff --git a/src/jalview/datamodel/GraphLine.java b/src/jalview/datamodel/GraphLine.java index 375fbea..aab55a1 100755 --- a/src/jalview/datamodel/GraphLine.java +++ b/src/jalview/datamodel/GraphLine.java @@ -54,10 +54,11 @@ public class GraphLine displayed = from.displayed; } } + @Override public boolean equals(Object obj) { - if (obj!=null && obj instanceof GraphLine) + if (obj != null && obj instanceof GraphLine) { GraphLine other = (GraphLine) obj; return displayed == other.displayed diff --git a/src/jalview/datamodel/SecondaryStructureAnnotation.java b/src/jalview/datamodel/SecondaryStructureAnnotation.java index 8c249cc..13f31d8 100644 --- a/src/jalview/datamodel/SecondaryStructureAnnotation.java +++ b/src/jalview/datamodel/SecondaryStructureAnnotation.java @@ -24,28 +24,29 @@ import fr.orsay.lri.varna.models.rna.RNA; public class SecondaryStructureAnnotation extends AlignmentAnnotation { - - private static RNA _rna = null; - public SecondaryStructureAnnotation (RNA rna) - { - super("Secondary Structure", "Un truc trop cool",getAnnotation(rna)); - - - _rna = rna; - } - - public RNA getRNA() - { - return _rna; - } - public static Annotation[] getAnnotation(RNA rna) - { - Annotation[] ann = new Annotation[rna.getSize()]; - for(int i=0;i getRNAMLForPDBFileAsString(String pdbfile) throws Exception { @@ -131,81 +134,106 @@ public class Annotate3D vals.add(new BasicNameValuePair("tool", "rnaview")); vals.add(new BasicNameValuePair("data", pdbfile)); vals.add(new BasicNameValuePair("output", "rnaml")); - // return processJsonResponseFor(HttpClientUtils.doHttpUrlPost(twoDtoolsURL, vals)); + // return processJsonResponseFor(HttpClientUtils.doHttpUrlPost(twoDtoolsURL, + // vals)); ArrayList readers = new ArrayList(); readers.add(HttpClientUtils.doHttpUrlPost(twoDtoolsURL, vals)); return readers.iterator(); } - public static Iterator processJsonResponseFor(Reader respons) throws Exception + + public static Iterator processJsonResponseFor(Reader respons) + throws Exception { org.json.simple.parser.JSONParser jp = new org.json.simple.parser.JSONParser(); - try { + try + { final JSONArray responses = (JSONArray) jp.parse(respons); final Iterator rvals = responses.iterator(); - return new Iterator() + return new Iterator() + { + @Override + public boolean hasNext() { - @Override - public boolean hasNext() - { - return rvals.hasNext(); - } - @Override - public Reader next() - { - JSONObject val=(JSONObject) rvals.next(); - - Object sval = null; - try { - sval = val.get("2D"); - } catch (Exception x) {x.printStackTrace();}; - if (sval==null) - { - System.err.println("DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :"+val.toString()); - - sval = ""; - } - return new StringReader((sval instanceof JSONObject) ? ((JSONObject)sval).toString():sval.toString()); - - }@Override - public void remove() + return rvals.hasNext(); + } + + @Override + public Reader next() + { + JSONObject val = (JSONObject) rvals.next(); + + Object sval = null; + try { - throw new Error("Remove: Not implemented"); - - }@Override - protected Object clone() throws CloneNotSupportedException + sval = val.get("2D"); + } catch (Exception x) { - throw new CloneNotSupportedException("Clone: Not implemented"); - }@Override - public boolean equals(Object obj) + x.printStackTrace(); + } + ; + if (sval == null) { - return super.equals(obj); - }@Override - protected void finalize() throws Throwable + System.err + .println("DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :" + + val.toString()); + + sval = ""; + } + return new StringReader( + (sval instanceof JSONObject) ? ((JSONObject) sval) + .toString() : sval.toString()); + + } + + @Override + public void remove() + { + throw new Error("Remove: Not implemented"); + + } + + @Override + protected Object clone() throws CloneNotSupportedException + { + throw new CloneNotSupportedException("Clone: Not implemented"); + } + + @Override + public boolean equals(Object obj) + { + return super.equals(obj); + } + + @Override + protected void finalize() throws Throwable + { + while (rvals.hasNext()) { - while (rvals.hasNext()) - { - rvals.next(); - } - super.finalize(); + rvals.next(); } - }; + super.finalize(); + } + }; } catch (Exception foo) { - throw new Exception("Couldn't parse response from Annotate3d server.",foo); + throw new Exception( + "Couldn't parse response from Annotate3d server.", foo); } - - + } - public static Iterator getRNAMLForPDBId(String pdbid) throws Exception + public static Iterator getRNAMLForPDBId(String pdbid) + throws Exception { List vals = new ArrayList(); vals.add(new BasicNameValuePair("tool", "rnaview")); vals.add(new BasicNameValuePair("pdbid", pdbid)); vals.add(new BasicNameValuePair("output", "rnaml")); - java.net.URL geturl = new URL(twoDtoolsURL+"?tool=rnaview&pdbid="+pdbid+"&output=rnaml"); - //return processJsonResponseFor(new InputStreamReader(geturl.openStream())); + java.net.URL geturl = new URL(twoDtoolsURL + "?tool=rnaview&pdbid=" + + pdbid + "&output=rnaml"); + // return processJsonResponseFor(new + // InputStreamReader(geturl.openStream())); ArrayList readers = new ArrayList(); readers.add(new InputStreamReader(geturl.openStream())); return readers.iterator(); diff --git a/src/jalview/ext/varna/JalviewVarnaBinding.java b/src/jalview/ext/varna/JalviewVarnaBinding.java index fa2f44b..9e9434c 100644 --- a/src/jalview/ext/varna/JalviewVarnaBinding.java +++ b/src/jalview/ext/varna/JalviewVarnaBinding.java @@ -19,6 +19,7 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.ext.varna; + import java.awt.event.*; import jalview.api.SequenceStructureBinding; diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 92316b3..bf9888c 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -153,9 +153,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public AlignmentPanel alignPanel; AlignViewport viewport; - + public AlignViewControllerI avc; - Vector alignPanels = new Vector(); @@ -299,7 +298,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, */ void init() { - avc = new jalview.controller.AlignViewController(this, viewport, alignPanel); + avc = new jalview.controller.AlignViewController(this, viewport, + alignPanel); if (viewport.getAlignmentConservationAnnotation() == null) { BLOSUM62Colour.setEnabled(false); @@ -343,7 +343,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } addKeyListener(); - + } /** @@ -489,7 +489,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, case KeyEvent.VK_F2: viewport.cursorMode = !viewport.cursorMode; - statusBar.setText(MessageManager.formatMessage("label.keyboard_editing_mode", new String[]{(viewport.cursorMode ? "on" : "off")})); + statusBar.setText(MessageManager.formatMessage( + "label.keyboard_editing_mode", new String[] + { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; @@ -570,7 +572,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, public void addAlignmentPanel(final AlignmentPanel ap, boolean newPanel) { ap.alignFrame = this; - avc = new jalview.controller.AlignViewController(this, viewport, alignPanel); + avc = new jalview.controller.AlignViewController(this, viewport, + alignPanel); alignPanels.addElement(ap); @@ -821,7 +824,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton(MessageManager.getString("action.cancel")); + JButton cancel = new JButton( + MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { @@ -855,9 +859,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } @Override - public void setStatus(String text) { + public void setStatus(String text) + { statusBar.setText(text); }; + /* * Added so Castor Mapping file can obtain Jalview Version */ @@ -1004,9 +1010,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, currentFileFormat = chooser.getSelectedFormat(); if (currentFileFormat == null) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.select_file_format_before_saving"), - MessageManager.getString("label.file_format_not_specified"), JOptionPane.WARNING_MESSAGE); + JOptionPane + .showInternalMessageDialog( + Desktop.desktop, + MessageManager + .getString("label.select_file_format_before_saving"), + MessageManager + .getString("label.file_format_not_specified"), + JOptionPane.WARNING_MESSAGE); value = chooser.showSaveDialog(this); return; } @@ -1042,8 +1053,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, success = new Jalview2XML().SaveAlignment(this, file, shortName); - statusBar.setText(MessageManager.formatMessage("label.successfully_saved_to_file_in_format",new String[]{fileName, format})); - + statusBar.setText(MessageManager.formatMessage( + "label.successfully_saved_to_file_in_format", new String[] + { fileName, format })); } else @@ -1064,8 +1076,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int reply = JOptionPane .showInternalConfirmDialog( Desktop.desktop, - MessageManager.getString("label.alignment_contains_hidden_columns"), - MessageManager.getString("action.save_omit_hidden_columns"), + MessageManager + .getString("label.alignment_contains_hidden_columns"), + MessageManager + .getString("action.save_omit_hidden_columns"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -1095,7 +1109,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, out.print(output); out.close(); this.setTitle(file); - statusBar.setText(MessageManager.formatMessage("label.successfully_saved_to_file_in_format",new String[]{fileName, format})); + statusBar.setText(MessageManager.formatMessage( + "label.successfully_saved_to_file_in_format", + new String[] + { fileName, format })); } catch (Exception ex) { success = false; @@ -1106,8 +1123,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (!success) { - JOptionPane.showInternalMessageDialog(this, MessageManager.formatMessage("label.couldnt_save_file", new String[]{fileName}), - MessageManager.getString("label.error_saving_file"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(this, MessageManager + .formatMessage("label.couldnt_save_file", new String[] + { fileName }), MessageManager + .getString("label.error_saving_file"), + JOptionPane.WARNING_MESSAGE); } return success; @@ -1144,8 +1164,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int reply = JOptionPane .showInternalConfirmDialog( Desktop.desktop, - MessageManager.getString("label.alignment_contains_hidden_columns"), - MessageManager.getString("action.save_omit_hidden_columns"), + MessageManager + .getString("label.alignment_contains_hidden_columns"), + MessageManager + .getString("action.save_omit_hidden_columns"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); @@ -1163,8 +1185,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, cap.setText(new FormatAdapter().formatSequences(e.getActionCommand(), viewport.getAlignment(), omitHidden, viewport.getColumnSelection())); - Desktop.addInternalFrame(cap, - MessageManager.formatMessage("label.alignment_output_command", new String[]{e.getActionCommand()}), 600, 500); + Desktop.addInternalFrame(cap, MessageManager.formatMessage( + "label.alignment_output_command", new String[] + { e.getActionCommand() }), 600, 500); } catch (OutOfMemoryError oom) { new OOMWarning("Outputting alignment as " + e.getActionCommand(), oom); @@ -1260,8 +1283,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager.getString("label.load_jalview_annotations")); - chooser.setToolTipText(MessageManager.getString("label.load_jalview_annotations")); + chooser.setDialogTitle(MessageManager + .getString("label.load_jalview_annotations")); + chooser.setToolTipText(MessageManager + .getString("label.load_jalview_annotations")); int value = chooser.showOpenDialog(null); @@ -1361,7 +1386,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { undoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.historyList.peek(); - undoMenuItem.setText(MessageManager.formatMessage("label.undo_command", new String[]{command.getDescription()})); + undoMenuItem.setText(MessageManager.formatMessage( + "label.undo_command", new String[] + { command.getDescription() })); } else { @@ -1374,7 +1401,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, redoMenuItem.setEnabled(true); CommandI command = (CommandI) viewport.redoList.peek(); - redoMenuItem.setText(MessageManager.formatMessage("label.redo_command", new String[]{command.getDescription()})); + redoMenuItem.setText(MessageManager.formatMessage( + "label.redo_command", new String[] + { command.getDescription() })); } else { @@ -1707,7 +1736,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, Desktop.jalviewClipboard = new Object[] { seqs, viewport.getAlignment().getDataset(), hiddenColumns }; - statusBar.setText(MessageManager.formatMessage("label.copied_sequences_to_clipboard", new String[]{Integer.valueOf(seqs.length).toString()})); + statusBar.setText(MessageManager.formatMessage( + "label.copied_sequences_to_clipboard", new String[] + { Integer.valueOf(seqs.length).toString() })); } /** @@ -2065,59 +2096,61 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } } + @Override protected void expand_newalign(ActionEvent e) { - try { - AlignmentI alignment = AlignmentUtils.expandContext(getViewport().getAlignment(), -1); - AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, - DEFAULT_HEIGHT); - String newtitle = new String("Flanking alignment"); - - if (Desktop.jalviewClipboard != null - && Desktop.jalviewClipboard[2] != null) + try { - Vector hc = (Vector) Desktop.jalviewClipboard[2]; - for (int i = 0; i < hc.size(); i++) + AlignmentI alignment = AlignmentUtils.expandContext(getViewport() + .getAlignment(), -1); + AlignFrame af = new AlignFrame(alignment, DEFAULT_WIDTH, + DEFAULT_HEIGHT); + String newtitle = new String("Flanking alignment"); + + if (Desktop.jalviewClipboard != null + && Desktop.jalviewClipboard[2] != null) { - int[] region = (int[]) hc.elementAt(i); - af.viewport.hideColumns(region[0], region[1]); + Vector hc = (Vector) Desktop.jalviewClipboard[2]; + for (int i = 0; i < hc.size(); i++) + { + int[] region = (int[]) hc.elementAt(i); + af.viewport.hideColumns(region[0], region[1]); + } } - } - // >>>This is a fix for the moment, until a better solution is - // found!!<<< - af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer() - .transferSettings( - alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); + // >>>This is a fix for the moment, until a better solution is + // found!!<<< + af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer() + .transferSettings( + alignPanel.seqPanel.seqCanvas.getFeatureRenderer()); - // TODO: maintain provenance of an alignment, rather than just make the - // title a concatenation of operations. - { - if (title.startsWith("Copied sequences")) - { - newtitle = title; - } - else + // TODO: maintain provenance of an alignment, rather than just make the + // title a concatenation of operations. { - newtitle = newtitle.concat("- from " + title); + if (title.startsWith("Copied sequences")) + { + newtitle = title; + } + else + { + newtitle = newtitle.concat("- from " + title); + } } - } - Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, - DEFAULT_HEIGHT); + Desktop.addInternalFrame(af, newtitle, DEFAULT_WIDTH, DEFAULT_HEIGHT); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Exception whilst pasting: " + ex); // could be anything being pasted in here - } - catch (OutOfMemoryError oom) + } catch (OutOfMemoryError oom) { new OOMWarning("Viewing flanking region of alignment", oom); } } + /** * DOCUMENT ME! * @@ -2201,7 +2234,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void deleteGroups_actionPerformed(ActionEvent e) { - if (avc.deleteGroups()) { + if (avc.deleteGroups()) + { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); alignPanel.paintAlignment(true); @@ -2359,7 +2393,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.getSelectionGroup()); } - statusBar.setText(MessageManager.formatMessage("label.removed_columns", new String[]{Integer.valueOf(trimRegion.getSize()).toString()})); + statusBar.setText(MessageManager.formatMessage( + "label.removed_columns", new String[] + { Integer.valueOf(trimRegion.getSize()).toString() })); addHistoryItem(trimRegion); @@ -2407,7 +2443,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addHistoryItem(removeGapCols); - statusBar.setText(MessageManager.formatMessage("label.removed_empty_columns", new String[]{Integer.valueOf(removeGapCols.getSize()).toString()})); + statusBar.setText(MessageManager.formatMessage( + "label.removed_empty_columns", new String[] + { Integer.valueOf(removeGapCols.getSize()).toString() })); // This is to maintain viewport position on first residue // of first sequence @@ -2602,7 +2640,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, addAlignmentPanel(newap, true); newap.alignmentChanged(); - + if (alignPanels.size() == 2) { viewport.gatherViewsHere = true; @@ -3016,11 +3054,15 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, editPane.setEditable(false); StringBuffer contents = new AlignmentProperties(viewport.getAlignment()) .formatAsHtml(); - editPane.setText(MessageManager.formatMessage("label.html_content", new String[]{contents.toString()})); + editPane.setText(MessageManager.formatMessage("label.html_content", + new String[] + { contents.toString() })); JInternalFrame frame = new JInternalFrame(); frame.getContentPane().add(new JScrollPane(editPane)); - Desktop.instance.addInternalFrame(frame, MessageManager.formatMessage("label.alignment_properties", new String[]{getTitle()}), 500, 400); + Desktop.instance.addInternalFrame(frame, MessageManager.formatMessage( + "label.alignment_properties", new String[] + { getTitle() }), 500, 400); } /** @@ -3040,8 +3082,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JInternalFrame frame = new JInternalFrame(); OverviewPanel overview = new OverviewPanel(alignPanel); frame.setContentPane(overview); - Desktop.addInternalFrame(frame, MessageManager.formatMessage("label.overview_params", new String[]{this.getTitle()}), - frame.getWidth(), frame.getHeight()); + Desktop.addInternalFrame(frame, MessageManager.formatMessage( + "label.overview_params", new String[] + { this.getTitle() }), frame.getWidth(), frame.getHeight()); frame.pack(); frame.setLayer(JLayeredPane.PALETTE_LAYER); frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() @@ -3423,7 +3466,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void userDefinedColour_actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals(MessageManager.getString("action.user_defined"))) + if (e.getActionCommand().equals( + MessageManager.getString("action.user_defined"))) { new UserDefinedColours(alignPanel, null); } @@ -3472,8 +3516,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, int option = JOptionPane.showInternalConfirmDialog( jalview.gui.Desktop.desktop, - MessageManager.getString("label.remove_from_default_list"), - MessageManager.getString("label.remove_user_defined_colour"), + MessageManager + .getString("label.remove_from_default_list"), + MessageManager + .getString("label.remove_user_defined_colour"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { @@ -3624,15 +3670,18 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if ((viewport.getSelectionGroup() == null) || (viewport.getSelectionGroup().getSize() < 2)) { - JOptionPane.showInternalMessageDialog(this, - MessageManager.getString("label.you_must_select_least_two_sequences"), MessageManager.getString("label.invalid_selection"), + JOptionPane.showInternalMessageDialog(this, MessageManager + .getString("label.you_must_select_least_two_sequences"), + MessageManager.getString("label.invalid_selection"), JOptionPane.WARNING_MESSAGE); } else { JInternalFrame frame = new JInternalFrame(); frame.setContentPane(new PairwiseAlignPanel(viewport)); - Desktop.addInternalFrame(frame, MessageManager.getString("action.pairwise_alignment"), 600, 500); + Desktop.addInternalFrame(frame, + MessageManager.getString("action.pairwise_alignment"), 600, + 500); } } @@ -3650,10 +3699,14 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .getSelectionGroup().getSize() > 0)) || (viewport.getAlignment().getHeight() < 4)) { - JOptionPane.showInternalMessageDialog(this, - MessageManager.getString("label.principal_component_analysis_must_take_least_four_input_sequences"), - MessageManager.getString("label.sequence_selection_insufficient"), - JOptionPane.WARNING_MESSAGE); + JOptionPane + .showInternalMessageDialog( + this, + MessageManager + .getString("label.principal_component_analysis_must_take_least_four_input_sequences"), + MessageManager + .getString("label.sequence_selection_insufficient"), + JOptionPane.WARNING_MESSAGE); return; } @@ -3754,8 +3807,11 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JOptionPane .showMessageDialog( Desktop.desktop, - MessageManager.getString("label.you_need_more_two_sequences_selected_build_tree"), - MessageManager.getString("label.not_enough_sequences"), JOptionPane.WARNING_MESSAGE); + MessageManager + .getString("label.you_need_more_two_sequences_selected_build_tree"), + MessageManager + .getString("label.not_enough_sequences"), + JOptionPane.WARNING_MESSAGE); return; } @@ -3769,8 +3825,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JOptionPane .showMessageDialog( Desktop.desktop, - MessageManager.getString("label.selected_region_to_tree_may_only_contain_residues_or_gaps"), - MessageManager.getString("label.sequences_selection_not_aligned"), + MessageManager + .getString("label.selected_region_to_tree_may_only_contain_residues_or_gaps"), + MessageManager + .getString("label.sequences_selection_not_aligned"), JOptionPane.WARNING_MESSAGE); return; @@ -3788,8 +3846,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JOptionPane .showMessageDialog( Desktop.desktop, - MessageManager.getString("label.sequences_must_be_aligned_before_creating_tree"), - MessageManager.getString("label.sequences_not_aligned"), + MessageManager + .getString("label.sequences_must_be_aligned_before_creating_tree"), + MessageManager + .getString("label.sequences_not_aligned"), JOptionPane.WARNING_MESSAGE); return; @@ -3944,15 +4004,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { calculateTree.removeAll(); // build the calculate menu - - for (final String type:new String[] {"NJ", "AV"}) + + for (final String type : new String[] + { "NJ", "AV" }) { - String treecalcnm = MessageManager.getString("label.tree_calc_"+type.toLowerCase()); - for (final Object pwtype: ResidueProperties.scoreMatrices.keySet()) + String treecalcnm = MessageManager.getString("label.tree_calc_" + + type.toLowerCase()); + for (final Object pwtype : ResidueProperties.scoreMatrices.keySet()) { JMenuItem tm = new JMenuItem(); ScoreModelI sm = ResidueProperties.scoreMatrices.get(pwtype); - if (sm.isProtein()==!viewport.getAlignment().isNucleotide()) + if (sm.isProtein() == !viewport.getAlignment().isNucleotide()) { String smn = MessageManager.getStringOrReturn( "label.score_model_", sm.getName()); @@ -4115,7 +4177,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager.getString("label.select_newick_like_tree_file")); + chooser.setDialogTitle(MessageManager + .getString("label.select_newick_like_tree_file")); chooser.setToolTipText(MessageManager.getString("label.load_tree_file")); int value = chooser.showOpenDialog(null); @@ -4131,14 +4194,20 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, viewport.setCurrentTree(ShowNewickTree(fin, choice).getTree()); } catch (Exception ex) { - JOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(), - MessageManager.getString("label.problem_reading_tree_file"), JOptionPane.WARNING_MESSAGE); + JOptionPane + .showMessageDialog( + Desktop.desktop, + ex.getMessage(), + MessageManager + .getString("label.problem_reading_tree_file"), + JOptionPane.WARNING_MESSAGE); ex.printStackTrace(); } if (fin != null && fin.hasWarningMessage()) { - JOptionPane.showMessageDialog(Desktop.desktop, - fin.getWarningMessage(), MessageManager.getString("label.possible_problem_with_tree_file"), + JOptionPane.showMessageDialog(Desktop.desktop, fin + .getWarningMessage(), MessageManager + .getString("label.possible_problem_with_tree_file"), JOptionPane.WARNING_MESSAGE); } } @@ -4243,7 +4312,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override public void run() { - final List legacyItems=new ArrayList(); + final List legacyItems = new ArrayList(); try { System.err.println("Building ws menu again " @@ -4276,7 +4345,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // be // stored or retrieved from elsewhere // No MSAWS used any more: - // Vector msaws = null; // (Vector) Discoverer.services.get("MsaWS"); + // Vector msaws = null; // (Vector) + // Discoverer.services.get("MsaWS"); Vector secstrpr = (Vector) Discoverer.services .get("SecStrPred"); if (secstrpr != null) @@ -4288,17 +4358,17 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, .get(i); jalview.ws.WSMenuEntryProviderI impl = jalview.ws.jws1.Discoverer .getServiceClient(sh); - int p=secstrmenu.getItemCount(); + int p = secstrmenu.getItemCount(); impl.attachWSMenuEntry(secstrmenu, me); - int q=secstrmenu.getItemCount(); - for (int litm=p;litm= mcomp || i == (otherdb.size())) { - ifetch.setText(MessageManager.formatMessage("label.source_to_target",imname,sname)); + ifetch.setText(MessageManager.formatMessage( + "label.source_to_target", imname, sname)); dfetch.add(ifetch); ifetch = new JMenu(); imname = null; @@ -5402,7 +5516,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, ++dbi; if (comp >= mcomp || dbi >= (dbclasses.length)) { - dfetch.setText(MessageManager.formatMessage("label.source_to_target",mname,dbclass)); + dfetch.setText(MessageManager.formatMessage( + "label.source_to_target", mname, dbclass)); rfetch.add(dfetch); dfetch = new JMenu(); mname = null; @@ -5540,7 +5655,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void makeGrpsFromSelection_actionPerformed(ActionEvent e) { - if (avc.makeGroupsFromSelection()) { + if (avc.makeGroupsFromSelection()) + { PaintRefresher.Refresh(this, viewport.getSequenceSetId()); alignPanel.updateAnnotation(); alignPanel.paintAlignment(true); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index e999f80..6d6531f 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -1016,7 +1016,6 @@ public class AlignViewport extends AlignmentViewport implements centreColumnLabels = centrecolumnlabels; } - /** * enable or disable the display of Database Cross References in the sequence * ID tooltip diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index 6ae19a5..134019d 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -424,16 +424,19 @@ public class AlignmentPanel extends GAlignmentPanel implements protected void validateAnnotationDimensions(boolean adjustPanelHeight) { int height = annotationPanel.adjustPanelHeight(); - - int theight = av.getCharHeight() * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 : av.getAlignment().getHiddenSequences().getSize())); - float sscaling = (float) (theight/(1.0*theight+height)); - float ascaling=(float)(height*1.0/alignFrame.getHeight()); + + int theight = av.getCharHeight() + * (av.getAlignment().getHeight() + (!av.hasHiddenRows() ? 0 + : av.getAlignment().getHiddenSequences().getSize())); + float sscaling = (float) (theight / (1.0 * theight + height)); + float ascaling = (float) (height * 1.0 / alignFrame.getHeight()); int rheight = alignFrame.getHeight() - height - av.getCharHeight(); if (adjustPanelHeight) { - // NOTE: this logic is different in the applet. Need a better algorithm to define behaviour + // NOTE: this logic is different in the applet. Need a better algorithm to + // define behaviour // try and set height according to alignment - if (ascaling>0 && sscaling < 0.5) + if (ascaling > 0 && sscaling < 0.5) { // if the alignment is too big then // default is 0.5 split @@ -441,10 +444,11 @@ public class AlignmentPanel extends GAlignmentPanel implements } else { - // if space for more than one sequence row left when annotation is fully displayed then set height to annotation height - // otherwise, leave at least two lines of sequence shown. - height = (rheight>av.getCharHeight()) ? height : (-av.getCharHeight() * 3 - + (int) (alignFrame.getHeight() * (1 - sscaling))); + // if space for more than one sequence row left when annotation is fully + // displayed then set height to annotation height + // otherwise, leave at least two lines of sequence shown. + height = (rheight > av.getCharHeight()) ? height + : (-av.getCharHeight() * 3 + (int) (alignFrame.getHeight() * (1 - sscaling))); } } else @@ -705,7 +709,7 @@ public class AlignmentPanel extends GAlignmentPanel implements seqPanel.seqCanvas.fastPaint(scrollX, scrollY); scalePanel.repaint(); - if (av.getShowAnnotation() && scrollX!=0) + if (av.getShowAnnotation() && scrollX != 0) { annotationPanel.fastPaint(scrollX); } @@ -1111,8 +1115,8 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(int type, File file) { long progress = System.currentTimeMillis(); - boolean headless = (System.getProperty("java.awt.headless") != null - && System.getProperty("java.awt.headless").equals("true")); + boolean headless = (System.getProperty("java.awt.headless") != null && System + .getProperty("java.awt.headless").equals("true")); if (alignFrame != null && !headless) { alignFrame.setProgressBar("Saving " diff --git a/src/jalview/gui/AnnotationColourChooser.java b/src/jalview/gui/AnnotationColourChooser.java index 32ecc52..39f3a13 100644 --- a/src/jalview/gui/AnnotationColourChooser.java +++ b/src/jalview/gui/AnnotationColourChooser.java @@ -52,8 +52,10 @@ public class AnnotationColourChooser extends JPanel jalview.datamodel.AlignmentAnnotation currentAnnotation; boolean adjusting = false; + /** - * enabled if the user is dragging the slider - try to keep updates to a minimun + * enabled if the user is dragging the slider - try to keep updates to a + * minimun */ boolean sliderDragging = false; @@ -76,7 +78,9 @@ public class AnnotationColourChooser extends JPanel frame = new JInternalFrame(); frame.setContentPane(this); frame.setLayer(JLayeredPane.PALETTE_LAYER); - Desktop.addInternalFrame(frame, MessageManager.getString("label.colour_by_annotation"), 520, 215); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.colour_by_annotation"), 520, + 215); slider.addChangeListener(new ChangeListener() { @@ -94,21 +98,22 @@ public class AnnotationColourChooser extends JPanel @Override public void mousePressed(MouseEvent e) { - sliderDragging=true; + sliderDragging = true; super.mousePressed(e); } @Override public void mouseDragged(MouseEvent e) { - sliderDragging=true; + sliderDragging = true; super.mouseDragged(e); } + public void mouseReleased(MouseEvent evt) { if (sliderDragging) { - sliderDragging=false; + sliderDragging = false; valueChanged(true); } ap.paintAlignment(true); @@ -127,21 +132,25 @@ public class AnnotationColourChooser extends JPanel if (oldcs instanceof AnnotationColourGradient) { AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; - currentColours.setSelected(acg.isPredefinedColours() || acg.getBaseColour()!=null); - if (!acg.isPredefinedColours() && acg.getBaseColour()==null) + currentColours.setSelected(acg.isPredefinedColours() + || acg.getBaseColour() != null); + if (!acg.isPredefinedColours() && acg.getBaseColour() == null) { minColour.setBackground(acg.getMinColour()); maxColour.setBackground(acg.getMaxColour()); } seqAssociated.setSelected(acg.isSeqAssociated()); - + } annotations = new JComboBox( getAnnotationItems(seqAssociated.isSelected())); - threshold.addItem(MessageManager.getString("label.threshold_feature_no_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_above_thereshold")); - threshold.addItem(MessageManager.getString("label.threshold_feature_below_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); if (oldcs instanceof AnnotationColourGradient) { @@ -221,6 +230,7 @@ public class AnnotationColourChooser extends JPanel System.arraycopy(anmap, 0, annmap, 0, annmap.length); return list; } + private void setDefaultMinMax() { minColour.setBackground(Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", @@ -290,8 +300,8 @@ public class AnnotationColourChooser extends JPanel }); defColours.setOpaque(false); defColours.setText(MessageManager.getString("action.set_defaults")); - defColours - .setToolTipText(MessageManager.getString("label.reset_min_max_colours_to_defaults")); + defColours.setToolTipText(MessageManager + .getString("label.reset_min_max_colours_to_defaults")); defColours.addActionListener(new ActionListener() { @@ -333,7 +343,8 @@ public class AnnotationColourChooser extends JPanel thresholdValue.setColumns(7); currentColours.setFont(JvSwingUtils.getLabelFont()); currentColours.setOpaque(false); - currentColours.setText(MessageManager.getString("label.use_original_colours")); + currentColours.setText(MessageManager + .getString("label.use_original_colours")); currentColours.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -343,7 +354,8 @@ public class AnnotationColourChooser extends JPanel }); thresholdIsMin.setBackground(Color.white); thresholdIsMin.setFont(JvSwingUtils.getLabelFont()); - thresholdIsMin.setText(MessageManager.getString("label.threshold_minmax")); + thresholdIsMin.setText(MessageManager + .getString("label.threshold_minmax")); thresholdIsMin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -353,7 +365,8 @@ public class AnnotationColourChooser extends JPanel }); seqAssociated.setBackground(Color.white); seqAssociated.setFont(JvSwingUtils.getLabelFont()); - seqAssociated.setText(MessageManager.getString("label.per_sequence_only")); + seqAssociated.setText(MessageManager + .getString("label.per_sequence_only")); seqAssociated.addActionListener(new ActionListener() { @@ -492,11 +505,11 @@ public class AnnotationColourChooser extends JPanel .getSelectedIndex()]]; int aboveThreshold = -1; - if (threshold.getSelectedIndex()==1) + if (threshold.getSelectedIndex() == 1) { aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; } - else if (threshold.getSelectedIndex()==2) + else if (threshold.getSelectedIndex() == 2) { aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; } @@ -678,7 +691,8 @@ public class AnnotationColourChooser extends JPanel { return; } - // TODO: JAL-1327 only update visible annotation thresholds if allAnnotation is false, since we only need to provide a quick visual indicator + // TODO: JAL-1327 only update visible annotation thresholds if allAnnotation + // is false, since we only need to provide a quick visual indicator float thr = currentAnnotation.threshold.value; for (int i = 0; i < av.getAlignment().getAlignmentAnnotation().length; i++) diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java index 1e87a93..0975d24 100644 --- a/src/jalview/gui/AnnotationExporter.java +++ b/src/jalview/gui/AnnotationExporter.java @@ -186,12 +186,21 @@ public class AnnotationExporter extends JPanel try { cap.setText(text); - Desktop.addInternalFrame(cap, (features ? MessageManager.formatMessage("label.features_for_params", new String[]{ap.alignFrame.getTitle()}) - : MessageManager.formatMessage("label.annotations_for_params", new String[]{ap.alignFrame.getTitle()})), 600, 500); + Desktop.addInternalFrame( + cap, + (features ? MessageManager.formatMessage( + "label.features_for_params", new String[] + { ap.alignFrame.getTitle() }) : MessageManager + .formatMessage("label.annotations_for_params", + new String[] + { ap.alignFrame.getTitle() })), 600, 500); } catch (OutOfMemoryError oom) { - new OOMWarning((features ? MessageManager.formatMessage("label.generating_features_for_params", new String[]{ap.alignFrame.getTitle()}) : MessageManager.formatMessage("label.generating_annotations_for_params", new String[]{ap.alignFrame.getTitle()})) - , oom); + new OOMWarning((features ? MessageManager.formatMessage( + "label.generating_features_for_params", new String[] + { ap.alignFrame.getTitle() }) : MessageManager.formatMessage( + "label.generating_annotations_for_params", new String[] + { ap.alignFrame.getTitle() })), oom); cap.dispose(); } diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index a5b0716..b553f56 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -534,7 +534,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, return; } - JPopupMenu pop = new JPopupMenu(MessageManager.getString("label.annotations")); + JPopupMenu pop = new JPopupMenu( + MessageManager.getString("label.annotations")); JMenuItem item = new JMenuItem(ADDNEW); item.addActionListener(this); pop.add(item); @@ -825,11 +826,14 @@ public class AnnotationLabels extends JPanel implements MouseListener, } /** - * Draw the full set of annotation Labels for the alignment at the given cursor + * Draw the full set of annotation Labels for the alignment at the given + * cursor + * + * @param g + * Graphics2D instance (needed for font scaling) + * @param width + * Width for scaling labels * - * @param g Graphics2D instance (needed for font scaling) - * @param width Width for scaling labels - * */ public void drawComponent(Graphics g, int width) { @@ -837,12 +841,18 @@ public class AnnotationLabels extends JPanel implements MouseListener, } private final boolean debugRedraw = false; + /** - * Draw the full set of annotation Labels for the alignment at the given cursor + * Draw the full set of annotation Labels for the alignment at the given + * cursor * - * @param g Graphics2D instance (needed for font scaling) - * @param clip - true indicates that only current visible area needs to be rendered - * @param width Width for scaling labels + * @param g + * Graphics2D instance (needed for font scaling) + * @param clip + * - true indicates that only current visible area needs to be + * rendered + * @param width + * Width for scaling labels */ public void drawComponent(Graphics g, boolean clip, int width) { @@ -861,7 +871,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, g.translate(0, scrollOffset); g.setColor(Color.black); - + AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); int fontHeight = g.getFont().getSize(); int y = 0; @@ -871,18 +881,20 @@ public class AnnotationLabels extends JPanel implements MouseListener, Font baseFont = g.getFont(); FontMetrics baseMetrics = fm; int ofontH = fontHeight; - int sOffset=0; + int sOffset = 0; int visHeight = 0; - int[] visr = (ap!=null && ap.annotationPanel!=null) ? ap.annotationPanel.getVisibleVRange() : null; - if (clip && visr!=null){ - sOffset = visr[0]; + int[] visr = (ap != null && ap.annotationPanel != null) ? ap.annotationPanel + .getVisibleVRange() : null; + if (clip && visr != null) + { + sOffset = visr[0]; visHeight = visr[1]; } - boolean visible = true,before=false,after=false; + boolean visible = true, before = false, after = false; if (aa != null) { hasHiddenRows = false; - int olY=0; + int olY = 0; for (int i = 0; i < aa.length; i++) { visible = true; @@ -891,33 +903,39 @@ public class AnnotationLabels extends JPanel implements MouseListener, hasHiddenRows = true; continue; } - olY=y; + olY = y; y += aa[i].height; - if (clip) {if (yvisHeight) - { - - if (!after) + if (olY > visHeight) { - if (debugRedraw) { - System.out.println("Scroll offset: "+sOffset+" after vis: "+i); + + if (!after) + { + if (debugRedraw) + { + System.out.println("Scroll offset: " + sOffset + + " after vis: " + i); + } + after = true; } - after=true; + // don't draw what isn't visible + continue; } - // don't draw what isn't visible - continue; - }} + } g.setColor(Color.black); offset = -aa[i].height / 2; @@ -935,7 +953,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (aa[i].graphGroup > -1) { int groupSize = 0; - // TODO: JAL-1291 revise rendering model so the graphGroup map is computed efficiently for all visible labels + // TODO: JAL-1291 revise rendering model so the graphGroup map is + // computed efficiently for all visible labels for (int gg = 0; gg < aa.length; gg++) { if (aa[gg].graphGroup == aa[i].graphGroup) @@ -1014,7 +1033,8 @@ public class AnnotationLabels extends JPanel implements MouseListener, if (!av.wrapAlignment && ((aa == null) || (aa.length < 1))) { g.drawString(MessageManager.getString("label.right_click"), 2, 8); - g.drawString(MessageManager.getString("label.to_add_annotation"), 2, 18); + g.drawString(MessageManager.getString("label.to_add_annotation"), 2, + 18); } } } diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index c8aa505..73be63e 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -271,8 +271,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, else if (evt.getActionCommand().equals(LABEL)) { String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL); - String label = JOptionPane.showInputDialog(this, MessageManager.getString("label.enter_label"), - exMesg); + String label = JOptionPane.showInputDialog(this, + MessageManager.getString("label.enter_label"), exMesg); if (label == null) { @@ -352,8 +352,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, aa[activeRow].hasIcons = true; } - String label = JOptionPane.showInputDialog( - MessageManager.getString("label.enter_label_for_the_structure"), symbol); + String label = JOptionPane.showInputDialog(MessageManager + .getString("label.enter_label_for_the_structure"), symbol); if (label == null) { @@ -365,7 +365,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, aa[activeRow].hasText = true; if (evt.getActionCommand().equals(STEM)) { - aa[activeRow].showAllColLabels=true; + aa[activeRow].showAllColLabels = true; } } for (int i = 0; i < av.getColumnSelection().size(); i++) @@ -382,12 +382,12 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, anot[index].secondaryStructure = type; anot[index].displayCharacter = label; - + } } av.getAlignment().validateAnnotation(aa[activeRow]); ap.alignmentChanged(); - + adjustPanelHeight(); repaint(); @@ -490,7 +490,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return; } - JPopupMenu pop = new JPopupMenu(MessageManager.getString("label.structure_type")); + JPopupMenu pop = new JPopupMenu( + MessageManager.getString("label.structure_type")); JMenuItem item; /* * Just display the needed structure options @@ -672,7 +673,10 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, && aa[row].annotations[res].description != null && aa[row].annotations[res].description.length() > 0) { - this.setToolTipText(""+JvSwingUtils.wrapTooltip(aa[row].annotations[res].description)+""); + this.setToolTipText("" + + JvSwingUtils + .wrapTooltip(aa[row].annotations[res].description) + + ""); } else { @@ -708,11 +712,11 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, @Override public void mouseClicked(MouseEvent evt) { -// if (activeRow != -1) -// { -// AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); -// AlignmentAnnotation anot = aa[activeRow]; -// } + // if (activeRow != -1) + // { + // AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); + // AlignmentAnnotation anot = aa[activeRow]; + // } } // TODO mouseClicked-content and drawCursor are quite experimental! @@ -804,10 +808,12 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imageFresh = false; g.drawImage(image, 0, 0, this); } + /** * set true to enable redraw timing debug output on stderr */ private final boolean debugRedraw = false; + /** * non-Thread safe repaint * @@ -824,9 +830,9 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, repaint(); return; } - long stime=System.currentTimeMillis(); + long stime = System.currentTimeMillis(); gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0); - long mtime=System.currentTimeMillis(); + long mtime = System.currentTimeMillis(); int sr = av.startRes; int er = av.endRes + 1; int transX = 0; @@ -846,12 +852,15 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, drawComponent(gg, sr, er); gg.translate(-transX, 0); - long dtime=System.currentTimeMillis(); + long dtime = System.currentTimeMillis(); fastPaint = true; repaint(); - long rtime=System.currentTimeMillis(); - if (debugRedraw) { - System.err.println("Scroll:\t"+horizontal+"\tCopyArea:\t"+(mtime-stime)+"\tDraw component:\t"+(dtime-mtime)+"\tRepaint call:\t"+(rtime-dtime)); + long rtime = System.currentTimeMillis(); + if (debugRedraw) + { + System.err.println("Scroll:\t" + horizontal + "\tCopyArea:\t" + + (mtime - stime) + "\tDraw component:\t" + (dtime - mtime) + + "\tRepaint call:\t" + (rtime - dtime)); } } @@ -913,7 +922,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, } fadedImage = null; } - + g.setColor(Color.white); g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight()); @@ -931,7 +940,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, g.setColor(Color.black); if (av.validCharWidth) { - g.drawString(MessageManager.getString("label.alignment_has_no_annotations"), 20, 15); + g.drawString(MessageManager + .getString("label.alignment_has_no_annotations"), 20, 15); } return; @@ -961,16 +971,21 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, { return imgWidth; } + private int[] bounds = new int[2]; + @Override public int[] getVisibleVRange() { - if (ap!=null && ap.alabels!=null) + if (ap != null && ap.alabels != null) { - int sOffset=-ap.alabels.scrollOffset; - int visHeight = sOffset+ap.annotationSpaceFillerHolder.getHeight(); - bounds[0] = sOffset; bounds[1]=visHeight; - return bounds; - } else return null; + int sOffset = -ap.alabels.scrollOffset; + int visHeight = sOffset + ap.annotationSpaceFillerHolder.getHeight(); + bounds[0] = sOffset; + bounds[1] = visHeight; + return bounds; + } + else + return null; } } diff --git a/src/jalview/gui/AppJmol.java b/src/jalview/gui/AppJmol.java index eab3580..6eb6ac3 100644 --- a/src/jalview/gui/AppJmol.java +++ b/src/jalview/gui/AppJmol.java @@ -202,7 +202,11 @@ public class AppJmol extends GStructureViewer implements Runnable, public void itemStateChanged(ItemEvent e) { alignStructs.setEnabled(_alignwith.size() > 0); - alignStructs.setToolTipText(MessageManager.formatMessage("label.align_structures_using_linked_alignment_views", new String[] {new Integer(_alignwith.size()).toString()})); + alignStructs.setToolTipText(MessageManager + .formatMessage( + "label.align_structures_using_linked_alignment_views", + new String[] + { new Integer(_alignwith.size()).toString() })); } }); handler.itemStateChanged(null); @@ -254,9 +258,11 @@ public class AppJmol extends GStructureViewer implements Runnable, if (alreadyMapped != null) { int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.formatMessage("label.pdb_entry_is_already_displayed", new String[]{pdbentry.getId()}), - MessageManager.formatMessage("label.map_sequences_to_visible_window", new String[]{pdbentry.getId()}), - JOptionPane.YES_NO_OPTION); + MessageManager.formatMessage( + "label.pdb_entry_is_already_displayed", new String[] + { pdbentry.getId() }), MessageManager.formatMessage( + "label.map_sequences_to_visible_window", new String[] + { pdbentry.getId() }), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { @@ -311,10 +317,15 @@ public class AppJmol extends GStructureViewer implements Runnable, { AppJmol topJmol = (AppJmol) jm.nextElement(); // TODO: highlight topJmol in view somehow - int option = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.formatMessage("label.add_pdbentry_to_view", new String[]{pdbentry.getId(),topJmol.getTitle()}), - MessageManager.getString("label.align_to_existing_structure_view"), - JOptionPane.YES_NO_OPTION); + int option = JOptionPane + .showInternalConfirmDialog( + Desktop.desktop, + MessageManager.formatMessage( + "label.add_pdbentry_to_view", new String[] + { pdbentry.getId(), topJmol.getTitle() }), + MessageManager + .getString("label.align_to_existing_structure_view"), + JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { topJmol.useAlignmentPanelForSuperposition(ap); @@ -619,7 +630,8 @@ public class AppJmol extends GStructureViewer implements Runnable, { return; } - JMenuItem menuItem = new JMenuItem(MessageManager.getString("label.all")); + JMenuItem menuItem = new JMenuItem( + MessageManager.getString("label.all")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) @@ -781,9 +793,12 @@ public class AppJmol extends GStructureViewer implements Runnable, if (errormsgs.length() > 0) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.pdb_entries_couldnt_be_retrieved", new String[]{errormsgs.toString()}), - MessageManager.getString("label.couldnt_load_file"), JOptionPane.ERROR_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .formatMessage("label.pdb_entries_couldnt_be_retrieved", + new String[] + { errormsgs.toString() }), MessageManager + .getString("label.couldnt_load_file"), + JOptionPane.ERROR_MESSAGE); } long lastnotify = jmb.getLoadNotifiesHandled(); @@ -831,7 +846,8 @@ public class AppJmol extends GStructureViewer implements Runnable, // need to wait around until script has finished while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled() - : (jmb.isFinishedInit() && jmb.getPdbFile()!=null && jmb.getPdbFile().length != jmb.pdbentry.length)) + : (jmb.isFinishedInit() && jmb.getPdbFile() != null && jmb + .getPdbFile().length != jmb.pdbentry.length)) { try { @@ -921,8 +937,9 @@ public class AppJmol extends GStructureViewer implements Runnable, cap.dispose(); return; } - jalview.gui.Desktop.addInternalFrame(cap, MessageManager.getString("label.pdb_sequence_mapping"), - 550, 600); + jalview.gui.Desktop.addInternalFrame(cap, + MessageManager.getString("label.pdb_sequence_mapping"), 550, + 600); } /** @@ -1144,7 +1161,8 @@ public class AppJmol extends GStructureViewer implements Runnable, g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.error_loading_file") + "...", 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.error_loading_file") + + "...", 20, currentSize.height / 2); StringBuffer sb = new StringBuffer(); int lines = 0; for (int e = 0; e < jmb.pdbentry.length; e++) @@ -1169,7 +1187,8 @@ public class AppJmol extends GStructureViewer implements Runnable, g.fillRect(0, 0, currentSize.width, currentSize.height); g.setColor(Color.white); g.setFont(new Font("Verdana", Font.BOLD, 14)); - g.drawString(MessageManager.getString("label.retrieving_pdb_data"), 20, currentSize.height / 2); + g.drawString(MessageManager.getString("label.retrieving_pdb_data"), + 20, currentSize.height / 2); } else { diff --git a/src/jalview/gui/AppVarna.java b/src/jalview/gui/AppVarna.java index d9795f0..4fe9ac2 100644 --- a/src/jalview/gui/AppVarna.java +++ b/src/jalview/gui/AppVarna.java @@ -83,12 +83,12 @@ public class AppVarna extends JInternalFrame implements String struc, String name, AlignmentPanel ap) { -// System.out.println("1:"+sname); -// System.out.println("2:"+seq); -// System.out.println("3:"+strucseq); -// System.out.println("4:"+struc); -// System.out.println("5:"+name); -// System.out.println("6:"+ap); + // System.out.println("1:"+sname); + // System.out.println("2:"+seq); + // System.out.println("3:"+strucseq); + // System.out.println("4:"+struc); + // System.out.println("5:"+name); + // System.out.println("6:"+ap); this.ap = ap; ArrayList rnaList = new ArrayList(); RNA rna1 = new RNA(name); @@ -96,9 +96,9 @@ public class AppVarna extends JInternalFrame implements { rna1.setRNA(strucseq, replaceOddGaps(struc)); -// System.out.println("The sequence is :"+rna1.getSeq()); -// System.out.println("The sequence is:"+struc); -// System.out.println("The sequence is:"+replaceOddGaps(struc).toString()); + // System.out.println("The sequence is :"+rna1.getSeq()); + // System.out.println("The sequence is:"+struc); + // System.out.println("The sequence is:"+replaceOddGaps(struc).toString()); } catch (ExceptionUnmatchedClosingParentheses e2) { e2.printStackTrace(); @@ -109,7 +109,7 @@ public class AppVarna extends JInternalFrame implements RNA trim = trimRNA(rna1, "trimmed " + sname); rnaList.add(trim); rnaList.add(rna1); - + rnas.put(seq, rna1); rnas.put(seq, trim); rna1.setName(sname + " (with gaps)"); @@ -117,7 +117,7 @@ public class AppVarna extends JInternalFrame implements { seqs.put(trim, seq); seqs.put(rna1, seq); - + /** * if (false || seq.getStart()!=1) { for (RNA rshift:rnaList) { ShiftList * shift=offsets.get(rshift); if (shift==null) { offsets.put(rshift, @@ -129,16 +129,16 @@ public class AppVarna extends JInternalFrame implements // vab = new AppVarnaBinding(seq,struc); this.name = sname + " trimmed to " + name; initVarna(); - + ssm = ap.getStructureSelectionManager(); - //System.out.println(ssm.toString()); + // System.out.println(ssm.toString()); ssm.addStructureViewerListener(this); ssm.addSelectionListener(this); } public void initVarna() { - + // vab.setFinishedInit(false); varnaPanel = vab.get_varnaPanel(); setBackground(Color.white); @@ -149,11 +149,12 @@ public class AppVarna extends JInternalFrame implements // getContentPane().add(vab.getTools(), BorderLayout.NORTH); varnaPanel.addVARNAListener(this); varnaPanel.addSelectionListener(this); - jalview.gui.Desktop.addInternalFrame(this, MessageManager.formatMessage("label.varna_params", new String[]{name}), - getBounds().width, getBounds().height); + jalview.gui.Desktop.addInternalFrame(this, + MessageManager.formatMessage("label.varna_params", new String[] + { name }), getBounds().width, getBounds().height); this.pack(); showPanel(true); - + } public String replaceOddGaps(String oldStr) @@ -169,7 +170,7 @@ public class AppVarna extends JInternalFrame implements public RNA trimRNA(RNA rna, String name) { ShiftList offset = new ShiftList(); - + RNA rnaTrim = new RNA(name); try { @@ -436,14 +437,14 @@ public class AppVarna extends JInternalFrame implements public void onTranslationChanged() { // TODO Auto-generated method stub - + } @Override public void onZoomLevelChanged() { // TODO Auto-generated method stub - + } } diff --git a/src/jalview/gui/AppVarnaBinding.java b/src/jalview/gui/AppVarnaBinding.java index 574a2da..a738a2c 100644 --- a/src/jalview/gui/AppVarnaBinding.java +++ b/src/jalview/gui/AppVarnaBinding.java @@ -103,17 +103,23 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding private JTextField _seq = new JTextField(); - private JLabel _strLabel = new JLabel(MessageManager.getString("label.str")); + private JLabel _strLabel = new JLabel( + MessageManager.getString("label.str")); - private JLabel _seqLabel = new JLabel(MessageManager.getString("label.seq")); + private JLabel _seqLabel = new JLabel( + MessageManager.getString("label.seq")); - private JButton _createButton = new JButton(MessageManager.getString("action.create")); + private JButton _createButton = new JButton( + MessageManager.getString("action.create")); - private JButton _updateButton = new JButton(MessageManager.getString("action.update")); + private JButton _updateButton = new JButton( + MessageManager.getString("action.update")); - private JButton _deleteButton = new JButton(MessageManager.getString("action.delete")); + private JButton _deleteButton = new JButton( + MessageManager.getString("action.delete")); - private JButton _duplicateButton = new JButton(MessageManager.getString("action.snapshot")); + private JButton _duplicateButton = new JButton( + MessageManager.getString("action.snapshot")); protected JPanel _listPanel = new JPanel(); @@ -145,7 +151,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding { // super("VARNA in Jalview"); initVarna(seq, struc); - + } public AppVarnaBinding(ArrayList rnaList) @@ -157,7 +163,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding private void initVarna(String seq, String str) { - + DefaultListModel dlm = new DefaultListModel(); DefaultListSelectionModel m = new DefaultListSelectionModel(); @@ -190,7 +196,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding try { - + vp = new VARNAPanel("0", "."); _RNA1.setRNA(seq, str); _RNA1.drawRNARadiate(vp.getConfig()); @@ -219,7 +225,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding private void initVarnaEdit(ArrayList rnaInList) { - + DefaultListModel dlm = new DefaultListModel(); int marginTools = 40; @@ -243,7 +249,7 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding FullBackup sel = (FullBackup) _sideList.getSelectedValue(); Mapping map = Mapping.DefaultOutermostMapping(vp.getRNA() .getSize(), sel.rna.getSize()); - //vp.showRNAInterpolated(sel.rna, sel.config, map); + // vp.showRNAInterpolated(sel.rna, sel.config, map); vp.showRNA(sel.rna, sel.config); // _seq.setText(sel.rna.getSeq()); _str.setText(sel.rna.getStructDBN()); @@ -254,12 +260,12 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding try { - + vp = new VARNAPanel("0", "."); for (int i = 0; i < rnaInList.size(); i++) { rnaInList.get(i).drawRNARadiate(vp.getConfig()); - + } } catch (ExceptionNonEqualLength e) { @@ -346,7 +352,9 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding ops.add(_deleteButton); ops.add(_duplicateButton); - JLabel j = new JLabel(MessageManager.getString("label.structures_manager"), JLabel.CENTER); + JLabel j = new JLabel( + MessageManager.getString("label.structures_manager"), + JLabel.CENTER); _listPanel.setLayout(new BorderLayout()); // _listPanel.add(ops, BorderLayout.SOUTH); @@ -809,10 +817,11 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding public void onUINewStructure(VARNAConfig v, RNA r) { // patch to fix infinite loop - // The problem is that onUINewStructure is called when user clicks + // The problem is that onUINewStructure is called when user clicks // check with Yann about whether Jalview should do anything with this event. - // e.g. if user has used VARNA's menu to import a structure .. Jalview may need to be told which structure is displayed. - + // e.g. if user has used VARNA's menu to import a structure .. Jalview may + // need to be told which structure is displayed. + // _rnaList.add(v, r, "", true); } @@ -948,14 +957,14 @@ public class AppVarnaBinding extends jalview.ext.varna.JalviewVarnaBinding public void onZoomLevelChanged() { // TODO Auto-generated method stub - + } @Override public void onTranslationChanged() { // TODO Auto-generated method stub - + } } diff --git a/src/jalview/gui/AssociatePdbFileWithSeq.java b/src/jalview/gui/AssociatePdbFileWithSeq.java index 939f572..01f1cb0 100644 --- a/src/jalview/gui/AssociatePdbFileWithSeq.java +++ b/src/jalview/gui/AssociatePdbFileWithSeq.java @@ -54,11 +54,11 @@ public class AssociatePdbFileWithSeq if (prompt) { - reply = JOptionPane - .showInternalInputDialog( - Desktop.desktop, - MessageManager.getString("label.couldnt_find_pdb_id_in_file"), - MessageManager.getString("label.no_pdb_id_in_file"), JOptionPane.QUESTION_MESSAGE); + reply = JOptionPane.showInternalInputDialog(Desktop.desktop, + MessageManager + .getString("label.couldnt_find_pdb_id_in_file"), + MessageManager.getString("label.no_pdb_id_in_file"), + JOptionPane.QUESTION_MESSAGE); } if (reply == null) { diff --git a/src/jalview/gui/BlogReader.java b/src/jalview/gui/BlogReader.java index 759b600..0935d9f 100644 --- a/src/jalview/gui/BlogReader.java +++ b/src/jalview/gui/BlogReader.java @@ -816,7 +816,14 @@ class ChannelsRenderer extends DefaultListCellRenderer if (value instanceof Channel) { Channel channel = (Channel) value; - component.setText(MessageManager.formatMessage("label.channel_title_item_count", new String[]{channel.getTitle(),Integer.valueOf(channel.getUnreadItemCount()).toString()})); + component + .setText(MessageManager.formatMessage( + "label.channel_title_item_count", + new String[] + { + channel.getTitle(), + Integer.valueOf(channel.getUnreadItemCount()) + .toString() })); component.setToolTipText(channel.getURL()); } return component; @@ -839,7 +846,15 @@ class ItemsRenderer extends DefaultListCellRenderer Item item = (Item) value; if (item.getPublishDate() != null) { - component.setText(MessageManager.formatMessage("label.blog_item_published_on_date", new String[]{DateFormat.getDateInstance(DateFormat.LONG, MessageManager.getLocale()).format(item.getPublishDate()).toString(),item.getTitle()})); + component.setText(MessageManager.formatMessage( + "label.blog_item_published_on_date", + new String[] + { + DateFormat + .getDateInstance(DateFormat.LONG, + MessageManager.getLocale()) + .format(item.getPublishDate()).toString(), + item.getTitle() })); } component.setToolTipText(item.getLink()); if (!item.isRead()) diff --git a/src/jalview/gui/CutAndPasteHtmlTransfer.java b/src/jalview/gui/CutAndPasteHtmlTransfer.java index 961ea33..74297bb 100644 --- a/src/jalview/gui/CutAndPasteHtmlTransfer.java +++ b/src/jalview/gui/CutAndPasteHtmlTransfer.java @@ -214,8 +214,10 @@ public class CutAndPasteHtmlTransfer extends GCutAndPasteHtmlTransfer { if (SwingUtilities.isRightMouseButton(e)) { - JPopupMenu popup = new JPopupMenu(MessageManager.getString("action.edit")); - JMenuItem item = new JMenuItem(MessageManager.getString("action.copy")); + JPopupMenu popup = new JPopupMenu( + MessageManager.getString("action.edit")); + JMenuItem item = new JMenuItem( + MessageManager.getString("action.copy")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/CutAndPasteTransfer.java b/src/jalview/gui/CutAndPasteTransfer.java index 77d8fc7..7f8d289 100644 --- a/src/jalview/gui/CutAndPasteTransfer.java +++ b/src/jalview/gui/CutAndPasteTransfer.java @@ -180,8 +180,11 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer } catch (java.io.IOException ex) { JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.couldnt_read_pasted_text", new String[]{ex.toString()}), - MessageManager.getString("label.error_parsing_text"), JOptionPane.WARNING_MESSAGE); + MessageManager.formatMessage( + "label.couldnt_read_pasted_text", new String[] + { ex.toString() }), MessageManager + .getString("label.error_parsing_text"), + JOptionPane.WARNING_MESSAGE); } } @@ -202,9 +205,12 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer AlignFrame af = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); af.currentFileFormat = format; - Desktop.addInternalFrame(af, MessageManager.formatMessage("label.input_cut_paste_params", new String[]{format}), - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - af.statusBar.setText(MessageManager.getString("label.successfully_pasted_alignment_file")); + Desktop.addInternalFrame(af, MessageManager.formatMessage( + "label.input_cut_paste_params", new String[] + { format }), AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); + af.statusBar.setText(MessageManager + .getString("label.successfully_pasted_alignment_file")); try { @@ -237,8 +243,10 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer { if (SwingUtilities.isRightMouseButton(e)) { - JPopupMenu popup = new JPopupMenu(MessageManager.getString("action.edit")); - JMenuItem item = new JMenuItem(MessageManager.getString("action.copy")); + JPopupMenu popup = new JPopupMenu( + MessageManager.getString("action.edit")); + JMenuItem item = new JMenuItem( + MessageManager.getString("action.copy")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java index 329990e..b8dd645 100644 --- a/src/jalview/gui/DasSourceBrowser.java +++ b/src/jalview/gui/DasSourceBrowser.java @@ -174,7 +174,9 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (nickName == null) { - fullDetails.setText(text + MessageManager.getString("label.select_das_service_from_table")); + fullDetails.setText(text + + MessageManager + .getString("label.select_das_service_from_table")); return; } @@ -433,21 +435,26 @@ public class DasSourceBrowser extends GDasSourceBrowser implements JTextField nametf = new JTextField(nickname, 40); JTextField urltf = new JTextField(url, 40); - JCheckBox seqs = new JCheckBox(MessageManager.getString("label.sequence_source")); + JCheckBox seqs = new JCheckBox( + MessageManager.getString("label.sequence_source")); seqs.setSelected(seqsrc); JPanel panel = new JPanel(new BorderLayout()); JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel(MessageManager.getString("label.structure_manager")), BorderLayout.CENTER); + pane12.add( + new JLabel(MessageManager.getString("label.structure_manager")), + BorderLayout.CENTER); pane12.add(nametf, BorderLayout.EAST); panel.add(pane12, BorderLayout.NORTH); pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel(MessageManager.getString("label.url")), BorderLayout.NORTH); + pane12.add(new JLabel(MessageManager.getString("label.url")), + BorderLayout.NORTH); pane12.add(seqs, BorderLayout.SOUTH); pane12.add(urltf, BorderLayout.EAST); panel.add(pane12, BorderLayout.SOUTH); int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - panel, MessageManager.getString("label.enter_local_das_source"), + panel, + MessageManager.getString("label.enter_local_das_source"), JOptionPane.OK_CANCEL_OPTION); if (reply != JOptionPane.OK_OPTION) @@ -519,10 +526,13 @@ public class DasSourceBrowser extends GDasSourceBrowser implements if (!sourceRegistry.getSource(nickname).isLocal()) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.you_can_only_edit_or_remove_local_das_sources"), - MessageManager.getString("label.public_das_source"), - JOptionPane.WARNING_MESSAGE); + JOptionPane + .showInternalMessageDialog( + Desktop.desktop, + MessageManager + .getString("label.you_can_only_edit_or_remove_local_das_sources"), + MessageManager.getString("label.public_das_source"), + JOptionPane.WARNING_MESSAGE); return; } diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 9f028ab..c3c23b0 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -561,7 +561,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements void showPasteMenu(int x, int y) { JPopupMenu popup = new JPopupMenu(); - JMenuItem item = new JMenuItem(MessageManager.getString("label.paste_new_window")); + JMenuItem item = new JMenuItem( + MessageManager.getString("label.paste_new_window")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) @@ -651,8 +652,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN // IF JALVIEW IS RUNNING HEADLESS // /////////////////////////////////////////////// - if (instance == null || (System.getProperty("java.awt.headless") != null - && System.getProperty("java.awt.headless").equals("true"))) + if (instance == null + || (System.getProperty("java.awt.headless") != null && System + .getProperty("java.awt.headless").equals("true"))) { return; } @@ -809,7 +811,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements */ public void drop(DropTargetDropEvent evt) { - boolean success=true; + boolean success = true; Transferable t = evt.getTransferable(); java.util.List files = null; java.util.List protocols = null; @@ -858,7 +860,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } catch (Exception e) { - success=false; + success = false; } if (files != null) @@ -887,10 +889,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } catch (Exception ex) { - success=false; + success = false; } } - evt.dropComplete(success); // need this to ensure input focus is properly transfered to any new windows created + evt.dropComplete(success); // need this to ensure input focus is properly + // transfered to any new windows created } /** @@ -908,7 +911,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT")); chooser.setFileView(new JalviewFileView()); - chooser.setDialogTitle(MessageManager.getString("label.open_local_file")); + chooser.setDialogTitle(MessageManager + .getString("label.open_local_file")); chooser.setToolTipText(MessageManager.getString("action.open")); int value = chooser.showOpenDialog(this); @@ -920,7 +924,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements .getSelectedFile().getParent()); String format = null; - if (chooser.getSelectedFormat()!=null && chooser.getSelectedFormat().equals("Jalview")) + if (chooser.getSelectedFormat() != null + && chooser.getSelectedFormat().equals("Jalview")) { format = "Jalview"; } @@ -951,7 +956,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements { // This construct allows us to have a wider textfield // for viewing - JLabel label = new JLabel(MessageManager.getString("label.input_file_url")); + JLabel label = new JLabel( + MessageManager.getString("label.input_file_url")); final JComboBox history = new JComboBox(); JPanel panel = new JPanel(new GridLayout(2, 1)); @@ -976,7 +982,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements } int reply = JOptionPane.showInternalConfirmDialog(desktop, panel, - MessageManager.getString("label.input_alignment_from_url"), JOptionPane.OK_CANCEL_OPTION); + MessageManager.getString("label.input_alignment_from_url"), + JOptionPane.OK_CANCEL_OPTION); if (reply != JOptionPane.OK_OPTION) { @@ -1431,8 +1438,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { JalviewFileChooser chooser = new JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] - { "jvp","jar" }, new String[] - { "Jalview Project", "Jalview Project (old)" }, "Jalview Project"); + { "jvp", "jar" }, new String[] + { "Jalview Project", "Jalview Project (old)" }, + "Jalview Project"); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Restore state"); @@ -1517,15 +1525,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements { if (progressPanel != null) { - synchronized(progressPanel) { - progressPanel.remove(progbar); - GridLayout gl = (GridLayout) progressPanel.getLayout(); - gl.setRows(gl.getRows() - 1); - if (--totalProgressCount < 1) + synchronized (progressPanel) { - this.getContentPane().remove(progressPanel); - progressPanel = null; - } + progressPanel.remove(progbar); + GridLayout gl = (GridLayout) progressPanel.getLayout(); + gl.setRows(gl.getRows() - 1); + if (--totalProgressCount < 1) + { + this.getContentPane().remove(progressPanel); + progressPanel = null; + } } } validate(); @@ -1536,7 +1545,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements fileLoadingCount--; if (fileLoadingCount < 1) { - while (fileLoadingPanels.size()>0) + while (fileLoadingPanels.size() > 0) { removeProgressPanel(fileLoadingPanels.remove(0)); } @@ -1721,7 +1730,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle("Open a saved VAMSAS session"); - chooser.setToolTipText(MessageManager.getString("label.select_vamsas_session_opened_as_new_vamsas_session")); + chooser.setToolTipText(MessageManager + .getString("label.select_vamsas_session_opened_as_new_vamsas_session")); int value = chooser.showOpenDialog(this); @@ -1730,10 +1740,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements String fle = chooser.getSelectedFile().toString(); if (!vamsasImport(chooser.getSelectedFile())) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.couldnt_import_as_vamsas_session", new String[]{fle}), - MessageManager.getString("label.vamsas_document_import_failed"), - JOptionPane.ERROR_MESSAGE); + JOptionPane + .showInternalMessageDialog( + Desktop.desktop, + MessageManager.formatMessage( + "label.couldnt_import_as_vamsas_session", + new String[] + { fle }), + MessageManager + .getString("label.vamsas_document_import_failed"), + JOptionPane.ERROR_MESSAGE); } } } @@ -1887,7 +1903,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements vamsasSave.setVisible(false); vamsasStop.setVisible(false); vamsasImport.setVisible(true); - vamsasStart.setText(MessageManager.getString("label.new_vamsas_session")); + vamsasStart.setText(MessageManager + .getString("label.new_vamsas_session")); } public void vamsasStop_actionPerformed(ActionEvent e) @@ -1923,7 +1940,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements { JMenuItem sessit = new JMenuItem(); sessit.setText(sess[i]); - sessit.setToolTipText(MessageManager.formatMessage("label.connect_to_session", new String[]{sess[i]})); + sessit.setToolTipText(MessageManager.formatMessage( + "label.connect_to_session", new String[] + { sess[i] })); final Desktop dsktp = this; final String mysesid = sess[i]; sessit.addActionListener(new ActionListener() @@ -2145,8 +2164,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements FontMetrics fm = g.getFontMetrics(); if (fm != null) { - g.drawString( - MessageManager.formatMessage("label.memory_stats", new String[]{df.format(totalFreeMemory),df.format(maxMemory),df.format(percentUsage)}), 10, + g.drawString(MessageManager.formatMessage( + "label.memory_stats", + new String[] + { df.format(totalFreeMemory), df.format(maxMemory), + df.format(percentUsage) }), 10, getHeight() - fm.getHeight()); } } @@ -2349,7 +2371,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton(MessageManager.getString("action.cancel")); + JButton cancel = new JButton( + MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { @@ -2447,15 +2470,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements // JAL-940 - JALVIEW 1 services are now being EOLed as of JABA 2.1 release if (true) { - // todo: changesupport handlers need to be transferred - if (discoverer == null) - { - discoverer = new jalview.ws.jws1.Discoverer(); - // register PCS handler for desktop. - discoverer.addPropertyChangeListener(changeSupport); - } - // JAL-940 - disabled JWS1 service configuration - always start discoverer - // until we phase out completely + // todo: changesupport handlers need to be transferred + if (discoverer == null) + { + discoverer = new jalview.ws.jws1.Discoverer(); + // register PCS handler for desktop. + discoverer.addPropertyChangeListener(changeSupport); + } + // JAL-940 - disabled JWS1 service configuration - always start discoverer + // until we phase out completely (t0 = new Thread(discoverer)).start(); } diff --git a/src/jalview/gui/EPSOptions.java b/src/jalview/gui/EPSOptions.java index 691b3d0..8906569 100644 --- a/src/jalview/gui/EPSOptions.java +++ b/src/jalview/gui/EPSOptions.java @@ -83,7 +83,8 @@ public class EPSOptions extends JPanel } }); jLabel1.setFont(JvSwingUtils.getLabelFont()); - jLabel1.setText(MessageManager.getString("label.select_eps_character_rendering_style")); + jLabel1.setText(MessageManager + .getString("label.select_eps_character_rendering_style")); this.setLayout(borderLayout1); jPanel3.setBorder(BorderFactory.createEtchedBorder()); jPanel2.add(text); diff --git a/src/jalview/gui/FeatureColourChooser.java b/src/jalview/gui/FeatureColourChooser.java index 1030431..8ab7c85 100644 --- a/src/jalview/gui/FeatureColourChooser.java +++ b/src/jalview/gui/FeatureColourChooser.java @@ -227,10 +227,14 @@ public class FeatureColourChooser extends JalviewDialog threshold_actionPerformed(e); } }); - threshold.setToolTipText(MessageManager.getString("label.threshold_feature_display_by_score")); - threshold.addItem(MessageManager.getString("label.threshold_feature_no_thereshold")); // index 0 - threshold.addItem(MessageManager.getString("label.threshold_feature_above_thereshold")); // index 1 - threshold.addItem(MessageManager.getString("label.threshold_feature_below_thereshold")); // index 2 + threshold.setToolTipText(MessageManager + .getString("label.threshold_feature_display_by_score")); + threshold.addItem(MessageManager + .getString("label.threshold_feature_no_thereshold")); // index 0 + threshold.addItem(MessageManager + .getString("label.threshold_feature_above_thereshold")); // index 1 + threshold.addItem(MessageManager + .getString("label.threshold_feature_below_thereshold")); // index 2 jPanel3.setLayout(flowLayout2); thresholdValue.addActionListener(new ActionListener() { @@ -245,14 +249,16 @@ public class FeatureColourChooser extends JalviewDialog slider.setEnabled(false); slider.setOpaque(false); slider.setPreferredSize(new Dimension(100, 32)); - slider.setToolTipText(MessageManager.getString("label.adjust_thereshold")); + slider.setToolTipText(MessageManager + .getString("label.adjust_thereshold")); thresholdValue.setEnabled(false); thresholdValue.setColumns(7); jPanel3.setBackground(Color.white); thresholdIsMin.setBackground(Color.white); - thresholdIsMin.setText(MessageManager.getString("label.threshold_minmax")); - thresholdIsMin - .setToolTipText(MessageManager.getString("label.toggle_absolute_relative_display_threshold")); + thresholdIsMin.setText(MessageManager + .getString("label.threshold_minmax")); + thresholdIsMin.setToolTipText(MessageManager + .getString("label.toggle_absolute_relative_display_threshold")); thresholdIsMin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -261,9 +267,11 @@ public class FeatureColourChooser extends JalviewDialog } }); colourByLabel.setBackground(Color.white); - colourByLabel.setText(MessageManager.getString("label.colour_by_label")); colourByLabel - .setToolTipText(MessageManager.getString("label.display_features_same_type_different_label_using_different_colour")); + .setText(MessageManager.getString("label.colour_by_label")); + colourByLabel + .setToolTipText(MessageManager + .getString("label.display_features_same_type_different_label_using_different_colour")); colourByLabel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -333,7 +341,8 @@ public class FeatureColourChooser extends JalviewDialog public void minColour_actionPerformed() { Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_minimum_value"), minColour.getBackground()); + MessageManager.getString("label.select_colour_minimum_value"), + minColour.getBackground()); if (col != null) { minColour.setBackground(col); @@ -346,7 +355,8 @@ public class FeatureColourChooser extends JalviewDialog public void maxColour_actionPerformed() { Color col = JColorChooser.showDialog(this, - MessageManager.getString("label.select_colour_maximum_value"), maxColour.getBackground()); + MessageManager.getString("label.select_colour_maximum_value"), + maxColour.getBackground()); if (col != null) { maxColour.setBackground(col); @@ -365,11 +375,11 @@ public class FeatureColourChooser extends JalviewDialog } int aboveThreshold = AnnotationColourGradient.NO_THRESHOLD; - if (threshold.getSelectedIndex()==1) + if (threshold.getSelectedIndex() == 1) { aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; } - else if (threshold.getSelectedIndex()==2) + else if (threshold.getSelectedIndex() == 2) { aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; } diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index b6a26b0..eb64dee 100644 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -172,9 +172,12 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer this.transparency = fr.transparency; this.featureOrder = fr.featureOrder; } + /** * update from another feature renderer - * @param fr settings to copy + * + * @param fr + * settings to copy */ public void transferSettings(FeatureRenderer fr) { @@ -1120,12 +1123,14 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer tmp = new JPanel(); panel.add(tmp); - tmp.add(new JLabel(MessageManager.getString("label.group")+":", JLabel.RIGHT)); + tmp.add(new JLabel(MessageManager.getString("label.group") + ":", + JLabel.RIGHT)); tmp.add(source); tmp = new JPanel(); panel.add(tmp); - tmp.add(new JLabel(MessageManager.getString("label.colour"), JLabel.RIGHT)); + tmp.add(new JLabel(MessageManager.getString("label.colour"), + JLabel.RIGHT)); tmp.add(colour); colour.setPreferredSize(new Dimension(150, 15)); colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 9)); @@ -1137,7 +1142,8 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer bigPanel.add(panel, BorderLayout.NORTH); panel = new JPanel(); - panel.add(new JLabel(MessageManager.getString("label.description"), JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.description"), + JLabel.RIGHT)); description.setFont(JvSwingUtils.getTextAreaFont()); description.setLineWrap(true); panel.add(new JScrollPane(description)); @@ -1147,9 +1153,11 @@ public class FeatureRenderer implements jalview.api.FeatureRenderer bigPanel.add(panel, BorderLayout.SOUTH); panel = new JPanel(); - panel.add(new JLabel(MessageManager.getString("label.start"), JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.start"), + JLabel.RIGHT)); panel.add(start); - panel.add(new JLabel(MessageManager.getString("label.end"), JLabel.RIGHT)); + panel.add(new JLabel(MessageManager.getString("label.end"), + JLabel.RIGHT)); panel.add(end); bigPanel.add(panel, BorderLayout.CENTER); } diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 3f1cc0d..3dae4e5 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -110,7 +110,8 @@ public class FeatureSettings extends JPanel else if (evt.getClickCount() == 2) { fr.ap.alignFrame.avc.markColumnsContainingFeatures( - evt.isAltDown(),evt.isShiftDown() || evt.isMetaDown(), evt.isMetaDown(), + evt.isAltDown(), evt.isShiftDown() || evt.isMetaDown(), + evt.isMetaDown(), (String) table.getValueAt(selectedRow, 0)); } } @@ -140,8 +141,10 @@ public class FeatureSettings extends JPanel } } }); - table.setToolTipText(""+JvSwingUtils - .wrapTooltip("Click/drag feature types up or down to change render order.
Double click to select columns containing feature in alignment/current selection
Pressing Alt will select columns outside features rather than inside
Pressing Shift to modify current selection (rather than clear current selection)
Press CTRL or Command/Meta to toggle columns in/outside features
")+""); + table.setToolTipText("" + + JvSwingUtils + .wrapTooltip("Click/drag feature types up or down to change render order.
Double click to select columns containing feature in alignment/current selection
Pressing Alt will select columns outside features rather than inside
Pressing Shift to modify current selection (rather than clear current selection)
Press CTRL or Command/Meta to toggle columns in/outside features
") + + ""); scrollPane.setViewportView(table); dassourceBrowser = new DasSourceBrowser(this); @@ -175,11 +178,15 @@ public class FeatureSettings extends JPanel frame.setContentPane(this); if (new jalview.util.Platform().isAMac()) { - Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 475, 480); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 475, 480); } else { - Desktop.addInternalFrame(frame, MessageManager.getString("label.sequence_feature_settings"), 400, 450); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.sequence_feature_settings"), + 400, 450); } frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter() @@ -197,8 +204,11 @@ public class FeatureSettings extends JPanel protected void popupSort(final int selectedRow, final String type, final Object typeCol, final Hashtable minmax, int x, int y) { - JPopupMenu men = new JPopupMenu(MessageManager.formatMessage("label.settings_for_param", new String[]{type})); - JMenuItem scr = new JMenuItem(MessageManager.getString("label.sort_by_score")); + JPopupMenu men = new JPopupMenu(MessageManager.formatMessage( + "label.settings_for_param", new String[] + { type })); + JMenuItem scr = new JMenuItem( + MessageManager.getString("label.sort_by_score")); men.add(scr); final FeatureSettings me = this; scr.addActionListener(new ActionListener() @@ -211,7 +221,8 @@ public class FeatureSettings extends JPanel } }); - JMenuItem dens = new JMenuItem(MessageManager.getString("label.sort_by_density")); + JMenuItem dens = new JMenuItem( + MessageManager.getString("label.sort_by_density")); dens.addActionListener(new ActionListener() { @@ -300,24 +311,28 @@ public class FeatureSettings extends JPanel }); } } - JMenuItem selCols = new JMenuItem(MessageManager.getString("label.select_columns_containing")); + JMenuItem selCols = new JMenuItem( + MessageManager.getString("label.select_columns_containing")); selCols.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent arg0) { - fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false, false, type); + fr.ap.alignFrame.avc.markColumnsContainingFeatures(false, false, + false, type); } }); - JMenuItem clearCols = new JMenuItem(MessageManager.getString("label.select_columns_not_containing")); + JMenuItem clearCols = new JMenuItem( + MessageManager.getString("label.select_columns_not_containing")); clearCols.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent arg0) { - fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false, false, type); + fr.ap.alignFrame.avc.markColumnsContainingFeatures(true, false, + false, type); } }); men.add(selCols); @@ -955,7 +970,8 @@ public class FeatureSettings extends JPanel } }); sortByScore.setFont(JvSwingUtils.getLabelFont()); - sortByScore.setText(MessageManager.getString("label.seq_sort_by_score")); + sortByScore + .setText(MessageManager.getString("label.seq_sort_by_score")); sortByScore.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -964,7 +980,8 @@ public class FeatureSettings extends JPanel } }); sortByDens.setFont(JvSwingUtils.getLabelFont()); - sortByDens.setText(MessageManager.getString("label.sequence_sort_by_density")); + sortByDens.setText(MessageManager + .getString("label.sequence_sort_by_density")); sortByDens.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1183,7 +1200,9 @@ public class FeatureSettings extends JPanel if (!valid) { return null; - } else { + } + else + { gps = new String[_gps.size()]; _gps.toArray(gps); } @@ -1341,10 +1360,15 @@ public class FeatureSettings extends JPanel public void noDasSourceActive() { complete(); - JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.getString("label.no_das_sources_selected_warn"), - MessageManager.getString("label.no_das_sources_selected_title"), JOptionPane.DEFAULT_OPTION, - JOptionPane.INFORMATION_MESSAGE); + JOptionPane + .showInternalConfirmDialog( + Desktop.desktop, + MessageManager + .getString("label.no_das_sources_selected_warn"), + MessageManager + .getString("label.no_das_sources_selected_title"), + JOptionPane.DEFAULT_OPTION, + JOptionPane.INFORMATION_MESSAGE); } // /////////////////////////////////////////////////////////////////////// diff --git a/src/jalview/gui/Finder.java b/src/jalview/gui/Finder.java index 9c31e11..bc5f823 100755 --- a/src/jalview/gui/Finder.java +++ b/src/jalview/gui/Finder.java @@ -239,11 +239,14 @@ public class Finder extends GFinder // 'SelectRegion' selection if (!haveResults) { - JOptionPane.showInternalMessageDialog(this, MessageManager.getString("label.finished_searching"), - null, JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showInternalMessageDialog(this, + MessageManager.getString("label.finished_searching"), null, + JOptionPane.INFORMATION_MESSAGE); resIndex = -1; seqIndex = 0; - } else { + } + else + { if (findAll) { // then we report the matches that were found diff --git a/src/jalview/gui/FontChooser.java b/src/jalview/gui/FontChooser.java index a4ddfde..cda6c46 100755 --- a/src/jalview/gui/FontChooser.java +++ b/src/jalview/gui/FontChooser.java @@ -84,12 +84,15 @@ public class FontChooser extends GFontChooser if (tp != null) { - Desktop.addInternalFrame(frame, MessageManager.getString("action.change_font_tree_panel"), 340, 170, - false); + Desktop.addInternalFrame(frame, + MessageManager.getString("action.change_font_tree_panel"), + 340, 170, false); } else { - Desktop.addInternalFrame(frame, MessageManager.getString("action.change_font"), 340, 170, false); + Desktop.addInternalFrame(frame, + MessageManager.getString("action.change_font"), 340, 170, + false); } frame.setLayer(JLayeredPane.PALETTE_LAYER); diff --git a/src/jalview/gui/JDatabaseTree.java b/src/jalview/gui/JDatabaseTree.java index 30fbe13..43f5333 100644 --- a/src/jalview/gui/JDatabaseTree.java +++ b/src/jalview/gui/JDatabaseTree.java @@ -62,7 +62,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener JButton getDatabaseSelectorButton() { - final JButton viewdbs = new JButton(MessageManager.getString("action.select_ddbb")); + final JButton viewdbs = new JButton( + MessageManager.getString("action.select_ddbb")); viewdbs.addActionListener(new ActionListener() { @@ -365,8 +366,8 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener } else { - srcs.add(sfetcher.getSourceProxy((String) dmt - .getUserObject()).get(0)); + srcs.add(sfetcher + .getSourceProxy((String) dmt.getUserObject()).get(0)); forcedFirstChild = true; } } @@ -409,17 +410,27 @@ public class JDatabaseTree extends JalviewDialog implements KeyListener if (allowMultiSelections) { - dbstatus.setText(MessageManager.formatMessage("label.selected_database_to_fetch_from", new String[]{Integer.valueOf(srcs.size()).toString(),(srcs.size() == 1 ? "" : "s"),(srcs.size() > 0 ? " with " + x + " test quer" + (x == 1 ? "y" : "ies") : ".")})); + dbstatus.setText(MessageManager.formatMessage( + "label.selected_database_to_fetch_from", new String[] + { + Integer.valueOf(srcs.size()).toString(), + (srcs.size() == 1 ? "" : "s"), + (srcs.size() > 0 ? " with " + x + " test quer" + + (x == 1 ? "y" : "ies") : ".") })); dbstatex.setText(" "); } else { if (nm.length() > 0) { - dbstatus.setText(MessageManager.formatMessage("label.database_param",new String[]{nm})); + dbstatus.setText(MessageManager.formatMessage( + "label.database_param", new String[] + { nm })); if (qr.length() > 0) { - dbstatex.setText(MessageManager.formatMessage("label.example_param", new String[]{qr})); + dbstatex.setText(MessageManager.formatMessage( + "label.example_param", new String[] + { qr })); } else { diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index f9e782f..8cad9ca 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -3211,15 +3211,18 @@ public class Jalview2XML /** * - * @param supported - minimum version we are comparing against - * @param version - version of data being processsed. + * @param supported + * - minimum version we are comparing against + * @param version + * - version of data being processsed. * @return true if version is development/null or evaluates to the same or * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*) */ private boolean isVersionStringLaterThan(String supported, String version) { if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD") - || version.equalsIgnoreCase("Test") || version.equalsIgnoreCase("AUTOMATED BUILD")) + || version.equalsIgnoreCase("Test") + || version.equalsIgnoreCase("AUTOMATED BUILD")) { System.err.println("Assuming project file with " + (version == null ? "null" : version) diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java index 7980be1..2e3b236 100755 --- a/src/jalview/gui/Jalview2XML_V1.java +++ b/src/jalview/gui/Jalview2XML_V1.java @@ -139,8 +139,10 @@ public class Jalview2XML_V1 System.err.println("Couldn't locate Jalview XML file : " + ex + "\n"); JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.formatMessage("label.couldnt_locate", new String[]{file}), - MessageManager.getString("label.url_not_found"), + MessageManager.formatMessage("label.couldnt_locate", + new String[] + { file }), MessageManager + .getString("label.url_not_found"), JOptionPane.WARNING_MESSAGE); } }); diff --git a/src/jalview/gui/JvSwingUtils.java b/src/jalview/gui/JvSwingUtils.java index c420dc0..4dfd40d 100644 --- a/src/jalview/gui/JvSwingUtils.java +++ b/src/jalview/gui/JvSwingUtils.java @@ -61,7 +61,8 @@ public final class JvSwingUtils return "
" + ttext + "
"; } - } + } + public static JButton makeButton(String label, String tooltip, ActionListener action) { diff --git a/src/jalview/gui/OptsAndParamsPage.java b/src/jalview/gui/OptsAndParamsPage.java index 06a11d4..847c26a 100644 --- a/src/jalview/gui/OptsAndParamsPage.java +++ b/src/jalview/gui/OptsAndParamsPage.java @@ -113,7 +113,7 @@ public class OptsAndParamsPage enabled.setToolTipText("" + JvSwingUtils - .wrapTooltip(((desc == null || desc.trim().length()==0) ? "see further details by right-clicking" + .wrapTooltip(((desc == null || desc.trim().length() == 0) ? "see further details by right-clicking" : desc) + "
") + ""); @@ -121,7 +121,7 @@ public class OptsAndParamsPage } else { - if (desc != null && desc.trim().length()>0) + if (desc != null && desc.trim().length() > 0) { enabled.setToolTipText("" + JvSwingUtils.wrapTooltip(opt.getDescription()) @@ -239,11 +239,11 @@ public class OptsAndParamsPage } - public void resetToDefault(boolean setDefaultParams) { enabled.setSelected(false); - if (option.isRequired() || (setDefaultParams && option.getValue()!=null)) + if (option.isRequired() + || (setDefaultParams && option.getValue() != null)) { // Apply default value selectOption(option, option.getValue()); @@ -263,7 +263,7 @@ public class OptsAndParamsPage initVal = (initEnabled) ? (String) val.getSelectedItem() : null; } } - + } public class ParamBox extends JPanel implements ChangeListener, @@ -681,7 +681,7 @@ public class OptsAndParamsPage { slider.getModel().setRangeProperties(iVal, 1, validator.getMin().intValue(), - validator.getMax().intValue()+1, true); + validator.getMax().intValue() + 1, true); } else { @@ -723,7 +723,8 @@ public class OptsAndParamsPage { slider.getModel().setRangeProperties((int) (fVal * 1000f), 1, (int) (validator.getMin().floatValue() * 1000f), - 1+(int) (validator.getMax().floatValue() * 1000f), true); + 1 + (int) (validator.getMax().floatValue() * 1000f), + true); } else { @@ -774,7 +775,9 @@ public class OptsAndParamsPage { JPopupMenu mnu = new JPopupMenu(); - JMenuItem mitem = new JMenuItem(MessageManager.formatMessage("label.view_params", new String[]{finfo})); + JMenuItem mitem = new JMenuItem(MessageManager.formatMessage( + "label.view_params", new String[] + { finfo })); mitem.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/PCAPanel.java b/src/jalview/gui/PCAPanel.java index 213b748..f07993c 100644 --- a/src/jalview/gui/PCAPanel.java +++ b/src/jalview/gui/PCAPanel.java @@ -112,11 +112,12 @@ public class PCAPanel extends GPCAPanel implements Runnable, Thread worker = new Thread(this); worker.start(); } + @Override protected void scoreMatrix_menuSelected() { scoreMatrixMenu.removeAll(); - for (final String sm:ResidueProperties.scoreMatrices.keySet()) + for (final String sm : ResidueProperties.scoreMatrices.keySet()) { if (ResidueProperties.getScoreMatrix(sm) != null) { @@ -149,6 +150,7 @@ public class PCAPanel extends GPCAPanel implements Runnable, } } } + public void bgcolour_actionPerformed(ActionEvent e) { Color col = JColorChooser.showDialog(this, "Select Background Colour", @@ -204,8 +206,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, if (getParent() == null) { addKeyListener(rc); - Desktop.addInternalFrame(this, MessageManager.getString("label.principal_component_analysis"), 475, - 450); + Desktop.addInternalFrame(this, MessageManager + .getString("label.principal_component_analysis"), 475, 450); } } @@ -302,7 +304,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, try { cap.setText(pcaModel.getDetails()); - Desktop.addInternalFrame(cap, MessageManager.getString("label.pca_details"), 500, 500); + Desktop.addInternalFrame(cap, + MessageManager.getString("label.pca_details"), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("opening PCA details", oom); @@ -376,8 +379,10 @@ public class PCAPanel extends GPCAPanel implements Runnable, // af.addSortByOrderMenuItem(ServiceName + " Ordering", // msaorder); - Desktop.addInternalFrame(af, MessageManager.formatMessage("label.original_data_for_params", new String[]{this.title}), - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + Desktop.addInternalFrame(af, MessageManager.formatMessage( + "label.original_data_for_params", new String[] + { this.title }), AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); } } /* @@ -487,7 +492,6 @@ public class PCAPanel extends GPCAPanel implements Runnable, } } - public void viewMenu_menuSelected() { buildAssociatedViewMenu(); @@ -566,7 +570,9 @@ public class PCAPanel extends GPCAPanel implements Runnable, cap.setText(pcaModel.getPointsasCsv(false, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); - Desktop.addInternalFrame(cap, MessageManager.formatMessage("label.points_for_params", new String[]{this.getTitle()}), 500, 500); + Desktop.addInternalFrame(cap, MessageManager.formatMessage( + "label.points_for_params", new String[] + { this.getTitle() }), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("exporting PCA points", oom); @@ -589,8 +595,9 @@ public class PCAPanel extends GPCAPanel implements Runnable, cap.setText(pcaModel.getPointsasCsv(true, xCombobox.getSelectedIndex(), yCombobox.getSelectedIndex(), zCombobox.getSelectedIndex())); - Desktop.addInternalFrame(cap, MessageManager.formatMessage("label.transformed_points_for_params", new String[]{this.getTitle()}), - 500, 500); + Desktop.addInternalFrame(cap, MessageManager.formatMessage( + "label.transformed_points_for_params", new String[] + { this.getTitle() }), 500, 500); } catch (OutOfMemoryError oom) { new OOMWarning("exporting transformed PCA points", oom); @@ -668,7 +675,8 @@ public class PCAPanel extends GPCAPanel implements Runnable, final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton(MessageManager.getString("action.cancel")); + JButton cancel = new JButton( + MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index a723662..01dfa3b 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -28,8 +28,8 @@ import java.awt.*; import jalview.datamodel.*; /** - * Route datamodel/view update events for a sequence set to any display components involved - * TODO: JV3 refactor to abstract gui/view package + * Route datamodel/view update events for a sequence set to any display + * components involved TODO: JV3 refactor to abstract gui/view package * * @author $author$ * @version $Revision$ diff --git a/src/jalview/gui/PairwiseAlignPanel.java b/src/jalview/gui/PairwiseAlignPanel.java index e2c7269..dcddf88 100755 --- a/src/jalview/gui/PairwiseAlignPanel.java +++ b/src/jalview/gui/PairwiseAlignPanel.java @@ -151,7 +151,8 @@ public class PairwiseAlignPanel extends GPairwiseAlignPanel AlignFrame af = new AlignFrame(new Alignment(seq), AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - Desktop.addInternalFrame(af, MessageManager.getString("label.pairwise_aligned_sequences"), + Desktop.addInternalFrame(af, + MessageManager.getString("label.pairwise_aligned_sequences"), AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } } diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 038477f..83544d7 100644 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -74,6 +74,7 @@ public class PopupMenu extends JPopupMenu protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem(); protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem(); + protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem(); // protected JRadioButtonMenuItem covariationColour = new @@ -94,7 +95,9 @@ public class PopupMenu extends JPopupMenu JMenuItem sequenceSelDetails = new JMenuItem(); SequenceI sequence; + JMenuItem createGroupMenuItem = new JMenuItem(); + JMenuItem unGroupMenuItem = new JMenuItem(); JMenuItem outline = new JMenuItem(); @@ -126,11 +129,13 @@ public class PopupMenu extends JPopupMenu JMenu pdbMenu = new JMenu(); JMenuItem pdbFromFile = new JMenuItem(); - // JBPNote: Commented these out - Should add these services via the web services menu system. - // JMenuItem ContraFold = new JMenuItem(); - - // JMenuItem RNAFold = new JMenuItem(); - + + // JBPNote: Commented these out - Should add these services via the web + // services menu system. + // JMenuItem ContraFold = new JMenuItem(); + + // JMenuItem RNAFold = new JMenuItem(); + JMenuItem enterPDB = new JMenuItem(); JMenuItem discoverPDB = new JMenuItem(); @@ -288,25 +293,28 @@ public class PopupMenu extends JPopupMenu final String rnastruc = aa[i].getRNAStruc(); final String structureLine = aa[i].label; menuItem = new JMenuItem(); - menuItem.setText(MessageManager.formatMessage("label.2d_rna_structure_line", new String[]{structureLine})); + menuItem.setText(MessageManager.formatMessage( + "label.2d_rna_structure_line", new String[] + { structureLine })); menuItem.addActionListener(new java.awt.event.ActionListener() - + { public void actionPerformed(ActionEvent e) { - //System.out.println("1:"+structureLine); - System.out.println("1:sname"+seq.getName()); - System.out.println("2:seq"+seq); - - //System.out.println("3:"+seq.getSequenceAsString()); - System.out.println("3:strucseq"+rnastruc); - //System.out.println("4:struc"+seq.getRNA()); - System.out.println("5:name"+seq.getName()); - System.out.println("6:ap"+ap); - new AppVarna(structureLine, seq, seq.getSequenceAsString(), rnastruc, seq - .getName(), ap); - //new AppVarna(seq.getName(),seq,rnastruc,seq.getRNA(), seq.getName(), ap); - System.out.println("end"); + // System.out.println("1:"+structureLine); + System.out.println("1:sname" + seq.getName()); + System.out.println("2:seq" + seq); + + // System.out.println("3:"+seq.getSequenceAsString()); + System.out.println("3:strucseq" + rnastruc); + // System.out.println("4:struc"+seq.getRNA()); + System.out.println("5:name" + seq.getName()); + System.out.println("6:ap" + ap); + new AppVarna(structureLine, seq, seq.getSequenceAsString(), + rnastruc, seq.getName(), ap); + // new AppVarna(seq.getName(),seq,rnastruc,seq.getRNA(), + // seq.getName(), ap); + System.out.println("end"); } }); viewStructureMenu.add(menuItem); @@ -326,13 +334,15 @@ public class PopupMenu extends JPopupMenu // TODO: make rnastrucF a bit more nice menuItem = new JMenuItem(); - menuItem.setText(MessageManager.formatMessage("label.2d_rna_sequence_name", new String[]{seq.getName()})); + menuItem.setText(MessageManager.formatMessage( + "label.2d_rna_sequence_name", new String[] + { seq.getName() })); menuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { // TODO: VARNA does'nt print gaps in the sequence - + new AppVarna(seq.getName() + " structure", seq, seq .getSequenceAsString(), rnastruc, seq.getName(), ap); @@ -345,7 +355,8 @@ public class PopupMenu extends JPopupMenu } - menuItem = new JMenuItem(MessageManager.getString("action.hide_sequences")); + menuItem = new JMenuItem( + MessageManager.getString("action.hide_sequences")); menuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -358,7 +369,9 @@ public class PopupMenu extends JPopupMenu if (ap.av.getSelectionGroup() != null && ap.av.getSelectionGroup().getSize() > 1) { - menuItem = new JMenuItem(MessageManager.formatMessage("label.represent_group_with", new String[]{seq.getName()})); + menuItem = new JMenuItem(MessageManager.formatMessage( + "label.represent_group_with", new String[] + { seq.getName() })); menuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -376,7 +389,8 @@ public class PopupMenu extends JPopupMenu if (ap.av.adjustForHiddenSeqs(index) - ap.av.adjustForHiddenSeqs(index - 1) > 1) { - menuItem = new JMenuItem(MessageManager.getString("action.reveal_sequences")); + menuItem = new JMenuItem( + MessageManager.getString("action.reveal_sequences")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -396,7 +410,8 @@ public class PopupMenu extends JPopupMenu if (ap.av.hasHiddenRows()) { { - menuItem = new JMenuItem(MessageManager.getString("action.reveal_all")); + menuItem = new JMenuItem( + MessageManager.getString("action.reveal_all")); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -415,12 +430,16 @@ public class PopupMenu extends JPopupMenu } SequenceGroup sg = ap.av.getSelectionGroup(); - boolean isDefinedGroup = (sg!=null) ? ap.av.getAlignment().getGroups().contains(sg) : false; + boolean isDefinedGroup = (sg != null) ? ap.av.getAlignment() + .getGroups().contains(sg) : false; if (sg != null && sg.getSize() > 0) - { - groupName.setText(MessageManager.formatMessage("label.name_param", new String[]{sg.getName()})); - groupName.setText(MessageManager.getString("label.edit_name_and_description_current_group")); + { + groupName.setText(MessageManager.formatMessage("label.name_param", + new String[] + { sg.getName() })); + groupName.setText(MessageManager + .getString("label.edit_name_and_description_current_group")); if (sg.cs instanceof ZappoColourScheme) { @@ -470,8 +489,7 @@ public class PopupMenu extends JPopupMenu { purinePyrimidineColour.setSelected(true); } - - + /* * else if (sg.cs instanceof CovariationColourScheme) { * covariationColour.setSelected(true); } @@ -495,7 +513,7 @@ public class PopupMenu extends JPopupMenu buildGroupURLMenu(sg, groupLinks); } // Add a 'show all structures' for the current selection - Hashtable pdbe = new Hashtable(),reppdb=new Hashtable(); + Hashtable pdbe = new Hashtable(), reppdb = new Hashtable(); SequenceI sqass = null; for (SequenceI sq : ap.av.getSequenceSelection()) { @@ -503,7 +521,7 @@ public class PopupMenu extends JPopupMenu .getPDBId(); if (pes != null) { - reppdb.put(pes.get(0).getId(),pes.get(0)); + reppdb.put(pes.get(0).getId(), pes.get(0)); for (PDBEntry pe : pes) { pdbe.put(pe.getId(), pe); @@ -517,18 +535,23 @@ public class PopupMenu extends JPopupMenu if (pdbe.size() > 0) { final PDBEntry[] pe = pdbe.values().toArray( - new PDBEntry[pdbe.size()]),pr = reppdb.values().toArray( - new PDBEntry[reppdb.size()]); - final JMenuItem gpdbview,rpdbview; + new PDBEntry[pdbe.size()]), pr = reppdb.values().toArray( + new PDBEntry[reppdb.size()]); + final JMenuItem gpdbview, rpdbview; if (pdbe.size() == 1) { - structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_structure_for", new String[]{sqass.getDisplayId(false)}))); + structureMenu.add(gpdbview = new JMenuItem(MessageManager + .formatMessage("label.view_structure_for", new String[] + { sqass.getDisplayId(false) }))); } else { - structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_structures", new String[]{new Integer(pdbe.size()).toString()}))); + structureMenu.add(gpdbview = new JMenuItem(MessageManager + .formatMessage("label.view_all_structures", new String[] + { new Integer(pdbe.size()).toString() }))); } - gpdbview.setToolTipText(MessageManager.getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment")); + gpdbview.setToolTipText(MessageManager + .getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment")); gpdbview.addActionListener(new ActionListener() { @@ -538,10 +561,15 @@ public class PopupMenu extends JPopupMenu new AppJmol(ap, pe, ap.av.collateForPDB(pe)); } }); - if (reppdb.size()>1 && reppdb.size() 1 && reppdb.size() < pdbe.size()) { - structureMenu.add(rpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_representative_structures", new String[]{new Integer(reppdb.size()).toString()}))); - rpdbview.setToolTipText(MessageManager.getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment")); + structureMenu.add(rpdbview = new JMenuItem(MessageManager + .formatMessage( + "label.view_all_representative_structures", + new String[] + { new Integer(reppdb.size()).toString() }))); + rpdbview.setToolTipText(MessageManager + .getString("label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment")); rpdbview.addActionListener(new ActionListener() { @@ -565,7 +593,9 @@ public class PopupMenu extends JPopupMenu createGroupMenuItem.setVisible(true); unGroupMenuItem.setVisible(false); jMenu1.setText(MessageManager.getString("action.edit_new_group")); - } else { + } + else + { createGroupMenuItem.setVisible(false); unGroupMenuItem.setVisible(true); jMenu1.setText(MessageManager.getString("action.edit_group")); @@ -707,11 +737,18 @@ public class PopupMenu extends JPopupMenu // menu appears asap // sequence only URLs // ID/regex match URLs - groupLinksMenu = new JMenu(MessageManager.getString("action.group_link")); + groupLinksMenu = new JMenu( + MessageManager.getString("action.group_link")); JMenu[] linkMenus = new JMenu[] - { null, new JMenu(MessageManager.getString("action.ids")), new JMenu(MessageManager.getString("action.sequences")), - new JMenu(MessageManager.getString("action.ids_sequences")) }; // three types of url that might be - // created. + { null, new JMenu(MessageManager.getString("action.ids")), + new JMenu(MessageManager.getString("action.sequences")), + new JMenu(MessageManager.getString("action.ids_sequences")) }; // three + // types + // of url + // that + // might + // be + // created. SequenceI[] seqs = ap.av.getSelectionAsNewSequence(); String[][] idandseqs = GroupUrlLink.formStrings(seqs); Hashtable commonDbrefs = new Hashtable(); @@ -833,7 +870,8 @@ public class PopupMenu extends JPopupMenu } if (addMenu) { - groupLinksMenu = new JMenu(MessageManager.getString("action.group_link")); + groupLinksMenu = new JMenu( + MessageManager.getString("action.group_link")); for (int m = 0; m < linkMenus.length; m++) { if (linkMenus[m] != null @@ -859,7 +897,9 @@ public class PopupMenu extends JPopupMenu private void addshowLink(JMenu linkMenu, String label, final String url) { JMenuItem item = new JMenuItem(label); - item.setToolTipText(MessageManager.formatMessage("label.open_url_param", new String[]{url})); + item.setToolTipText(MessageManager.formatMessage( + "label.open_url_param", new String[] + { url })); item.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -894,7 +934,11 @@ public class PopupMenu extends JPopupMenu final GroupUrlLink urlgenerator, final Object[] urlstub) { JMenuItem item = new JMenuItem(label); - item.setToolTipText(MessageManager.formatMessage("label.open_url_seqs_param", new Object[]{urlgenerator.getUrl_prefix(),urlgenerator.getNumberInvolved(urlstub)})); + item.setToolTipText(MessageManager.formatMessage( + "label.open_url_seqs_param", + new Object[] + { urlgenerator.getUrl_prefix(), + urlgenerator.getNumberInvolved(urlstub) })); // TODO: put in info about what is being sent. item.addActionListener(new java.awt.event.ActionListener() { @@ -939,7 +983,8 @@ public class PopupMenu extends JPopupMenu } }); sequenceMenu.setText(MessageManager.getString("label.sequence")); - sequenceName.setText(MessageManager.getString("label.edit_name_description")); + sequenceName.setText(MessageManager + .getString("label.edit_name_description")); sequenceName.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -947,7 +992,8 @@ public class PopupMenu extends JPopupMenu sequenceName_actionPerformed(); } }); - sequenceDetails.setText(MessageManager.getString("label.sequence_details") + "..."); + sequenceDetails.setText(MessageManager + .getString("label.sequence_details") + "..."); sequenceDetails.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -955,7 +1001,8 @@ public class PopupMenu extends JPopupMenu sequenceDetails_actionPerformed(); } }); - sequenceSelDetails.setText(MessageManager.getString("label.sequence_details") + "..."); + sequenceSelDetails.setText(MessageManager + .getString("label.sequence_details") + "..."); sequenceSelDetails .addActionListener(new java.awt.event.ActionListener() { @@ -965,7 +1012,8 @@ public class PopupMenu extends JPopupMenu } }); PIDColour.setFocusPainted(false); - unGroupMenuItem.setText(MessageManager.getString("action.remove_group")); + unGroupMenuItem + .setText(MessageManager.getString("action.remove_group")); unGroupMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -973,14 +1021,16 @@ public class PopupMenu extends JPopupMenu unGroupMenuItem_actionPerformed(); } }); - createGroupMenuItem.setText(MessageManager.getString("action.create_group")); - createGroupMenuItem.addActionListener(new java.awt.event.ActionListener() - { - public void actionPerformed(ActionEvent e) - { - createGroupMenuItem_actionPerformed(); - } - }); + createGroupMenuItem.setText(MessageManager + .getString("action.create_group")); + createGroupMenuItem + .addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + createGroupMenuItem_actionPerformed(); + } + }); outline.setText(MessageManager.getString("action.border_colour")); outline.addActionListener(new java.awt.event.ActionListener() @@ -990,7 +1040,8 @@ public class PopupMenu extends JPopupMenu outline_actionPerformed(); } }); - nucleotideMenuItem.setText(MessageManager.getString("label.nucleotide")); + nucleotideMenuItem + .setText(MessageManager.getString("label.nucleotide")); nucleotideMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1025,7 +1076,8 @@ public class PopupMenu extends JPopupMenu showColourText_actionPerformed(); } }); - displayNonconserved.setText(MessageManager.getString("label.show_non_conversed")); + displayNonconserved.setText(MessageManager + .getString("label.show_non_conversed")); displayNonconserved.setState(true); displayNonconserved.addActionListener(new ActionListener() { @@ -1075,7 +1127,8 @@ public class PopupMenu extends JPopupMenu changeCase(e); } }); - pdbMenu.setText(MessageManager.getString("label.associate_structure_with_sequence")); + pdbMenu.setText(MessageManager + .getString("label.associate_structure_with_sequence")); pdbFromFile.setText(MessageManager.getString("label.from_file")); pdbFromFile.addActionListener(new ActionListener() { @@ -1084,32 +1137,32 @@ public class PopupMenu extends JPopupMenu pdbFromFile_actionPerformed(); } }); -// RNAFold.setText("From RNA Fold with predict2D"); -// RNAFold.addActionListener(new ActionListener() -// { -// public void actionPerformed(ActionEvent e) -// { -// try { -// RNAFold_actionPerformed(); -// } catch (Exception e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// } -// }); -// ContraFold.setText("From Contra Fold with predict2D"); -// ContraFold.addActionListener(new ActionListener() -// { -// public void actionPerformed(ActionEvent e) -// { -// try { -// ContraFold_actionPerformed(); -// } catch (Exception e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// } -// }); + // RNAFold.setText("From RNA Fold with predict2D"); + // RNAFold.addActionListener(new ActionListener() + // { + // public void actionPerformed(ActionEvent e) + // { + // try { + // RNAFold_actionPerformed(); + // } catch (Exception e1) { + // // TODO Auto-generated catch block + // e1.printStackTrace(); + // } + // } + // }); + // ContraFold.setText("From Contra Fold with predict2D"); + // ContraFold.addActionListener(new ActionListener() + // { + // public void actionPerformed(ActionEvent e) + // { + // try { + // ContraFold_actionPerformed(); + // } catch (Exception e1) { + // // TODO Auto-generated catch block + // e1.printStackTrace(); + // } + // } + // }); enterPDB.setText(MessageManager.getString("label.enter_pdb_id")); enterPDB.addActionListener(new ActionListener() { @@ -1126,8 +1179,10 @@ public class PopupMenu extends JPopupMenu discoverPDB_actionPerformed(); } }); - outputMenu.setText(MessageManager.getString("label.out_to_textbox") + "..."); - sequenceFeature.setText(MessageManager.getString("label.create_sequence_feature")); + outputMenu.setText(MessageManager.getString("label.out_to_textbox") + + "..."); + sequenceFeature.setText(MessageManager + .getString("label.create_sequence_feature")); sequenceFeature.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1145,9 +1200,11 @@ public class PopupMenu extends JPopupMenu }); jMenu1.setText(MessageManager.getString("label.group")); structureMenu.setText(MessageManager.getString("label.structure")); - viewStructureMenu.setText(MessageManager.getString("label.view_structure")); + viewStructureMenu.setText(MessageManager + .getString("label.view_structure")); // colStructureMenu.setText("Colour By Structure"); - editSequence.setText(MessageManager.getString("label.edit_sequence") + "..."); + editSequence.setText(MessageManager.getString("label.edit_sequence") + + "..."); editSequence.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -1187,10 +1244,11 @@ public class PopupMenu extends JPopupMenu colourMenu.add(turnColour); colourMenu.add(buriedColour); colourMenu.add(nucleotideMenuItem); - if (ap.getAlignment().isNucleotide()) { - // JBPNote - commented since the colourscheme isn't functional - // colourMenu.add(RNAInteractionColour); - colourMenu.add(purinePyrimidineColour); + if (ap.getAlignment().isNucleotide()) + { + // JBPNote - commented since the colourscheme isn't functional + // colourMenu.add(RNAInteractionColour); + colourMenu.add(purinePyrimidineColour); } // colourMenu.add(covariationColour); colourMenu.add(userDefinedColour); @@ -1225,9 +1283,10 @@ public class PopupMenu extends JPopupMenu editMenu.add(lowerCase); editMenu.add(toggle); pdbMenu.add(pdbFromFile); - // JBPNote: These shouldn't be added here - should appear in a generic 'apply web service to this sequence menu' - // pdbMenu.add(RNAFold); - // pdbMenu.add(ContraFold); + // JBPNote: These shouldn't be added here - should appear in a generic + // 'apply web service to this sequence menu' + // pdbMenu.add(RNAFold); + // pdbMenu.add(ContraFold); pdbMenu.add(enterPDB); pdbMenu.add(discoverPDB); jMenu1.add(groupName); @@ -1249,7 +1308,8 @@ public class PopupMenu extends JPopupMenu } }); - clustalColour.setText(MessageManager.getString("label.clustalx_colours")); + clustalColour.setText(MessageManager + .getString("label.clustalx_colours")); clustalColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1273,7 +1333,8 @@ public class PopupMenu extends JPopupMenu taylorColour_actionPerformed(); } }); - hydrophobicityColour.setText(MessageManager.getString("label.hydrophobicity")); + hydrophobicityColour.setText(MessageManager + .getString("label.hydrophobicity")); hydrophobicityColour .addActionListener(new java.awt.event.ActionListener() { @@ -1290,7 +1351,8 @@ public class PopupMenu extends JPopupMenu helixColour_actionPerformed(); } }); - strandColour.setText(MessageManager.getString("label.strand_propensity")); + strandColour.setText(MessageManager + .getString("label.strand_propensity")); strandColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1314,7 +1376,8 @@ public class PopupMenu extends JPopupMenu buriedColour_actionPerformed(); } }); - abovePIDColour.setText(MessageManager.getString("label.above_identity_percentage")); + abovePIDColour.setText(MessageManager + .getString("label.above_identity_percentage")); abovePIDColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1322,7 +1385,8 @@ public class PopupMenu extends JPopupMenu abovePIDColour_actionPerformed(); } }); - userDefinedColour.setText(MessageManager.getString("action.user_defined")); + userDefinedColour.setText(MessageManager + .getString("action.user_defined")); userDefinedColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1330,7 +1394,8 @@ public class PopupMenu extends JPopupMenu userDefinedColour_actionPerformed(e); } }); - PIDColour.setText(MessageManager.getString("label.percentage_identity")); + PIDColour + .setText(MessageManager.getString("label.percentage_identity")); PIDColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1346,7 +1411,8 @@ public class PopupMenu extends JPopupMenu BLOSUM62Colour_actionPerformed(); } }); - purinePyrimidineColour.setText(MessageManager.getString("label.purine_pyrimidine")); + purinePyrimidineColour.setText(MessageManager + .getString("label.purine_pyrimidine")); purinePyrimidineColour .addActionListener(new java.awt.event.ActionListener() { @@ -1355,15 +1421,15 @@ public class PopupMenu extends JPopupMenu purinePyrimidineColour_actionPerformed(); } }); - - + /* * covariationColour.addActionListener(new java.awt.event.ActionListener() { * public void actionPerformed(ActionEvent e) { * covariationColour_actionPerformed(); } }); */ - conservationMenuItem.setText(MessageManager.getString("label.conservation")); + conservationMenuItem.setText(MessageManager + .getString("label.conservation")); conservationMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -1391,8 +1457,12 @@ public class PopupMenu extends JPopupMenu StringBuffer contents = new StringBuffer(); for (SequenceI seq : sequences) { - contents.append("

" + MessageManager.formatMessage("label.create_sequence_details_report_annotation_for", new String[]{seq.getDisplayId(true)}) - + "

"); + contents.append("

" + + MessageManager + .formatMessage( + "label.create_sequence_details_report_annotation_for", + new String[] + { seq.getDisplayId(true) }) + "

"); new SequenceAnnotationReport(null) .createSequenceAnnotationReport( contents, @@ -1406,8 +1476,11 @@ public class PopupMenu extends JPopupMenu } cap.setText("" + contents.toString() + ""); - Desktop.instance.addInternalFrame(cap, MessageManager.formatMessage("label.sequece_details_for", (sequences.length == 1 ? new String[]{sequences[0].getDisplayId(true)}: new String[]{MessageManager.getString("label.selection")})) - ,500, 400); + Desktop.instance.addInternalFrame(cap, MessageManager.formatMessage( + "label.sequece_details_for", + (sequences.length == 1 ? new String[] + { sequences[0].getDisplayId(true) } : new String[] + { MessageManager.getString("label.selection") })), 500, 400); } @@ -1543,7 +1616,6 @@ public class PopupMenu extends JPopupMenu refresh(); } - /* * protected void covariationColour_actionPerformed() { getGroup().cs = new * CovariationColourScheme(sequence.getAnnotation()[0]); refresh(); } @@ -1671,7 +1743,7 @@ public class PopupMenu extends JPopupMenu if (conservationMenuItem.isSelected()) { - // JBPNote: Conservation name shouldn't be i18n translated + // JBPNote: Conservation name shouldn't be i18n translated Conservation c = new Conservation("Group", ResidueProperties.propHash, 3, sg.getSequences(ap.av .getHiddenRepSequences()), sg.getStartRes(), @@ -1723,8 +1795,10 @@ public class PopupMenu extends JPopupMenu SequenceGroup sg = getGroup(); EditNameDialog dialog = new EditNameDialog(sg.getName(), - sg.getDescription(), " " + MessageManager.getString("label.group_name") + " ", - MessageManager.getString("label.group_description") + " ", MessageManager.getString("label.edit_group_name_description"), + sg.getDescription(), " " + + MessageManager.getString("label.group_name") + " ", + MessageManager.getString("label.group_description") + " ", + MessageManager.getString("label.edit_group_name_description"), ap.alignFrame); if (!dialog.accept) @@ -1763,8 +1837,12 @@ public class PopupMenu extends JPopupMenu void sequenceName_actionPerformed() { EditNameDialog dialog = new EditNameDialog(sequence.getName(), - sequence.getDescription(), " " + MessageManager.getString("label.sequence_name") + " ", - MessageManager.getString("label.sequence_description") + " ", MessageManager.getString("label.edit_sequence_name_description"), + sequence.getDescription(), + " " + MessageManager.getString("label.sequence_name") + + " ", + MessageManager.getString("label.sequence_description") + " ", + MessageManager + .getString("label.edit_sequence_name_description"), ap.alignFrame); if (!dialog.accept) @@ -1776,10 +1854,14 @@ public class PopupMenu extends JPopupMenu { if (dialog.getName().indexOf(" ") > -1) { - JOptionPane.showMessageDialog(ap, - MessageManager.getString("label.spaces_converted_to_backslashes"), - MessageManager.getString("label.no_spaces_allowed_sequence_name"), - JOptionPane.WARNING_MESSAGE); + JOptionPane + .showMessageDialog( + ap, + MessageManager + .getString("label.spaces_converted_to_backslashes"), + MessageManager + .getString("label.no_spaces_allowed_sequence_name"), + JOptionPane.WARNING_MESSAGE); } sequence.setName(dialog.getName().replace(' ', '_')); @@ -1806,9 +1888,11 @@ public class PopupMenu extends JPopupMenu ap.av.setSelectionGroup(null); refresh(); } + void createGroupMenuItem_actionPerformed() { - getGroup(); // implicitly creates group - note - should apply defaults / use standard alignment window logic for this + getGroup(); // implicitly creates group - note - should apply defaults / use + // standard alignment window logic for this refresh(); } @@ -1821,7 +1905,8 @@ public class PopupMenu extends JPopupMenu protected void outline_actionPerformed() { SequenceGroup sg = getGroup(); - Color col = JColorChooser.showDialog(this, MessageManager.getString("label.select_outline_colour"), + Color col = JColorChooser.showDialog(this, + MessageManager.getString("label.select_outline_colour"), Color.BLUE); if (col != null) @@ -1875,11 +1960,10 @@ public class PopupMenu extends JPopupMenu jalview.util.BrowserLauncher.openURL(url); } catch (Exception ex) { - JOptionPane - .showInternalMessageDialog( - Desktop.desktop, - MessageManager.getString("label.web_browser_not_found_unix"), - MessageManager.getString("label.web_browser_not_found"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, + MessageManager.getString("label.web_browser_not_found_unix"), + MessageManager.getString("label.web_browser_not_found"), + JOptionPane.WARNING_MESSAGE); ex.printStackTrace(); } @@ -1975,8 +2059,9 @@ public class PopupMenu extends JPopupMenu { CutAndPasteTransfer cap = new CutAndPasteTransfer(); cap.setForInput(null); - Desktop.addInternalFrame(cap, - MessageManager.formatMessage("label.alignment_output_command", new String[]{e.getActionCommand()}), 600, 500); + Desktop.addInternalFrame(cap, MessageManager.formatMessage( + "label.alignment_output_command", new String[] + { e.getActionCommand() }), 600, 500); String[] omitHidden = null; @@ -2007,8 +2092,12 @@ public class PopupMenu extends JPopupMenu jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser( jalview.bin.Cache.getProperty("LAST_DIRECTORY")); chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle(MessageManager.formatMessage("label.select_pdb_file_for", new String[]{sequence.getDisplayId(false)})); - chooser.setToolTipText(MessageManager.formatMessage("label.load_pdb_file_associate_with_sequence", new String[]{new Integer(sequence.getDisplayId(false)).toString()})); + chooser.setDialogTitle(MessageManager.formatMessage( + "label.select_pdb_file_for", new String[] + { sequence.getDisplayId(false) })); + chooser.setToolTipText(MessageManager.formatMessage( + "label.load_pdb_file_associate_with_sequence", new String[] + { new Integer(sequence.getDisplayId(false)).toString() })); int value = chooser.showOpenDialog(null); @@ -2021,22 +2110,25 @@ public class PopupMenu extends JPopupMenu } } - // JBNote: commented out - these won't be instantiated here...! -// public void RNAFold_actionPerformed() throws Exception -// { -// Predict2D P2D = new Predict2D(); -// P2D.getStructure2DFromRNAFold("toto"); -// } -// -// public void ContraFold_actionPerformed() throws Exception -// { -// Predict2D P2D = new Predict2D(); -// P2D.getStructure2DFromContraFold("toto"); -// } + + // JBNote: commented out - these won't be instantiated here...! + // public void RNAFold_actionPerformed() throws Exception + // { + // Predict2D P2D = new Predict2D(); + // P2D.getStructure2DFromRNAFold("toto"); + // } + // + // public void ContraFold_actionPerformed() throws Exception + // { + // Predict2D P2D = new Predict2D(); + // P2D.getStructure2DFromContraFold("toto"); + // } public void enterPDB_actionPerformed() { String id = JOptionPane.showInternalInputDialog(Desktop.desktop, - MessageManager.getString("label.enter_pdb_id"), MessageManager.getString("label.enter_pdb_id"), JOptionPane.QUESTION_MESSAGE); + MessageManager.getString("label.enter_pdb_id"), + MessageManager.getString("label.enter_pdb_id"), + JOptionPane.QUESTION_MESSAGE); if (id != null && id.length() > 0) { @@ -2142,12 +2234,15 @@ public class PopupMenu extends JPopupMenu EditNameDialog dialog = new EditNameDialog( sequence.getSequenceAsString(sg.getStartRes(), - sg.getEndRes() + 1), null, MessageManager.getString("label.edit_sequence"), null, - MessageManager.getString("label.edit_sequence"), ap.alignFrame); + sg.getEndRes() + 1), null, + MessageManager.getString("label.edit_sequence"), null, + MessageManager.getString("label.edit_sequence"), + ap.alignFrame); if (dialog.accept) { - EditCommand editCommand = new EditCommand(MessageManager.getString("label.edit_sequences"), + EditCommand editCommand = new EditCommand( + MessageManager.getString("label.edit_sequences"), EditCommand.REPLACE, dialog.getName().replace(' ', ap.av.getGapCharacter()), sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 6ebdc07..4f52f52 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -90,9 +90,10 @@ public class Preferences extends GPreferences .indexOf("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry"); if (srsPos > -1) { - sequenceURLLinks.setElementAt( - "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$", - srsPos); + sequenceURLLinks + .setElementAt( + "EMBL-EBI Search|http://www.ebi.ac.uk/ebisearch/search.ebi?db=allebi&query=$SEQUENCE_ID$", + srsPos); } } @@ -131,7 +132,8 @@ public class Preferences extends GPreferences height = 460; } - Desktop.addInternalFrame(frame, MessageManager.getString("label.preferences"), width, height); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.preferences"), width, height); frame.setMinimumSize(new Dimension(width, height)); seqLimit.setSelected(Cache.getDefault("SHOW_JVSUFFIX", true)); @@ -566,8 +568,8 @@ public class Preferences extends GPreferences while (!valid) { if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link, - MessageManager.getString("label.new_sequence_url_link"), JOptionPane.OK_CANCEL_OPTION, -1, - null) == JOptionPane.OK_OPTION) + MessageManager.getString("label.new_sequence_url_link"), + JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION) { if (link.checkValid()) { @@ -592,7 +594,8 @@ public class Preferences extends GPreferences if (index == -1) { JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.no_link_selected"), MessageManager.getString("label.no_link_selected"), + MessageManager.getString("label.no_link_selected"), + MessageManager.getString("label.no_link_selected"), JOptionPane.WARNING_MESSAGE); return; } @@ -605,8 +608,8 @@ public class Preferences extends GPreferences { if (JOptionPane.showInternalConfirmDialog(Desktop.desktop, link, - MessageManager.getString("label.new_sequence_url_link"), JOptionPane.OK_CANCEL_OPTION, -1, - null) == JOptionPane.OK_OPTION) + MessageManager.getString("label.new_sequence_url_link"), + JOptionPane.OK_CANCEL_OPTION, -1, null) == JOptionPane.OK_OPTION) { if (link.checkValid()) { @@ -630,7 +633,8 @@ public class Preferences extends GPreferences if (index == -1) { JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.no_link_selected"), MessageManager.getString("label.no_link_selected"), + MessageManager.getString("label.no_link_selected"), + MessageManager.getString("label.no_link_selected"), JOptionPane.WARNING_MESSAGE); return; } diff --git a/src/jalview/gui/RedundancyPanel.java b/src/jalview/gui/RedundancyPanel.java index 5e7f2a1..5adfae9 100755 --- a/src/jalview/gui/RedundancyPanel.java +++ b/src/jalview/gui/RedundancyPanel.java @@ -88,8 +88,9 @@ public class RedundancyPanel extends GSliderPanel implements Runnable frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, MessageManager.getString("label.redundancy_threshold_selection"), 400, - 100, false); + Desktop.addInternalFrame(frame, MessageManager + .getString("label.redundancy_threshold_selection"), 400, 100, + false); frame.addInternalFrameListener(new InternalFrameAdapter() { public void internalFrameClosing(InternalFrameEvent evt) diff --git a/src/jalview/gui/RestServiceEditorPane.java b/src/jalview/gui/RestServiceEditorPane.java index de71f6c..191e420 100644 --- a/src/jalview/gui/RestServiceEditorPane.java +++ b/src/jalview/gui/RestServiceEditorPane.java @@ -270,7 +270,8 @@ public class RestServiceEditorPane extends GRestServiceEditorPane final int rdatasel = rdata.getSelectedIndex(); if (rdatasel > -1) { - JPopupMenu popup = new JPopupMenu(MessageManager.getString("label.select_return_type")); + JPopupMenu popup = new JPopupMenu( + MessageManager.getString("label.select_return_type")); for (final JvDataType type : JvDataType.values()) { popup.add(new JMenuItem(type.name())).addActionListener( @@ -431,13 +432,21 @@ public class RestServiceEditorPane extends GRestServiceEditorPane } else { - parseRes.setText(MessageManager.formatMessage("label.parsing_failed_syntax_errors_shown_below_param", new String[]{rsd.getInvalidMessage()})); + parseRes.setText(MessageManager + .formatMessage( + "label.parsing_failed_syntax_errors_shown_below_param", + new String[] + { rsd.getInvalidMessage() })); parseWarnings.setVisible(true); } } catch (Throwable e) { e.printStackTrace(); - parseRes.setText(MessageManager.formatMessage("label.parsing_failed_unrecoverable_exception_thrown_param", new String[]{e.toString()})); + parseRes.setText(MessageManager + .formatMessage( + "label.parsing_failed_unrecoverable_exception_thrown_param", + new String[] + { e.toString() })); parseWarnings.setVisible(true); } } diff --git a/src/jalview/gui/RotatableCanvas.java b/src/jalview/gui/RotatableCanvas.java index b8de5fb..1ff78b4 100755 --- a/src/jalview/gui/RotatableCanvas.java +++ b/src/jalview/gui/RotatableCanvas.java @@ -373,7 +373,8 @@ public class RotatableCanvas extends JPanel implements MouseListener, if (points == null) { g.setFont(new Font("Verdana", Font.PLAIN, 18)); - g.drawString(MessageManager.getString("label.calculating_pca")+ "....", 20, getHeight() / 2); + g.drawString(MessageManager.getString("label.calculating_pca") + + "....", 20, getHeight() / 2); } else { diff --git a/src/jalview/gui/ScalePanel.java b/src/jalview/gui/ScalePanel.java index 9daa67e..f2c5154 100755 --- a/src/jalview/gui/ScalePanel.java +++ b/src/jalview/gui/ScalePanel.java @@ -97,7 +97,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, JPopupMenu pop = new JPopupMenu(); if (reveal != null) { - JMenuItem item = new JMenuItem(MessageManager.getString("label.reveal")); + JMenuItem item = new JMenuItem( + MessageManager.getString("label.reveal")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -115,7 +116,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, if (av.getColumnSelection().getHiddenColumns().size() > 1) { - item = new JMenuItem(MessageManager.getString("action.reveal_all")); + item = new JMenuItem( + MessageManager.getString("action.reveal_all")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -135,7 +137,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, } else if (av.getColumnSelection().contains(res)) { - JMenuItem item = new JMenuItem(MessageManager.getString("label.hide_columns")); + JMenuItem item = new JMenuItem( + MessageManager.getString("label.hide_columns")); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -360,7 +363,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, { reveal = region; ToolTipManager.sharedInstance().registerComponent(this); - this.setToolTipText(MessageManager.getString("label.reveal_hidden_columns")); + this.setToolTipText(MessageManager + .getString("label.reveal_hidden_columns")); break; } else @@ -508,7 +512,8 @@ public class ScalePanel extends JPanel implements MouseMotionListener, if (reveal != null && reveal[0] > startx && reveal[0] < endx) { - gg.drawString(MessageManager.getString("label.reveal_columns"), reveal[0] * av.charWidth, 0); + gg.drawString(MessageManager.getString("label.reveal_columns"), + reveal[0] * av.charWidth, 0); } } diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 03821d7..bf5ea93 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -520,29 +520,34 @@ public class SeqPanel extends JPanel implements MouseListener, int getKeyboardNo1() { - try { - if (keyboardNo1 != null) + try { - int value = Integer.parseInt(keyboardNo1.toString()); - keyboardNo1 = null; - return value; - } + if (keyboardNo1 != null) + { + int value = Integer.parseInt(keyboardNo1.toString()); + keyboardNo1 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo1 = null; return 1; } int getKeyboardNo2() { - try { - if (keyboardNo2!=null){ - int value = Integer.parseInt(keyboardNo2.toString()); - keyboardNo2 = null; - return value; - } + try + { + if (keyboardNo2 != null) + { + int value = Integer.parseInt(keyboardNo2.toString()); + keyboardNo2 = null; + return value; + } } catch (Exception x) - {} + { + } keyboardNo2 = null; return 1; } @@ -1432,9 +1437,10 @@ public class SeqPanel extends JPanel implements MouseListener, if (av.wrapAlignment && seq > av.getAlignment().getHeight()) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.cannot_edit_annotations_in_wrapped_view"), - MessageManager.getString("label.wrapped_view_no_edit"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .getString("label.cannot_edit_annotations_in_wrapped_view"), + MessageManager.getString("label.wrapped_view_no_edit"), + JOptionPane.WARNING_MESSAGE); return; } diff --git a/src/jalview/gui/SequenceFetcher.java b/src/jalview/gui/SequenceFetcher.java index 90e7b44..b2bf35f 100755 --- a/src/jalview/gui/SequenceFetcher.java +++ b/src/jalview/gui/SequenceFetcher.java @@ -231,12 +231,14 @@ public class SequenceFetcher extends JPanel implements Runnable dbeg.setFont(new java.awt.Font("Verdana", Font.BOLD, 11)); jLabel1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); jLabel1.setHorizontalAlignment(SwingConstants.CENTER); - jLabel1.setText(MessageManager.getString("label.separate_multiple_accession_ids")); + jLabel1.setText(MessageManager + .getString("label.separate_multiple_accession_ids")); replacePunctuation.setHorizontalAlignment(SwingConstants.CENTER); replacePunctuation .setFont(new java.awt.Font("Verdana", Font.ITALIC, 11)); - replacePunctuation.setText(MessageManager.getString("label.replace_commas_semicolons")); + replacePunctuation.setText(MessageManager + .getString("label.replace_commas_semicolons")); ok.setText(MessageManager.getString("action.ok")); ok.addActionListener(new ActionListener() { @@ -308,7 +310,9 @@ public class SequenceFetcher extends JPanel implements Runnable + database.getSelectedSources().size() + " others)" : "")); String eq = database.getExampleQueries(); - dbeg.setText(MessageManager.formatMessage("label.example_query_param", new String[]{eq})); + dbeg.setText(MessageManager.formatMessage( + "label.example_query_param", new String[] + { eq })); boolean enablePunct = !(eq != null && eq.indexOf(",") > -1); for (DbSourceProxy dbs : database.getSelectedSources()) { @@ -806,7 +810,8 @@ public class SequenceFetcher extends JPanel implements Runnable Desktop.addInternalFrame(af, title, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - af.statusBar.setText(MessageManager.getString("label.successfully_pasted_alignment_file")); + af.statusBar.setText(MessageManager + .getString("label.successfully_pasted_alignment_file")); try { @@ -847,7 +852,8 @@ public class SequenceFetcher extends JPanel implements Runnable public void run() { JOptionPane.showInternalMessageDialog(Desktop.desktop, error, - MessageManager.getString("label.error_retrieving_data"), JOptionPane.WARNING_MESSAGE); + MessageManager.getString("label.error_retrieving_data"), + JOptionPane.WARNING_MESSAGE); } }); } diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index 1bac450..48f09f8 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -72,13 +72,15 @@ public class SliderPanel extends GSliderPanel if (forConservation) { - label.setText(MessageManager.getString("label.enter_value_increase_conservation_visibility")); + label.setText(MessageManager + .getString("label.enter_value_increase_conservation_visibility")); slider.setMinimum(0); slider.setMaximum(100); } else { - label.setText(MessageManager.getString("label.enter_percentage_identity_above_which_colour_residues")); + label.setText(MessageManager + .getString("label.enter_percentage_identity_above_which_colour_residues")); slider.setMinimum(0); slider.setMaximum(100); } diff --git a/src/jalview/gui/TreeCanvas.java b/src/jalview/gui/TreeCanvas.java index 37bb6e9..e188177 100755 --- a/src/jalview/gui/TreeCanvas.java +++ b/src/jalview/gui/TreeCanvas.java @@ -611,7 +611,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (tree == null) { - g.drawString(MessageManager.getString("label.calculating_tree") + "....", 20, getHeight() / 2); + g.drawString(MessageManager.getString("label.calculating_tree") + + "....", 20, getHeight() / 2); } else { @@ -671,9 +672,9 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, g2.fillRect(0, 0, width, height); g2.setFont(font); - if (longestName==null || tree ==null) + if (longestName == null || tree == null) { - g2.drawString("Calculating tree.",20,20); + g2.drawString("Calculating tree.", 20, 20); } offy = font.getSize() + 10; @@ -796,7 +797,8 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, if (ob instanceof SequenceNode) { highlightNode = (SequenceNode) ob; - this.setToolTipText("" + MessageManager.getString("label.highlightnode")); + this.setToolTipText("" + + MessageManager.getString("label.highlightnode")); repaint(); } diff --git a/src/jalview/gui/TreePanel.java b/src/jalview/gui/TreePanel.java index 5ce8e36..cf49608 100755 --- a/src/jalview/gui/TreePanel.java +++ b/src/jalview/gui/TreePanel.java @@ -492,8 +492,10 @@ public class TreePanel extends GTreePanel // af.addSortByOrderMenuItem(ServiceName + " Ordering", // msaorder); - Desktop.addInternalFrame(af, MessageManager.formatMessage("label.original_data_for_params", new String[]{this.title}), - AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); + Desktop.addInternalFrame(af, MessageManager.formatMessage( + "label.original_data_for_params", new String[] + { this.title }), AlignFrame.DEFAULT_WIDTH, + AlignFrame.DEFAULT_HEIGHT); } } } diff --git a/src/jalview/gui/UserDefinedColours.java b/src/jalview/gui/UserDefinedColours.java index eb9e9c3..3803fa1 100755 --- a/src/jalview/gui/UserDefinedColours.java +++ b/src/jalview/gui/UserDefinedColours.java @@ -146,7 +146,9 @@ public class UserDefinedColours extends GUserDefinedColours implements colorChooser.getSelectionModel().addChangeListener(this); frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, MessageManager.getString("label.user_defined_colours"), 720, 370, true); + Desktop.addInternalFrame(frame, + MessageManager.getString("label.user_defined_colours"), 720, + 370, true); if (seqGroup != null) { @@ -506,7 +508,8 @@ public class UserDefinedColours extends GUserDefinedColours implements { "jc" }, new String[] { "Jalview User Colours" }, "Jalview User Colours"); chooser.setFileView(new jalview.io.JalviewFileView()); - chooser.setDialogTitle(MessageManager.getString("label.load_colour_scheme")); + chooser.setDialogTitle(MessageManager + .getString("label.load_colour_scheme")); chooser.setToolTipText(MessageManager.getString("action.load")); int value = chooser.showOpenDialog(this); @@ -713,19 +716,22 @@ public class UserDefinedColours extends GUserDefinedColours implements { if (schemeName.getText().trim().length() < 1) { - JOptionPane.showInternalMessageDialog(Desktop.desktop, - MessageManager.getString("label.user_colour_scheme_must_have_name"), - MessageManager.getString("label.no_name_colour_scheme"), JOptionPane.WARNING_MESSAGE); + JOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager + .getString("label.user_colour_scheme_must_have_name"), + MessageManager.getString("label.no_name_colour_scheme"), + JOptionPane.WARNING_MESSAGE); return; } if (userColourSchemes != null && userColourSchemes.containsKey(schemeName.getText())) { - int reply = JOptionPane.showInternalConfirmDialog( - Desktop.desktop, - MessageManager.formatMessage("label.colour_scheme_exists_overwrite", new String[]{schemeName.getText(),schemeName.getText()}), - MessageManager.getString("label.duplicate_scheme_name"), JOptionPane.YES_NO_OPTION); + int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, + MessageManager.formatMessage( + "label.colour_scheme_exists_overwrite", new String[] + { schemeName.getText(), schemeName.getText() }), + MessageManager.getString("label.duplicate_scheme_name"), + JOptionPane.YES_NO_OPTION); if (reply != JOptionPane.YES_OPTION) { return; diff --git a/src/jalview/gui/UserQuestionnaireCheck.java b/src/jalview/gui/UserQuestionnaireCheck.java index 62852bf..315dd66 100644 --- a/src/jalview/gui/UserQuestionnaireCheck.java +++ b/src/jalview/gui/UserQuestionnaireCheck.java @@ -141,10 +141,13 @@ public class UserQuestionnaireCheck implements Runnable + qid + "&rid=" + rid; jalview.bin.Cache.log.info("Prompting user for questionnaire at " + qurl); - int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop, - MessageManager.getString("label.jalview_new_questionnaire"), - MessageManager.getString("label.jalview_user_survey"), JOptionPane.YES_NO_OPTION, - JOptionPane.QUESTION_MESSAGE); + int reply = JOptionPane + .showInternalConfirmDialog(Desktop.desktop, MessageManager + .getString("label.jalview_new_questionnaire"), + MessageManager + .getString("label.jalview_user_survey"), + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE); if (reply == JOptionPane.YES_OPTION) { diff --git a/src/jalview/gui/ViewSelectionMenu.java b/src/jalview/gui/ViewSelectionMenu.java index e9cdcef..164f975 100644 --- a/src/jalview/gui/ViewSelectionMenu.java +++ b/src/jalview/gui/ViewSelectionMenu.java @@ -151,8 +151,8 @@ public class ViewSelectionMenu extends JMenu // ensure we update menu state to reflect external selection list state append = append || _selectedviews.size() > 1; toggleview = new JCheckBoxMenuItem("Select many views", append); - toggleview - .setToolTipText(MessageManager.getString("label.toggle_enabled_views")); + toggleview.setToolTipText(MessageManager + .getString("label.toggle_enabled_views")); toggleview.addItemListener(new ItemListener() { @@ -170,7 +170,8 @@ public class ViewSelectionMenu extends JMenu }); add(toggleview); - add(selectAll = new JMenuItem(MessageManager.getString("label.select_all_views"))); + add(selectAll = new JMenuItem( + MessageManager.getString("label.select_all_views"))); selectAll.addActionListener(new ActionListener() { @@ -192,7 +193,8 @@ public class ViewSelectionMenu extends JMenu } } }); - add(invertSel = new JMenuItem(MessageManager.getString("label.invert_selection"))); + add(invertSel = new JMenuItem( + MessageManager.getString("label.invert_selection"))); invertSel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 985c624..2afec55 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -770,32 +770,52 @@ public class WebserviceInfo extends GWebserviceInfo implements switch (currentStatus) { case STATE_QUEUING: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.state_queueing")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager.getString("label.state_queueing")), + 60, 30); break; case STATE_RUNNING: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.state_running")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager.getString("label.state_running")), + 60, 30); break; case STATE_STOPPED_OK: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.state_completed")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager.getString("label.state_completed")), + 60, 30); break; case STATE_CANCELLED_OK: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.state_job_cancelled")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager + .getString("label.state_job_cancelled")), + 60, 30); break; case STATE_STOPPED_ERROR: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.state_job_error")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager.getString("label.state_job_error")), + 60, 30); break; case STATE_STOPPED_SERVERERROR: - g.drawString(title.concat(" - ").concat(MessageManager.getString("label.server_error_try_later")), 60, 30); + g.drawString( + title.concat(" - ").concat( + MessageManager + .getString("label.server_error_try_later")), + 60, 30); break; } @@ -899,7 +919,8 @@ public class WebserviceInfo extends GWebserviceInfo implements final JPanel progressPanel = (JPanel) progressBars.get(new Long(id)); if (handler.canCancel()) { - JButton cancel = new JButton(MessageManager.getString("action.cancel")); + JButton cancel = new JButton( + MessageManager.getString("action.cancel")); final IProgressIndicator us = this; cancel.addActionListener(new ActionListener() { diff --git a/src/jalview/gui/WsJobParameters.java b/src/jalview/gui/WsJobParameters.java index 40bb5be..0c9937d 100644 --- a/src/jalview/gui/WsJobParameters.java +++ b/src/jalview/gui/WsJobParameters.java @@ -265,7 +265,8 @@ public class WsJobParameters extends JPanel implements ItemListener, } }); - updatepref = JvSwingUtils.makeButton(MessageManager.getString("action.update"), + updatepref = JvSwingUtils.makeButton( + MessageManager.getString("action.update"), MessageManager.getString("label.update_user_parameter_set"), new ActionListener() { @@ -275,7 +276,8 @@ public class WsJobParameters extends JPanel implements ItemListener, update_actionPerformed(e); } }); - deletepref = JvSwingUtils.makeButton(MessageManager.getString("action.delete"), + deletepref = JvSwingUtils.makeButton( + MessageManager.getString("action.delete"), MessageManager.getString("label.delete_user_parameter_set"), new ActionListener() { @@ -285,7 +287,8 @@ public class WsJobParameters extends JPanel implements ItemListener, delete_actionPerformed(e); } }); - createpref = JvSwingUtils.makeButton(MessageManager.getString("action.create"), + createpref = JvSwingUtils.makeButton( + MessageManager.getString("action.create"), MessageManager.getString("label.create_user_parameter_set"), new ActionListener() { @@ -295,8 +298,9 @@ public class WsJobParameters extends JPanel implements ItemListener, create_actionPerformed(e); } }); - revertpref = JvSwingUtils.makeButton(MessageManager.getString("action.revert"), - MessageManager.getString("label.revert_changes_user_parameter_set"), + revertpref = JvSwingUtils.makeButton(MessageManager + .getString("action.revert"), MessageManager + .getString("label.revert_changes_user_parameter_set"), new ActionListener() { @@ -305,16 +309,20 @@ public class WsJobParameters extends JPanel implements ItemListener, revert_actionPerformed(e); } }); - startjob = JvSwingUtils.makeButton(MessageManager.getString("action.start_job"), - MessageManager.getString("label.start_job_current_settings"), new ActionListener() + startjob = JvSwingUtils.makeButton( + MessageManager.getString("action.start_job"), + MessageManager.getString("label.start_job_current_settings"), + new ActionListener() { public void actionPerformed(ActionEvent e) { startjob_actionPerformed(e); } }); - canceljob = JvSwingUtils.makeButton(MessageManager.getString("action.cancel_job"), - MessageManager.getString("label.cancel_job_close_dialog"), new ActionListener() + canceljob = JvSwingUtils.makeButton( + MessageManager.getString("action.cancel_job"), + MessageManager.getString("label.cancel_job_close_dialog"), + new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -322,7 +330,8 @@ public class WsJobParameters extends JPanel implements ItemListener, } }); - setDetails.setBorder(new TitledBorder(MessageManager.getString("label.details"))); + setDetails.setBorder(new TitledBorder(MessageManager + .getString("label.details"))); setDetails.setLayout(new BorderLayout()); setDescr.setColumns(40); setDescr.setWrapStyleWord(true); @@ -330,7 +339,8 @@ public class WsJobParameters extends JPanel implements ItemListener, setDescr.setBackground(getBackground()); setDescr.setEditable(true); setDescr.getDocument().addDocumentListener(this); - setDescr.setToolTipText(MessageManager.getString("label.edit_notes_parameter_set")); + setDescr.setToolTipText(MessageManager + .getString("label.edit_notes_parameter_set")); JScrollPane setDescrView = new JScrollPane(); // setDescrView.setPreferredSize(new Dimension(350, 200)); setDescrView.getViewport().setView(setDescr); @@ -341,7 +351,8 @@ public class WsJobParameters extends JPanel implements ItemListener, GridBagLayout gbl = new GridBagLayout(); SetNamePanel.setLayout(gbl); - JLabel setNameLabel = new JLabel(MessageManager.getString("label.current_parameter_set_name")); + JLabel setNameLabel = new JLabel( + MessageManager.getString("label.current_parameter_set_name")); setNameLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); setNameInfo.add(setNameLabel); @@ -380,9 +391,11 @@ public class WsJobParameters extends JPanel implements ItemListener, // paramPane.setPreferredSize(new Dimension(360, 400)); // paramPane.setPreferredSize(null); - jobOptions.setBorder(new TitledBorder(MessageManager.getString("label.options"))); + jobOptions.setBorder(new TitledBorder(MessageManager + .getString("label.options"))); jobOptions.setOpaque(true); - paramList.setBorder(new TitledBorder(MessageManager.getString("label.parameters"))); + paramList.setBorder(new TitledBorder(MessageManager + .getString("label.parameters"))); paramList.setOpaque(true); JPanel bjo = new JPanel(new BorderLayout()), bjp = new JPanel( new BorderLayout()); @@ -570,17 +583,17 @@ public class WsJobParameters extends JPanel implements ItemListener, @SuppressWarnings("unchecked") private void updateTable(WsParamSetI p, List jobArgset) { - boolean setDefaultParams=false; + boolean setDefaultParams = false; if (lastParmSet == null) { isUserPreset = false; // First call - so provide Service default settings setName.setSelectedItem(lastSetName = SVC_DEF); } - if (p==null && SVC_DEF.equals(""+setName.getSelectedItem())) + if (p == null && SVC_DEF.equals("" + setName.getSelectedItem())) { // indicate that service defaults should be set if available - setDefaultParams=true; + setDefaultParams = true; } // populate table from default parameter set. List args = paramStore.getServiceParameters(); @@ -588,9 +601,9 @@ public class WsJobParameters extends JPanel implements ItemListener, // split to params and required arguments { int cw = 0; - boolean optset=false; + boolean optset = false; for (ArgumentI myarg : args) - { + { // Ideally, Argument would implement isRequired ! if (myarg instanceof ParameterI) { diff --git a/src/jalview/gui/WsPreferences.java b/src/jalview/gui/WsPreferences.java index 6e3da27..a85ebbf 100644 --- a/src/jalview/gui/WsPreferences.java +++ b/src/jalview/gui/WsPreferences.java @@ -449,7 +449,8 @@ public class WsPreferences extends GWsPreferences JTextField urltf = new JTextField(url, 40); JPanel panel = new JPanel(new BorderLayout()); JPanel pane12 = new JPanel(new BorderLayout()); - pane12.add(new JLabel(MessageManager.getString("label.url")), BorderLayout.CENTER); + pane12.add(new JLabel(MessageManager.getString("label.url")), + BorderLayout.CENTER); pane12.add(urltf, BorderLayout.EAST); panel.add(pane12, BorderLayout.NORTH); boolean valid = false; diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index bb90d2d..c3c86d6 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -68,8 +68,10 @@ public abstract class AlignFile extends FileParse */ public AlignFile() { - // Shouldn't we init data structures (JBPNote: not sure - initData is for initialising the structures used for reading from a datasource, and the bare constructor hasn't got any datasource) - initData(); + // Shouldn't we init data structures (JBPNote: not sure - initData is for + // initialising the structures used for reading from a datasource, and the + // bare constructor hasn't got any datasource) + initData(); } /** diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 668aa3c..7736332 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -134,8 +134,8 @@ public class AnnotationFile StringBuffer colours = new StringBuffer(); StringBuffer graphLine = new StringBuffer(); StringBuffer rowprops = new StringBuffer(); - Hashtable graphGroup = new Hashtable(); - Hashtable graphGroup_refs = new Hashtable(); + Hashtable graphGroup = new Hashtable(); + Hashtable graphGroup_refs = new Hashtable(); BitSet graphGroupSeen = new BitSet(); java.awt.Color color; @@ -144,16 +144,19 @@ public class AnnotationFile { row = annotations[i]; - if (!row.visible && !row.hasScore() && !(row.graphGroup>-1 && graphGroupSeen.get(row.graphGroup))) + if (!row.visible + && !row.hasScore() + && !(row.graphGroup > -1 && graphGroupSeen + .get(row.graphGroup))) { continue; } color = null; oneColour = true; - + // mark any sequence references for the row - writeSequence_Ref(refSeq ,row.sequenceRef); + writeSequence_Ref(refSeq, row.sequenceRef); refSeq = row.sequenceRef; // mark any group references for the row writeGroup_Ref(refGroup, row.groupRef); @@ -220,11 +223,12 @@ public class AnnotationFile if (graphGroup.containsKey(key)) { graphGroup.put(key, graphGroup.get(key) + "\t" + row.label); - + } else { - graphGroup_refs.put(key, new Object[] { refSeq, refGroup}); + graphGroup_refs.put(key, new Object[] + { refSeq, refGroup }); graphGroup.put(key, row.label); } } @@ -341,7 +345,8 @@ public class AnnotationFile rowprops.append(row.centreColLabels); rowprops.append(newline); } - if (graphLine.length()>0) { + if (graphLine.length() > 0) + { text.append(graphLine.toString()); graphLine.setLength(0); } @@ -354,22 +359,24 @@ public class AnnotationFile { SequenceI oldRefSeq = refSeq; SequenceGroup oldRefGroup = refGroup; - for (Map.Entry combine_statement:graphGroup.entrySet()) - { - Object[] seqRefAndGroup=graphGroup_refs.get(combine_statement.getKey()); - - writeSequence_Ref(refSeq, (SequenceI)seqRefAndGroup[0]); - refSeq = (SequenceI)seqRefAndGroup[0]; - - writeGroup_Ref(refGroup, (SequenceGroup)seqRefAndGroup[1]); - refGroup = (SequenceGroup)seqRefAndGroup[1]; + for (Map.Entry combine_statement : graphGroup + .entrySet()) + { + Object[] seqRefAndGroup = graphGroup_refs.get(combine_statement + .getKey()); + + writeSequence_Ref(refSeq, (SequenceI) seqRefAndGroup[0]); + refSeq = (SequenceI) seqRefAndGroup[0]; + + writeGroup_Ref(refGroup, (SequenceGroup) seqRefAndGroup[1]); + refGroup = (SequenceGroup) seqRefAndGroup[1]; text.append("COMBINE\t"); text.append(combine_statement.getValue()); text.append(newline); } writeSequence_Ref(refSeq, oldRefSeq); refSeq = oldRefSeq; - + writeGroup_Ref(refGroup, oldRefGroup); refGroup = oldRefGroup; } @@ -402,7 +409,8 @@ public class AnnotationFile return text.toString(); } - private Object writeGroup_Ref(SequenceGroup refGroup, SequenceGroup next_refGroup) + private Object writeGroup_Ref(SequenceGroup refGroup, + SequenceGroup next_refGroup) { if (next_refGroup == null) { @@ -427,13 +435,13 @@ public class AnnotationFile return true; } } - return false; + return false; } - + private boolean writeSequence_Ref(SequenceI refSeq, SequenceI next_refSeq) { - if (next_refSeq==null) + if (next_refSeq == null) { if (refSeq != null) { @@ -618,16 +626,22 @@ public class AnnotationFile { ex.printStackTrace(); System.out.println("Problem reading annotation file: " + ex); - if (nlinesread>0) { - System.out.println("Last read line "+nlinesread+": '"+lastread+"' (first 80 chars) ..."); + if (nlinesread > 0) + { + System.out.println("Last read line " + nlinesread + ": '" + + lastread + "' (first 80 chars) ..."); } return false; } return false; } - long nlinesread=0; - String lastread=""; - private static String GRAPHLINE="GRAPHLINE", COMBINE="COMBINE"; + + long nlinesread = 0; + + String lastread = ""; + + private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE"; + public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) throws Exception { @@ -678,7 +692,8 @@ public class AnnotationFile boolean jvAnnotationFile = false; while ((line = in.readLine()) != null) { - nlinesread++;lastread = new String(line); + nlinesread++; + lastread = new String(line); if (line.indexOf("#") == 0) { continue; @@ -699,7 +714,8 @@ public class AnnotationFile while ((line = in.readLine()) != null) { - nlinesread++;lastread = new String(line); + nlinesread++; + lastread = new String(line); if (line.indexOf("#") == 0 || line.indexOf("JALVIEW_ANNOTATION") > -1 || line.length() == 0) @@ -720,7 +736,8 @@ public class AnnotationFile else if (token.equalsIgnoreCase(COMBINE)) { // keep a record of current state and resolve groupRef at end - combineAnnotation_calls.add(new Object[] { st, refSeq, groupRef}); + combineAnnotation_calls.add(new Object[] + { st, refSeq, groupRef }); modified = true; continue; } @@ -733,7 +750,8 @@ public class AnnotationFile else if (token.equalsIgnoreCase(GRAPHLINE)) { // resolve at end - deferredAnnotation_calls.add(new Object[] { GRAPHLINE, st, refSeq, groupRef}); + deferredAnnotation_calls.add(new Object[] + { GRAPHLINE, st, refSeq, groupRef }); modified = true; continue; } @@ -793,7 +811,7 @@ public class AnnotationFile else if (token.equalsIgnoreCase("SEQUENCE_GROUP")) { addGroup(al, st); - modified=true; + modified = true; continue; } @@ -938,7 +956,7 @@ public class AnnotationFile modified = true; } // Resolve the groupRefs - Hashtable groupRefLookup=new Hashtable(); + Hashtable groupRefLookup = new Hashtable(); Enumeration en = groupRefRows.keys(); while (en.hasMoreElements()) @@ -962,7 +980,7 @@ public class AnnotationFile { matched = true; Vector rowset = (Vector) groupRefRows.get(groupRef); - groupRefLookup.put(groupRef, theGroup); + groupRefLookup.put(groupRef, theGroup); if (rowset != null && rowset.size() > 0) { AlignmentAnnotation alan = null; @@ -990,20 +1008,25 @@ public class AnnotationFile // group, or null ); } - } + } // finally, combine all the annotation rows within each context. /** - * number of combine statements in this annotation file. Used to create new groups for combined annotation graphs without disturbing existing ones + * number of combine statements in this annotation file. Used to create + * new groups for combined annotation graphs without disturbing existing + * ones */ int combinecount = 0; - for (Object[] _combine_args:combineAnnotation_calls) { - combineAnnotations(al, + for (Object[] _combine_args : combineAnnotation_calls) + { + combineAnnotations(al, ++combinecount, (StringTokenizer) _combine_args[0], // st (SequenceI) _combine_args[1], // refSeq - (_combine_args[2]==null) ? null : groupRefLookup.get((String)_combine_args[2]) // the reference group, or null - ); + (_combine_args[2] == null) ? null : groupRefLookup + .get((String) _combine_args[2]) // the reference group, + // or null + ); } } return modified; @@ -1161,31 +1184,35 @@ public class AnnotationFile } } - void combineAnnotations(AlignmentI al, int combineCount, StringTokenizer st, SequenceI seqRef, SequenceGroup groupRef) + void combineAnnotations(AlignmentI al, int combineCount, + StringTokenizer st, SequenceI seqRef, SequenceGroup groupRef) { String group = st.nextToken(); // First make sure we are not overwriting the graphIndex - int graphGroup=0; + int graphGroup = 0; if (al.getAlignmentAnnotation() != null) { for (int i = 0; i < al.getAlignmentAnnotation().length; i++) { AlignmentAnnotation aa = al.getAlignmentAnnotation()[i]; - - if (aa.graphGroup>graphGroup) + + if (aa.graphGroup > graphGroup) { // try to number graphGroups in order of occurence. - graphGroup=aa.graphGroup+1; + graphGroup = aa.graphGroup + 1; } - if (aa.sequenceRef==seqRef && aa.groupRef==groupRef && aa.label.equalsIgnoreCase(group)) + if (aa.sequenceRef == seqRef && aa.groupRef == groupRef + && aa.label.equalsIgnoreCase(group)) { - if (aa.graphGroup>-1) + if (aa.graphGroup > -1) { graphGroup = aa.graphGroup; - } else { + } + else + { if (graphGroup <= combineCount) { - graphGroup=combineCount+1; + graphGroup = combineCount + 1; } aa.graphGroup = graphGroup; } @@ -1200,7 +1227,8 @@ public class AnnotationFile for (int i = 0; i < al.getAlignmentAnnotation().length; i++) { AlignmentAnnotation aa = al.getAlignmentAnnotation()[i]; - if (aa.sequenceRef==seqRef && aa.groupRef==groupRef && aa.label.equalsIgnoreCase(group)) + if (aa.sequenceRef == seqRef && aa.groupRef == groupRef + && aa.label.equalsIgnoreCase(group)) { aa.graphGroup = graphGroup; break; @@ -1215,7 +1243,8 @@ public class AnnotationFile } } - void addLine(AlignmentI al, StringTokenizer st, SequenceI seqRef, SequenceGroup groupRef) + void addLine(AlignmentI al, StringTokenizer st, SequenceI seqRef, + SequenceGroup groupRef) { String group = st.nextToken(); AlignmentAnnotation annotation = null, alannot[] = al @@ -1232,7 +1261,9 @@ public class AnnotationFile { for (int i = 0; i < alannot.length; i++) { - if (alannot[i].label.equalsIgnoreCase(group) && (seqRef==null || alannot[i].sequenceRef==seqRef) && (groupRef==null || alannot[i].groupRef==groupRef)) + if (alannot[i].label.equalsIgnoreCase(group) + && (seqRef == null || alannot[i].sequenceRef == seqRef) + && (groupRef == null || alannot[i].groupRef == groupRef)) { alannot[i].setThreshold(new GraphLine(value, label, colour)); } diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index b22b8d3..d7da302 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -41,7 +41,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FORMATS = new String[] { "BLC", "CLUSTAL", "FASTA", "MSF", "PileUp", "PIR", "PFAM", "STH", - "PDB", "JnetFile" , "RNAML"}; // , "SimpleBLAST" }; + "PDB", "JnetFile", "RNAML" }; // , "SimpleBLAST" }; /** * List of valid format strings for use by callers of the formatSequences @@ -55,8 +55,8 @@ public class AppletFormatAdapter * that are writable by the application. */ public static final String[] WRITABLE_EXTENSIONS = new String[] - { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jvp", - "sto,stk", "jar" }; + { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", + "jvp", "sto,stk", "jar" }; /** * List of writable formats by the application. Order must correspond with the @@ -71,8 +71,8 @@ public class AppletFormatAdapter * corresponding to READABLE_FNAMES */ public static final String[] READABLE_EXTENSIONS = new String[] - { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar,jvp", - "sto,stk", "xml,rnaml" }; // ".blast" + { "fa, fasta, mfa, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", + "jar,jvp", "sto,stk", "xml,rnaml" }; // ".blast" /** * List of readable formats by application in order corresponding to @@ -80,7 +80,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_FNAMES = new String[] { "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "AMSA", "Jalview", - "Stockholm","RNAML" };// , + "Stockholm", "RNAML" };// , // "SimpleBLAST" // }; @@ -229,7 +229,7 @@ public class AppletFormatAdapter } else if (format.equals("PDB")) { - afile = new MCview.PDBfile(inFile, type); + afile = new MCview.PDBfile(inFile, type); // Uncomment to test Jmol data based PDB processing: JAL-1213 // afile = new jalview.ext.jmol.PDBFileWithJmol(inFile, type); } @@ -245,7 +245,7 @@ public class AppletFormatAdapter { afile = new RnamlFile(inFile, type); } - + Alignment al = new Alignment(afile.getSeqsAsArray()); afile.addAnnotations(al); @@ -467,7 +467,7 @@ public class AppletFormatAdapter { afile = new RnamlFile(); } - + else { throw new Exception( diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java index 9aff348..6e5de81 100755 --- a/src/jalview/io/FastaFile.java +++ b/src/jalview/io/FastaFile.java @@ -22,7 +22,6 @@ package jalview.io; import java.io.*; - import jalview.datamodel.*; /** @@ -79,7 +78,7 @@ public class FastaFile extends AlignFile StringBuffer sb = new StringBuffer(); boolean firstLine = true; - String line,uline; + String line, uline; Sequence seq = null; boolean annotation = false; @@ -141,23 +140,24 @@ public class FastaFile extends AlignFile seqs.addElement(seq); } } + private AlignmentAnnotation makeAnnotation(SequenceI seq, StringBuffer sb) { Annotation[] anots = new Annotation[sb.length()]; char cb; - for (int i=0;i 0)) { if (viewport != null) @@ -326,15 +326,19 @@ public class FileLoader implements Runnable alignFrame = new AlignFrame(al, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); - alignFrame.statusBar.setText(MessageManager.formatMessage("label.successfully_loaded_file", new String[]{title})); + alignFrame.statusBar.setText(MessageManager.formatMessage( + "label.successfully_loaded_file", new String[] + { title })); if (!protocol.equals(AppletFormatAdapter.PASTE)) alignFrame.setFileName(file, format); if (raiseGUI) { // add the window to the GUI - // note - this actually should happen regardless of raiseGUI status in Jalview 3 - // TODO: define 'virtual desktop' for benefit of headless scripts that perform queries to find the 'current working alignment' + // note - this actually should happen regardless of raiseGUI + // status in Jalview 3 + // TODO: define 'virtual desktop' for benefit of headless scripts + // that perform queries to find the 'current working alignment' Desktop.addInternalFrame(alignFrame, title, AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT); } @@ -364,7 +368,8 @@ public class FileLoader implements Runnable public void run() { JOptionPane.showInternalMessageDialog(Desktop.desktop, - errorMessage, MessageManager.getString("label.error_loading_file"), + errorMessage, MessageManager + .getString("label.error_loading_file"), JOptionPane.WARNING_MESSAGE); } }); @@ -389,8 +394,10 @@ public class FileLoader implements Runnable public void run() { javax.swing.JOptionPane.showInternalMessageDialog( - Desktop.desktop, MessageManager.formatMessage("label.problems_opening_file", new String[]{file}), - MessageManager.getString("label.file_open_error"), + Desktop.desktop, MessageManager.formatMessage( + "label.problems_opening_file", new String[] + { file }), MessageManager + .getString("label.file_open_error"), javax.swing.JOptionPane.WARNING_MESSAGE); } }); diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index ed9fb7e..d20b468 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -160,43 +160,53 @@ public class FileParse } ; } - + dataIn = new BufferedReader(new FileReader(fileStr)); dataName = fileStr; } return error; } - private BufferedReader tryAsGzipSource(InputStream inputStream) throws Exception + + private BufferedReader tryAsGzipSource(InputStream inputStream) + throws Exception { - BufferedReader inData = new BufferedReader(new InputStreamReader(new GZIPInputStream(inputStream))); + BufferedReader inData = new BufferedReader(new InputStreamReader( + new GZIPInputStream(inputStream))); inData.mark(2048); inData.read(); inData.reset(); return inData; } + private boolean checkURLSource(String fileStr) throws IOException, MalformedURLException { errormessage = "URL NOT FOUND"; URL url = new URL(fileStr); // - // GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via Kenny Sabir - Exception e=null; - if (fileStr.toLowerCase().endsWith(".gz")) { - try { - InputStream inputStream = url.openStream(); - dataIn = tryAsGzipSource(inputStream); - dataName = fileStr; - return false; - } catch (Exception ex) { - e=ex; + // GZIPInputStream code borrowed from Aquaria (soon to be open sourced) via + // Kenny Sabir + Exception e = null; + if (fileStr.toLowerCase().endsWith(".gz")) + { + try + { + InputStream inputStream = url.openStream(); + dataIn = tryAsGzipSource(inputStream); + dataName = fileStr; + return false; + } catch (Exception ex) + { + e = ex; } } - try { + try + { dataIn = new BufferedReader(new InputStreamReader(url.openStream())); - } catch (IOException q) { - if (e!=null) + } catch (IOException q) + { + if (e != null) { throw new IOException("Failed to resolve GZIP stream", e); } diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 13dbb95..9913428 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -199,7 +199,8 @@ public class FormatAdapter extends AppletFormatAdapter { // TODO consider using AlignmentView to prune to visible region // TODO prune sequence annotation and groups to visible region - // TODO: JAL-1486 - set start and end for output correctly. basically, AlignmentView.getVisibleContigs does this. + // TODO: JAL-1486 - set start and end for output correctly. basically, + // AlignmentView.getVisibleContigs does this. Alignment alv = new Alignment(replaceStrings( alignment.getSequencesArray(), omitHidden)); AlignmentAnnotation[] ala = alignment.getAlignmentAnnotation(); diff --git a/src/jalview/io/IdentifyFile.java b/src/jalview/io/IdentifyFile.java index 2629896..08d4dca 100755 --- a/src/jalview/io/IdentifyFile.java +++ b/src/jalview/io/IdentifyFile.java @@ -134,11 +134,11 @@ public class IdentifyFile break; } - + if ((data.indexOf("<") > -1)) { reply = "RNAML"; - + break; } @@ -169,8 +169,7 @@ public class IdentifyFile break; } - - + else if (data.indexOf(">") > -1) { // FASTA, PIR file or BLC file @@ -199,13 +198,16 @@ public class IdentifyFile starterm = (data1 != null && data1.indexOf("*") > -1) || (data2 != null && data2.indexOf("*") > -1); } - if (data2 != null && (c1=data.indexOf("*")) > -1) + if (data2 != null && (c1 = data.indexOf("*")) > -1) { - if (c1==0 && c1 == data2.indexOf("*")) + if (c1 == 0 && c1 == data2.indexOf("*")) { reply = "BLC"; - } else { - reply = "FASTA"; // possibly a bad choice - may be recognised as PIR + } + else + { + reply = "FASTA"; // possibly a bad choice - may be recognised as + // PIR } // otherwise can still possibly be a PIR file } diff --git a/src/jalview/io/InputStreamParser.java b/src/jalview/io/InputStreamParser.java index e2d39f2..b5b5671 100644 --- a/src/jalview/io/InputStreamParser.java +++ b/src/jalview/io/InputStreamParser.java @@ -35,18 +35,18 @@ public class InputStreamParser extends FileParse super(); setDataName(dataName); dataIn = new BufferedReader(new InputStreamReader(is)); - error=false; + error = false; } + public InputStreamParser(Reader isreader, String dataName) throws IOException { super(); setDataName(dataName); dataIn = new BufferedReader(isreader); - error=false; + error = false; } - @Override protected void finalize() throws Throwable { diff --git a/src/jalview/io/JPredFile.java b/src/jalview/io/JPredFile.java index c2bbe9e..0b3cd13 100755 --- a/src/jalview/io/JPredFile.java +++ b/src/jalview/io/JPredFile.java @@ -351,7 +351,7 @@ public class JPredFile extends AlignFile * @param args * DOCUMENT ME! */ - public static void main(String[] args) + public static void main(String[] args) { try { diff --git a/src/jalview/io/JalviewFileView.java b/src/jalview/io/JalviewFileView.java index 6df223a..65581c3 100755 --- a/src/jalview/io/JalviewFileView.java +++ b/src/jalview/io/JalviewFileView.java @@ -32,7 +32,8 @@ public class JalviewFileView extends FileView static { - // TODO: these names should come from the FormatAdapter lists for readable/writable extensions + // TODO: these names should come from the FormatAdapter lists for + // readable/writable extensions alignSuffix.put("amsa", "AMSA file"); alignSuffix.put("fasta", "Fasta file"); alignSuffix.put("fa", "Fasta file"); diff --git a/src/jalview/io/NewickFile.java b/src/jalview/io/NewickFile.java index b4f3a33..9c91c13 100755 --- a/src/jalview/io/NewickFile.java +++ b/src/jalview/io/NewickFile.java @@ -295,7 +295,7 @@ public class NewickFile extends FileParse int nextcp = 0; int ncp = cp; - boolean parsednodename=false; + boolean parsednodename = false; while (majorsyms.searchFrom(nf, cp) && (Error == null)) { int fcp = majorsyms.matchedFrom(); @@ -361,12 +361,13 @@ public class NewickFile extends FileParse nodename = new String(qnodename.stringMatched().substring(1, nl - 1)); // unpack any escaped colons - com.stevesoft.pat.Regex xpandquotes = com.stevesoft.pat.Regex.perlCode("s/''/'/"); + com.stevesoft.pat.Regex xpandquotes = com.stevesoft.pat.Regex + .perlCode("s/''/'/"); String widernodename = xpandquotes.replaceAll(nodename); - nodename=widernodename; + nodename = widernodename; // jump to after end of quoted nodename nextcp = fcp + nl + 1; - parsednodename=true; + parsednodename = true; } else { @@ -435,7 +436,8 @@ public class NewickFile extends FileParse com.stevesoft.pat.Regex ndist = new com.stevesoft.pat.Regex( ":([-0-9Ee.+]+)"); - if (!parsednodename && uqnodename.search(fstring) + if (!parsednodename + && uqnodename.search(fstring) && ((uqnodename.matchedFrom(1) == 0) || (fstring .charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote // HACK! @@ -594,7 +596,7 @@ public class NewickFile extends FileParse distance = DefDistance; bootstrap = DefBootstrap; commentString2 = null; - parsednodename=false; + parsednodename = false; } if (nextcp == 0) { diff --git a/src/jalview/io/PfamFile.java b/src/jalview/io/PfamFile.java index a7faacb..361b47f 100755 --- a/src/jalview/io/PfamFile.java +++ b/src/jalview/io/PfamFile.java @@ -23,7 +23,6 @@ package jalview.io; import java.io.*; import java.util.*; - import jalview.datamodel.*; import jalview.util.*; diff --git a/src/jalview/io/PileUpfile.java b/src/jalview/io/PileUpfile.java index 6294312..2a902b4 100755 --- a/src/jalview/io/PileUpfile.java +++ b/src/jalview/io/PileUpfile.java @@ -60,7 +60,6 @@ public class PileUpfile extends MSFfile * * @throws IOException * DOCUMENT ME! - */ public PileUpfile(String inFile, String type) throws IOException { diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java index 24bb521..9d21a40 100644 --- a/src/jalview/io/StockholmFile.java +++ b/src/jalview/io/StockholmFile.java @@ -62,7 +62,8 @@ import fr.orsay.lri.varna.models.rna.RNA; * * @author bsb at sanger.ac.uk * @author Natasha Shersnev (Dundee, UK) (Stockholm file writer) - * @author Lauren Lui (UCSC, USA) (RNA secondary structure annotation import as stockholm) + * @author Lauren Lui (UCSC, USA) (RNA secondary structure annotation import as + * stockholm) * @author Anne Menard (Paris, FR) (VARNA parsing of Stockholm file data) * @version 0.3 + jalview mods * @@ -71,6 +72,7 @@ public class StockholmFile extends AlignFile { // static Logger logger = Logger.getLogger("jalview.io.StockholmFile"); protected ArrayList result; + StringBuffer out; // output buffer AlignmentI al; @@ -101,6 +103,7 @@ public class StockholmFile extends AlignFile { super.initData(); } + /** * Parse a file in Stockholm format into Jalview's data model using VARNA * @@ -126,7 +129,7 @@ public class StockholmFile extends AlignFile // DEBUG System.out.println("this is the secondary scructure:" // +result.size()); SequenceI[] seqs = new SequenceI[result.size()]; - String id=null; + String id = null; for (int i = 0; i < result.size(); i++) { // DEBUG System.err.println("Processing i'th sequence in Stockholm file") @@ -166,7 +169,6 @@ public class StockholmFile extends AlignFile } - /** * Parse a file in Stockholm format into Jalview's data model. The file has to * be passed at construction time @@ -176,71 +178,70 @@ public class StockholmFile extends AlignFile */ public void parse() throws IOException { - StringBuffer treeString = new StringBuffer(); - String treeName = null; - // --------------- Variable Definitions ------------------- - String line; - String version; + StringBuffer treeString = new StringBuffer(); + String treeName = null; + // --------------- Variable Definitions ------------------- + String line; + String version; // String id; - Hashtable seqAnn = new Hashtable(); // Sequence related annotations - Hashtable seqs = new Hashtable(); - Regex p, r, rend, s, x; - // Temporary line for processing RNA annotation - // String RNAannot = ""; - - // ------------------ Parsing File ---------------------- - // First, we have to check that this file has STOCKHOLM format, i.e. the - // first line must match - - - r = new Regex("# STOCKHOLM ([\\d\\.]+)"); - if (!r.search(nextLine())) - { - throw new IOException( - "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'"); - } - else - { - version = r.stringMatched(1); - - // logger.debug("Stockholm version: " + version); - } - - // We define some Regexes here that will be used regularily later - rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment - p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in - // id/from/to - s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype - r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line - x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence - - // Convert all bracket types to parentheses (necessary for passing to VARNA) - Regex openparen = new Regex("(<|\\[)", "("); - Regex closeparen = new Regex("(>|\\])", ")"); - - // Detect if file is RNA by looking for bracket types - Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); - - rend.optimize(); - p.optimize(); - s.optimize(); - r.optimize(); - x.optimize(); - openparen.optimize(); - closeparen.optimize(); - - while ((line = nextLine()) != null) - { - if (line.length() == 0) - { - continue; - } - if (rend.search(line)) - { - // End of the alignment, pass stuff back + Hashtable seqAnn = new Hashtable(); // Sequence related annotations + Hashtable seqs = new Hashtable(); + Regex p, r, rend, s, x; + // Temporary line for processing RNA annotation + // String RNAannot = ""; + + // ------------------ Parsing File ---------------------- + // First, we have to check that this file has STOCKHOLM format, i.e. the + // first line must match + + r = new Regex("# STOCKHOLM ([\\d\\.]+)"); + if (!r.search(nextLine())) + { + throw new IOException( + "This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'"); + } + else + { + version = r.stringMatched(1); + + // logger.debug("Stockholm version: " + version); + } + + // We define some Regexes here that will be used regularily later + rend = new Regex("^\\s*\\/\\/"); // Find the end of an alignment + p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in + // id/from/to + s = new Regex("(\\S+)\\s+(\\S*)\\s+(.*)"); // Parses annotation subtype + r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line + x = new Regex("(\\S+)\\s+(\\S+)"); // split id from sequence + + // Convert all bracket types to parentheses (necessary for passing to VARNA) + Regex openparen = new Regex("(<|\\[)", "("); + Regex closeparen = new Regex("(>|\\])", ")"); + + // Detect if file is RNA by looking for bracket types + Regex detectbrackets = new Regex("(<|>|\\[|\\]|\\(|\\))"); + + rend.optimize(); + p.optimize(); + s.optimize(); + r.optimize(); + x.optimize(); + openparen.optimize(); + closeparen.optimize(); + + while ((line = nextLine()) != null) + { + if (line.length() == 0) + { + continue; + } + if (rend.search(line)) + { + // End of the alignment, pass stuff back this.noSeqs = seqs.size(); - - String seqdb,dbsource = null; + + String seqdb, dbsource = null; Regex pf = new Regex("PF[0-9]{5}(.*)"); // Finds AC for Pfam Regex rf = new Regex("RF[0-9]{5}(.*)"); // Finds AC for Rfam if (getAlignmentProperty("AC") != null) @@ -256,59 +257,59 @@ public class StockholmFile extends AlignFile dbsource = "RFAM"; } } - // logger.debug("Number of sequences: " + this.noSeqs); - Enumeration accs = seqs.keys(); - while (accs.hasMoreElements()) - { - String acc = (String) accs.nextElement(); - // logger.debug("Processing sequence " + acc); - String seq = (String) seqs.remove(acc); - if (maxLength < seq.length()) - { - maxLength = seq.length(); - } - int start = 1; - int end = -1; - String sid = acc; - /* + // logger.debug("Number of sequences: " + this.noSeqs); + Enumeration accs = seqs.keys(); + while (accs.hasMoreElements()) + { + String acc = (String) accs.nextElement(); + // logger.debug("Processing sequence " + acc); + String seq = (String) seqs.remove(acc); + if (maxLength < seq.length()) + { + maxLength = seq.length(); + } + int start = 1; + int end = -1; + String sid = acc; + /* * Retrieve hash of annotations for this accession Associate * Annotation with accession - */ - Hashtable accAnnotations = null; - - if (seqAnn != null && seqAnn.containsKey(acc)) - { - accAnnotations = (Hashtable) seqAnn.remove(acc); - //TODO: add structures to sequence - } - - // Split accession in id and from/to - if (p.search(acc)) - { - sid = p.stringMatched(1); - start = Integer.parseInt(p.stringMatched(2)); - end = Integer.parseInt(p.stringMatched(3)); - } - // logger.debug(sid + ", " + start + ", " + end); - - Sequence seqO = new Sequence(sid, seq, start, end); - // Add Description (if any) - if (accAnnotations != null && accAnnotations.containsKey("DE")) - { - String desc = (String) accAnnotations.get("DE"); - seqO.setDescription((desc == null) ? "" : desc); - } - // Add DB References (if any) - if (accAnnotations != null && accAnnotations.containsKey("DR")) - { - String dbr = (String) accAnnotations.get("DR"); - if (dbr != null && dbr.indexOf(";") > -1) - { - String src = dbr.substring(0, dbr.indexOf(";")); - String acn = dbr.substring(dbr.indexOf(";") + 1); - jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); - } - } + */ + Hashtable accAnnotations = null; + + if (seqAnn != null && seqAnn.containsKey(acc)) + { + accAnnotations = (Hashtable) seqAnn.remove(acc); + // TODO: add structures to sequence + } + + // Split accession in id and from/to + if (p.search(acc)) + { + sid = p.stringMatched(1); + start = Integer.parseInt(p.stringMatched(2)); + end = Integer.parseInt(p.stringMatched(3)); + } + // logger.debug(sid + ", " + start + ", " + end); + + Sequence seqO = new Sequence(sid, seq, start, end); + // Add Description (if any) + if (accAnnotations != null && accAnnotations.containsKey("DE")) + { + String desc = (String) accAnnotations.get("DE"); + seqO.setDescription((desc == null) ? "" : desc); + } + // Add DB References (if any) + if (accAnnotations != null && accAnnotations.containsKey("DR")) + { + String dbr = (String) accAnnotations.get("DR"); + if (dbr != null && dbr.indexOf(";") > -1) + { + String src = dbr.substring(0, dbr.indexOf(";")); + String acn = dbr.substring(dbr.indexOf(";") + 1); + jalview.util.DBRefUtils.parseToDbRef(seqO, src, "0", acn); + } + } if (accAnnotations != null && accAnnotations.containsKey("AC")) { @@ -316,39 +317,42 @@ public class StockholmFile extends AlignFile { String dbr = (String) accAnnotations.get("AC"); if (dbr != null) - { - // we could get very clever here - but for now - just try to guess accession type from source of alignment plus structure of accession + { + // we could get very clever here - but for now - just try to + // guess accession type from source of alignment plus structure + // of accession guessDatabaseFor(seqO, dbr, dbsource); - - } - } - // else - do what ? add the data anyway and prompt the user to specify what references these are ? + + } + } + // else - do what ? add the data anyway and prompt the user to + // specify what references these are ? } - - Hashtable features = null; - // We need to adjust the positions of all features to account for gaps - try - { - features = (Hashtable) accAnnotations.remove("features"); - } catch (java.lang.NullPointerException e) - { - // loggerwarn("Getting Features for " + acc + ": " + - // e.getMessage()); - // continue; - } - // if we have features - if (features != null) - { - int posmap[] = seqO.findPositionMap(); - Enumeration i = features.keys(); - while (i.hasMoreElements()) - { - // TODO: parse out secondary structure annotation as annotation - // row - // TODO: parse out scores as annotation row - // TODO: map coding region to core jalview feature types - String type = i.nextElement().toString(); - Hashtable content = (Hashtable) features.remove(type); + + Hashtable features = null; + // We need to adjust the positions of all features to account for gaps + try + { + features = (Hashtable) accAnnotations.remove("features"); + } catch (java.lang.NullPointerException e) + { + // loggerwarn("Getting Features for " + acc + ": " + + // e.getMessage()); + // continue; + } + // if we have features + if (features != null) + { + int posmap[] = seqO.findPositionMap(); + Enumeration i = features.keys(); + while (i.hasMoreElements()) + { + // TODO: parse out secondary structure annotation as annotation + // row + // TODO: parse out scores as annotation row + // TODO: map coding region to core jalview feature types + String type = i.nextElement().toString(); + Hashtable content = (Hashtable) features.remove(type); // add alignment annotation for this feature String key = type2id(type); @@ -367,338 +371,347 @@ public class StockholmFile extends AlignFile } } - Enumeration j = content.keys(); - while (j.hasMoreElements()) - { - String desc = j.nextElement().toString(); - String ns = content.get(desc).toString(); - char[] byChar = ns.toCharArray(); - for (int k = 0; k < byChar.length; k++) - { - char c = byChar[k]; - if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM - // uses - // '.' - // for - // feature - // background - { - int new_pos = posmap[k]; // look up nearest seqeunce - // position to this column - SequenceFeature feat = new SequenceFeature(type, desc, - new_pos, new_pos, 0f, null); - - seqO.addSequenceFeature(feat); - } - } - } - - } - - } - // garbage collect - - // logger.debug("Adding seq " + acc + " from " + start + " to " + end - // + ": " + seq); - this.seqs.addElement(seqO); - } - return; // finished parsing this segment of source - } - else if (!r.search(line)) - { - // System.err.println("Found sequence line: " + line); - - // Split sequence in sequence and accession parts - if (!x.search(line)) - { - // logger.error("Could not parse sequence line: " + line); - throw new IOException("Could not parse sequence line: " + line); - } - String ns = (String) seqs.get(x.stringMatched(1)); - if (ns == null) - { - ns = ""; - } - ns += x.stringMatched(2); - - seqs.put(x.stringMatched(1), ns); - } - else - { - String annType = r.stringMatched(1); - String annContent = r.stringMatched(2); - - // System.err.println("type:" + annType + " content: " + annContent); - - if (annType.equals("GF")) - { - /* - * Generic per-File annotation, free text Magic features: #=GF NH - * #=GF TN Pfam descriptions: 7. DESCRIPTION OF FIELDS - * - * Compulsory fields: ------------------ - * - * AC Accession number: Accession number in form PFxxxxx.version or - * PBxxxxxx. ID Identification: One word name for family. DE - * Definition: Short description of family. AU Author: Authors of the - * entry. SE Source of seed: The source suggesting the seed members - * belong to one family. GA Gathering method: Search threshold to - * build the full alignment. TC Trusted Cutoff: Lowest sequence score - * and domain score of match in the full alignment. NC Noise Cutoff: - * Highest sequence score and domain score of match not in full - * alignment. TP Type: Type of family -- presently Family, Domain, - * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM - * Alignment Method The order ls and fs hits are aligned to the model - * to build the full align. // End of alignment. - * - * Optional fields: ---------------- - * - * DC Database Comment: Comment about database reference. DR Database - * Reference: Reference to external database. RC Reference Comment: - * Comment about literature reference. RN Reference Number: Reference - * Number. RM Reference Medline: Eight digit medline UI number. RT - * Reference Title: Reference Title. RA Reference Author: Reference - * Author RL Reference Location: Journal location. PI Previous - * identifier: Record of all previous ID lines. KW Keywords: Keywords. - * CC Comment: Comments. NE Pfam accession: Indicates a nested domain. - * NL Location: Location of nested domains - sequence ID, start and - * end of insert. - * - * Obsolete fields: ----------- AL Alignment method of seed: The - * method used to align the seed members. - */ - // Let's save the annotations, maybe we'll be able to do something - // with them later... - Regex an = new Regex("(\\w+)\\s*(.*)"); - if (an.search(annContent)) - { - if (an.stringMatched(1).equals("NH")) - { - treeString.append(an.stringMatched(2)); - } - else if (an.stringMatched(1).equals("TN")) - { - if (treeString.length() > 0) - { - if (treeName == null) - { - treeName = "Tree " + (getTreeCount() + 1); - } - addNewickTree(treeName, treeString.toString()); - } - treeName = an.stringMatched(2); - treeString = new StringBuffer(); - } - setAlignmentProperty(an.stringMatched(1), an.stringMatched(2)); - } - } - else if (annType.equals("GS")) - { - // Generic per-Sequence annotation, free text - /* - * Pfam uses these features: Feature Description --------------------- - * ----------- AC ACcession number DE - * DEscription DR ; ; Database Reference OS - * OrganiSm (species) OC Organism Classification (clade, etc.) - * LO Look (Color, etc.) - */ - if (s.search(annContent)) - { - String acc = s.stringMatched(1); - String type = s.stringMatched(2); - String content = s.stringMatched(3); - // TODO: store DR in a vector. - // TODO: store AC according to generic file db annotation. - Hashtable ann; - if (seqAnn.containsKey(acc)) - { - ann = (Hashtable) seqAnn.get(acc); - } - else - { - ann = new Hashtable(); - } - ann.put(type, content); - seqAnn.put(acc, ann); - } - else - { - throw new IOException("Error parsing " + line); - } - } - else if (annType.equals("GC")) - { - // Generic per-Column annotation, exactly 1 char per column - // always need a label. - if (x.search(annContent)) - { - // parse out and create alignment annotation directly. - parseAnnotationRow(annotations, x.stringMatched(1), - x.stringMatched(2)); - } - } - else if (annType.equals("GR")) - { - // Generic per-Sequence AND per-Column markup, exactly 1 char per - // column - /* - * Feature Description Markup letters ------- ----------- - * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface - * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane - * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15; - * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in - * or after) [0-2] - */ - if (s.search(annContent)) - { - String acc = s.stringMatched(1); - String type = s.stringMatched(2); - String seq = new String(s.stringMatched(3)); - String description = null; - // Check for additional information about the current annotation - // We use a simple string tokenizer here for speed - StringTokenizer sep = new StringTokenizer(seq, " \t"); - description = sep.nextToken(); - if (sep.hasMoreTokens()) - { - seq = sep.nextToken(); - } - else - { - seq = description; - description = new String(); - } - // sequence id with from-to fields - - Hashtable ann; - // Get an object with all the annotations for this sequence - if (seqAnn.containsKey(acc)) - { - // logger.debug("Found annotations for " + acc); - ann = (Hashtable) seqAnn.get(acc); - } - else - { - // logger.debug("Creating new annotations holder for " + acc); - ann = new Hashtable(); - seqAnn.put(acc, ann); - } + Enumeration j = content.keys(); + while (j.hasMoreElements()) + { + String desc = j.nextElement().toString(); + String ns = content.get(desc).toString(); + char[] byChar = ns.toCharArray(); + for (int k = 0; k < byChar.length; k++) + { + char c = byChar[k]; + if (!(c == ' ' || c == '_' || c == '-' || c == '.')) // PFAM + // uses + // '.' + // for + // feature + // background + { + int new_pos = posmap[k]; // look up nearest seqeunce + // position to this column + SequenceFeature feat = new SequenceFeature(type, desc, + new_pos, new_pos, 0f, null); + + seqO.addSequenceFeature(feat); + } + } + } + + } + + } + // garbage collect + + // logger.debug("Adding seq " + acc + " from " + start + " to " + end + // + ": " + seq); + this.seqs.addElement(seqO); + } + return; // finished parsing this segment of source + } + else if (!r.search(line)) + { + // System.err.println("Found sequence line: " + line); + + // Split sequence in sequence and accession parts + if (!x.search(line)) + { + // logger.error("Could not parse sequence line: " + line); + throw new IOException("Could not parse sequence line: " + line); + } + String ns = (String) seqs.get(x.stringMatched(1)); + if (ns == null) + { + ns = ""; + } + ns += x.stringMatched(2); + + seqs.put(x.stringMatched(1), ns); + } + else + { + String annType = r.stringMatched(1); + String annContent = r.stringMatched(2); + + // System.err.println("type:" + annType + " content: " + annContent); + + if (annType.equals("GF")) + { + /* + * Generic per-File annotation, free text Magic features: #=GF NH + * #=GF TN Pfam descriptions: 7. DESCRIPTION OF FIELDS + * + * Compulsory fields: ------------------ + * + * AC Accession number: Accession number in form PFxxxxx.version or + * PBxxxxxx. ID Identification: One word name for family. DE + * Definition: Short description of family. AU Author: Authors of the + * entry. SE Source of seed: The source suggesting the seed members + * belong to one family. GA Gathering method: Search threshold to + * build the full alignment. TC Trusted Cutoff: Lowest sequence score + * and domain score of match in the full alignment. NC Noise Cutoff: + * Highest sequence score and domain score of match not in full + * alignment. TP Type: Type of family -- presently Family, Domain, + * Motif or Repeat. SQ Sequence: Number of sequences in alignment. AM + * Alignment Method The order ls and fs hits are aligned to the model + * to build the full align. // End of alignment. + * + * Optional fields: ---------------- + * + * DC Database Comment: Comment about database reference. DR Database + * Reference: Reference to external database. RC Reference Comment: + * Comment about literature reference. RN Reference Number: Reference + * Number. RM Reference Medline: Eight digit medline UI number. RT + * Reference Title: Reference Title. RA Reference Author: Reference + * Author RL Reference Location: Journal location. PI Previous + * identifier: Record of all previous ID lines. KW Keywords: Keywords. + * CC Comment: Comments. NE Pfam accession: Indicates a nested domain. + * NL Location: Location of nested domains - sequence ID, start and + * end of insert. + * + * Obsolete fields: ----------- AL Alignment method of seed: The + * method used to align the seed members. + */ + // Let's save the annotations, maybe we'll be able to do something + // with them later... + Regex an = new Regex("(\\w+)\\s*(.*)"); + if (an.search(annContent)) + { + if (an.stringMatched(1).equals("NH")) + { + treeString.append(an.stringMatched(2)); + } + else if (an.stringMatched(1).equals("TN")) + { + if (treeString.length() > 0) + { + if (treeName == null) + { + treeName = "Tree " + (getTreeCount() + 1); + } + addNewickTree(treeName, treeString.toString()); + } + treeName = an.stringMatched(2); + treeString = new StringBuffer(); + } + setAlignmentProperty(an.stringMatched(1), an.stringMatched(2)); + } + } + else if (annType.equals("GS")) + { + // Generic per-Sequence annotation, free text + /* + * Pfam uses these features: Feature Description --------------------- + * ----------- AC ACcession number DE + * DEscription DR ; ; Database Reference OS + * OrganiSm (species) OC Organism Classification (clade, etc.) + * LO Look (Color, etc.) + */ + if (s.search(annContent)) + { + String acc = s.stringMatched(1); + String type = s.stringMatched(2); + String content = s.stringMatched(3); + // TODO: store DR in a vector. + // TODO: store AC according to generic file db annotation. + Hashtable ann; + if (seqAnn.containsKey(acc)) + { + ann = (Hashtable) seqAnn.get(acc); + } + else + { + ann = new Hashtable(); + } + ann.put(type, content); + seqAnn.put(acc, ann); + } + else + { + throw new IOException("Error parsing " + line); + } + } + else if (annType.equals("GC")) + { + // Generic per-Column annotation, exactly 1 char per column + // always need a label. + if (x.search(annContent)) + { + // parse out and create alignment annotation directly. + parseAnnotationRow(annotations, x.stringMatched(1), + x.stringMatched(2)); + } + } + else if (annType.equals("GR")) + { + // Generic per-Sequence AND per-Column markup, exactly 1 char per + // column + /* + * Feature Description Markup letters ------- ----------- + * -------------- SS Secondary Structure [HGIEBTSCX] SA Surface + * Accessibility [0-9X] (0=0%-10%; ...; 9=90%-100%) TM TransMembrane + * [Mio] PP Posterior Probability [0-9*] (0=0.00-0.05; 1=0.05-0.15; + * *=0.95-1.00) LI LIgand binding [*] AS Active Site [*] IN INtron (in + * or after) [0-2] + */ + if (s.search(annContent)) + { + String acc = s.stringMatched(1); + String type = s.stringMatched(2); + String seq = new String(s.stringMatched(3)); + String description = null; + // Check for additional information about the current annotation + // We use a simple string tokenizer here for speed + StringTokenizer sep = new StringTokenizer(seq, " \t"); + description = sep.nextToken(); + if (sep.hasMoreTokens()) + { + seq = sep.nextToken(); + } + else + { + seq = description; + description = new String(); + } + // sequence id with from-to fields + + Hashtable ann; + // Get an object with all the annotations for this sequence + if (seqAnn.containsKey(acc)) + { + // logger.debug("Found annotations for " + acc); + ann = (Hashtable) seqAnn.get(acc); + } + else + { + // logger.debug("Creating new annotations holder for " + acc); + ann = new Hashtable(); + seqAnn.put(acc, ann); + } // TODO test structure, call parseAnnotationRow with vector from // hashtable for specific sequence - Hashtable features; - // Get an object with all the content for an annotation - if (ann.containsKey("features")) - { - // logger.debug("Found features for " + acc); - features = (Hashtable) ann.get("features"); - } - else - { - // logger.debug("Creating new features holder for " + acc); - features = new Hashtable(); - ann.put("features", features); - } - - Hashtable content; - if (features.containsKey(this.id2type(type))) - { - // logger.debug("Found content for " + this.id2type(type)); - content = (Hashtable) features.get(this.id2type(type)); - } - else - { - // logger.debug("Creating new content holder for " + - // this.id2type(type)); - content = new Hashtable(); - features.put(this.id2type(type), content); - } - String ns = (String) content.get(description); - if (ns == null) - { - ns = ""; - } - ns += seq; - content.put(description, ns); - -// if(type.equals("SS")){ - Hashtable strucAnn; - if (seqAnn.containsKey(acc)) - { - strucAnn = (Hashtable) seqAnn.get(acc); - } - else - { - strucAnn = new Hashtable(); - } - - Vector newStruc=new Vector(); - parseAnnotationRow(newStruc, type,ns); - - strucAnn.put(type, newStruc); - seqAnn.put(acc, strucAnn); - } -// } - else - { - System.err - .println("Warning - couldn't parse sequence annotation row line:\n" - + line); - // throw new IOException("Error parsing " + line); - } - } - else - { - throw new IOException("Unknown annotation detected: " + annType - + " " + annContent); - } - } - } - if (treeString.length() > 0) - { - if (treeName == null) - { - treeName = "Tree " + (1 + getTreeCount()); - } - addNewickTree(treeName, treeString.toString()); - } - } + Hashtable features; + // Get an object with all the content for an annotation + if (ann.containsKey("features")) + { + // logger.debug("Found features for " + acc); + features = (Hashtable) ann.get("features"); + } + else + { + // logger.debug("Creating new features holder for " + acc); + features = new Hashtable(); + ann.put("features", features); + } -/** - * Demangle an accession string and guess the originating sequence database for a given sequence - * @param seqO sequence to be annotated - * @param dbr Accession string for sequence - * @param dbsource source database for alignment (PFAM or RFAM) + Hashtable content; + if (features.containsKey(this.id2type(type))) + { + // logger.debug("Found content for " + this.id2type(type)); + content = (Hashtable) features.get(this.id2type(type)); + } + else + { + // logger.debug("Creating new content holder for " + + // this.id2type(type)); + content = new Hashtable(); + features.put(this.id2type(type), content); + } + String ns = (String) content.get(description); + if (ns == null) + { + ns = ""; + } + ns += seq; + content.put(description, ns); + + // if(type.equals("SS")){ + Hashtable strucAnn; + if (seqAnn.containsKey(acc)) + { + strucAnn = (Hashtable) seqAnn.get(acc); + } + else + { + strucAnn = new Hashtable(); + } + + Vector newStruc = new Vector(); + parseAnnotationRow(newStruc, type, ns); + + strucAnn.put(type, newStruc); + seqAnn.put(acc, strucAnn); + } + // } + else + { + System.err + .println("Warning - couldn't parse sequence annotation row line:\n" + + line); + // throw new IOException("Error parsing " + line); + } + } + else + { + throw new IOException("Unknown annotation detected: " + annType + + " " + annContent); + } + } + } + if (treeString.length() > 0) + { + if (treeName == null) + { + treeName = "Tree " + (1 + getTreeCount()); + } + addNewickTree(treeName, treeString.toString()); + } + } + + /** + * Demangle an accession string and guess the originating sequence database + * for a given sequence + * + * @param seqO + * sequence to be annotated + * @param dbr + * Accession string for sequence + * @param dbsource + * source database for alignment (PFAM or RFAM) */ private void guessDatabaseFor(Sequence seqO, String dbr, String dbsource) { - DBRefEntry dbrf=null; - List dbrs=new ArrayList(); - String seqdb="Unknown",sdbac=""+dbr; - int st=-1,en=-1,p; - if ((st=sdbac.indexOf("/"))>-1) + DBRefEntry dbrf = null; + List dbrs = new ArrayList(); + String seqdb = "Unknown", sdbac = "" + dbr; + int st = -1, en = -1, p; + if ((st = sdbac.indexOf("/")) > -1) { - String num,range=sdbac.substring(st+1); - sdbac = sdbac.substring(0,st); - if ((p=range.indexOf("-"))>-1) + String num, range = sdbac.substring(st + 1); + sdbac = sdbac.substring(0, st); + if ((p = range.indexOf("-")) > -1) { p++; - if (p-1) + if (sdbac.indexOf(".") > -1) { // strip of last subdomain - sdbac = sdbac.substring(0,sdbac.indexOf(".")); - dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource, sdbac); - if (dbrf!=null) + sdbac = sdbac.substring(0, sdbac.indexOf(".")); + dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource, + sdbac); + if (dbrf != null) { dbrs.add(dbrf); } } - dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource, dbr); - if (dbr!=null) + dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource, + dbr); + if (dbr != null) { dbrs.add(dbrf); } - } else { - seqdb = "EMBL"; // total guess - could be ENA, or something else these days - if (sdbac.indexOf(".")>-1) + } + else + { + seqdb = "EMBL"; // total guess - could be ENA, or something else these + // days + if (sdbac.indexOf(".") > -1) { // strip off last subdomain - sdbac = sdbac.substring(0,sdbac.indexOf(".")); - dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource, sdbac); - if (dbrf!=null) + sdbac = sdbac.substring(0, sdbac.indexOf(".")); + dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, seqdb, dbsource, + sdbac); + if (dbrf != null) { dbrs.add(dbrf); } } - - dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource, dbr); - if (dbrf!=null) + + dbrf = jalview.util.DBRefUtils.parseToDbRef(seqO, dbsource, dbsource, + dbr); + if (dbrf != null) { dbrs.add(dbrf); } } - if (st!=-1 && en!=-1) + if (st != -1 && en != -1) { - for (DBRefEntry d:dbrs) + for (DBRefEntry d : dbrs) { - jalview.util.MapList mp = new jalview.util.MapList(new int[] { seqO.getStart(),seqO.getEnd()},new int[] { st,en},1,1); + jalview.util.MapList mp = new jalview.util.MapList(new int[] + { seqO.getStart(), seqO.getEnd() }, new int[] + { st, en }, 1, 1); jalview.datamodel.Mapping mping = new Mapping(mp); d.setMap(mping); } @@ -1025,7 +1048,7 @@ public class StockholmFile extends AlignFile seq += ch; } else if (ch.length() > 1) - { + { seq += ch.charAt(1); } } @@ -1105,6 +1128,7 @@ public class StockholmFile extends AlignFile + type); return key; } + /** * make a friendly ID string. * diff --git a/src/jalview/io/TCoffeeScoreFile.java b/src/jalview/io/TCoffeeScoreFile.java index 7e5f0c3..d437bd8 100644 --- a/src/jalview/io/TCoffeeScoreFile.java +++ b/src/jalview/io/TCoffeeScoreFile.java @@ -89,7 +89,8 @@ import java.util.regex.Pattern; * @author Paolo Di Tommaso * */ -public class TCoffeeScoreFile extends AlignFile { +public class TCoffeeScoreFile extends AlignFile +{ public TCoffeeScoreFile(String inFile, String type) throws IOException { super(inFile, type); @@ -396,8 +397,9 @@ public class TCoffeeScoreFile extends AlignFile { } } - static Pattern SCORES_WITH_RESIDUE_NUMS = Pattern.compile("^\\d+\\s([^\\s]+)\\s+\\d+$"); - + static Pattern SCORES_WITH_RESIDUE_NUMS = Pattern + .compile("^\\d+\\s([^\\s]+)\\s+\\d+$"); + /** * Read a scores block ihe provided stream. * @@ -458,10 +460,11 @@ public class TCoffeeScoreFile extends AlignFile { String val = line.substring(p + 1).trim(); Matcher m = SCORES_WITH_RESIDUE_NUMS.matcher(val); - if( m.matches() ) { - val = m.group(1); + if (m.matches()) + { + val = m.group(1); } - + result.items.put(id, val); } while ((line = reader.nextLine()) != null); @@ -550,8 +553,11 @@ public class TCoffeeScoreFile extends AlignFile { { if (al.getHeight() != getHeight() || al.getWidth() != getWidth()) { - String info = String.format("align w: %s, h: %s; score: w: %s; h: %s ", al.getWidth(), al.getHeight(), getWidth(), getHeight() ); - warningMessage = "Alignment shape does not match T-Coffee score file shape -- " + info; + String info = String.format( + "align w: %s, h: %s; score: w: %s; h: %s ", al.getWidth(), + al.getHeight(), getWidth(), getHeight()); + warningMessage = "Alignment shape does not match T-Coffee score file shape -- " + + info; return false; } boolean added = false; diff --git a/src/jalview/io/WSWUBlastClient.java b/src/jalview/io/WSWUBlastClient.java index 584e21c..cc5fbed 100755 --- a/src/jalview/io/WSWUBlastClient.java +++ b/src/jalview/io/WSWUBlastClient.java @@ -60,10 +60,12 @@ public class WSWUBlastClient { this.ap = ap; this.al = al; - output.setText(MessageManager.getString("label.wswublast_client_credits")); + output.setText(MessageManager + .getString("label.wswublast_client_credits")); - Desktop.addInternalFrame(output, - MessageManager.getString("label.blasting_for_unidentified_sequence"), 800, 300); + Desktop.addInternalFrame(output, MessageManager + .getString("label.blasting_for_unidentified_sequence"), 800, + 300); for (int i = 0; i < ids.size(); i++) { diff --git a/src/jalview/javascript/JsCallBack.java b/src/jalview/javascript/JsCallBack.java index dfc9bfe..16c01a6 100644 --- a/src/jalview/javascript/JsCallBack.java +++ b/src/jalview/javascript/JsCallBack.java @@ -19,6 +19,7 @@ * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.javascript; + public interface JsCallBack { public jalview.appletgui.AlignFrame getAlignFrame(); diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index 16e78f5..d3154c7 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -142,7 +142,7 @@ public class GAlignFrame extends JInternalFrame protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem(); protected JRadioButtonMenuItem purinePyrimidineColour = new JRadioButtonMenuItem(); - + protected JRadioButtonMenuItem RNAInteractionColour = new JRadioButtonMenuItem(); // protected JRadioButtonMenuItem covariationColour = new @@ -187,8 +187,9 @@ public class GAlignFrame extends JInternalFrame public JCheckBoxMenuItem showSeqFeaturesHeight = new JCheckBoxMenuItem(); JMenuItem deleteGroups = new JMenuItem(); - + JMenuItem createGroup = new JMenuItem(); + JMenuItem unGroup = new JMenuItem(); JMenuItem delete = new JMenuItem(); @@ -246,7 +247,7 @@ public class GAlignFrame extends JInternalFrame protected JMenuItem showTranslation = new JMenuItem(); protected JMenuItem extractScores = new JMenuItem(); - + protected JMenuItem expandAlignment = new JMenuItem(); protected JMenu showProducts = new JMenu(); @@ -415,8 +416,10 @@ public class GAlignFrame extends JInternalFrame int option = JOptionPane.showInternalConfirmDialog( jalview.gui.Desktop.desktop, - MessageManager.getString("label.remove_from_default_list"), - MessageManager.getString("label.remove_user_defined_colour"), + MessageManager + .getString("label.remove_from_default_list"), + MessageManager + .getString("label.remove_user_defined_colour"), JOptionPane.YES_NO_OPTION); if (option == JOptionPane.YES_OPTION) { @@ -542,11 +545,11 @@ public class GAlignFrame extends JInternalFrame purinePyrimidineColour.setSelected(true); break; - + case ColourSchemeProperty.RNAINTERACTION: - RNAInteractionColour.setSelected(true); + RNAInteractionColour.setSelected(true); - break; + break; /* * case ColourSchemeProperty.COVARIATION: * covariationColour.setSelected(true); @@ -598,7 +601,8 @@ public class GAlignFrame extends JInternalFrame colourMenu.setText(MessageManager.getString("action.colour")); calculateMenu.setText(MessageManager.getString("action.calculate")); webService.setText(MessageManager.getString("action.web_service")); - selectAllSequenceMenuItem.setText(MessageManager.getString("action.select_all")); + selectAllSequenceMenuItem.setText(MessageManager + .getString("action.select_all")); selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_A, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -610,7 +614,8 @@ public class GAlignFrame extends JInternalFrame selectAllSequenceMenuItem_actionPerformed(e); } }); - deselectAllSequenceMenuItem.setText(MessageManager.getString("action.deselect_all")); + deselectAllSequenceMenuItem.setText(MessageManager + .getString("action.deselect_all")); deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false)); deselectAllSequenceMenuItem @@ -621,7 +626,8 @@ public class GAlignFrame extends JInternalFrame deselectAllSequenceMenuItem_actionPerformed(e); } }); - invertSequenceMenuItem.setText(MessageManager.getString("action.invert_sequence_selection")); + invertSequenceMenuItem.setText(MessageManager + .getString("action.invert_sequence_selection")); invertSequenceMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_I, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -633,7 +639,8 @@ public class GAlignFrame extends JInternalFrame invertSequenceMenuItem_actionPerformed(e); } }); - grpsFromSelection.setText(MessageManager.getString("action.make_groups_selection")); + grpsFromSelection.setText(MessageManager + .getString("action.make_groups_selection")); grpsFromSelection.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -641,16 +648,20 @@ public class GAlignFrame extends JInternalFrame makeGrpsFromSelection_actionPerformed(e); } }); - expandAlignment.setText(MessageManager.getString("action.view_flanking_regions")); - expandAlignment.setToolTipText(MessageManager.getString("label.view_flanking_regions")); - expandAlignment.addActionListener(new java.awt.event.ActionListener() { + expandAlignment.setText(MessageManager + .getString("action.view_flanking_regions")); + expandAlignment.setToolTipText(MessageManager + .getString("label.view_flanking_regions")); + expandAlignment.addActionListener(new java.awt.event.ActionListener() + { @Override public void actionPerformed(ActionEvent e) { expand_newalign(e); } }); - remove2LeftMenuItem.setText(MessageManager.getString("action.remove_left")); + remove2LeftMenuItem.setText(MessageManager + .getString("action.remove_left")); remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask(), false)); @@ -662,7 +673,8 @@ public class GAlignFrame extends JInternalFrame remove2LeftMenuItem_actionPerformed(e); } }); - remove2RightMenuItem.setText(MessageManager.getString("action.remove_right")); + remove2RightMenuItem.setText(MessageManager + .getString("action.remove_right")); remove2RightMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_R, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask(), false)); @@ -674,7 +686,8 @@ public class GAlignFrame extends JInternalFrame remove2RightMenuItem_actionPerformed(e); } }); - removeGappedColumnMenuItem.setText(MessageManager.getString("action.remove_empty_columns")); + removeGappedColumnMenuItem.setText(MessageManager + .getString("action.remove_empty_columns")); removeGappedColumnMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -686,7 +699,8 @@ public class GAlignFrame extends JInternalFrame removeGappedColumnMenuItem_actionPerformed(e); } }); - removeAllGapsMenuItem.setText(MessageManager.getString("action.remove_all_gaps")); + removeAllGapsMenuItem.setText(MessageManager + .getString("action.remove_all_gaps")); removeAllGapsMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_E, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask() @@ -699,7 +713,8 @@ public class GAlignFrame extends JInternalFrame removeAllGapsMenuItem_actionPerformed(e); } }); - justifyLeftMenuItem.setText(MessageManager.getString("action.left_justify_alignment")); + justifyLeftMenuItem.setText(MessageManager + .getString("action.left_justify_alignment")); justifyLeftMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -708,7 +723,8 @@ public class GAlignFrame extends JInternalFrame justifyLeftMenuItem_actionPerformed(e); } }); - justifyRightMenuItem.setText(MessageManager.getString("action.right_justify_alignment")); + justifyRightMenuItem.setText(MessageManager + .getString("action.right_justify_alignment")); justifyRightMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -735,7 +751,8 @@ public class GAlignFrame extends JInternalFrame viewTextMenuItem_actionPerformed(e); } }); - showNonconservedMenuItem.setText(MessageManager.getString("label.show_non_conversed")); + showNonconservedMenuItem.setText(MessageManager + .getString("label.show_non_conversed")); showNonconservedMenuItem.setState(false); showNonconservedMenuItem .addActionListener(new java.awt.event.ActionListener() @@ -745,7 +762,8 @@ public class GAlignFrame extends JInternalFrame showUnconservedMenuItem_actionPerformed(e); } }); - sortPairwiseMenuItem.setText(MessageManager.getString("action.by_pairwise_id")); + sortPairwiseMenuItem.setText(MessageManager + .getString("action.by_pairwise_id")); sortPairwiseMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -762,7 +780,8 @@ public class GAlignFrame extends JInternalFrame sortIDMenuItem_actionPerformed(e); } }); - sortLengthMenuItem.setText(MessageManager.getString("action.by_length")); + sortLengthMenuItem + .setText(MessageManager.getString("action.by_length")); sortLengthMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -779,7 +798,8 @@ public class GAlignFrame extends JInternalFrame sortGroupMenuItem_actionPerformed(e); } }); - removeRedundancyMenuItem.setText(MessageManager.getString("action.remove_redundancy")); + removeRedundancyMenuItem.setText(MessageManager + .getString("action.remove_redundancy")); removeRedundancyMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_D, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -791,7 +811,8 @@ public class GAlignFrame extends JInternalFrame removeRedundancyMenuItem_actionPerformed(e); } }); - pairwiseAlignmentMenuItem.setText(MessageManager.getString("action.pairwise_alignment")); + pairwiseAlignmentMenuItem.setText(MessageManager + .getString("action.pairwise_alignment")); pairwiseAlignmentMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -800,7 +821,8 @@ public class GAlignFrame extends JInternalFrame pairwiseAlignmentMenuItem_actionPerformed(e); } }); - PCAMenuItem.setText(MessageManager.getString("label.principal_component_analysis")); + PCAMenuItem.setText(MessageManager + .getString("label.principal_component_analysis")); PCAMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -808,8 +830,8 @@ public class GAlignFrame extends JInternalFrame PCAMenuItem_actionPerformed(e); } }); - averageDistanceTreeMenuItem - .setText(MessageManager.getString("label.average_distance_identity")); + averageDistanceTreeMenuItem.setText(MessageManager + .getString("label.average_distance_identity")); averageDistanceTreeMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -818,7 +840,8 @@ public class GAlignFrame extends JInternalFrame averageDistanceTreeMenuItem_actionPerformed(e); } }); - neighbourTreeMenuItem.setText(MessageManager.getString("label.neighbour_joining_identity")); + neighbourTreeMenuItem.setText(MessageManager + .getString("label.neighbour_joining_identity")); neighbourTreeMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -833,7 +856,8 @@ public class GAlignFrame extends JInternalFrame statusBar.setFont(new java.awt.Font("Verdana", 0, 11)); statusBar.setBorder(BorderFactory.createLineBorder(Color.black)); statusBar.setText(MessageManager.getString("label.status_bar")); - outputTextboxMenu.setText(MessageManager.getString("label.out_to_textbox")); + outputTextboxMenu.setText(MessageManager + .getString("label.out_to_textbox")); clustalColour.setText(MessageManager.getString("label.clustalx")); clustalColour.addActionListener(new java.awt.event.ActionListener() @@ -859,7 +883,8 @@ public class GAlignFrame extends JInternalFrame taylorColour_actionPerformed(e); } }); - hydrophobicityColour.setText(MessageManager.getString("label.hydrophobicity")); + hydrophobicityColour.setText(MessageManager + .getString("label.hydrophobicity")); hydrophobicityColour .addActionListener(new java.awt.event.ActionListener() { @@ -876,7 +901,8 @@ public class GAlignFrame extends JInternalFrame helixColour_actionPerformed(e); } }); - strandColour.setText(MessageManager.getString("label.strand_propensity")); + strandColour.setText(MessageManager + .getString("label.strand_propensity")); strandColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -900,7 +926,8 @@ public class GAlignFrame extends JInternalFrame buriedColour_actionPerformed(e); } }); - userDefinedColour.setText(MessageManager.getString("action.user_defined")); + userDefinedColour.setText(MessageManager + .getString("action.user_defined")); userDefinedColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -908,7 +935,8 @@ public class GAlignFrame extends JInternalFrame userDefinedColour_actionPerformed(e); } }); - PIDColour.setText(MessageManager.getString("label.percentage_identity")); + PIDColour + .setText(MessageManager.getString("label.percentage_identity")); PIDColour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -916,7 +944,8 @@ public class GAlignFrame extends JInternalFrame PIDColour_actionPerformed(e); } }); - BLOSUM62Colour.setText(MessageManager.getString("label.blosum62_score")); + BLOSUM62Colour + .setText(MessageManager.getString("label.blosum62_score")); BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -933,7 +962,8 @@ public class GAlignFrame extends JInternalFrame } }); - purinePyrimidineColour.setText(MessageManager.getString("label.purine_pyrimidine")); + purinePyrimidineColour.setText(MessageManager + .getString("label.purine_pyrimidine")); purinePyrimidineColour .addActionListener(new java.awt.event.ActionListener() { @@ -942,13 +972,14 @@ public class GAlignFrame extends JInternalFrame purinePyrimidineColour_actionPerformed(e); } }); - + RNAInteractionColour.setText("RNA Interaction type"); - RNAInteractionColour.addActionListener(new java.awt.event.ActionListener() + RNAInteractionColour + .addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - RNAInteractionColour_actionPerformed(e); + RNAInteractionColour_actionPerformed(e); } }); /* @@ -958,7 +989,8 @@ public class GAlignFrame extends JInternalFrame * covariationColour_actionPerformed(e); } }); */ - avDistanceTreeBlosumMenuItem.setText(MessageManager.getString("label.average_distance_bloslum62")); + avDistanceTreeBlosumMenuItem.setText(MessageManager + .getString("label.average_distance_bloslum62")); avDistanceTreeBlosumMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -967,7 +999,8 @@ public class GAlignFrame extends JInternalFrame avTreeBlosumMenuItem_actionPerformed(e); } }); - njTreeBlosumMenuItem.setText(MessageManager.getString("label.neighbour_blosum62")); + njTreeBlosumMenuItem.setText(MessageManager + .getString("label.neighbour_blosum62")); njTreeBlosumMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -977,7 +1010,8 @@ public class GAlignFrame extends JInternalFrame } }); annotationPanelMenuItem.setActionCommand(""); - annotationPanelMenuItem.setText(MessageManager.getString("label.show_annotations")); + annotationPanelMenuItem.setText(MessageManager + .getString("label.show_annotations")); annotationPanelMenuItem.setState(jalview.bin.Cache.getDefault( "SHOW_ANNOTATIONS", true)); annotationPanelMenuItem @@ -988,7 +1022,8 @@ public class GAlignFrame extends JInternalFrame annotationPanelMenuItem_actionPerformed(e); } }); - colourTextMenuItem.setText(MessageManager.getString("label.colour_text")); + colourTextMenuItem.setText(MessageManager + .getString("label.colour_text")); colourTextMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -1005,7 +1040,8 @@ public class GAlignFrame extends JInternalFrame htmlMenuItem_actionPerformed(e); } }); - overviewMenuItem.setText(MessageManager.getString("label.overview_window")); + overviewMenuItem.setText(MessageManager + .getString("label.overview_window")); overviewMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1037,7 +1073,8 @@ public class GAlignFrame extends JInternalFrame redoMenuItem_actionPerformed(e); } }); - conservationMenuItem.setText(MessageManager.getString("action.by_conservation")); + conservationMenuItem.setText(MessageManager + .getString("action.by_conservation")); conservationMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -1073,7 +1110,8 @@ public class GAlignFrame extends JInternalFrame printMenuItem_actionPerformed(e); } }); - renderGapsMenuItem.setText(MessageManager.getString("action.show_gaps")); + renderGapsMenuItem + .setText(MessageManager.getString("action.show_gaps")); renderGapsMenuItem.setState(true); renderGapsMenuItem .addActionListener(new java.awt.event.ActionListener() @@ -1094,7 +1132,8 @@ public class GAlignFrame extends JInternalFrame findMenuItem_actionPerformed(e); } }); - abovePIDThreshold.setText(MessageManager.getString("label.above_identity_threshold")); + abovePIDThreshold.setText(MessageManager + .getString("label.above_identity_threshold")); abovePIDThreshold.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1102,7 +1141,8 @@ public class GAlignFrame extends JInternalFrame abovePIDThreshold_actionPerformed(e); } }); - showSeqFeatures.setText(MessageManager.getString("label.show_sequence_features")); + showSeqFeatures.setText(MessageManager + .getString("label.show_sequence_features")); showSeqFeatures.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -1116,7 +1156,8 @@ public class GAlignFrame extends JInternalFrame * void actionPerformed(ActionEvent actionEvent) { * showSeqFeaturesHeight_actionPerformed(actionEvent); } }); */ - showDbRefsMenuitem.setText(MessageManager.getString("label.show_database_refs")); + showDbRefsMenuitem.setText(MessageManager + .getString("label.show_database_refs")); showDbRefsMenuitem.addActionListener(new ActionListener() { @@ -1126,7 +1167,8 @@ public class GAlignFrame extends JInternalFrame } }); - showNpFeatsMenuitem.setText(MessageManager.getString("label.show_non_positional_features")); + showNpFeatsMenuitem.setText(MessageManager + .getString("label.show_non_positional_features")); showNpFeatsMenuitem.addActionListener(new ActionListener() { @@ -1136,7 +1178,8 @@ public class GAlignFrame extends JInternalFrame } }); - showGroupConservation.setText(MessageManager.getString("label.group_conservation")); + showGroupConservation.setText(MessageManager + .getString("label.group_conservation")); showGroupConservation.addActionListener(new ActionListener() { @@ -1147,7 +1190,8 @@ public class GAlignFrame extends JInternalFrame }); - showGroupConsensus.setText(MessageManager.getString("label.group_consensus")); + showGroupConsensus.setText(MessageManager + .getString("label.group_consensus")); showGroupConsensus.addActionListener(new ActionListener() { @@ -1157,7 +1201,8 @@ public class GAlignFrame extends JInternalFrame } }); - showConsensusHistogram.setText(MessageManager.getString("label.show_consensus_histogram")); + showConsensusHistogram.setText(MessageManager + .getString("label.show_consensus_histogram")); showConsensusHistogram.addActionListener(new ActionListener() { @@ -1167,7 +1212,8 @@ public class GAlignFrame extends JInternalFrame } }); - showSequenceLogo.setText(MessageManager.getString("label.show_consensus_logo")); + showSequenceLogo.setText(MessageManager + .getString("label.show_consensus_logo")); showSequenceLogo.addActionListener(new ActionListener() { @@ -1177,7 +1223,8 @@ public class GAlignFrame extends JInternalFrame } }); - normaliseSequenceLogo.setText(MessageManager.getString("label.norm_consensus_logo")); + normaliseSequenceLogo.setText(MessageManager + .getString("label.norm_consensus_logo")); normaliseSequenceLogo.addActionListener(new ActionListener() { @@ -1187,7 +1234,8 @@ public class GAlignFrame extends JInternalFrame } }); - applyAutoAnnotationSettings.setText(MessageManager.getString("label.apply_all_groups")); + applyAutoAnnotationSettings.setText(MessageManager + .getString("label.apply_all_groups")); applyAutoAnnotationSettings.setState(false); applyAutoAnnotationSettings.setVisible(true); applyAutoAnnotationSettings.addActionListener(new ActionListener() @@ -1221,7 +1269,8 @@ public class GAlignFrame extends JInternalFrame } }); - deleteGroups.setText(MessageManager.getString("action.undefine_groups")); + deleteGroups + .setText(MessageManager.getString("action.undefine_groups")); deleteGroups.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_U, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask(), false)); @@ -1245,8 +1294,9 @@ public class GAlignFrame extends JInternalFrame }); unGroup.setText(MessageManager.getString("action.remove_group")); unGroup.setAccelerator(javax.swing.KeyStroke.getKeyStroke( - java.awt.event.KeyEvent.VK_G,Toolkit.getDefaultToolkit() - .getMenuShortcutKeyMask() | java.awt.event.KeyEvent.SHIFT_MASK, false)); + java.awt.event.KeyEvent.VK_G, Toolkit.getDefaultToolkit() + .getMenuShortcutKeyMask() + | java.awt.event.KeyEvent.SHIFT_MASK, false)); unGroup.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1311,7 +1361,8 @@ public class GAlignFrame extends JInternalFrame pasteThis_actionPerformed(e); } }); - applyToAllGroups.setText(MessageManager.getString("label.apply_colour_to_all_groups")); + applyToAllGroups.setText(MessageManager + .getString("label.apply_colour_to_all_groups")); applyToAllGroups.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1326,7 +1377,8 @@ public class GAlignFrame extends JInternalFrame createPNG(null); } }); - createPNG.setActionCommand(MessageManager.getString("label.save_png_image")); + createPNG.setActionCommand(MessageManager + .getString("label.save_png_image")); createPNG.setText("PNG"); font.setText(MessageManager.getString("action.font")); font.addActionListener(new java.awt.event.ActionListener() @@ -1337,7 +1389,8 @@ public class GAlignFrame extends JInternalFrame } }); - seqLimits.setText(MessageManager.getString("label.show_sequence_limits")); + seqLimits.setText(MessageManager + .getString("label.show_sequence_limits")); seqLimits.setState(jalview.bin.Cache.getDefault("SHOW_JVSUFFIX", true)); seqLimits.addActionListener(new java.awt.event.ActionListener() { @@ -1354,8 +1407,10 @@ public class GAlignFrame extends JInternalFrame createEPS(null); } }); - LoadtreeMenuItem.setActionCommand(MessageManager.getString("label.load_tree_for_sequence_set")); - LoadtreeMenuItem.setText(MessageManager.getString("label.load_associated_tree")); + LoadtreeMenuItem.setActionCommand(MessageManager + .getString("label.load_tree_for_sequence_set")); + LoadtreeMenuItem.setText(MessageManager + .getString("label.load_associated_tree")); LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1395,7 +1450,8 @@ public class GAlignFrame extends JInternalFrame }); centreColumnLabelsMenuItem.setVisible(true); centreColumnLabelsMenuItem.setState(false); - centreColumnLabelsMenuItem.setText(MessageManager.getString("label.centre_column_labels")); + centreColumnLabelsMenuItem.setText(MessageManager + .getString("label.centre_column_labels")); centreColumnLabelsMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -1406,7 +1462,8 @@ public class GAlignFrame extends JInternalFrame }); followHighlightMenuItem.setVisible(true); followHighlightMenuItem.setState(true); - followHighlightMenuItem.setText(MessageManager.getString("label.automatic_scrolling")); + followHighlightMenuItem.setText(MessageManager + .getString("label.automatic_scrolling")); followHighlightMenuItem.addActionListener(new ActionListener() { @@ -1417,7 +1474,8 @@ public class GAlignFrame extends JInternalFrame }); - modifyPID.setText(MessageManager.getString("label.modify_identity_thereshold")); + modifyPID.setText(MessageManager + .getString("label.modify_identity_thereshold")); modifyPID.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -1425,7 +1483,8 @@ public class GAlignFrame extends JInternalFrame modifyPID_actionPerformed(e); } }); - modifyConservation.setText(MessageManager.getString("label.modify_conservation_thereshold")); + modifyConservation.setText(MessageManager + .getString("label.modify_conservation_thereshold")); modifyConservation .addActionListener(new java.awt.event.ActionListener() { @@ -1434,7 +1493,8 @@ public class GAlignFrame extends JInternalFrame modifyConservation_actionPerformed(e); } }); - sortByTreeMenu.setText(MessageManager.getString("action.by_tree_order")); + sortByTreeMenu + .setText(MessageManager.getString("action.by_tree_order")); sort.setText(MessageManager.getString("action.sort")); sort.addMenuListener(new MenuListener() { @@ -1451,7 +1511,8 @@ public class GAlignFrame extends JInternalFrame { } }); - sortByAnnotScore.setText(MessageManager.getString("label.sort_by_score")); + sortByAnnotScore.setText(MessageManager + .getString("label.sort_by_score")); sort.add(sortByAnnotScore); sortByAnnotScore.addMenuListener(new javax.swing.event.MenuListener() { @@ -1471,7 +1532,8 @@ public class GAlignFrame extends JInternalFrame }); sortByAnnotScore.setVisible(false); - calculateTree.setText(MessageManager.getString("action.calculate_tree")); + calculateTree + .setText(MessageManager.getString("action.calculate_tree")); jMenu2.setText(MessageManager.getString("label.export_image")); padGapsMenuitem.setText(MessageManager.getString("label.pad_gaps")); @@ -1493,7 +1555,8 @@ public class GAlignFrame extends JInternalFrame vamsasStore_actionPerformed(e); } }); - showTranslation.setText(MessageManager.getString("label.translate_cDNA")); + showTranslation.setText(MessageManager + .getString("label.translate_cDNA")); showTranslation.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1501,7 +1564,8 @@ public class GAlignFrame extends JInternalFrame showTranslation_actionPerformed(e); } }); - extractScores.setText(MessageManager.getString("label.extract_scores") + "..."); + extractScores.setText(MessageManager.getString("label.extract_scores") + + "..."); extractScores.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1518,7 +1582,8 @@ public class GAlignFrame extends JInternalFrame * public void actionPerformed(ActionEvent e) { * showProducts_actionPerformed(e); } }); */ - openFeatureSettings.setText(MessageManager.getString("label.feature_settings")); + openFeatureSettings.setText(MessageManager + .getString("label.feature_settings")); openFeatureSettings.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1526,7 +1591,8 @@ public class GAlignFrame extends JInternalFrame featureSettings_actionPerformed(e); } }); - fetchSequence.setText(MessageManager.getString("label.fetch_sequences")); + fetchSequence + .setText(MessageManager.getString("label.fetch_sequences")); fetchSequence.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1535,7 +1601,8 @@ public class GAlignFrame extends JInternalFrame } }); - annotationColour.setText(MessageManager.getString("action.by_annotation")); + annotationColour.setText(MessageManager + .getString("action.by_annotation")); annotationColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1544,7 +1611,8 @@ public class GAlignFrame extends JInternalFrame } }); - rnahelicesColour.setText(MessageManager.getString("action.by_rna_helixes")); + rnahelicesColour.setText(MessageManager + .getString("action.by_rna_helixes")); rnahelicesColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1553,7 +1621,8 @@ public class GAlignFrame extends JInternalFrame } }); - associatedData.setText(MessageManager.getString("label.load_features_annotations")); + associatedData.setText(MessageManager + .getString("label.load_features_annotations")); associatedData.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1561,7 +1630,8 @@ public class GAlignFrame extends JInternalFrame associatedData_actionPerformed(e); } }); - autoCalculate.setText(MessageManager.getString("label.autocalculate_consensus")); + autoCalculate.setText(MessageManager + .getString("label.autocalculate_consensus")); autoCalculate.setState(jalview.bin.Cache.getDefault( "AUTO_CALC_CONSENSUS", true)); autoCalculate.addActionListener(new ActionListener() @@ -1571,9 +1641,12 @@ public class GAlignFrame extends JInternalFrame autoCalculate_actionPerformed(e); } }); - sortByTree.setText(MessageManager.getString("label.sort_alignment_new_tree")); + sortByTree.setText(MessageManager + .getString("label.sort_alignment_new_tree")); sortByTree - .setToolTipText("" + MessageManager.getString("label.enable_automatically_sort_alignment_when_open_new_tree")); + .setToolTipText("" + + MessageManager + .getString("label.enable_automatically_sort_alignment_when_open_new_tree")); sortByTree .setState(jalview.bin.Cache.getDefault("SORT_BY_TREE", false)); sortByTree.addActionListener(new ActionListener() @@ -1584,9 +1657,12 @@ public class GAlignFrame extends JInternalFrame } }); - listenToViewSelections.setText(MessageManager.getString("label.listen_for_selections")); + listenToViewSelections.setText(MessageManager + .getString("label.listen_for_selections")); listenToViewSelections - .setToolTipText("" + MessageManager.getString("label.selections_mirror_selections_made_same_sequences_other_views")); + .setToolTipText("" + + MessageManager + .getString("label.selections_mirror_selections_made_same_sequences_other_views")); listenToViewSelections.setState(false); listenToViewSelections.addActionListener(new ActionListener() { @@ -1596,7 +1672,8 @@ public class GAlignFrame extends JInternalFrame } }); - addSequenceMenu.setText(MessageManager.getString("label.add_sequences")); + addSequenceMenu + .setText(MessageManager.getString("label.add_sequences")); addFromFile.setText(MessageManager.getString("label.from_file")); addFromFile.addActionListener(new ActionListener() { @@ -1621,7 +1698,8 @@ public class GAlignFrame extends JInternalFrame addFromURL_actionPerformed(e); } }); - exportFeatures.setText(MessageManager.getString("label.export_features")); + exportFeatures.setText(MessageManager + .getString("label.export_features")); exportFeatures.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1629,7 +1707,8 @@ public class GAlignFrame extends JInternalFrame exportFeatures_actionPerformed(e); } }); - exportAnnotations.setText(MessageManager.getString("label.export_annotations")); + exportAnnotations.setText(MessageManager + .getString("label.export_annotations")); exportAnnotations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1640,7 +1719,8 @@ public class GAlignFrame extends JInternalFrame statusPanel.setLayout(gridLayout1); jMenu3.setText(MessageManager.getString("action.show")); showAllSeqs.setText(MessageManager.getString("label.all_sequences")); - showAllSeqs.setToolTipText(MessageManager.getString("label.toggle_sequence_visibility")); + showAllSeqs.setToolTipText(MessageManager + .getString("label.toggle_sequence_visibility")); showAllSeqs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1649,7 +1729,8 @@ public class GAlignFrame extends JInternalFrame } }); showAllColumns.setText(MessageManager.getString("label.all_columns")); - showAllColumns.setToolTipText(MessageManager.getString("label.toggle_columns_visibility")); + showAllColumns.setToolTipText(MessageManager + .getString("label.toggle_columns_visibility")); showAllColumns.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1658,8 +1739,10 @@ public class GAlignFrame extends JInternalFrame } }); hideMenu.setText(MessageManager.getString("action.hide")); - hideSelSequences.setText(MessageManager.getString("label.selected_sequences")); - hideSelSequences.setToolTipText(MessageManager.getString("label.toggle_sequence_visibility")); + hideSelSequences.setText(MessageManager + .getString("label.selected_sequences")); + hideSelSequences.setToolTipText(MessageManager + .getString("label.toggle_sequence_visibility")); hideSelSequences.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1667,8 +1750,10 @@ public class GAlignFrame extends JInternalFrame hideSelSequences_actionPerformed(e); } }); - hideSelColumns.setText(MessageManager.getString("label.selected_columns")); - hideSelColumns.setToolTipText(MessageManager.getString("label.toggle_columns_visibility")); + hideSelColumns.setText(MessageManager + .getString("label.selected_columns")); + hideSelColumns.setToolTipText(MessageManager + .getString("label.toggle_columns_visibility")); hideSelColumns.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1676,7 +1761,8 @@ public class GAlignFrame extends JInternalFrame hideSelColumns_actionPerformed(e); } }); - hideAllSelection.setText(MessageManager.getString("label.selected_region")); + hideAllSelection.setText(MessageManager + .getString("label.selected_region")); hideAllSelection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1685,7 +1771,8 @@ public class GAlignFrame extends JInternalFrame } }); // TODO: should be hidden if no selection exists. - hideAllButSelection.setText(MessageManager.getString("label.all_but_selected_region")); + hideAllButSelection.setText(MessageManager + .getString("label.all_but_selected_region")); hideAllButSelection.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1693,9 +1780,10 @@ public class GAlignFrame extends JInternalFrame hideAllButSelection_actionPerformed(e); } }); - showAllhidden.setText(MessageManager.getString("label.all_sequences_columns")); - showAllhidden - .setToolTipText(MessageManager.getString("label.toggles_visibility_hidden_selected_regions")); + showAllhidden.setText(MessageManager + .getString("label.all_sequences_columns")); + showAllhidden.setToolTipText(MessageManager + .getString("label.toggles_visibility_hidden_selected_regions")); showAllhidden.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1704,7 +1792,8 @@ public class GAlignFrame extends JInternalFrame } }); - hiddenMarkers.setText(MessageManager.getString("action.show_hidden_markers")); + hiddenMarkers.setText(MessageManager + .getString("action.show_hidden_markers")); hiddenMarkers.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1712,7 +1801,8 @@ public class GAlignFrame extends JInternalFrame hiddenMarkers_actionPerformed(e); } }); - invertColSel.setText(MessageManager.getString("action.invert_column_selection")); + invertColSel.setText(MessageManager + .getString("action.invert_column_selection")); invertColSel.setAccelerator(javax.swing.KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_I, Toolkit.getDefaultToolkit() .getMenuShortcutKeyMask() @@ -1778,8 +1868,11 @@ public class GAlignFrame extends JInternalFrame newView_actionPerformed(e); } }); - tabbedPane.setToolTipText("" + MessageManager.getString("label.rename_tab_eXpand_reGroup") + ""); - textColour.setText(MessageManager.getString("label.colour_text") + "..."); + tabbedPane.setToolTipText("" + + MessageManager.getString("label.rename_tab_eXpand_reGroup") + + ""); + textColour.setText(MessageManager.getString("label.colour_text") + + "..."); textColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1789,7 +1882,8 @@ public class GAlignFrame extends JInternalFrame }); formatMenu.setText(MessageManager.getString("action.format")); selectMenu.setText(MessageManager.getString("action.select")); - idRightAlign.setText(MessageManager.getString("label.right_align_sequence_id")); + idRightAlign.setText(MessageManager + .getString("label.right_align_sequence_id")); idRightAlign.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1819,7 +1913,8 @@ public class GAlignFrame extends JInternalFrame expandViews_actionPerformed(e); } }); - pageSetup.setText(MessageManager.getString("action.page_setup") + "..."); + pageSetup + .setText(MessageManager.getString("action.page_setup") + "..."); pageSetup.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -1827,7 +1922,8 @@ public class GAlignFrame extends JInternalFrame pageSetup_actionPerformed(e); } }); - alignmentProperties.setText(MessageManager.getString("label.alignment_props") + "..."); + alignmentProperties.setText(MessageManager + .getString("label.alignment_props") + "..."); alignmentProperties.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -1835,8 +1931,10 @@ public class GAlignFrame extends JInternalFrame alignmentProperties(); } }); - tooltipSettingsMenu.setText(MessageManager.getString("label.sequence_id_tooltip")); - autoAnnMenu.setText(MessageManager.getString("label.autocalculated_annotation")); + tooltipSettingsMenu.setText(MessageManager + .getString("label.sequence_id_tooltip")); + autoAnnMenu.setText(MessageManager + .getString("label.autocalculated_annotation")); alignFrameMenuBar.add(fileMenu); alignFrameMenuBar.add(editMenu); alignFrameMenuBar.add(selectMenu); @@ -1937,7 +2035,7 @@ public class GAlignFrame extends JInternalFrame colourMenu.add(abovePIDThreshold); colourMenu.add(modifyPID); colourMenu.add(annotationColour); - colourMenu.add(rnahelicesColour); + colourMenu.add(rnahelicesColour); calculateMenu.add(sort); calculateMenu.add(calculateTree); calculateMenu.addSeparator(); @@ -1950,7 +2048,8 @@ public class GAlignFrame extends JInternalFrame calculateMenu.add(sortByTree); calculateMenu.addSeparator(); calculateMenu.add(extractScores); - webServiceNoServices = new JMenuItem(MessageManager.getString("label.no_services")); + webServiceNoServices = new JMenuItem( + MessageManager.getString("label.no_services")); webService.add(webServiceNoServices); pasteMenu.add(pasteNew); pasteMenu.add(pasteThis); @@ -2321,11 +2420,10 @@ public class GAlignFrame extends JInternalFrame protected void purinePyrimidineColour_actionPerformed(ActionEvent e) { } - + protected void RNAInteractionColour_actionPerformed(ActionEvent e) { } - /* * protected void covariationColour_actionPerformed(ActionEvent e) { } @@ -2366,11 +2464,11 @@ public class GAlignFrame extends JInternalFrame protected void deleteGroups_actionPerformed(ActionEvent e) { } - + protected void createGroup_actionPerformed(ActionEvent e) { } - + protected void unGroup_actionPerformed(ActionEvent e) { } @@ -2651,6 +2749,6 @@ public class GAlignFrame extends JInternalFrame protected void expand_newalign(ActionEvent e) { // TODO Auto-generated method stub - + } } diff --git a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java index 3977d2f..bc05d8c 100644 --- a/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java +++ b/src/jalview/jbgui/GCutAndPasteHtmlTransfer.java @@ -165,9 +165,10 @@ public class GCutAndPasteHtmlTransfer extends JInternalFrame copyItem_actionPerformed(e); } }); - displaySource.setText(MessageManager.getString("action.show_html_source")); - displaySource - .setToolTipText(MessageManager.getString("label.select_copy_raw_html")); + displaySource.setText(MessageManager + .getString("action.show_html_source")); + displaySource.setToolTipText(MessageManager + .getString("label.select_copy_raw_html")); displaySource.addActionListener(new ActionListener() { diff --git a/src/jalview/jbgui/GDasSourceBrowser.java b/src/jalview/jbgui/GDasSourceBrowser.java index 6ba2c4f..185ce13 100755 --- a/src/jalview/jbgui/GDasSourceBrowser.java +++ b/src/jalview/jbgui/GDasSourceBrowser.java @@ -44,7 +44,8 @@ public class GDasSourceBrowser extends JPanel private void jbInit() throws Exception { this.setLayout(gridBagLayout1); - refresh.setText(MessageManager.getString("label.refresh_available_sources")); + refresh.setText(MessageManager + .getString("label.refresh_available_sources")); refresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -144,7 +145,8 @@ public class GDasSourceBrowser extends JPanel protected JEditorPane fullDetails = new JEditorPane("text/html", ""); - TitledBorder titledBorder1 = new TitledBorder(MessageManager.getString("label.available_das_sources")); + TitledBorder titledBorder1 = new TitledBorder( + MessageManager.getString("label.available_das_sources")); protected JButton refresh = new JButton(); @@ -152,7 +154,8 @@ public class GDasSourceBrowser extends JPanel protected JScrollPane scrollPane = new JScrollPane(); - TitledBorder titledBorder2 = new TitledBorder(MessageManager.getString("label.full_details")); + TitledBorder titledBorder2 = new TitledBorder( + MessageManager.getString("label.full_details")); protected JScrollPane fullDetailsScrollpane = new JScrollPane(); @@ -180,11 +183,14 @@ public class GDasSourceBrowser extends JPanel GridBagLayout gridBagLayout1 = new GridBagLayout(); - TitledBorder titledBorder3 = new TitledBorder(MessageManager.getString("label.authority") + ":"); + TitledBorder titledBorder3 = new TitledBorder( + MessageManager.getString("label.authority") + ":"); - TitledBorder titledBorder4 = new TitledBorder(MessageManager.getString("label.type") + ":"); + TitledBorder titledBorder4 = new TitledBorder( + MessageManager.getString("label.type") + ":"); - TitledBorder titledBorder5 = new TitledBorder(MessageManager.getString("label.label") + ":"); + TitledBorder titledBorder5 = new TitledBorder( + MessageManager.getString("label.label") + ":"); JButton reset = new JButton(); diff --git a/src/jalview/jbgui/GDesktop.java b/src/jalview/jbgui/GDesktop.java index a7f3e95..0b9d779 100755 --- a/src/jalview/jbgui/GDesktop.java +++ b/src/jalview/jbgui/GDesktop.java @@ -131,14 +131,17 @@ public class GDesktop extends JFrame */ private void jbInit() throws Exception { - + FileMenu.setText(MessageManager.getString("action.file")); HelpMenu.setText(MessageManager.getString("action.help")); VamsasMenu.setText("Vamsas"); - VamsasMenu.setToolTipText(MessageManager.getString("label.share_data_vamsas_applications")); + VamsasMenu.setToolTipText(MessageManager + .getString("label.share_data_vamsas_applications")); VamsasStMenu.setText(MessageManager.getString("label.connect_to")); - VamsasStMenu.setToolTipText(MessageManager.getString("label.join_existing_vamsas_session")); - inputLocalFileMenuItem.setText(MessageManager.getString("label.load_tree_from_file")); + VamsasStMenu.setToolTipText(MessageManager + .getString("label.join_existing_vamsas_session")); + inputLocalFileMenuItem.setText(MessageManager + .getString("label.load_tree_from_file")); inputLocalFileMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_O, Toolkit .getDefaultToolkit().getMenuShortcutKeyMask(), false)); @@ -158,7 +161,8 @@ public class GDesktop extends JFrame inputURLMenuItem_actionPerformed(null); } }); - inputTextboxMenuItem.setText(MessageManager.getString("label.from_textbox")); + inputTextboxMenuItem.setText(MessageManager + .getString("label.from_textbox")); inputTextboxMenuItem .addActionListener(new java.awt.event.ActionListener() { @@ -183,7 +187,8 @@ public class GDesktop extends JFrame aboutMenuItem_actionPerformed(e); } }); - documentationMenuItem.setText(MessageManager.getString("label.documentation")); + documentationMenuItem.setText(MessageManager + .getString("label.documentation")); documentationMenuItem.setAccelerator(javax.swing.KeyStroke .getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0, false)); documentationMenuItem @@ -196,7 +201,8 @@ public class GDesktop extends JFrame }); this.getContentPane().setLayout(flowLayout1); windowMenu.setText(MessageManager.getString("label.window")); - preferences.setText(MessageManager.getString("label.preferences") + "..."); + preferences.setText(MessageManager.getString("label.preferences") + + "..."); preferences.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -222,7 +228,8 @@ public class GDesktop extends JFrame } }); inputMenu.setText(MessageManager.getString("label.input_alignment")); - vamsasStart.setText(MessageManager.getString("label.new_vamsas_session") + "..."); + vamsasStart.setText(MessageManager + .getString("label.new_vamsas_session") + "..."); vamsasStart.setVisible(false); vamsasStart.addActionListener(new ActionListener() { @@ -231,7 +238,8 @@ public class GDesktop extends JFrame vamsasStart_actionPerformed(e); } }); - vamsasImport.setText(MessageManager.getString("label.load_vamsas_session") + "..."); + vamsasImport.setText(MessageManager + .getString("label.load_vamsas_session") + "..."); vamsasImport.setVisible(false); vamsasImport.addActionListener(new ActionListener() { @@ -240,7 +248,8 @@ public class GDesktop extends JFrame vamsasImport_actionPerformed(e); } }); - vamsasSave.setText(MessageManager.getString("label.save_vamsas_session") + "..."); + vamsasSave.setText(MessageManager + .getString("label.save_vamsas_session") + "..."); vamsasSave.setVisible(false); vamsasSave.addActionListener(new ActionListener() { @@ -249,7 +258,8 @@ public class GDesktop extends JFrame vamsasSave_actionPerformed(e); } }); - inputSequence.setText(MessageManager.getString("label.fetch_sequences") + "..."); + inputSequence.setText(MessageManager.getString("label.fetch_sequences") + + "..."); inputSequence.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -257,7 +267,8 @@ public class GDesktop extends JFrame inputSequence_actionPerformed(e); } }); - vamsasStop.setText(MessageManager.getString("label.stop_vamsas_session")); + vamsasStop.setText(MessageManager + .getString("label.stop_vamsas_session")); vamsasStop.setVisible(false); vamsasStop.addActionListener(new ActionListener() { @@ -274,7 +285,8 @@ public class GDesktop extends JFrame closeAll_actionPerformed(e); } }); - raiseRelated.setText(MessageManager.getString("action.raise_associated_windows")); + raiseRelated.setText(MessageManager + .getString("action.raise_associated_windows")); raiseRelated.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -282,7 +294,8 @@ public class GDesktop extends JFrame raiseRelated_actionPerformed(e); } }); - minimizeAssociated.setText(MessageManager.getString("action.minimize_associated_windows")); + minimizeAssociated.setText(MessageManager + .getString("action.minimize_associated_windows")); minimizeAssociated.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -290,7 +303,8 @@ public class GDesktop extends JFrame minimizeAssociated_actionPerformed(e); } }); - garbageCollect.setText(MessageManager.getString("label.collect_garbage")); + garbageCollect.setText(MessageManager + .getString("label.collect_garbage")); garbageCollect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -298,7 +312,8 @@ public class GDesktop extends JFrame garbageCollect_actionPerformed(e); } }); - showMemusage.setText(MessageManager.getString("label.show_memory_usage")); + showMemusage.setText(MessageManager + .getString("label.show_memory_usage")); showMemusage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -306,7 +321,8 @@ public class GDesktop extends JFrame showMemusage_actionPerformed(e); } }); - showConsole.setText(MessageManager.getString("label.show_java_console")); + showConsole + .setText(MessageManager.getString("label.show_java_console")); showConsole.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/jbgui/GFontChooser.java b/src/jalview/jbgui/GFontChooser.java index 70ff918..17ed4ad 100755 --- a/src/jalview/jbgui/GFontChooser.java +++ b/src/jalview/jbgui/GFontChooser.java @@ -191,7 +191,8 @@ public class GFontChooser extends JPanel monospaced.setEnabled(false); monospaced.setFont(JvSwingUtils.getLabelFont()); monospaced.setOpaque(false); - monospaced.setToolTipText(MessageManager.getString("label.monospaced_fonts_faster_to_render")); + monospaced.setToolTipText(MessageManager + .getString("label.monospaced_fonts_faster_to_render")); monospaced.setText(MessageManager.getString("label.monospaced_font")); jPanel4.setOpaque(false); jPanel4.setBounds(new Rectangle(24, 92, 259, 35)); diff --git a/src/jalview/jbgui/GPCAPanel.java b/src/jalview/jbgui/GPCAPanel.java index e2ad178..ed2dc7d 100755 --- a/src/jalview/jbgui/GPCAPanel.java +++ b/src/jalview/jbgui/GPCAPanel.java @@ -55,7 +55,7 @@ public class GPCAPanel extends JInternalFrame JMenu fileMenu = new JMenu(); JMenu saveMenu = new JMenu(); - + protected JMenu scoreMatrixMenu = new JMenu(); JMenuItem eps = new JMenuItem(); @@ -194,7 +194,8 @@ public class GPCAPanel extends JInternalFrame outputPoints_actionPerformed(e); } }); - outputProjPoints.setText(MessageManager.getString("label.output_transformed_points") + "..."); + outputProjPoints.setText(MessageManager + .getString("label.output_transformed_points") + "..."); outputProjPoints.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -225,7 +226,8 @@ public class GPCAPanel extends JInternalFrame { } }); - scoreMatrixMenu.setText(MessageManager.getString("label.select_score_model")); + scoreMatrixMenu.setText(MessageManager + .getString("label.select_score_model")); scoreMatrixMenu.addMenuListener(new MenuListener() { public void menuSelected(MenuEvent e) @@ -250,7 +252,8 @@ public class GPCAPanel extends JInternalFrame } }); print.setText(MessageManager.getString("action.print")); - bgcolour.setText(MessageManager.getString("label.background_colour") + "..."); + bgcolour.setText(MessageManager.getString("label.background_colour") + + "..."); bgcolour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -266,9 +269,11 @@ public class GPCAPanel extends JInternalFrame originalSeqData_actionPerformed(e); } }); - associateViewsMenu.setText(MessageManager.getString("label.associate_nodes_with")); + associateViewsMenu.setText(MessageManager + .getString("label.associate_nodes_with")); calcSettings.setText(MessageManager.getString("action.change_params")); - nuclSetting.setText(MessageManager.getString("label.nucleotide_matrix")); + nuclSetting + .setText(MessageManager.getString("label.nucleotide_matrix")); protSetting.setText(MessageManager.getString("label.protein_matrix")); nuclSetting.addActionListener(new ActionListener() { @@ -288,7 +293,8 @@ public class GPCAPanel extends JInternalFrame protSetting_actionPerfomed(arg0); } }); - jvVersionSetting.setText(MessageManager.getString("label.jalview_pca_calculation")); + jvVersionSetting.setText(MessageManager + .getString("label.jalview_pca_calculation")); jvVersionSetting.addActionListener(new ActionListener() { @Override @@ -336,7 +342,7 @@ public class GPCAPanel extends JInternalFrame protected void scoreMatrix_menuSelected() { // TODO Auto-generated method stub - + } protected void resetButton_actionPerformed(ActionEvent e) diff --git a/src/jalview/jbgui/GPairwiseAlignPanel.java b/src/jalview/jbgui/GPairwiseAlignPanel.java index c50f677..aa88a92 100755 --- a/src/jalview/jbgui/GPairwiseAlignPanel.java +++ b/src/jalview/jbgui/GPairwiseAlignPanel.java @@ -71,7 +71,8 @@ public class GPairwiseAlignPanel extends JPanel textarea.setText(""); textarea.setWrapStyleWord(false); viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12)); - viewInEditorButton.setText(MessageManager.getString("label.view_alignment_editor")); + viewInEditorButton.setText(MessageManager + .getString("label.view_alignment_editor")); viewInEditorButton .addActionListener(new java.awt.event.ActionListener() { diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index d11d046..86fe535 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -133,9 +133,11 @@ public class GPreferences extends JPanel JPanel jPanel1 = new JPanel(); - TitledBorder titledBorder1 = new TitledBorder(MessageManager.getString("label.proxy_server")); + TitledBorder titledBorder1 = new TitledBorder( + MessageManager.getString("label.proxy_server")); - TitledBorder titledBorder2 = new TitledBorder(MessageManager.getString("label.file_output")); + TitledBorder titledBorder2 = new TitledBorder( + MessageManager.getString("label.file_output")); GridBagLayout gridBagLayout2 = new GridBagLayout(); @@ -302,9 +304,11 @@ public class GPreferences extends JPanel quality.setHorizontalTextPosition(SwingConstants.LEFT); quality.setSelected(true); quality.setText(MessageManager.getString("label.quality")); - visualTab.setBorder(new TitledBorder(MessageManager.getString("action.open_new_aligmnent"))); + visualTab.setBorder(new TitledBorder(MessageManager + .getString("action.open_new_aligmnent"))); visualTab.setLayout(null); - visual2Tab.setBorder(new TitledBorder(MessageManager.getString("action.open_new_aligmnent"))); + visual2Tab.setBorder(new TitledBorder(MessageManager + .getString("action.open_new_aligmnent"))); visual2Tab.setLayout(new FlowLayout()); fullScreen.setFont(verdana11); fullScreen.setHorizontalAlignment(SwingConstants.RIGHT); @@ -325,17 +329,20 @@ public class GPreferences extends JPanel showGroupbits.setFont(verdana11); showGroupbits.setHorizontalAlignment(SwingConstants.RIGHT); showGroupbits.setHorizontalTextPosition(SwingConstants.LEFT); - showGroupbits.setText(MessageManager.getString("action.show_group") + ":"); + showGroupbits.setText(MessageManager.getString("action.show_group") + + ":"); showConsensbits.setFont(verdana11); showConsensbits.setHorizontalAlignment(SwingConstants.RIGHT); showConsensbits.setHorizontalTextPosition(SwingConstants.LEFT); - showConsensbits.setText(MessageManager.getString("label.consensus") + ":"); + showConsensbits.setText(MessageManager.getString("label.consensus") + + ":"); showConsensHistogram.setEnabled(false); showConsensHistogram.setFont(verdana11); showConsensHistogram.setHorizontalAlignment(SwingConstants.RIGHT); showConsensHistogram.setHorizontalTextPosition(SwingConstants.LEFT); showConsensHistogram.setSelected(true); - showConsensHistogram.setText(MessageManager.getString("label.histogram")); + showConsensHistogram.setText(MessageManager + .getString("label.histogram")); showConsensLogo.setEnabled(false); showConsensLogo.setFont(verdana11); showConsensLogo.setHorizontalAlignment(SwingConstants.RIGHT); @@ -353,19 +360,22 @@ public class GPreferences extends JPanel showGroupConservation.setHorizontalAlignment(SwingConstants.RIGHT); showGroupConservation.setHorizontalTextPosition(SwingConstants.LEFT); showGroupConservation.setSelected(true); - showGroupConservation.setText(MessageManager.getString("label.conservation")); + showGroupConservation.setText(MessageManager + .getString("label.conservation")); showNpTooltip.setEnabled(true); showNpTooltip.setFont(verdana11); showNpTooltip.setHorizontalAlignment(SwingConstants.RIGHT); showNpTooltip.setHorizontalTextPosition(SwingConstants.LEFT); showNpTooltip.setSelected(true); - showNpTooltip.setText(MessageManager.getString("label.non_positional_features")); + showNpTooltip.setText(MessageManager + .getString("label.non_positional_features")); showDbRefTooltip.setEnabled(true); showDbRefTooltip.setFont(verdana11); showDbRefTooltip.setHorizontalAlignment(SwingConstants.RIGHT); showDbRefTooltip.setHorizontalTextPosition(SwingConstants.LEFT); showDbRefTooltip.setSelected(true); - showDbRefTooltip.setText(MessageManager.getString("label.database_references")); + showDbRefTooltip.setText(MessageManager + .getString("label.database_references")); annotations.setFont(verdana11); annotations.setHorizontalAlignment(SwingConstants.RIGHT); annotations.setHorizontalTextPosition(SwingConstants.LEADING); @@ -397,7 +407,8 @@ public class GPreferences extends JPanel showUnconserved.setHorizontalAlignment(SwingConstants.RIGHT); showUnconserved.setHorizontalTextPosition(SwingConstants.LEFT); showUnconserved.setSelected(true); - showUnconserved.setText(MessageManager.getString("action.show_unconserved")); + showUnconserved.setText(MessageManager + .getString("action.show_unconserved")); showUnconserved.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -410,13 +421,15 @@ public class GPreferences extends JPanel shareSelections.setHorizontalAlignment(SwingConstants.RIGHT); shareSelections.setHorizontalTextPosition(SwingConstants.LEFT); shareSelections.setSelected(true); - shareSelections.setText(MessageManager.getString("label.share_selection_across_views")); + shareSelections.setText(MessageManager + .getString("label.share_selection_across_views")); followHighlight.setFont(verdana11); followHighlight.setHorizontalAlignment(SwingConstants.RIGHT); followHighlight.setHorizontalTextPosition(SwingConstants.LEFT); // showUnconserved.setBounds(new Rectangle(169, 40, 200, 23)); followHighlight.setSelected(true); - followHighlight.setText(MessageManager.getString("label.scroll_highlighted_regions")); + followHighlight.setText(MessageManager + .getString("label.scroll_highlighted_regions")); gapLabel.setFont(verdana11); gapLabel.setHorizontalAlignment(SwingConstants.RIGHT); @@ -425,7 +438,8 @@ public class GPreferences extends JPanel colour.setBounds(new Rectangle(172, 225, 155, 21)); colourLabel.setFont(verdana11); colourLabel.setHorizontalAlignment(SwingConstants.RIGHT); - colourLabel.setText(MessageManager.getString("label.alignment_colour") + " "); + colourLabel.setText(MessageManager.getString("label.alignment_colour") + + " "); fontLabel.setFont(verdana11); fontLabel.setHorizontalAlignment(SwingConstants.RIGHT); fontLabel.setText(MessageManager.getString("label.font")); @@ -493,18 +507,22 @@ public class GPreferences extends JPanel portLabel.setText(MessageManager.getString("label.port")); browserLabel.setFont(new java.awt.Font("SansSerif", 0, 11)); browserLabel.setHorizontalAlignment(SwingConstants.TRAILING); - browserLabel.setText(MessageManager.getString("label.default_browser_unix")); + browserLabel.setText(MessageManager + .getString("label.default_browser_unix")); defaultBrowser.setFont(verdana11); defaultBrowser.setText(""); - usagestats.setText(MessageManager.getString("label.send_usage_statistics")); + usagestats.setText(MessageManager + .getString("label.send_usage_statistics")); usagestats.setFont(verdana11); usagestats.setHorizontalAlignment(SwingConstants.RIGHT); usagestats.setHorizontalTextPosition(SwingConstants.LEADING); - questionnaire.setText(MessageManager.getString("label.check_for_questionnaires")); + questionnaire.setText(MessageManager + .getString("label.check_for_questionnaires")); questionnaire.setFont(verdana11); questionnaire.setHorizontalAlignment(SwingConstants.RIGHT); questionnaire.setHorizontalTextPosition(SwingConstants.LEADING); - versioncheck.setText(MessageManager.getString("label.check_for_latest_version")); + versioncheck.setText(MessageManager + .getString("label.check_for_latest_version")); versioncheck.setFont(verdana11); versioncheck.setHorizontalAlignment(SwingConstants.RIGHT); versioncheck.setHorizontalTextPosition(SwingConstants.LEADING); @@ -552,7 +570,8 @@ public class GPreferences extends JPanel }); linkScrollPane.setBorder(null); - linkPanel.setBorder(new TitledBorder(MessageManager.getString("label.url_linkfrom_sequence_id"))); + linkPanel.setBorder(new TitledBorder(MessageManager + .getString("label.url_linkfrom_sequence_id"))); linkPanel.setLayout(borderLayout2); editLinkButtons.setLayout(gridLayout1); gridLayout1.setRows(3); @@ -609,7 +628,7 @@ public class GPreferences extends JPanel clustaljv.setText(MessageManager.getString("label.clustal") + " "); blcjv.setText(MessageManager.getString("label.blc") + " "); fastajv.setText(MessageManager.getString("label.fasta") + " "); - msfjv.setText(MessageManager.getString("label.msf")+ " "); + msfjv.setText(MessageManager.getString("label.msf") + " "); pfamjv.setText(MessageManager.getString("label.pfam") + " "); pileupjv.setText(MessageManager.getString("label.pileup") + " "); msfjv.setFont(verdana11); @@ -640,19 +659,23 @@ public class GPreferences extends JPanel smoothFont.setText(MessageManager.getString("label.smooth_font")); calcTab.setLayout(null); autoCalculateConsCheck.setFont(JvSwingUtils.getLabelFont()); - autoCalculateConsCheck.setText(MessageManager.getString("label.autocalculate_consensus")); + autoCalculateConsCheck.setText(MessageManager + .getString("label.autocalculate_consensus")); autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23)); padGaps.setFont(JvSwingUtils.getLabelFont()); padGaps.setText(MessageManager.getString("label.pad_gaps_when_editing")); padGaps.setBounds(new Rectangle(22, 94, 168, 23)); sortByTree.setFont(JvSwingUtils.getLabelFont()); - sortByTree.setText(MessageManager.getString("label.sort_with_new_tree")); sortByTree - .setToolTipText(MessageManager.getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort")); + .setText(MessageManager.getString("label.sort_with_new_tree")); + sortByTree + .setToolTipText(MessageManager + .getString("label.any_trees_calculated_or_loaded_alignment_automatically_sort")); sortByTree.setBounds(new Rectangle(22, 136, 168, 23)); autoIdWidth.setFont(JvSwingUtils.getLabelFont()); - autoIdWidth.setText(MessageManager.getString("label.automatically_set_id_width")); + autoIdWidth.setText(MessageManager + .getString("label.automatically_set_id_width")); autoIdWidth .setToolTipText("" + JvSwingUtils @@ -669,7 +692,8 @@ public class GPreferences extends JPanel } }); userIdWidthlabel.setFont(JvSwingUtils.getLabelFont()); - userIdWidthlabel.setText(MessageManager.getString("label.figure_id_column_width")); + userIdWidthlabel.setText(MessageManager + .getString("label.figure_id_column_width")); userIdWidth .setToolTipText("" + JvSwingUtils @@ -694,7 +718,8 @@ public class GPreferences extends JPanel } }); modellerOutput.setFont(JvSwingUtils.getLabelFont()); - modellerOutput.setText(MessageManager.getString("label.use_modeller_output")); + modellerOutput.setText(MessageManager + .getString("label.use_modeller_output")); modellerOutput.setBounds(new Rectangle(228, 226, 168, 23)); dasPanel.setLayout(borderLayout4); @@ -711,9 +736,11 @@ public class GPreferences extends JPanel idItalics.setFont(JvSwingUtils.getLabelFont()); idItalics.setHorizontalAlignment(SwingConstants.RIGHT); idItalics.setHorizontalTextPosition(SwingConstants.LEADING); - idItalics.setText(MessageManager.getString("label.sequence_name_italics")); + idItalics.setText(MessageManager + .getString("label.sequence_name_italics")); openoverv.setFont(JvSwingUtils.getLabelFont()); - openoverv.setActionCommand(MessageManager.getString("label.open_overview")); + openoverv.setActionCommand(MessageManager + .getString("label.open_overview")); openoverv.setHorizontalAlignment(SwingConstants.RIGHT); openoverv.setHorizontalTextPosition(SwingConstants.LEFT); openoverv.setText(MessageManager.getString(("label.open_overview"))); @@ -767,24 +794,26 @@ public class GPreferences extends JPanel autoAnnotSettings3.add(showConsensLogo); JPanel tooltipSettings = new JPanel(); - tooltipSettings.setBorder(new TitledBorder(MessageManager.getString("label.sequence_id_tooltip"))); + tooltipSettings.setBorder(new TitledBorder(MessageManager + .getString("label.sequence_id_tooltip"))); tooltipSettings.setBounds(173, 130, 200, 62); tooltipSettings.setLayout(new GridLayout(2, 1)); tooltipSettings.add(showDbRefTooltip); tooltipSettings.add(showNpTooltip); visualTab.add(tooltipSettings); visualTab.add(jPanel2); - JvSwingUtils.addtoLayout(visual2Tab, - MessageManager.getString("label.default_colour_scheme_for_alignment"), colourLabel, colour); + JvSwingUtils.addtoLayout(visual2Tab, MessageManager + .getString("label.default_colour_scheme_for_alignment"), + colourLabel, colour); JPanel annotationShding = new JPanel(); - annotationShding.setBorder(new TitledBorder( - MessageManager.getString("label.annotation_shading_default"))); + annotationShding.setBorder(new TitledBorder(MessageManager + .getString("label.annotation_shading_default"))); annotationShding.setLayout(new GridLayout(1, 2)); - JvSwingUtils.addtoLayout(annotationShding, - MessageManager.getString("label.default_minimum_colour_annotation_shading"), + JvSwingUtils.addtoLayout(annotationShding, MessageManager + .getString("label.default_minimum_colour_annotation_shading"), mincolourLabel, minColour); - JvSwingUtils.addtoLayout(annotationShding, - MessageManager.getString("label.default_maximum_colour_annotation_shading"), + JvSwingUtils.addtoLayout(annotationShding, MessageManager + .getString("label.default_maximum_colour_annotation_shading"), maxcolourLabel, maxColour); visual2Tab.add(annotationShding); // , FlowLayout.LEFT); @@ -848,7 +877,8 @@ public class GPreferences extends JPanel tabbedPane.add(visualTab, MessageManager.getString("label.visual")); tabbedPane.add(visual2Tab, MessageManager.getString("label.colours")); - tabbedPane.add(connectTab, MessageManager.getString("label.connections")); + tabbedPane.add(connectTab, + MessageManager.getString("label.connections")); tabbedPane.add(exportTab, MessageManager.getString("label.output")); jPanel11.add(jLabel1); jPanel11.add(blcjv); @@ -867,7 +897,8 @@ public class GPreferences extends JPanel calcTab.add(padGaps); calcTab.add(sortByTree); - tabbedPane.add(dasPanel, MessageManager.getString("label.das_settings")); + tabbedPane + .add(dasPanel, MessageManager.getString("label.das_settings")); tabbedPane.add(wsPanel, MessageManager.getString("label.web_services")); exportTab.add(epsLabel); diff --git a/src/jalview/jbgui/GRestInputParamEditDialog.java b/src/jalview/jbgui/GRestInputParamEditDialog.java index c55ae45..f91d8b2 100644 --- a/src/jalview/jbgui/GRestInputParamEditDialog.java +++ b/src/jalview/jbgui/GRestInputParamEditDialog.java @@ -98,16 +98,20 @@ public class GRestInputParamEditDialog optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]")); JScrollPane optionView = new JScrollPane(); optionView.setViewportView(options); - JvSwingUtils.mgAddtoLayout(dpane, MessageManager.getString("label.input_parameter_name"), new JLabel( - MessageManager.getString("label.name")), tok, "grow,spanx 3,wrap"); + JvSwingUtils.mgAddtoLayout(dpane, + MessageManager.getString("label.input_parameter_name"), + new JLabel(MessageManager.getString("label.name")), tok, + "grow,spanx 3,wrap"); JPanel paramsType = new JPanel(new MigLayout("", "[grow 100,fill]", "[grow 100,fill]")); - paramsType.setBorder(new TitledBorder(MessageManager.getString("label.select_input_type"))); + paramsType.setBorder(new TitledBorder(MessageManager + .getString("label.select_input_type"))); JScrollPane jlistScroller = new JScrollPane(); jlistScroller.setViewportView(typeList); paramsType.add(jlistScroller, "spanx 2,spany 2"); dpane.add(paramsType); - optionsPanel.setBorder(new TitledBorder(MessageManager.getString("label.set_options_for_type"))); + optionsPanel.setBorder(new TitledBorder(MessageManager + .getString("label.set_options_for_type"))); optionsPanel.add(optionView); dpane.add(optionsPanel, "wrap"); okcancel = new JPanel(new MigLayout("", "[center][center]", "[]")); diff --git a/src/jalview/jbgui/GRestServiceEditorPane.java b/src/jalview/jbgui/GRestServiceEditorPane.java index 651e961..259824a 100644 --- a/src/jalview/jbgui/GRestServiceEditorPane.java +++ b/src/jalview/jbgui/GRestServiceEditorPane.java @@ -109,38 +109,38 @@ public class GRestServiceEditorPane extends JPanel cpanel = details; name = new JTextArea(1, 12); - JvSwingUtils.mgAddtoLayout(cpanel, - MessageManager.getString("label.short_descriptive_name_for_service"), new JLabel(MessageManager.getString("label.name")), - name, "wrap"); + JvSwingUtils.mgAddtoLayout(cpanel, MessageManager + .getString("label.short_descriptive_name_for_service"), + new JLabel(MessageManager.getString("label.name")), name, + "wrap"); action = new JComboBox(); - JvSwingUtils - .mgAddtoLayout( - cpanel, - MessageManager.getString("label.function_service_performs"), - new JLabel(MessageManager.getString("label.service_action")), action, "wrap"); + JvSwingUtils.mgAddtoLayout(cpanel, + MessageManager.getString("label.function_service_performs"), + new JLabel(MessageManager.getString("label.service_action")), + action, "wrap"); descr = new JTextArea(4, 60); descrVp = new JScrollPane(); descrVp.setViewportView(descr); - JvSwingUtils.mgAddtoLayout(cpanel, MessageManager.getString("label.brief_description_service"), - new JLabel(MessageManager.getString("label.description")), descrVp, "wrap"); + JvSwingUtils.mgAddtoLayout(cpanel, + MessageManager.getString("label.brief_description_service"), + new JLabel(MessageManager.getString("label.description")), + descrVp, "wrap"); url = new JTextArea(2, 60); urlVp = new JScrollPane(); urlVp.setViewportView(url); - JvSwingUtils - .mgAddtoLayout( - cpanel, - MessageManager.getString("label.url_post_data_service"), - new JLabel(MessageManager.getString("label.post_url")), urlVp, "wrap"); + JvSwingUtils.mgAddtoLayout(cpanel, + MessageManager.getString("label.url_post_data_service"), + new JLabel(MessageManager.getString("label.post_url")), urlVp, + "wrap"); urlsuff = new JTextArea(); urlsuff.setColumns(60); - JvSwingUtils - .mgAddtoLayout( - cpanel, - MessageManager.getString("label.optional_suffix"), - new JLabel(MessageManager.getString("label.url_suffix")), urlsuff, "wrap"); + JvSwingUtils.mgAddtoLayout(cpanel, MessageManager + .getString("label.optional_suffix"), + new JLabel(MessageManager.getString("label.url_suffix")), + urlsuff, "wrap"); // input options // details.add(cpanel = new JPanel(), BorderLayout.CENTER); @@ -161,7 +161,8 @@ public class GRestServiceEditorPane extends JPanel } }); - vSeparable = new JCheckBox(MessageManager.getString("label.result_vertically_separable")); + vSeparable = new JCheckBox( + MessageManager.getString("label.result_vertically_separable")); vSeparable .setToolTipText("" + JvSwingUtils @@ -182,8 +183,9 @@ public class GRestServiceEditorPane extends JPanel }); gapChar = new JComboBox(); JvSwingUtils.mgAddtoLayout(cpanel, - MessageManager.getString("label.preferred_gap_character"), new JLabel( - MessageManager.getString("label.gap_character") + ":"), gapChar, "wrap"); + MessageManager.getString("label.preferred_gap_character"), + new JLabel(MessageManager.getString("label.gap_character") + + ":"), gapChar, "wrap"); cpanel.add(hSeparable); cpanel.add(vSeparable); @@ -191,7 +193,8 @@ public class GRestServiceEditorPane extends JPanel // Input and Output lists // Inputparams JPanel iprmsList = new JPanel(); - iprmsList.setBorder(new TitledBorder(MessageManager.getString("label.data_input_parameters"))); + iprmsList.setBorder(new TitledBorder(MessageManager + .getString("label.data_input_parameters"))); iprmsList.setLayout(new MigLayout("", "[grow 90, fill][]")); iprmVp = new JScrollPane(); iprmVp.getViewport().setView(iprms = new JList()); @@ -241,7 +244,8 @@ public class GRestServiceEditorPane extends JPanel JPanel iprmButs = new JPanel(); iprmButs.setLayout(new MigLayout()); - iprmsAdd = JvSwingUtils.makeButton("+", MessageManager.getString("action.add_input_parameter"), + iprmsAdd = JvSwingUtils.makeButton("+", + MessageManager.getString("action.add_input_parameter"), new ActionListener() { @@ -253,7 +257,8 @@ public class GRestServiceEditorPane extends JPanel } }); iprmsRem = JvSwingUtils.makeButton("-", - MessageManager.getString("action.remove_input_parameter"), new ActionListener() + MessageManager.getString("action.remove_input_parameter"), + new ActionListener() { @Override @@ -271,7 +276,8 @@ public class GRestServiceEditorPane extends JPanel // Return Parameters - rdataAdd = JvSwingUtils.makeButton("+", MessageManager.getString("action.add_return_datatype"), + rdataAdd = JvSwingUtils.makeButton("+", + MessageManager.getString("action.add_return_datatype"), new ActionListener() { @@ -282,7 +288,8 @@ public class GRestServiceEditorPane extends JPanel } }); - rdataRem = JvSwingUtils.makeButton("-", MessageManager.getString("action.remove_return_datatype"), + rdataRem = JvSwingUtils.makeButton("-", + MessageManager.getString("action.remove_return_datatype"), new ActionListener() { @@ -293,8 +300,10 @@ public class GRestServiceEditorPane extends JPanel } }); - rdataNup = JvSwingUtils.makeButton(MessageManager.getString("action.move_up"), - MessageManager.getString("label.move_return_type_up_order"), new ActionListener() + rdataNup = JvSwingUtils.makeButton( + MessageManager.getString("action.move_up"), + MessageManager.getString("label.move_return_type_up_order"), + new ActionListener() { @Override @@ -304,8 +313,10 @@ public class GRestServiceEditorPane extends JPanel } }); - rdataNdown = JvSwingUtils.makeButton(MessageManager.getString("action.move_down"), - MessageManager.getString("label.move_return_type_down_order"), new ActionListener() + rdataNdown = JvSwingUtils.makeButton( + MessageManager.getString("action.move_down"), + MessageManager.getString("label.move_return_type_down_order"), + new ActionListener() { @Override @@ -317,10 +328,12 @@ public class GRestServiceEditorPane extends JPanel }); JPanel rparamList = new JPanel(); - rparamList.setBorder(new TitledBorder(MessageManager.getString("label.data_returned_by_service"))); + rparamList.setBorder(new TitledBorder(MessageManager + .getString("label.data_returned_by_service"))); rparamList.setLayout(new MigLayout("", "[grow 90, fill][]")); rdata = new JList(); - rdata.setToolTipText(MessageManager.getString("label.right_click_to_edit_currently_selected_parameter")); + rdata.setToolTipText(MessageManager + .getString("label.right_click_to_edit_currently_selected_parameter")); rdata.addMouseListener(new MouseListener() { @@ -383,7 +396,8 @@ public class GRestServiceEditorPane extends JPanel JPanel urldescPane = new JPanel(); urldescPane.setLayout(new MigLayout("", "[grow 100, fill]", "[grow 100, fill]")); - urldescPane.setBorder(new TitledBorder(MessageManager.getString("label.rsbs_encoded_service"))); + urldescPane.setBorder(new TitledBorder(MessageManager + .getString("label.rsbs_encoded_service"))); urldescPane.add(urldescVp, "span"); paste.add(urldescPane, "span"); urldescPane @@ -398,7 +412,8 @@ public class GRestServiceEditorPane extends JPanel parseRes.setColumns(60); parseWarnings = new JPanel(new MigLayout("", "[grow 100, fill]", "[grow 100, fill]")); - parseWarnings.setBorder(new TitledBorder(MessageManager.getString("label.parsing_errors"))); + parseWarnings.setBorder(new TitledBorder(MessageManager + .getString("label.parsing_errors"))); parseWarnings .setToolTipText("" + JvSwingUtils @@ -409,16 +424,18 @@ public class GRestServiceEditorPane extends JPanel paste.add(parseWarnings, "span"); setLayout(new BorderLayout()); add(panels, BorderLayout.CENTER); - okButton = JvSwingUtils.makeButton(MessageManager.getString("action.ok"), "", new ActionListener() - { + okButton = JvSwingUtils.makeButton( + MessageManager.getString("action.ok"), "", new ActionListener() + { - @Override - public void actionPerformed(ActionEvent e) - { - ok_actionPerformed(); - } - }); - cancelButton = JvSwingUtils.makeButton(MessageManager.getString("action.cancel"), "", + @Override + public void actionPerformed(ActionEvent e) + { + ok_actionPerformed(); + } + }); + cancelButton = JvSwingUtils.makeButton( + MessageManager.getString("action.cancel"), "", new ActionListener() { diff --git a/src/jalview/jbgui/GSliderPanel.java b/src/jalview/jbgui/GSliderPanel.java index db86294..b11fb7f 100755 --- a/src/jalview/jbgui/GSliderPanel.java +++ b/src/jalview/jbgui/GSliderPanel.java @@ -140,7 +140,8 @@ public class GSliderPanel extends JPanel allGroupsCheck.setEnabled(false); allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11)); allGroupsCheck.setOpaque(false); - allGroupsCheck.setText(MessageManager.getString("action.apply_all_groups")); + allGroupsCheck.setText(MessageManager + .getString("action.apply_all_groups")); allGroupsCheck.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/jbgui/GStructureViewer.java b/src/jalview/jbgui/GStructureViewer.java index 270acbe..f6c4e05 100644 --- a/src/jalview/jbgui/GStructureViewer.java +++ b/src/jalview/jbgui/GStructureViewer.java @@ -80,7 +80,8 @@ public class GStructureViewer extends JInternalFrame viewMenu.setText(MessageManager.getString("action.view")); chainMenu.setText(MessageManager.getString("action.show_chain")); colourMenu.setText(MessageManager.getString("label.colours")); - backGround.setText(MessageManager.getString("label.background_colour") + "..."); + backGround.setText(MessageManager.getString("label.background_colour") + + "..."); backGround.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -137,7 +138,8 @@ public class GStructureViewer extends JInternalFrame hydroColour_actionPerformed(actionEvent); } }); - strandColour.setText(MessageManager.getString("label.strand_propensity")); + strandColour.setText(MessageManager + .getString("label.strand_propensity")); strandColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -169,7 +171,8 @@ public class GStructureViewer extends JInternalFrame buriedColour_actionPerformed(actionEvent); } }); - purinePyrimidineColour.setText(MessageManager.getString("label.purine_pyrimidine")); + purinePyrimidineColour.setText(MessageManager + .getString("label.purine_pyrimidine")); purinePyrimidineColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -188,7 +191,8 @@ public class GStructureViewer extends JInternalFrame }); jmolColour.setSelected(false); jmolColour.setText(MessageManager.getString("label.colour_with_jmol")); - jmolColour.setToolTipText(MessageManager.getString("label.let_jmol_manage_structure_colours")); + jmolColour.setToolTipText(MessageManager + .getString("label.let_jmol_manage_structure_colours")); jmolColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) @@ -205,7 +209,8 @@ public class GStructureViewer extends JInternalFrame jmolHelp_actionPerformed(actionEvent); } }); - alignStructs.setText(MessageManager.getString("label.align_structures")); + alignStructs + .setText(MessageManager.getString("label.align_structures")); alignStructs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) diff --git a/src/jalview/jbgui/GTreePanel.java b/src/jalview/jbgui/GTreePanel.java index ae6f784..b492c21 100755 --- a/src/jalview/jbgui/GTreePanel.java +++ b/src/jalview/jbgui/GTreePanel.java @@ -118,7 +118,8 @@ public class GTreePanel extends JInternalFrame { } }); - sortAssocViews.setText(MessageManager.getString("label.sort_alignment_by_tree")); + sortAssocViews.setText(MessageManager + .getString("label.sort_alignment_by_tree")); sortAssocViews.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -134,7 +135,8 @@ public class GTreePanel extends JInternalFrame font_actionPerformed(e); } }); - bootstrapMenu.setText(MessageManager.getString("label.show_bootstrap_values")); + bootstrapMenu.setText(MessageManager + .getString("label.show_bootstrap_values")); bootstrapMenu.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) @@ -177,8 +179,10 @@ public class GTreePanel extends JInternalFrame }); saveAsMenu.setText(MessageManager.getString("action.save_as")); placeholdersMenu - .setToolTipText(MessageManager.getString("label.marks_leaves_tree_not_associated_with_sequence")); - placeholdersMenu.setText(MessageManager.getString("label.mark_unlinked_leaves")); + .setToolTipText(MessageManager + .getString("label.marks_leaves_tree_not_associated_with_sequence")); + placeholdersMenu.setText(MessageManager + .getString("label.mark_unlinked_leaves")); placeholdersMenu.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -186,7 +190,8 @@ public class GTreePanel extends JInternalFrame placeholdersMenu_actionPerformed(e); } }); - textbox.setText(MessageManager.getString("label.out_to_textbox") + "..."); + textbox.setText(MessageManager.getString("label.out_to_textbox") + + "..."); textbox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -202,7 +207,8 @@ public class GTreePanel extends JInternalFrame originalSeqData_actionPerformed(e); } }); - associateLeavesMenu.setText(MessageManager.getString("label.associate_leaves_with")); + associateLeavesMenu.setText(MessageManager + .getString("label.associate_leaves_with")); this.getContentPane().add(scrollPane, BorderLayout.CENTER); jMenuBar1.add(fileMenu); jMenuBar1.add(viewMenu); diff --git a/src/jalview/jbgui/GUserDefinedColours.java b/src/jalview/jbgui/GUserDefinedColours.java index f445d36..1cc1f11 100755 --- a/src/jalview/jbgui/GUserDefinedColours.java +++ b/src/jalview/jbgui/GUserDefinedColours.java @@ -183,7 +183,11 @@ public class GUserDefinedColours extends JPanel label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10)); label.setOpaque(false); label.setPreferredSize(new Dimension(260, 34)); - label.setText(MessageManager.formatMessage("label.html_content", new String[]{MessageManager.getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu")})); + label.setText(MessageManager.formatMessage( + "label.html_content", + new String[] + { MessageManager + .getString("label.save_colour_scheme_with_unique_name_added_to_colour_menu") })); caseSensitive.setText(MessageManager.getString("label.case_sensitive")); caseSensitive.addActionListener(new ActionListener() { @@ -192,7 +196,8 @@ public class GUserDefinedColours extends JPanel caseSensitive_actionPerformed(e); } }); - lcaseColour.setText(MessageManager.getString("label.lower_case_colour")); + lcaseColour + .setText(MessageManager.getString("label.lower_case_colour")); lcaseColour.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/jbgui/GWebserviceInfo.java b/src/jalview/jbgui/GWebserviceInfo.java index ba6d99e..910768e 100755 --- a/src/jalview/jbgui/GWebserviceInfo.java +++ b/src/jalview/jbgui/GWebserviceInfo.java @@ -109,7 +109,8 @@ public class GWebserviceInfo extends JPanel }); buttonPanel.setLayout(gridBagLayout1); buttonPanel.setOpaque(false); - showResultsNewFrame.setText(MessageManager.getString("label.new_window")); + showResultsNewFrame.setText(MessageManager + .getString("label.new_window")); mergeResults.setText(MessageManager.getString("action.merge_results")); this.setBackground(Color.white); this.add(jPanel1, BorderLayout.NORTH); diff --git a/src/jalview/jbgui/GWsPreferences.java b/src/jalview/jbgui/GWsPreferences.java index 31d4a0a..ff171c9 100644 --- a/src/jalview/jbgui/GWsPreferences.java +++ b/src/jalview/jbgui/GWsPreferences.java @@ -55,7 +55,8 @@ public class GWsPreferences extends JPanel protected JList sbrsList = new JList(); protected TitledBorder sbrsListTitleBorder = new TitledBorder( - MessageManager.getString("label.simple_bioinformatics_rest_services")); + MessageManager + .getString("label.simple_bioinformatics_rest_services")); protected JButton newSbrsUrl = new JButton(); @@ -162,8 +163,8 @@ public class GWsPreferences extends JPanel }); indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); indexByHost.setText(MessageManager.getString("label.index_by_host")); - indexByHost - .setToolTipText(MessageManager.getString("label.index_web_services_menu_by_host_site")); + indexByHost.setToolTipText(MessageManager + .getString("label.index_web_services_menu_by_host_site")); indexByHost.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -182,7 +183,8 @@ public class GWsPreferences extends JPanel }); enableJws2Services .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - enableJws2Services.setText(MessageManager.getString("label.enable_jabaws_services")); + enableJws2Services.setText(MessageManager + .getString("label.enable_jabaws_services")); enableJws2Services.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -191,9 +193,12 @@ public class GWsPreferences extends JPanel } }); displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - displayWsWarning.setText(MessageManager.getString("label.display_warnings")); + displayWsWarning.setText(MessageManager + .getString("label.display_warnings")); displayWsWarning - .setToolTipText("" + MessageManager.getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up")); + .setToolTipText("" + + MessageManager + .getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up")); displayWsWarning.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -221,7 +226,8 @@ public class GWsPreferences extends JPanel }); deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - deleteWsUrl.setText(MessageManager.getString("label.delete_service_url")); + deleteWsUrl.setText(MessageManager + .getString("label.delete_service_url")); deleteWsUrl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -231,7 +237,8 @@ public class GWsPreferences extends JPanel }); moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); moveWsUrlUp.setText(MessageManager.getString("action.move_up")); - moveWsUrlUp.setToolTipText(MessageManager.getString("label.move_url_up")); + moveWsUrlUp.setToolTipText(MessageManager + .getString("label.move_url_up")); moveWsUrlUp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -241,7 +248,8 @@ public class GWsPreferences extends JPanel }); moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); moveWsUrlDown.setText(MessageManager.getString("action.move_down")); - moveWsUrlDown.setToolTipText(MessageManager.getString("label.move_url_down")); + moveWsUrlDown.setToolTipText(MessageManager + .getString("label.move_url_down")); moveWsUrlDown.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -250,7 +258,8 @@ public class GWsPreferences extends JPanel } }); newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - newSbrsUrl.setText(MessageManager.getString("label.add_sbrs_definition")); + newSbrsUrl.setText(MessageManager + .getString("label.add_sbrs_definition")); newSbrsUrl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -259,7 +268,8 @@ public class GWsPreferences extends JPanel } }); editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - editSbrsUrl.setText(MessageManager.getString("label.edit_sbrs_definition")); + editSbrsUrl.setText(MessageManager + .getString("label.edit_sbrs_definition")); editSbrsUrl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) @@ -269,7 +279,8 @@ public class GWsPreferences extends JPanel }); deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); - deleteSbrsUrl.setText(MessageManager.getString("label.delete_sbrs_definition")); + deleteSbrsUrl.setText(MessageManager + .getString("label.delete_sbrs_definition")); deleteSbrsUrl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) diff --git a/src/jalview/math/Matrix.java b/src/jalview/math/Matrix.java index 7c31f73..036d16a 100755 --- a/src/jalview/math/Matrix.java +++ b/src/jalview/math/Matrix.java @@ -50,7 +50,7 @@ public class Matrix public double[] e; // off diagonal /** - * maximum number of iterations for tqli + * maximum number of iterations for tqli * */ int maxIter = 45; // fudge - add 15 iterations, just in case @@ -350,7 +350,7 @@ public class Matrix } } } - + /** * DOCUMENT ME! */ @@ -403,7 +403,8 @@ public class Matrix if (iter == maxIter) { - throw new Exception("Too many iterations in tqli ("+maxIter+")"); + throw new Exception("Too many iterations in tqli (" + maxIter + + ")"); } else { @@ -652,7 +653,8 @@ public class Matrix if (iter == maxIter) { - throw new Exception ("Too many iterations in tqli2 (max is "+maxIter+")"); + throw new Exception("Too many iterations in tqli2 (max is " + + maxIter + ")"); } else { diff --git a/src/jalview/renderer/AnnotationRenderer.java b/src/jalview/renderer/AnnotationRenderer.java index c0ddf71..4c3711d 100644 --- a/src/jalview/renderer/AnnotationRenderer.java +++ b/src/jalview/renderer/AnnotationRenderer.java @@ -54,13 +54,17 @@ public class AnnotationRenderer { this(false); } + /** * Create a new annotation Renderer - * @param debugRedraw flag indicating if timing and redraw parameter info should be output + * + * @param debugRedraw + * flag indicating if timing and redraw parameter info should be + * output */ public AnnotationRenderer(boolean debugRedraw) { - this.debugRedraw=debugRedraw; + this.debugRedraw = debugRedraw; } public void drawStemAnnot(Graphics g, Annotation[] row_annotations, @@ -85,7 +89,7 @@ public class AnnotationRenderer // If a closing base pair half of the stem, display a backward arrow if (column > 0 && closeparen.search(dc)) { - + if (diffupstream) // if (validRes && column>1 && row_annotations[column-2]!=null && // dc.equals(row_annotations[column-2].displayCharacter)) @@ -102,7 +106,7 @@ public class AnnotationRenderer } else { - + // display a forward arrow if (diffdownstream) { @@ -159,36 +163,42 @@ public class AnnotationRenderer * width of image to render in panel */ private int imgWidth; + /** * offset to beginning of visible area */ private int sOffset; + /** * offset to end of visible area */ private int visHeight; + /** - * indicate if the renderer should only render the visible portion of the annotation given the current view settings + * indicate if the renderer should only render the visible portion of the + * annotation given the current view settings */ - private boolean useClip=true; + private boolean useClip = true; + /** - * master flag indicating if renderer should ever try to clip. not enabled for jalview 2.8.1 + * master flag indicating if renderer should ever try to clip. not enabled for + * jalview 2.8.1 */ - private boolean canClip=false; + private boolean canClip = false; - - public void drawNotCanonicalAnnot(Graphics g, Color nonCanColor, Annotation[] row_annotations, - int lastSSX, int x, int y, int iconOffset, int startRes, - int column, boolean validRes, boolean validEnd) + public void drawNotCanonicalAnnot(Graphics g, Color nonCanColor, + Annotation[] row_annotations, int lastSSX, int x, int y, + int iconOffset, int startRes, int column, boolean validRes, + boolean validEnd) { - //System.out.println(nonCanColor); - + // System.out.println(nonCanColor); + g.setColor(nonCanColor); int sCol = (lastSSX / charWidth) + startRes; int x1 = lastSSX; int x2 = (x * charWidth); Regex closeparen = new Regex("}|]|<|[a-z]"); - + String dc = (column == 0 || row_annotations[column - 1] == null) ? "" : row_annotations[column - 1].displayCharacter; @@ -199,9 +209,10 @@ public class AnnotationRenderer || !dc.equals(row_annotations[column].displayCharacter); // System.out.println("Column "+column+" diff up: "+diffupstream+" down:"+diffdownstream); // If a closing base pair half of the stem, display a backward arrow - if (column > 0 && closeparen.search(dc))// closeletter_b.search(dc)||closeletter_c.search(dc)||closeletter_d.search(dc)||closecrochet.search(dc)) ) + if (column > 0 && closeparen.search(dc))// closeletter_b.search(dc)||closeletter_c.search(dc)||closeletter_d.search(dc)||closecrochet.search(dc)) + // ) { - + if (diffupstream) // if (validRes && column>1 && row_annotations[column-2]!=null && // dc.equals(row_annotations[column-2].displayCharacter)) @@ -218,7 +229,7 @@ public class AnnotationRenderer } else { - + // display a forward arrow if (diffdownstream) { @@ -235,6 +246,7 @@ public class AnnotationRenderer // draw arrow body g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 7); } + // public void updateFromAnnotationPanel(FontMetrics annotFM, AlignViewportI // av) public void updateFromAwtRenderPanel(AwtRenderPanelI annotPanel, @@ -245,19 +257,23 @@ public class AnnotationRenderer fadedImage = annotPanel.getFadedImage(); imgWidth = annotPanel.getFadedImageWidth(); // visible area for rendering - int[] bounds=annotPanel.getVisibleVRange(); - if (bounds!=null) + int[] bounds = annotPanel.getVisibleVRange(); + if (bounds != null) { sOffset = bounds[0]; visHeight = bounds[1]; - if (visHeight==0) + if (visHeight == 0) + { + useClip = false; + } + else { - useClip=false; - } else { - useClip=canClip; + useClip = canClip; } - } else { - useClip=false; + } + else + { + useClip = false; } updateFromAlignViewport(av); @@ -359,7 +375,7 @@ public class AnnotationRenderer AlignViewportI av, Graphics g, int activeRow, int startRes, int endRes) { - long stime=System.currentTimeMillis(); + long stime = System.currentTimeMillis(); boolean usedFaded = false; // NOTES: // AnnotationPanel needs to implement: ImageObserver, access to @@ -368,7 +384,7 @@ public class AnnotationRenderer fm = g.getFontMetrics(); AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); int temp = 0; - if (aa==null) + if (aa == null) { return false; } @@ -383,7 +399,9 @@ public class AnnotationRenderer boolean centreColLabels, centreColLabelsDef = av .getCentreColumnLabels(); boolean scaleColLabel = false; - AlignmentAnnotation consensusAnnot=av.getAlignmentConsensusAnnotation(),structConsensusAnnot=av.getAlignmentStrucConsensusAnnotation(); + AlignmentAnnotation consensusAnnot = av + .getAlignmentConsensusAnnotation(), structConsensusAnnot = av + .getAlignmentStrucConsensusAnnotation(); boolean renderHistogram = true, renderProfile = true, normaliseProfile = false; BitSet graphGroupDrawn = new BitSet(); @@ -393,13 +411,14 @@ public class AnnotationRenderer Font ofont = g.getFont(); // \u03B2 \u03B1 // debug ints - int yfrom=0,f_i=0,yto=0,f_to=0; - boolean clipst=false,clipend=false; + int yfrom = 0, f_i = 0, yto = 0, f_to = 0; + boolean clipst = false, clipend = false; for (int i = 0; i < aa.length; i++) { AlignmentAnnotation row = aa[i]; { - // check if this is a consensus annotation row and set the display settings appropriately + // check if this is a consensus annotation row and set the display + // settings appropriately // TODO: generalise this to have render styles for consensus/profile // data if (row.groupRef != null && row == row.groupRef.getConsensus()) @@ -413,9 +432,12 @@ public class AnnotationRenderer renderHistogram = av_renderHistogram; renderProfile = av_renderProfile; normaliseProfile = av_normaliseProfile; - } else { + } + else + { renderHistogram = true; - // don't need to set render/normaliseProfile since they are not currently used in any other annotation track renderer + // don't need to set render/normaliseProfile since they are not + // currently used in any other annotation track renderer } } Annotation[] row_annotations = row.annotations; @@ -428,528 +450,530 @@ public class AnnotationRenderer scaleColLabel = row.scaleColLabel; lastSS = ' '; lastSSX = 0; - - if (!useClip || ((y-charHeight)=sOffset)) + + if (!useClip + || ((y - charHeight) < visHeight && (y + row.height + charHeight * 2) >= sOffset)) {// if_in_visible_region if (!clipst) { - clipst=true; - yfrom=y; - f_i=i; + clipst = true; + yfrom = y; + f_i = i; } yto = y; - f_to=i; - if (row.graph > 0) - { - if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) { - continue; - } - - // this is so that we draw the characters below the graph - y += row.height; - - if (row.hasText) + f_to = i; + if (row.graph > 0) { - iconOffset = charHeight - fm.getDescent(); - y -= charHeight; - } - } - else if (row.hasText) - { - iconOffset = charHeight - fm.getDescent(); - - } - else - { - iconOffset = 0; - } - - if (row.autoCalculated && av.isCalculationInProgress(row)) - { - y += charHeight; - usedFaded = true; - g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y - - row.height, imgWidth, y, annotationPanel); - g.setColor(Color.black); - // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2); + if (row.graphGroup > -1 && graphGroupDrawn.get(row.graphGroup)) + { + continue; + } - continue; - } + // this is so that we draw the characters below the graph + y += row.height; - /* - * else if (annotationPanel.av.updatingConservation && - * aa[i].label.equals("Conservation")) { - * - * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - - * row.height, annotationPanel.imgWidth, y, 0, y - row.height, - * annotationPanel.imgWidth, y, annotationPanel); - * - * g.setColor(Color.black); // - * g.drawString("Calculating Conservation.....",20, y-row.height/2); - * - * continue; } else if (annotationPanel.av.updatingConservation && - * aa[i].label.equals("Quality")) { - * - * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - - * row.height, annotationPanel.imgWidth, y, 0, y - row.height, - * annotationPanel.imgWidth, y, annotationPanel); g.setColor(Color.black); - * // / g.drawString("Calculating Quality....",20, y-row.height/2); - * - * continue; } - */ - // first pass sets up state for drawing continuation from left-hand column - // of startRes - x = (startRes == 0) ? 0 : -1; - while (x < endRes - startRes) - { - if (hasHiddenColumns) - { - column = columnSelection.adjustForHiddenColumns(startRes + x); - if (column > row_annotations.length - 1) + if (row.hasText) { - break; + iconOffset = charHeight - fm.getDescent(); + y -= charHeight; } } - else + else if (row.hasText) { - column = startRes + x; - } + iconOffset = charHeight - fm.getDescent(); - if ((row_annotations == null) || (row_annotations.length <= column) - || (row_annotations[column] == null)) - { - validRes = false; } else { - validRes = true; + iconOffset = 0; } - if (x > -1) + + if (row.autoCalculated && av.isCalculationInProgress(row)) { - if (activeRow == i) - { - g.setColor(Color.red); + y += charHeight; + usedFaded = true; + g.drawImage(fadedImage, 0, y - row.height, imgWidth, y, 0, y + - row.height, imgWidth, y, annotationPanel); + g.setColor(Color.black); + // g.drawString("Calculating "+aa[i].label+"....",20, y-row.height/2); - if (columnSelection != null) - { - for (int n = 0; n < columnSelection.size(); n++) - { - int v = columnSelection.columnAt(n); + continue; + } - if (v == column) - { - g.fillRect(x * charWidth, y, charWidth, charHeight); - } - } + /* + * else if (annotationPanel.av.updatingConservation && + * aa[i].label.equals("Conservation")) { + * + * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - + * row.height, annotationPanel.imgWidth, y, 0, y - row.height, + * annotationPanel.imgWidth, y, annotationPanel); + * + * g.setColor(Color.black); // + * g.drawString("Calculating Conservation.....",20, y-row.height/2); + * + * continue; } else if (annotationPanel.av.updatingConservation && + * aa[i].label.equals("Quality")) { + * + * y += charHeight; g.drawImage(annotationPanel.fadedImage, 0, y - + * row.height, annotationPanel.imgWidth, y, 0, y - row.height, + * annotationPanel.imgWidth, y, annotationPanel); + * g.setColor(Color.black); // / + * g.drawString("Calculating Quality....",20, y-row.height/2); + * + * continue; } + */ + // first pass sets up state for drawing continuation from left-hand + // column + // of startRes + x = (startRes == 0) ? 0 : -1; + while (x < endRes - startRes) + { + if (hasHiddenColumns) + { + column = columnSelection.adjustForHiddenColumns(startRes + x); + if (column > row_annotations.length - 1) + { + break; } } - if (!row.isValidStruc()) + else { - g.setColor(Color.orange); - g.fillRect((int) row.getInvalidStrucPos() * charWidth, y, - charWidth, charHeight); + column = startRes + x; } - if (validCharWidth - && validRes - && row_annotations[column].displayCharacter != null - && (row_annotations[column].displayCharacter.length() > 0)) - { - if (centreColLabels || scaleColLabel) + if ((row_annotations == null) + || (row_annotations.length <= column) + || (row_annotations[column] == null)) + { + validRes = false; + } + else + { + validRes = true; + } + if (x > -1) + { + if (activeRow == i) { - fmWidth = fm.charsWidth( - row_annotations[column].displayCharacter - .toCharArray(), 0, - row_annotations[column].displayCharacter.length()); + g.setColor(Color.red); - if (scaleColLabel) + if (columnSelection != null) { - // justify the label and scale to fit in column - if (fmWidth > charWidth) + for (int n = 0; n < columnSelection.size(); n++) { - // scale only if the current font isn't already small enough - fmScaling = charWidth; - fmScaling /= fmWidth; - g.setFont(ofont.deriveFont(AffineTransform - .getScaleInstance(fmScaling, 1.0))); - // and update the label's width to reflect the scaling. - fmWidth = charWidth; + int v = columnSelection.columnAt(n); + + if (v == column) + { + g.fillRect(x * charWidth, y, charWidth, charHeight); + } } } } - else + if (!row.isValidStruc()) { - fmWidth = fm - .charWidth(row_annotations[column].displayCharacter - .charAt(0)); + g.setColor(Color.orange); + g.fillRect((int) row.getInvalidStrucPos() * charWidth, y, + charWidth, charHeight); } - charOffset = (int) ((charWidth - fmWidth) / 2f); + if (validCharWidth + && validRes + && row_annotations[column].displayCharacter != null + && (row_annotations[column].displayCharacter.length() > 0)) + { - if (row_annotations[column].colour == null) - g.setColor(Color.black); - else - g.setColor(row_annotations[column].colour); + if (centreColLabels || scaleColLabel) + { + fmWidth = fm.charsWidth( + row_annotations[column].displayCharacter + .toCharArray(), 0, + row_annotations[column].displayCharacter.length()); - if (column == 0 || row.graph > 0) - { - g.drawString(row_annotations[column].displayCharacter, - (x * charWidth) + charOffset, y + iconOffset); - } - else if (row_annotations[column - 1] == null - || (labelAllCols - || !row_annotations[column].displayCharacter - .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter - .length() < 2 && row_annotations[column].secondaryStructure == ' '))) - { - g.drawString(row_annotations[column].displayCharacter - , x - * charWidth + charOffset, y + iconOffset); + if (scaleColLabel) + { + // justify the label and scale to fit in column + if (fmWidth > charWidth) + { + // scale only if the current font isn't already small enough + fmScaling = charWidth; + fmScaling /= fmWidth; + g.setFont(ofont.deriveFont(AffineTransform + .getScaleInstance(fmScaling, 1.0))); + // and update the label's width to reflect the scaling. + fmWidth = charWidth; + } + } + } + else + { + fmWidth = fm + .charWidth(row_annotations[column].displayCharacter + .charAt(0)); + } + charOffset = (int) ((charWidth - fmWidth) / 2f); + + if (row_annotations[column].colour == null) + g.setColor(Color.black); + else + g.setColor(row_annotations[column].colour); + + if (column == 0 || row.graph > 0) + { + g.drawString(row_annotations[column].displayCharacter, + (x * charWidth) + charOffset, y + iconOffset); + } + else if (row_annotations[column - 1] == null + || (labelAllCols + || !row_annotations[column].displayCharacter + .equals(row_annotations[column - 1].displayCharacter) || (row_annotations[column].displayCharacter + .length() < 2 && row_annotations[column].secondaryStructure == ' '))) + { + g.drawString(row_annotations[column].displayCharacter, x + * charWidth + charOffset, y + iconOffset); + } + g.setFont(ofont); } - g.setFont(ofont); } - } - if (row.hasIcons) - { - char ss = validRes ? row_annotations[column].secondaryStructure - : '-'; - - if (ss == '(') + if (row.hasIcons) { - // distinguish between forward/backward base-pairing - if (row_annotations[column].displayCharacter.indexOf(')') > -1) + char ss = validRes ? row_annotations[column].secondaryStructure + : '-'; + + if (ss == '(') { - - ss = ')'; - + // distinguish between forward/backward base-pairing + if (row_annotations[column].displayCharacter.indexOf(')') > -1) + { + + ss = ')'; + + } } - } - if (ss == '[') - { - if ((row_annotations[column].displayCharacter.indexOf(']') > -1)) + if (ss == '[') { + if ((row_annotations[column].displayCharacter.indexOf(']') > -1)) + { ss = ']'; - - + + } } - } - if (ss == '{') - { - // distinguish between forward/backward base-pairing - if (row_annotations[column].displayCharacter.indexOf('}') > -1) - { - ss = '}'; - - - } - } - if (ss == '<') - { - // distinguish between forward/backward base-pairing - if (row_annotations[column].displayCharacter.indexOf('<') > -1) - { - ss = '>'; - - - } - } - if (ss >=65) - { - // distinguish between forward/backward base-pairing - if (row_annotations[column].displayCharacter.indexOf(ss+32) > -1) - { - - ss = (char) (ss+32); - - - } - } - - - if (!validRes || (ss != lastSS)) - { - - - if (x > -1) - { - - - int nb_annot=x-temp; - //System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre annot :"+nb_annot); - switch (lastSS) - { - - case '$': - drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; - - case '�': - drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; - - case '(': // Stem case for RNA secondary structure - case ')': // and opposite direction - drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - temp=x; - break; - case '{': - case '}': - case '[': - case ']': - case '>': - case '<': - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'S': - case 's': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - - Color nonCanColor= getNotCanonicalColor(lastSS); - drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - temp=x; - break; - default: - g.setColor(Color.gray); - g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - - lastSSX, 2); - temp=x; - break; + if (ss == '{') + { + // distinguish between forward/backward base-pairing + if (row_annotations[column].displayCharacter.indexOf('}') > -1) + { + ss = '}'; + } } - if (validRes) + if (ss == '<') { - lastSS = ss; + // distinguish between forward/backward base-pairing + if (row_annotations[column].displayCharacter.indexOf('<') > -1) + { + ss = '>'; + + } } - else + if (ss >= 65) { - lastSS = ' '; + // distinguish between forward/backward base-pairing + if (row_annotations[column].displayCharacter.indexOf(ss + 32) > -1) + { + + ss = (char) (ss + 32); + + } } - if (x > -1) + + if (!validRes || (ss != lastSS)) { - lastSSX = (x * charWidth); + + if (x > -1) + { + + int nb_annot = x - temp; + // System.out.println("\t type :"+lastSS+"\t x :"+x+"\t nbre annot :"+nb_annot); + switch (lastSS) + { + + case '$': + drawHelixAnnot(g, row_annotations, lastSSX, x, y, + iconOffset, startRes, column, validRes, validEnd); + break; + + case '�': + drawSheetAnnot(g, row_annotations, lastSSX, x, y, + iconOffset, startRes, column, validRes, validEnd); + break; + + case '(': // Stem case for RNA secondary structure + case ')': // and opposite direction + drawStemAnnot(g, row_annotations, lastSSX, x, y, + iconOffset, startRes, column, validRes, validEnd); + temp = x; + break; + case '{': + case '}': + case '[': + case ']': + case '>': + case '<': + case 'A': + case 'a': + case 'B': + case 'b': + case 'C': + case 'c': + case 'D': + case 'd': + case 'E': + case 'e': + case 'F': + case 'f': + case 'G': + case 'g': + case 'H': + case 'h': + case 'I': + case 'i': + case 'J': + case 'j': + case 'K': + case 'k': + case 'L': + case 'l': + case 'M': + case 'm': + case 'N': + case 'n': + case 'O': + case 'o': + case 'P': + case 'p': + case 'Q': + case 'q': + case 'R': + case 'r': + case 'S': + case 's': + case 'T': + case 't': + case 'U': + case 'u': + case 'V': + case 'v': + case 'W': + case 'w': + case 'X': + case 'x': + case 'Y': + case 'y': + case 'Z': + case 'z': + + Color nonCanColor = getNotCanonicalColor(lastSS); + drawNotCanonicalAnnot(g, nonCanColor, row_annotations, + lastSSX, x, y, iconOffset, startRes, column, + validRes, validEnd); + temp = x; + break; + default: + g.setColor(Color.gray); + g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) + - lastSSX, 2); + temp = x; + break; + } + } + if (validRes) + { + lastSS = ss; + } + else + { + lastSS = ' '; + } + if (x > -1) + { + lastSSX = (x * charWidth); + } } } + column++; + x++; + } + if (column >= row_annotations.length) + { + column = row_annotations.length - 1; + validEnd = false; + } + else + { + validEnd = true; + } + if ((row_annotations == null) || (row_annotations.length <= column) + || (row_annotations[column] == null)) + { + validRes = false; + } + else + { + validRes = true; } - column++; - x++; - } - if (column >= row_annotations.length) - { - column = row_annotations.length - 1; - validEnd = false; - } - else - { - validEnd = true; - } - if ((row_annotations == null) || (row_annotations.length <= column) - || (row_annotations[column] == null)) - { - validRes = false; - } - else - { - validRes = true; - } - // x ++; + // x ++; - if (row.hasIcons) - { - switch (lastSS) + if (row.hasIcons) { - case '$': - drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; - - case '�': - drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; - case 's': - case 'S': // Stem case for RNA secondary structure - - drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - - break; - case '{': - case '}': - case '[': - case ']': - case '>': - case '<': - case 'A': - case 'a': - case 'B': - case 'b': - case 'C': - case 'c': - case 'D': - case 'd': - case 'E': - case 'e': - case 'F': - case 'f': - case 'G': - case 'g': - case 'H': - case 'h': - case 'I': - case 'i': - case 'J': - case 'j': - case 'K': - case 'k': - case 'L': - case 'l': - case 'M': - case 'm': - case 'N': - case 'n': - case 'O': - case 'o': - case 'P': - case 'p': - case 'Q': - case 'q': - case 'R': - case 'r': - case 'T': - case 't': - case 'U': - case 'u': - case 'V': - case 'v': - case 'W': - case 'w': - case 'X': - case 'x': - case 'Y': - case 'y': - case 'Z': - case 'z': - //System.out.println(lastSS); - Color nonCanColor = getNotCanonicalColor(lastSS); - drawNotCanonicalAnnot(g,nonCanColor, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; - default: - drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, startRes, - column, validRes, validEnd); - break; + switch (lastSS) + { + case '$': + drawHelixAnnot(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + break; + + case '�': + drawSheetAnnot(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + break; + case 's': + case 'S': // Stem case for RNA secondary structure + + drawStemAnnot(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + + break; + case '{': + case '}': + case '[': + case ']': + case '>': + case '<': + case 'A': + case 'a': + case 'B': + case 'b': + case 'C': + case 'c': + case 'D': + case 'd': + case 'E': + case 'e': + case 'F': + case 'f': + case 'G': + case 'g': + case 'H': + case 'h': + case 'I': + case 'i': + case 'J': + case 'j': + case 'K': + case 'k': + case 'L': + case 'l': + case 'M': + case 'm': + case 'N': + case 'n': + case 'O': + case 'o': + case 'P': + case 'p': + case 'Q': + case 'q': + case 'R': + case 'r': + case 'T': + case 't': + case 'U': + case 'u': + case 'V': + case 'v': + case 'W': + case 'w': + case 'X': + case 'x': + case 'Y': + case 'y': + case 'Z': + case 'z': + // System.out.println(lastSS); + Color nonCanColor = getNotCanonicalColor(lastSS); + drawNotCanonicalAnnot(g, nonCanColor, row_annotations, lastSSX, + x, y, iconOffset, startRes, column, validRes, validEnd); + break; + default: + drawGlyphLine(g, row_annotations, lastSSX, x, y, iconOffset, + startRes, column, validRes, validEnd); + break; + } } - } - if (row.graph > 0 && row.graphHeight > 0) - { - if (row.graph == AlignmentAnnotation.LINE_GRAPH) + if (row.graph > 0 && row.graphHeight > 0) { - if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup)) + if (row.graph == AlignmentAnnotation.LINE_GRAPH) { - // TODO: JAL-1291 revise rendering model so the graphGroup map is computed efficiently for all visible labels - float groupmax = -999999, groupmin = 9999999; - for (int gg = 0; gg < aa.length; gg++) + if (row.graphGroup > -1 && !graphGroupDrawn.get(row.graphGroup)) { - if (aa[gg].graphGroup != row.graphGroup) + // TODO: JAL-1291 revise rendering model so the graphGroup map is + // computed efficiently for all visible labels + float groupmax = -999999, groupmin = 9999999; + for (int gg = 0; gg < aa.length; gg++) { - continue; - } + if (aa[gg].graphGroup != row.graphGroup) + { + continue; + } - if (aa[gg] != row) - { - aa[gg].visible = false; - } - if (aa[gg].graphMax > groupmax) - { - groupmax = aa[gg].graphMax; + if (aa[gg] != row) + { + aa[gg].visible = false; + } + if (aa[gg].graphMax > groupmax) + { + groupmax = aa[gg].graphMax; + } + if (aa[gg].graphMin < groupmin) + { + groupmin = aa[gg].graphMin; + } } - if (aa[gg].graphMin < groupmin) + + for (int gg = 0; gg < aa.length; gg++) { - groupmin = aa[gg].graphMin; + if (aa[gg].graphGroup == row.graphGroup) + { + drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, + endRes, y, groupmin, groupmax, row.graphHeight); + } } - } - for (int gg = 0; gg < aa.length; gg++) + graphGroupDrawn.set(row.graphGroup); + } + else { - if (aa[gg].graphGroup == row.graphGroup) - { - drawLineGraph(g, aa[gg], aa[gg].annotations, startRes, endRes, y, groupmin, - groupmax, row.graphHeight); - } + drawLineGraph(g, row, row_annotations, startRes, endRes, y, + row.graphMin, row.graphMax, row.graphHeight); } - - graphGroupDrawn.set(row.graphGroup); } - else + else if (row.graph == AlignmentAnnotation.BAR_GRAPH) { - drawLineGraph(g, row, row_annotations, startRes, endRes, y, row.graphMin, - row.graphMax, row.graphHeight); + drawBarGraph(g, row, row_annotations, startRes, endRes, + row.graphMin, row.graphMax, y, renderHistogram, + renderProfile, normaliseProfile); } } - else if (row.graph == AlignmentAnnotation.BAR_GRAPH) - { - drawBarGraph(g, row, row_annotations, startRes, endRes, - row.graphMin, row.graphMax, y, renderHistogram,renderProfile,normaliseProfile); - } } - } else { - if (clipst && !clipend) + else { - clipend = true; - } - }// end if_in_visible_region + if (clipst && !clipend) + { + clipend = true; + } + }// end if_in_visible_region if (row.graph > 0 && row.hasText) { y += charHeight; @@ -991,12 +1015,12 @@ public class AnnotationRenderer private final Color HELIX_COLOUR = Color.red; private final Color STEM_COLOUR = Color.blue; - - private Color sdNOTCANONICAL_COLOUR; - public void drawGlyphLine(Graphics g, Annotation[] row, - int lastSSX, int x, int y, int iconOffset, int startRes, - int column, boolean validRes, boolean validEnd) + private Color sdNOTCANONICAL_COLOUR; + + public void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX, + int x, int y, int iconOffset, int startRes, int column, + boolean validRes, boolean validEnd) { g.setColor(GLYPHLINE_COLOR); g.fillRect(lastSSX, y + 6 + iconOffset, (x * charWidth) - lastSSX, 2); @@ -1004,8 +1028,8 @@ public class AnnotationRenderer public void drawSheetAnnot(Graphics g, Annotation[] row, - int lastSSX, int x, int y, int iconOffset, int startRes, - int column, boolean validRes, boolean validEnd) + int lastSSX, int x, int y, int iconOffset, int startRes, int column, + boolean validRes, boolean validEnd) { g.setColor(SHEET_COLOUR); @@ -1180,7 +1204,8 @@ public class AnnotationRenderer public void drawBarGraph(Graphics g, AlignmentAnnotation _aa, Annotation[] aa_annotations, int sRes, int eRes, float min, - float max, int y, boolean renderHistogram,boolean renderProfile,boolean normaliseProfile) + float max, int y, boolean renderHistogram, boolean renderProfile, + boolean normaliseProfile) { if (sRes > aa_annotations.length) { @@ -1359,134 +1384,130 @@ public class AnnotationRenderer } } - Color getNotCanonicalColor(char lastss) - { - switch (lastss) - { - case '{': - case '}': - return new Color(255,125,5); - - case '[': - case ']': - return new Color(245,115,10); - - case '>': - case '<': - return new Color(235,135,15); - - case 'A': - case 'a': - return new Color(225,105,20); - - case 'B': - case 'b': - return new Color(215,145,30); - - case 'C': - case 'c': - return new Color(205,95,35); - - case 'D': - case 'd': - return new Color(195,155,45); - - case 'E': - case 'e': - return new Color(185,85,55); - - case 'F': - case 'f': - return new Color(175,165,65); - - case 'G': - case 'g': - return new Color(170,75,75); - - case 'H': - case 'h': - return new Color(160,175,85); - - case 'I': - case 'i': - return new Color(150,65,95); - - case 'J': - case 'j': - return new Color(140,185,105); - - case 'K': - case 'k': - return new Color(130,55,110); - - case 'L': - case 'l': - return new Color(120,195,120); - - case 'M': - case 'm': - return new Color(110,45,130); - - case 'N': - case 'n': - return new Color(100,205,140); - - case 'O': - case 'o': - return new Color(90,35,150); - - case 'P': - case 'p': - return new Color(85,215,160); - - case 'Q': - case 'q': - return new Color(75,25,170); - - case 'R': - case 'r': - return new Color(65,225,180); - - case 'S': - case 's': - return new Color(55,15,185); - - case 'T': - case 't': - return new Color(45,235,195); - - case 'U': - case 'u': - return new Color(35,5,205); - - case 'V': - case 'v': - return new Color(25,245,215); - - case 'W': - case 'w': - return new Color(15,0,225); - - case 'X': - case 'x': - return new Color(10,255,235); - - case 'Y': - case 'y': - return new Color(5,150,245); - - case 'Z': - case 'z': - return new Color(0,80,255); - - default : - System.out.println("This is not a interaction : "+lastss); - return null; - - } - } -} + { + switch (lastss) + { + case '{': + case '}': + return new Color(255, 125, 5); + + case '[': + case ']': + return new Color(245, 115, 10); - - + case '>': + case '<': + return new Color(235, 135, 15); + + case 'A': + case 'a': + return new Color(225, 105, 20); + + case 'B': + case 'b': + return new Color(215, 145, 30); + + case 'C': + case 'c': + return new Color(205, 95, 35); + + case 'D': + case 'd': + return new Color(195, 155, 45); + + case 'E': + case 'e': + return new Color(185, 85, 55); + + case 'F': + case 'f': + return new Color(175, 165, 65); + + case 'G': + case 'g': + return new Color(170, 75, 75); + + case 'H': + case 'h': + return new Color(160, 175, 85); + + case 'I': + case 'i': + return new Color(150, 65, 95); + + case 'J': + case 'j': + return new Color(140, 185, 105); + + case 'K': + case 'k': + return new Color(130, 55, 110); + + case 'L': + case 'l': + return new Color(120, 195, 120); + + case 'M': + case 'm': + return new Color(110, 45, 130); + + case 'N': + case 'n': + return new Color(100, 205, 140); + + case 'O': + case 'o': + return new Color(90, 35, 150); + + case 'P': + case 'p': + return new Color(85, 215, 160); + + case 'Q': + case 'q': + return new Color(75, 25, 170); + + case 'R': + case 'r': + return new Color(65, 225, 180); + + case 'S': + case 's': + return new Color(55, 15, 185); + + case 'T': + case 't': + return new Color(45, 235, 195); + + case 'U': + case 'u': + return new Color(35, 5, 205); + + case 'V': + case 'v': + return new Color(25, 245, 215); + + case 'W': + case 'w': + return new Color(15, 0, 225); + + case 'X': + case 'x': + return new Color(10, 255, 235); + + case 'Y': + case 'y': + return new Color(5, 150, 245); + + case 'Z': + case 'z': + return new Color(0, 80, 255); + + default: + System.out.println("This is not a interaction : " + lastss); + return null; + + } + } +} diff --git a/src/jalview/renderer/AwtRenderPanelI.java b/src/jalview/renderer/AwtRenderPanelI.java index 0439227..ab601da 100644 --- a/src/jalview/renderer/AwtRenderPanelI.java +++ b/src/jalview/renderer/AwtRenderPanelI.java @@ -46,6 +46,7 @@ public interface AwtRenderPanelI extends ImageObserver /** * height of visible area on to the image - used to draw only what is visible. + * * @return [start, end of visible region] */ int[] getVisibleVRange(); diff --git a/src/jalview/schemes/AnnotationColourGradient.java b/src/jalview/schemes/AnnotationColourGradient.java index e6128c9..f467cb8 100755 --- a/src/jalview/schemes/AnnotationColourGradient.java +++ b/src/jalview/schemes/AnnotationColourGradient.java @@ -54,13 +54,16 @@ public class AnnotationColourGradient extends FollowerColourScheme private boolean seqAssociated = false; IdentityHashMap seqannot = null; + @Override public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) { - AnnotationColourGradient acg = new AnnotationColourGradient(annotation, colourScheme, aboveAnnotationThreshold); + AnnotationColourGradient acg = new AnnotationColourGradient(annotation, + colourScheme, aboveAnnotationThreshold); acg.thresholdIsMinMax = thresholdIsMinMax; - acg.annotationThreshold = (annotationThreshold==null) ? null : new GraphLine(annotationThreshold); + acg.annotationThreshold = (annotationThreshold == null) ? null + : new GraphLine(annotationThreshold); acg.r1 = r1; acg.g1 = g1; acg.b1 = b1; @@ -72,9 +75,10 @@ public class AnnotationColourGradient extends FollowerColourScheme acg.db = db; acg.predefinedColours = predefinedColours; acg.seqAssociated = seqAssociated; - + return acg; } + /** * Creates a new AnnotationColourGradient object. */ @@ -141,7 +145,8 @@ public class AnnotationColourGradient extends FollowerColourScheme seqannot = new IdentityHashMap(); } // resolve the context containing all the annotation for the sequence - AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment : alignment.getContext(); + AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment + : alignment.getContext(); for (AlignmentAnnotation alan : alcontext.findAnnotation(annotation .getCalcId())) { @@ -222,7 +227,8 @@ public class AnnotationColourGradient extends FollowerColourScheme } if ((threshold == 0) || aboveThreshold(c, j)) { - if (annotation.annotations!=null && j < annotation.annotations.length + if (annotation.annotations != null + && j < annotation.annotations.length && annotation.annotations[j] != null && !jalview.util.Comparison.isGap(c)) { @@ -268,7 +274,7 @@ public class AnnotationColourGradient extends FollowerColourScheme { currentColour = colourScheme.findColour(c, j, seq); } - else + else { dr = rr * range + r1; dg = gg * range + g1; diff --git a/src/jalview/schemes/Blosum62ColourScheme.java b/src/jalview/schemes/Blosum62ColourScheme.java index d914168..41f7781 100755 --- a/src/jalview/schemes/Blosum62ColourScheme.java +++ b/src/jalview/schemes/Blosum62ColourScheme.java @@ -94,10 +94,11 @@ public class Blosum62ColourScheme extends ResidueColourScheme return currentColour; } + @Override public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) - { + { ColourSchemeI newcs = super.applyTo(sg, hiddenRepSequences); return newcs; } diff --git a/src/jalview/schemes/ClustalxColourScheme.java b/src/jalview/schemes/ClustalxColourScheme.java index 8bb1acd..92d2dd7 100755 --- a/src/jalview/schemes/ClustalxColourScheme.java +++ b/src/jalview/schemes/ClustalxColourScheme.java @@ -329,11 +329,13 @@ public class ClustalxColourScheme extends ResidueColourScheme // implements { this.includeGaps = includeGaps; } + @Override public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) { - ClustalxColourScheme css= new ClustalxColourScheme(sg, hiddenRepSequences); + ClustalxColourScheme css = new ClustalxColourScheme(sg, + hiddenRepSequences); css.includeGaps = includeGaps; return css; } diff --git a/src/jalview/schemes/ColourSchemeI.java b/src/jalview/schemes/ColourSchemeI.java index c1550cc..67d23ea 100755 --- a/src/jalview/schemes/ColourSchemeI.java +++ b/src/jalview/schemes/ColourSchemeI.java @@ -40,10 +40,14 @@ public interface ColourSchemeI /** * - * @param c - sequence symbol or gap - * @param j - position in seq - * @param seq - sequence being coloured - * @return context dependent colour for the given symbol at the position in the given sequence + * @param c + * - sequence symbol or gap + * @param j + * - position in seq + * @param seq + * - sequence being coloured + * @return context dependent colour for the given symbol at the position in + * the given sequence */ public Color findColour(char c, int j, SequenceI seq); @@ -54,15 +58,18 @@ public interface ColourSchemeI /** * assign the given conservation to the colourscheme + * * @param c */ public void setConservation(jalview.analysis.Conservation c); /** * enable or disable conservation shading for this colourscheme - * @param conservationApplied + * + * @param conservationApplied */ public void setConservationApplied(boolean conservationApplied); + /** * * @return true if conservation shading is enabled for this colourscheme @@ -71,13 +78,14 @@ public interface ColourSchemeI /** * set scale factor for bleaching of colour in unconserved regions + * * @param i */ public void setConservationInc(int i); /** * - * @return scale factor for bleaching colour in unconserved regions + * @return scale factor for bleaching colour in unconserved regions */ public int getConservationInc(); @@ -88,14 +96,20 @@ public interface ColourSchemeI public int getThreshold(); /** - * set percentage identity threshold and type of %age identity calculation for shading - * @param ct 0..100 percentage identity for applying this colourscheme - * @param ignoreGaps when true, calculate PID without including gapped positions + * set percentage identity threshold and type of %age identity calculation for + * shading + * + * @param ct + * 0..100 percentage identity for applying this colourscheme + * @param ignoreGaps + * when true, calculate PID without including gapped positions */ public void setThreshold(int ct, boolean ignoreGaps); /** - * recalculate dependent data using the given sequence collection, taking account of hidden rows + * recalculate dependent data using the given sequence collection, taking + * account of hidden rows + * * @param alignment * @param hiddenReps */ @@ -103,7 +117,9 @@ public interface ColourSchemeI Map hiddenReps); /** - * create a new instance of the colourscheme configured to colour the given connection + * create a new instance of the colourscheme configured to colour the given + * connection + * * @param sg * @param hiddenRepSequences * @return copy of current scheme with any inherited settings transfered diff --git a/src/jalview/schemes/ColourSchemeProperty.java b/src/jalview/schemes/ColourSchemeProperty.java index 385e080..cc303d6 100755 --- a/src/jalview/schemes/ColourSchemeProperty.java +++ b/src/jalview/schemes/ColourSchemeProperty.java @@ -88,7 +88,7 @@ public class ColourSchemeProperty public static final int COVARIATION = 14; public static final int TCOFFEE = 15; - + public static final int RNAHELIX = 16; public static final int RNAINTERACTION = 17; @@ -352,11 +352,11 @@ public class ColourSchemeProperty ret = "T-Coffee Scores"; break; - + case RNAINTERACTION: - ret = "RNA Interaction type"; + ret = "RNA Interaction type"; - break; + break; case RNAHELIX: ret = "RNA Helices"; @@ -513,13 +513,13 @@ public class ColourSchemeProperty case TCOFFEE: cs = new TCoffeeColourScheme(coll); break; - + case RNAHELIX: cs = new RNAHelicesColour(coll); break; - - // case COVARIATION: - // cs = new CovariationColourScheme(annotation); + + // case COVARIATION: + // cs = new CovariationColourScheme(annotation); // break; case USER_DEFINED: diff --git a/src/jalview/schemes/FollowerColourScheme.java b/src/jalview/schemes/FollowerColourScheme.java index da51e03..54b0848 100644 --- a/src/jalview/schemes/FollowerColourScheme.java +++ b/src/jalview/schemes/FollowerColourScheme.java @@ -26,8 +26,9 @@ import java.util.Hashtable; /** * Colourscheme that takes its colours from some other colourscheme + * * @author jimp - * + * */ public class FollowerColourScheme extends ResidueColourScheme { @@ -42,7 +43,7 @@ public class FollowerColourScheme extends ResidueColourScheme @Override public void setConsensus(Hashtable[] consensus) { - if (colourScheme!=null) + if (colourScheme != null) { colourScheme.setConsensus(consensus); } @@ -51,7 +52,7 @@ public class FollowerColourScheme extends ResidueColourScheme @Override public void setConservation(Conservation cons) { - if (colourScheme!=null) + if (colourScheme != null) { colourScheme.setConservation(cons); } @@ -60,7 +61,7 @@ public class FollowerColourScheme extends ResidueColourScheme @Override public void setConservationInc(int i) { - if (colourScheme!=null) + if (colourScheme != null) { colourScheme.setConservationInc(i); } diff --git a/src/jalview/schemes/RNAHelicesColour.java b/src/jalview/schemes/RNAHelicesColour.java index 46fa626..152ad9a 100644 --- a/src/jalview/schemes/RNAHelicesColour.java +++ b/src/jalview/schemes/RNAHelicesColour.java @@ -67,6 +67,7 @@ public class RNAHelicesColour extends ResidueColourScheme this.annotation = annotation; refresh(); } + public RNAHelicesColour(AnnotatedCollectionI alignment) { super(ResidueProperties.nucleotideIndex); @@ -79,28 +80,31 @@ public class RNAHelicesColour extends ResidueColourScheme { // This loop will find the first rna structure annotation by which to colour - // the sequences. + // the sequences. AlignmentAnnotation[] annotations = alignment.getAlignmentAnnotation(); - for (int i = 0; i < annotations.length; i++) { - - // is this a sensible way of determining type of annotation? - if (annotations[i].getRNAStruc() != null) { - annotation = annotations[i]; - break; - } + for (int i = 0; i < annotations.length; i++) + { + + // is this a sensible way of determining type of annotation? + if (annotations[i].getRNAStruc() != null) + { + annotation = annotations[i]; + break; + } } refresh(); } + private long lastrefresh = -1; public void refresh() { - - if (annotation!=null && ((annotation._rnasecstr == null - || lastrefresh != annotation._rnasecstr.hashCode()) - && annotation.isValidStruc())) + + if (annotation != null + && ((annotation._rnasecstr == null || lastrefresh != annotation._rnasecstr + .hashCode()) && annotation.isValidStruc())) { annotation.getRNAStruc(); lastrefresh = annotation._rnasecstr.hashCode(); diff --git a/src/jalview/schemes/RNAInteractionColourScheme.java b/src/jalview/schemes/RNAInteractionColourScheme.java index 2738f22..6ecc418 100644 --- a/src/jalview/schemes/RNAInteractionColourScheme.java +++ b/src/jalview/schemes/RNAInteractionColourScheme.java @@ -18,68 +18,68 @@ * along with Jalview. If not, see . * The Jalview Authors are detailed in the 'AUTHORS' file. */ - package jalview.schemes; +package jalview.schemes; import jalview.datamodel.SequenceI; import java.awt.Color; +public class RNAInteractionColourScheme extends ResidueColourScheme +{ + public RNAInteractionColourScheme() + { + super(); + } -public class RNAInteractionColourScheme extends ResidueColourScheme{ - public RNAInteractionColourScheme() - { - super(); - } + /** + * DOCUMENT ME! + * + * @param n + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @Override + public Color findColour(char c) + { + // System.out.println("called"); log.debug + return colors[ResidueProperties.nucleotideIndex[c]]; + } - /** - * DOCUMENT ME! - * - * @param n - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @Override - public Color findColour(char c) - { - // System.out.println("called"); log.debug - return colors[ResidueProperties.nucleotideIndex[c]]; - } + /** + * DOCUMENT ME! + * + * @param n + * DOCUMENT ME! + * @param j + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @Override + public Color findColour(char c, int j, SequenceI seq) + { + Color currentColour; + if ((threshold == 0) || aboveThreshold(c, j)) + { + try + { + currentColour = colors[ResidueProperties.nucleotideIndex[c]]; + } catch (Exception ex) + { + return Color.white; + } + } + else + { + return Color.white; + } - /** - * DOCUMENT ME! - * - * @param n - * DOCUMENT ME! - * @param j - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @Override - public Color findColour(char c, int j, SequenceI seq) - { - Color currentColour; - if ((threshold == 0) || aboveThreshold(c, j)) - { - try - { - currentColour = colors[ResidueProperties.nucleotideIndex[c]]; - } catch (Exception ex) - { - return Color.white; - } - } - else - { - return Color.white; - } + if (conservationColouring) + { + currentColour = applyConservation(currentColour, j); + } - if (conservationColouring) - { - currentColour = applyConservation(currentColour, j); - } - - return currentColour; - } - } + return currentColour; + } +} diff --git a/src/jalview/schemes/ResidueColourScheme.java b/src/jalview/schemes/ResidueColourScheme.java index e6b942b8..609e741 100755 --- a/src/jalview/schemes/ResidueColourScheme.java +++ b/src/jalview/schemes/ResidueColourScheme.java @@ -196,6 +196,7 @@ public class ResidueColourScheme implements ColourSchemeI { return conservationColouring; } + @Override public void setConservationApplied(boolean conservationApplied) { @@ -317,12 +318,14 @@ public class ResidueColourScheme implements ColourSchemeI public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) { - try { + try + { return getClass().newInstance(); - } - catch (Exception q) + } catch (Exception q) { - throw new Error("Serious implementation error: cannot duplicate colourscheme "+getClass().getName(), q); + throw new Error( + "Serious implementation error: cannot duplicate colourscheme " + + getClass().getName(), q); } } } diff --git a/src/jalview/schemes/ResidueProperties.java b/src/jalview/schemes/ResidueProperties.java index 1780a4a..7ec9e1c 100755 --- a/src/jalview/schemes/ResidueProperties.java +++ b/src/jalview/schemes/ResidueProperties.java @@ -29,7 +29,7 @@ import java.awt.*; public class ResidueProperties { - public static Hashtable scoreMatrices = new Hashtable(); + public static Hashtable scoreMatrices = new Hashtable(); // Stores residue codes/names and colours and other things public static final int[] aaIndex; // aaHash version 2.1.1 and below @@ -697,19 +697,20 @@ public class ResidueProperties } /** - * Nucleotide Ambiguity Codes + * Nucleotide Ambiguity Codes */ - public static final Hashtable ambiguityCodes=new Hashtable(); + public static final Hashtable ambiguityCodes = new Hashtable(); + /** - * Codon triplets with additional symbols for unambiguous codons that include ambiguity codes + * Codon triplets with additional symbols for unambiguous codons that include + * ambiguity codes */ - public static final Hashtable codonHash2 = new Hashtable(); - + public static final Hashtable codonHash2 = new Hashtable(); + /** * all ambiguity codes for a given base */ - public final static Hashtable> _ambiguityCodes = new Hashtable>(); - + public final static Hashtable> _ambiguityCodes = new Hashtable>(); static { @@ -894,10 +895,10 @@ public class ResidueProperties codonHash2.put("TTC", "F"); codonHash2.put("TTT", "F"); - + buildAmbiguityCodonSet(); } - + /** * programmatic generation of codons including ambiguity codes */ @@ -933,7 +934,8 @@ public class ResidueProperties } // and programmatically add in the ambiguity codes that yield the same amino // acid - String[] unambcodons = codonHash2.keySet().toArray(new String[codonHash2.size()]); + String[] unambcodons = codonHash2.keySet().toArray( + new String[codonHash2.size()]); for (String codon : unambcodons) { String residue = codonHash2.get(codon); @@ -968,7 +970,7 @@ public class ResidueProperties char _anuc; for (ipos = 0; ipos < tpos.length; ipos++) { - if (acodon[ipos].length==0 || tpos[ipos] < 0) + if (acodon[ipos].length == 0 || tpos[ipos] < 0) { _acodon += codon.charAt(ipos); allres[ipos] = new char[] @@ -1000,7 +1002,7 @@ public class ResidueProperties _codon += allres[j][cpos[j]]; } String tr = codonHash2.get(_codon); - if (valid = (tr!=null && tr.equals(residue))) + if (valid = (tr != null && tr.equals(residue))) { // advance to next combination ipos = acodon.length - 1; @@ -1014,14 +1016,14 @@ public class ResidueProperties if (valid) { // Add this to the set of codons we will translate -// System.out.println("Adding ambiguity codon: " + _acodon + " for " -// + residue); + // System.out.println("Adding ambiguity codon: " + _acodon + " for " + // + residue); codonHash2.put(_acodon, residue); } else { -// System.err.println("Rejecting ambiguity codon: " + _acodon -// + " for " + residue); + // System.err.println("Rejecting ambiguity codon: " + _acodon + // + " for " + residue); } // next combination ipos = acodon.length - 1; @@ -1422,62 +1424,75 @@ public class ResidueProperties } static { - int[][] propMatrixF = new int[maxProteinIndex][maxProteinIndex], - propMatrixPos = new int[maxProteinIndex][maxProteinIndex], - propMatrixEpos = new int[maxProteinIndex][maxProteinIndex]; - for (int i=0;ii) { - ic+=aa[i]; + int maxF = 0, maxP = 0, maxEP = 0; + String ic = ""; + if (aa.length > i) + { + ic += aa[i]; } - else {ic = "-";} - for (int j=i+1;jj) { - jc+=aa[j]; + ic = "-"; + } + for (int j = i + 1; j < maxProteinIndex; j++) + { + String jc = ""; + if (aa.length > j) + { + jc += aa[j]; } - else {jc = "-";} - propMatrixF[i][j]=0; - propMatrixPos[i][j]=0; - propMatrixEpos[i][j]=0; - for (Enumeration en= (Enumeration)propHash.keys(); en.hasMoreElements(); ) + else + { + jc = "-"; + } + propMatrixF[i][j] = 0; + propMatrixPos[i][j] = 0; + propMatrixEpos[i][j] = 0; + for (Enumeration en = (Enumeration) propHash.keys(); en + .hasMoreElements();) { String ph = en.nextElement(); - Map pph=(Map)propHash.get(ph); - if (pph.get(ic)!=null && pph.get(jc)!=null) { - int icp=pph.get(ic).intValue(),jcp=pph.get(jc).intValue(); + Map pph = (Map) propHash + .get(ph); + if (pph.get(ic) != null && pph.get(jc) != null) + { + int icp = pph.get(ic).intValue(), jcp = pph.get(jc).intValue(); // Still working on these definitions. - propMatrixPos[i][j] += icp == jcp && icp>0 ? 2 : 0; - propMatrixPos[j][i] += icp == jcp && icp>0 ? 2 : 0; + propMatrixPos[i][j] += icp == jcp && icp > 0 ? 2 : 0; + propMatrixPos[j][i] += icp == jcp && icp > 0 ? 2 : 0; propMatrixF[i][j] += icp == jcp ? 2 : 0; propMatrixF[j][i] += icp == jcp ? 2 : 0; - propMatrixEpos[i][j] += icp == jcp ? (1+icp * 2) : 0; - propMatrixEpos[j][i] += icp == jcp ? (1+icp * 2) : 0; - }} - if (maxF(); + toRNAssState = new Hashtable(); toRNAssState.put(")", "("); toRNAssState.put("(", "("); toRNAssState.put("]", "["); @@ -1742,7 +1759,7 @@ public class ResidueProperties toRNAssState.put("y", "Y"); toRNAssState.put("Z", "Z"); toRNAssState.put("z", "Z"); - + } /** diff --git a/src/jalview/schemes/ScoreMatrix.java b/src/jalview/schemes/ScoreMatrix.java index a0e632f..ac02ee5 100644 --- a/src/jalview/schemes/ScoreMatrix.java +++ b/src/jalview/schemes/ScoreMatrix.java @@ -23,10 +23,11 @@ package jalview.schemes; import jalview.analysis.scoremodels.PairwiseSeqScoreModel; import jalview.api.analysis.ScoreModelI; -public class ScoreMatrix extends PairwiseSeqScoreModel implements ScoreModelI +public class ScoreMatrix extends PairwiseSeqScoreModel implements + ScoreModelI { String name; - + @Override public String getName() { @@ -42,11 +43,15 @@ public class ScoreMatrix extends PairwiseSeqScoreModel implements ScoreModelI * 0 for Protein Score matrix. 1 for dna score matrix */ int type; + /** * - * @param name Unique, human readable name for the matrix - * @param matrix Pairwise scores indexed according to appropriate symbol alphabet - * @param type 0 for Protein, 1 for NA + * @param name + * Unique, human readable name for the matrix + * @param matrix + * Pairwise scores indexed according to appropriate symbol alphabet + * @param type + * 0 for Protein, 1 for NA */ ScoreMatrix(String name, int[][] matrix, int type) { @@ -60,6 +65,7 @@ public class ScoreMatrix extends PairwiseSeqScoreModel implements ScoreModelI { return type == 1; } + @Override public boolean isProtein() { diff --git a/src/jalview/schemes/TCoffeeColourScheme.java b/src/jalview/schemes/TCoffeeColourScheme.java index 7caa735..b5c24ce 100644 --- a/src/jalview/schemes/TCoffeeColourScheme.java +++ b/src/jalview/schemes/TCoffeeColourScheme.java @@ -87,7 +87,8 @@ public class TCoffeeColourScheme extends ResidueColourScheme // Search alignment to get all tcoffee annotation and pick one set of // annotation to use to colour seqs. seqMap = new IdentityHashMap(); - AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment : alignment.getContext(); + AnnotatedCollectionI alcontext = alignment instanceof AlignmentI ? alignment + : alignment.getContext(); int w = 0; for (AlignmentAnnotation al : alcontext .findAnnotation(TCoffeeScoreFile.TCOFFEE_SCORE)) @@ -132,7 +133,7 @@ public class TCoffeeColourScheme extends ResidueColourScheme } return cols[j]; } - + @Override public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) diff --git a/src/jalview/schemes/UserColourScheme.java b/src/jalview/schemes/UserColourScheme.java index 89ed91b..8ca0b86 100755 --- a/src/jalview/schemes/UserColourScheme.java +++ b/src/jalview/schemes/UserColourScheme.java @@ -44,18 +44,22 @@ public class UserColourScheme extends ResidueColourScheme super(ResidueProperties.aaIndex); colors = newColors; } + @Override public ColourSchemeI applyTo(AnnotatedCollectionI sg, Map hiddenRepSequences) { UserColourScheme usc = new UserColourScheme(colors); - if (lowerCaseColours!=null) { + if (lowerCaseColours != null) + { usc.schemeName = new String(schemeName); usc.lowerCaseColours = new Color[lowerCaseColours.length]; - System.arraycopy(lowerCaseColours, 0, usc.lowerCaseColours, 0, lowerCaseColours.length); + System.arraycopy(lowerCaseColours, 0, usc.lowerCaseColours, 0, + lowerCaseColours.length); } return usc; } + public UserColourScheme(String colour) { super(ResidueProperties.aaIndex); @@ -160,7 +164,8 @@ public class UserColourScheme extends ResidueColourScheme public void parseAppletParameter(String paramValue) { - // TODO: need a function to generate appletParameter colour string from a UCS + // TODO: need a function to generate appletParameter colour string from a + // UCS StringTokenizer st = new StringTokenizer(paramValue, ";"); StringTokenizer st2; String token = null, colour, residues; diff --git a/src/jalview/structure/StructureSelectionManager.java b/src/jalview/structure/StructureSelectionManager.java index c6f8f17..c0c559a 100644 --- a/src/jalview/structure/StructureSelectionManager.java +++ b/src/jalview/structure/StructureSelectionManager.java @@ -56,11 +56,14 @@ public class StructureSelectionManager } Hashtable mappingData = new Hashtable(); + private static StructureSelectionManager nullProvider = null; + public static StructureSelectionManager getStructureSelectionManager( StructureSelectionManagerProvider context) { - if (context==null) { + if (context == null) + { if (nullProvider == null) { if (instances != null) @@ -83,10 +86,12 @@ public class StructureSelectionManager StructureSelectionManager instance = instances.get(context); if (instance == null) { - if (nullProvider!=null) + if (nullProvider != null) { instance = nullProvider; - } else { + } + else + { instance = new StructureSelectionManager(); } instances.put(context, instance); diff --git a/src/jalview/util/DBRefUtils.java b/src/jalview/util/DBRefUtils.java index a757d79..d6965f5 100755 --- a/src/jalview/util/DBRefUtils.java +++ b/src/jalview/util/DBRefUtils.java @@ -433,7 +433,7 @@ public class DBRefUtils ref = new DBRefEntry(locsrc, version, pdbid + chaincode); PDBEntry pdbr = new PDBEntry(); pdbr.setId(pdbid); - pdbr.getProperty().put("CHAIN",chaincode); + pdbr.getProperty().put("CHAIN", chaincode); seq.addPDBId(pdbr); } } diff --git a/src/jalview/util/MessageManager.java b/src/jalview/util/MessageManager.java index 8adac34..cd885f0 100644 --- a/src/jalview/util/MessageManager.java +++ b/src/jalview/util/MessageManager.java @@ -31,77 +31,91 @@ import java.util.logging.Logger; * @author David Roldan Martinez * @author Thomas Abeel * - * + * */ -public class MessageManager { +public class MessageManager +{ - private static ResourceBundle rb; - - private static Logger log=Logger.getLogger(MessageManager.class.getCanonicalName()); - - private static Locale loc; - - - - static{ - try { - /* Localize Java dialogs */ - loc = Locale.getDefault(); - // Locale.setDefault(loc); - /* Getting messages for GV */ - log.info("Getting messages for lang: "+loc); - rb = ResourceBundle.getBundle("lang.Messages", loc); - if (log.isLoggable(Level.FINEST)) { - // this might take a while, so we only do it if it will be shown - log.finest("Language keys: "+rb.keySet()); - } - } catch (Exception q) { - log.warning("Exception when initting Locale for i18n messages\n"+q.getMessage()); - q.printStackTrace(); - } - catch (Error v) + private static ResourceBundle rb; + + private static Logger log = Logger.getLogger(MessageManager.class + .getCanonicalName()); + + private static Locale loc; + + static + { + try + { + /* Localize Java dialogs */ + loc = Locale.getDefault(); + // Locale.setDefault(loc); + /* Getting messages for GV */ + log.info("Getting messages for lang: " + loc); + rb = ResourceBundle.getBundle("lang.Messages", loc); + if (log.isLoggable(Level.FINEST)) { - log.warning("Error when initting Locale for i18n messages\n"+v.getMessage()); - v.printStackTrace(); + // this might take a while, so we only do it if it will be shown + log.finest("Language keys: " + rb.keySet()); } - - + } catch (Exception q) + { + log.warning("Exception when initting Locale for i18n messages\n" + + q.getMessage()); + q.printStackTrace(); + } catch (Error v) + { + log.warning("Error when initting Locale for i18n messages\n" + + v.getMessage()); + v.printStackTrace(); } - - public static String getString(String key){ - String value = "[missing key] " + key; - try{ - value = rb.getString(key); - }catch(Exception e){ - log.warning("I18N missing: "+loc+"\t"+key); - } - return value; + + } + + public static String getString(String key) + { + String value = "[missing key] " + key; + try + { + value = rb.getString(key); + } catch (Exception e) + { + log.warning("I18N missing: " + loc + "\t" + key); } - - public static Locale getLocale() { - return loc; - } - public static String formatMessage(String key, Object... params){ - return MessageFormat.format(rb.getString(key), (Object[]) params); - } + return value; + } + + public static Locale getLocale() + { + return loc; + } + + public static String formatMessage(String key, Object... params) + { + return MessageFormat.format(rb.getString(key), (Object[]) params); + } /** - * lookup and return a key given a root and a human-readable(ish) name that when combined might resolve to an i18n string. - * If the key doesn't resolve, then name is returned.if the key doesn't exist. - * Use this for programatically constructed keys that have have a human readable alternative used in the program (e.g. BLOSUM62 and label.score_blosum62) + * lookup and return a key given a root and a human-readable(ish) name that + * when combined might resolve to an i18n string. If the key doesn't resolve, + * then name is returned.if the key doesn't exist. Use this for + * programatically constructed keys that have have a human readable + * alternative used in the program (e.g. BLOSUM62 and label.score_blosum62) + * * @param keyroot * @param name * @return */ public static String getStringOrReturn(String keyroot, String name) { - String smkey = keyroot - + name.toLowerCase().replaceAll(" ", ""); - try { - name = rb.getString(smkey); - } - catch (Exception x) { - log.finest("I18N missing key with root "+keyroot+": "+loc+"\t"+smkey); + String smkey = keyroot + name.toLowerCase().replaceAll(" ", ""); + try + { + name = rb.getString(smkey); + } catch (Exception x) + { + log.finest("I18N missing key with root " + keyroot + ": " + loc + + "\t" + smkey); } return name; } diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 617800b..0c8afaa 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -214,15 +214,18 @@ public abstract class AlignmentViewport implements AlignViewportI // calculation till later or to do all calculations in thread. // via changecolour globalColourScheme = cs; - boolean recalc=false; - if (cs!=null) + boolean recalc = false; + if (cs != null) { cs.setConservationApplied(recalc = getConservationSelected()); - if (getAbovePIDThreshold() || cs instanceof PIDColourScheme || cs instanceof Blosum62ColourScheme) + if (getAbovePIDThreshold() || cs instanceof PIDColourScheme + || cs instanceof Blosum62ColourScheme) { recalc = true; cs.setThreshold(threshold, ignoreGapsInConsensusCalculation); - } else { + } + else + { cs.setThreshold(0, ignoreGapsInConsensusCalculation); } if (recalc) @@ -247,7 +250,7 @@ public abstract class AlignmentViewport implements AlignViewportI || cs instanceof Blosum62ColourScheme) { sg.cs.setThreshold(threshold, getIgnoreGapsConsensus()); - recalc=true; + recalc = true; } else { @@ -257,16 +260,19 @@ public abstract class AlignmentViewport implements AlignViewportI if (getConservationSelected()) { sg.cs.setConservationApplied(true); - recalc=true; + recalc = true; } else { sg.cs.setConservation(null); // sg.cs.setThreshold(0, getIgnoreGapsConsensus()); } - if (recalc) { + if (recalc) + { sg.recalcConservation(); - } else { + } + else + { sg.cs.alignmentChanged(sg, hiddenRepSequences); } } @@ -302,13 +308,15 @@ public abstract class AlignmentViewport implements AlignViewportI * view */ protected Hashtable[] hStrucConsensus = null; - + protected Conservation hconservation = null; + @Override public void setConservation(Conservation cons) { hconservation = cons; } + /** * percentage gaps allowed in a column before all amino acid properties should * be considered unconserved @@ -1373,15 +1381,15 @@ public abstract class AlignmentViewport implements AlignViewportI { conservation = new AlignmentAnnotation("Conservation", "Conservation of total alignment less than " - + getConsPercGaps() + "% gaps", - new Annotation[1], 0f, 11f, - AlignmentAnnotation.BAR_GRAPH); + + getConsPercGaps() + "% gaps", new Annotation[1], + 0f, 11f, AlignmentAnnotation.BAR_GRAPH); conservation.hasText = true; conservation.autoCalculated = true; alignment.addAnnotation(conservation); } } } + private void initQuality() { if (showQuality) @@ -1390,21 +1398,20 @@ public abstract class AlignmentViewport implements AlignViewportI { quality = new AlignmentAnnotation("Quality", "Alignment Quality based on Blosum62 scores", - new Annotation[1], 0f, 11f, - AlignmentAnnotation.BAR_GRAPH); + new Annotation[1], 0f, 11f, AlignmentAnnotation.BAR_GRAPH); quality.hasText = true; quality.autoCalculated = true; alignment.addAnnotation(quality); } } } + private void initRNAStructure() { - if (alignment.hasRNAStructure() && strucConsensus==null) + if (alignment.hasRNAStructure() && strucConsensus == null) { strucConsensus = new AlignmentAnnotation("StrucConsensus", "PID", - new Annotation[1], 0f, 100f, - AlignmentAnnotation.BAR_GRAPH); + new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH); strucConsensus.hasText = true; strucConsensus.autoCalculated = true; @@ -1414,6 +1421,7 @@ public abstract class AlignmentViewport implements AlignViewportI } } } + /* * (non-Javadoc) * @@ -1514,7 +1522,7 @@ public abstract class AlignmentViewport implements AlignViewportI if (aan[an].autoCalculated && aan[an].groupRef != null) { oldrfs.add(aan[an].groupRef); - alignment.deleteAnnotation(aan[an],false); + alignment.deleteAnnotation(aan[an], false); } } } @@ -1554,11 +1562,12 @@ public abstract class AlignmentViewport implements AlignViewportI @Override public Color getSequenceColour(SequenceI seq) { - Color sqc=Color.white; + Color sqc = Color.white; if (sequenceColours != null) { sqc = (Color) sequenceColours.get(seq); - if (sqc == null) { + if (sqc == null) + { sqc = Color.white; } } diff --git a/src/jalview/viewmodel/PCAModel.java b/src/jalview/viewmodel/PCAModel.java index a501793..2983851 100644 --- a/src/jalview/viewmodel/PCAModel.java +++ b/src/jalview/viewmodel/PCAModel.java @@ -47,7 +47,7 @@ public class PCAModel AlignmentView seqstrings; SequenceI[] seqs; - + /** * Score matrix used to calculate PC */ @@ -70,7 +70,8 @@ public class PCAModel public void run() { - pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide, score_matrix); + pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide, + score_matrix); pca.setJvCalcMode(jvCalcMode); pca.run(); @@ -241,5 +242,5 @@ public class PCAModel { this.score_matrix = score_matrix; } - + } diff --git a/src/jalview/workers/ConsensusThread.java b/src/jalview/workers/ConsensusThread.java index 04f7440..69bdd24 100644 --- a/src/jalview/workers/ConsensusThread.java +++ b/src/jalview/workers/ConsensusThread.java @@ -35,7 +35,7 @@ import java.util.Hashtable; public class ConsensusThread extends AlignCalcWorker implements AlignCalcWorkerI { - private long nseq=-1; + private long nseq = -1; public ConsensusThread(AlignViewportI alignViewport, AlignmentViewPanel alignPanel) @@ -102,8 +102,8 @@ public class ConsensusThread extends AlignCalcWorker implements { SequenceI aseqs[] = alignment.getSequencesArray(); nseq = aseqs.length; - AAFrequency.calculate(aseqs, 0, - alignment.getWidth(), hconsensus, true); + AAFrequency.calculate(aseqs, 0, alignment.getWidth(), hconsensus, + true); } catch (ArrayIndexOutOfBoundsException x) { // this happens due to a race condition - diff --git a/src/jalview/workers/StrucConsensusThread.java b/src/jalview/workers/StrucConsensusThread.java index 1122663..72d26ff 100644 --- a/src/jalview/workers/StrucConsensusThread.java +++ b/src/jalview/workers/StrucConsensusThread.java @@ -44,7 +44,7 @@ public class StrucConsensusThread extends AlignCalcWorker implements Hashtable[] hStrucConsensus; - private long nseq=-1; + private long nseq = -1; @Override public void run() @@ -113,11 +113,10 @@ public class StrucConsensusThread extends AlignCalcWorker implements try { - final SequenceI[] arr= - alignment.getSequencesArray(); + final SequenceI[] arr = alignment.getSequencesArray(); nseq = arr.length; - jalview.analysis.StructureFrequency.calculate(arr, 0, alignment.getWidth(), - hStrucConsensus, true, rnaStruc); + jalview.analysis.StructureFrequency.calculate(arr, 0, + alignment.getWidth(), hStrucConsensus, true, rnaStruc); } catch (ArrayIndexOutOfBoundsException x) { calcMan.workerComplete(this); diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index e8494e4..ebf3a7d 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -81,9 +81,10 @@ public class DBRefFetcher implements Runnable private SequenceI[] alseqs; /** - * when true - retrieved sequences will be trimmed to cover longest derived alignment sequence + * when true - retrieved sequences will be trimmed to cover longest derived + * alignment sequence */ - private boolean trimDsSeqs=true; + private boolean trimDsSeqs = true; public DBRefFetcher() { @@ -131,7 +132,8 @@ public class DBRefFetcher implements Runnable this.dataset = ds; // TODO Jalview 2.5 lots of this code should be in the gui package! sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af); - // set default behaviour for transferring excess sequence data to the dataset + // set default behaviour for transferring excess sequence data to the + // dataset trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true); if (sources == null) { @@ -381,7 +383,7 @@ public class DBRefFetcher implements Runnable if (retrieved != null) { transferReferences(sdataset, dbsource.getDbSource(), - retrieved,trimDsSeqs); + retrieved, trimDsSeqs); } } else @@ -460,15 +462,20 @@ public class DBRefFetcher implements Runnable } // all databases have been queries. if (sbuffer.length() > 0) { - output.setText(MessageManager.getString("label.your_sequences_have_been_verified") + output.setText(MessageManager + .getString("label.your_sequences_have_been_verified") + sbuffer.toString()); - Desktop.addInternalFrame(output, MessageManager.getString("label.sequence_names_updated"), 600, 300); + Desktop.addInternalFrame(output, + MessageManager.getString("label.sequence_names_updated"), + 600, 300); // The above is the dataset, we must now find out the index // of the viewed sequence } - af.setProgressBar(MessageManager.getString("label.dbref_search_completed"), startTime); + af.setProgressBar( + MessageManager.getString("label.dbref_search_completed"), + startTime); // promptBeforeBlast(); running = false; @@ -478,14 +485,15 @@ public class DBRefFetcher implements Runnable /** * Verify local sequences in seqRefs against the retrieved sequence database * records. - * @param trimDatasetSeqs + * + * @param trimDatasetSeqs * */ void transferReferences(Vector sdataset, String dbSource, AlignmentI retrievedAl, boolean trimDatasetSeqs) // File // file) { - System.out.println("trimming ? "+trimDatasetSeqs); + System.out.println("trimming ? " + trimDatasetSeqs); if (retrievedAl == null || retrievedAl.getHeight() == 0) { return; @@ -660,7 +668,8 @@ public class DBRefFetcher implements Runnable // unknownSequences.remove(sequence); int absEnd = absStart + nonGapped.length(); absStart += 1; - if (!trimDatasetSeqs) { + if (!trimDatasetSeqs) + { // insert full length sequence from record sequence.setSequence(entry.getSequenceAsString()); sequence.setStart(entry.getStart()); @@ -668,7 +677,8 @@ public class DBRefFetcher implements Runnable if (updateRefFrame) { // finally, update local sequence reference frame if we're allowed - if (trimDatasetSeqs) { + if (trimDatasetSeqs) + { // just fix start/end sequence.setStart(absStart); sequence.setEnd(absEnd); diff --git a/src/jalview/ws/EnfinEnvision2OneWay.java b/src/jalview/ws/EnfinEnvision2OneWay.java index 8180bc8..c048f45 100644 --- a/src/jalview/ws/EnfinEnvision2OneWay.java +++ b/src/jalview/ws/EnfinEnvision2OneWay.java @@ -59,6 +59,7 @@ import com.lowagie.text.html.HtmlEncoder; * Lightweight runnable to discover dynamic 'one way' group URL services * * as of Jalview 2.8.1 this class is mothballed and will be dropped in v3. + * * @author JimP * @deprecated * diff --git a/src/jalview/ws/HttpClientUtils.java b/src/jalview/ws/HttpClientUtils.java index 93566f8..229fa4e 100644 --- a/src/jalview/ws/HttpClientUtils.java +++ b/src/jalview/ws/HttpClientUtils.java @@ -43,8 +43,9 @@ import org.apache.http.impl.client.DefaultHttpClient; /** * Helpful procedures for working with services via HTTPClient + * * @author jimp - * + * */ public class HttpClientUtils { @@ -83,18 +84,20 @@ public class HttpClientUtils } public static BufferedReader doHttpMpartFilePost(String postUrl, - List vals, String fparm,File file, String mtype) throws ClientProtocolException, - IOException + List vals, String fparm, File file, String mtype) + throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(postUrl); - MultipartEntity mpe = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); - for (NameValuePair nvp:vals) + MultipartEntity mpe = new MultipartEntity( + HttpMultipartMode.BROWSER_COMPATIBLE); + for (NameValuePair nvp : vals) { mpe.addPart(nvp.getName(), new StringBody(nvp.getValue())); } - - FileBody fb = new FileBody(file, mtype!=null ? mtype : "application/octet-stream"); + + FileBody fb = new FileBody(file, mtype != null ? mtype + : "application/octet-stream"); mpe.addPart(fparm, fb); UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8"); httppost.setEntity(ue); @@ -112,19 +115,22 @@ public class HttpClientUtils return null; } } + public static BufferedReader doHttpMpartInputstreamPost(String postUrl, - List vals, String fparm,String fname, InputStream is, String mtype) throws ClientProtocolException, + List vals, String fparm, String fname, + InputStream is, String mtype) throws ClientProtocolException, IOException { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost(postUrl); MultipartEntity mpe = new MultipartEntity(HttpMultipartMode.STRICT); - for (NameValuePair nvp:vals) + for (NameValuePair nvp : vals) { mpe.addPart(nvp.getName(), new StringBody(nvp.getValue())); } - - InputStreamBody fb = (mtype!=null) ? new InputStreamBody(is, fname, mtype) : new InputStreamBody(is, fname); + + InputStreamBody fb = (mtype != null) ? new InputStreamBody(is, fname, + mtype) : new InputStreamBody(is, fname); mpe.addPart(fparm, fb); UrlEncodedFormEntity ue = new UrlEncodedFormEntity(vals, "UTF-8"); httppost.setEntity(ue); diff --git a/src/jalview/ws/JobStateSummary.java b/src/jalview/ws/JobStateSummary.java index 34d99b6..d0f6d7d 100644 --- a/src/jalview/ws/JobStateSummary.java +++ b/src/jalview/ws/JobStateSummary.java @@ -79,11 +79,11 @@ public class JobStateSummary { if (j.cancelled) { - cancelled++; - j.subjobComplete=true; - wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_CANCELLED_OK); - return; - } + cancelled++; + j.subjobComplete = true; + wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_CANCELLED_OK); + return; + } if (j.submitted) { String progheader = ""; diff --git a/src/jalview/ws/SequenceFetcher.java b/src/jalview/ws/SequenceFetcher.java index ad7b578..caf5b5e 100644 --- a/src/jalview/ws/SequenceFetcher.java +++ b/src/jalview/ws/SequenceFetcher.java @@ -52,6 +52,7 @@ public class SequenceFetcher extends ASequenceFetcher { this(true); } + public SequenceFetcher(boolean addDas) { addDBRefSourceImpl(jalview.ws.dbsources.EmblSource.class); @@ -66,7 +67,8 @@ public class SequenceFetcher extends ASequenceFetcher // PFAM addDBRefSourceImpl(jalview.ws.dbsources.RfamFull.class); addDBRefSourceImpl(jalview.ws.dbsources.RfamSeed.class); - if (addDas) { + if (addDas) + { registerDasSequenceSources(); } } @@ -224,13 +226,14 @@ public class SequenceFetcher extends ASequenceFetcher + "With one argument, the argument will be resolved to one or more db sources and each will be queried with their test accession only.\n" + "If given two arguments, SequenceFetcher will try to find the DbFetcher corresponding to and retrieve from it.\n" + "The -nodas option will exclude DAS sources from the database fetchers Jalview will try to use."; - boolean withDas=true; - if (argv!=null && argv.length>0 && argv[0].toLowerCase().startsWith("-nodas")) + boolean withDas = true; + if (argv != null && argv.length > 0 + && argv[0].toLowerCase().startsWith("-nodas")) { - withDas=false; - String targs[] = new String[argv.length-1]; + withDas = false; + String targs[] = new String[argv.length - 1]; System.arraycopy(argv, 1, targs, 0, targs.length); - argv=targs; + argv = targs; } if (argv != null && argv.length > 0) { @@ -244,11 +247,13 @@ public class SequenceFetcher extends ASequenceFetcher AlignmentI al = null; try { - al = sp.getSequenceRecords(argv.length>1 ? argv[1] : sp.getTestQuery()); + al = sp.getSequenceRecords(argv.length > 1 ? argv[1] : sp + .getTestQuery()); } catch (Exception e) { e.printStackTrace(); - System.err.println("Error when retrieving " + (argv.length>1 ? argv[1] : sp.getTestQuery()) + System.err.println("Error when retrieving " + + (argv.length > 1 ? argv[1] : sp.getTestQuery()) + " from " + argv[0] + "\nUsage: " + usage); } SequenceI[] prod = al.getSequencesArray(); diff --git a/src/jalview/ws/dbsources/GeneDbSource.java b/src/jalview/ws/dbsources/GeneDbSource.java index 07677d8..6fbc081 100644 --- a/src/jalview/ws/dbsources/GeneDbSource.java +++ b/src/jalview/ws/dbsources/GeneDbSource.java @@ -20,7 +20,6 @@ */ package jalview.ws.dbsources; - import com.stevesoft.pat.Regex; import jalview.datamodel.AlignmentI; @@ -121,6 +120,7 @@ public class GeneDbSource extends EmblXmlSource implements DbSourceProxy { return "GeneDB"; // getDbSource(); } + @Override public int getTier() { diff --git a/src/jalview/ws/dbsources/Pdb.java b/src/jalview/ws/dbsources/Pdb.java index b252900..1c6c015 100644 --- a/src/jalview/ws/dbsources/Pdb.java +++ b/src/jalview/ws/dbsources/Pdb.java @@ -138,7 +138,7 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy jalview.io.AppletFormatAdapter.FILE, "PDB"); if (pdbfile != null) { - List toremove=new ArrayList(); + List toremove = new ArrayList(); for (SequenceI pdbcs : pdbfile.getSequences()) { String chid = null; @@ -183,17 +183,18 @@ public class Pdb extends EbiFileRetrievedProxy implements DbSourceProxy } else { - // mark this sequence to be removed from the alignment + // mark this sequence to be removed from the alignment // - since it's not from the right chain toremove.add(pdbcs); } } - // now remove marked sequences - for (SequenceI pdbcs:toremove) { + // now remove marked sequences + for (SequenceI pdbcs : toremove) + { pdbfile.deleteSequence(pdbcs); } } - + if (pdbfile == null || pdbfile.getHeight() < 1) { throw new Exception("No PDB Records for " + id + " chain " diff --git a/src/jalview/ws/dbsources/Pfam.java b/src/jalview/ws/dbsources/Pfam.java index 746ae04..489db1f 100644 --- a/src/jalview/ws/dbsources/Pfam.java +++ b/src/jalview/ws/dbsources/Pfam.java @@ -20,7 +20,6 @@ */ package jalview.ws.dbsources; - import com.stevesoft.pat.Regex; import jalview.datamodel.AlignmentI; diff --git a/src/jalview/ws/dbsources/PfamFull.java b/src/jalview/ws/dbsources/PfamFull.java index 4b13110..9b4587e 100644 --- a/src/jalview/ws/dbsources/PfamFull.java +++ b/src/jalview/ws/dbsources/PfamFull.java @@ -68,7 +68,7 @@ public class PfamFull extends Pfam implements DbSourceProxy return null; } - @Override + @Override public int getTier() { return 0; diff --git a/src/jalview/ws/dbsources/das/api/jalviewSourceI.java b/src/jalview/ws/dbsources/das/api/jalviewSourceI.java index 4160199..681faa4 100644 --- a/src/jalview/ws/dbsources/das/api/jalviewSourceI.java +++ b/src/jalview/ws/dbsources/das/api/jalviewSourceI.java @@ -79,6 +79,7 @@ public interface jalviewSourceI /** * test if the source is a reference source for the authority + * * @return */ boolean isReferenceSource(); diff --git a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java index c3916e7..b9d778b 100644 --- a/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/DasSequenceSource.java @@ -73,9 +73,10 @@ public class DasSequenceSource extends DbSourceProxyImpl implements protected MultipleConnectionPropertyProviderI connprops = null; /** - * DAS sources are tier 1 - if we have a direct DB connection then we should prefer it + * DAS sources are tier 1 - if we have a direct DB connection then we should + * prefer it */ - private int tier=1; + private int tier = 1; /** * create a new DbSource proxy for a DAS 1 source @@ -102,7 +103,7 @@ public class DasSequenceSource extends DbSourceProxyImpl implements throw new Exception("Source " + source.getTitle() + " does not support the sequence command."); } - this.tier = 1+((jsrc.isLocal() || jsrc.isReferenceSource()) ? 0 : 1); + this.tier = 1 + ((jsrc.isLocal() || jsrc.isReferenceSource()) ? 0 : 1); this.source = source; this.dbname = dbname; this.dbrefname = dbrefname.toUpperCase(); diff --git a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java index bb3d4c2..d260b9e 100644 --- a/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java +++ b/src/jalview/ws/dbsources/das/datamodel/JalviewSource.java @@ -373,7 +373,8 @@ public class JalviewSource implements jalviewSourceI @Override public boolean isReferenceSource() { - // TODO check source object for indication that we are the primary for a DAS coordinate system + // TODO check source object for indication that we are the primary for a DAS + // coordinate system return false; } } diff --git a/src/jalview/ws/ebi/EBIFetchClient.java b/src/jalview/ws/ebi/EBIFetchClient.java index e363750..f5f9190 100644 --- a/src/jalview/ws/ebi/EBIFetchClient.java +++ b/src/jalview/ws/ebi/EBIFetchClient.java @@ -221,10 +221,9 @@ public class EBIFetchClient return null; } finally { - //System.err.println("Took " + (System.currentTimeMillis() - time) - // / 1000 + " secs for one call."); + // System.err.println("Took " + (System.currentTimeMillis() - time) + // / 1000 + " secs for one call."); } return null; } } - diff --git a/src/jalview/ws/jws1/Annotate3D.java b/src/jalview/ws/jws1/Annotate3D.java index d0712da..465c5fc 100644 --- a/src/jalview/ws/jws1/Annotate3D.java +++ b/src/jalview/ws/jws1/Annotate3D.java @@ -82,15 +82,17 @@ public class Annotate3D } Iterator r = jalview.ext.paradise.Annotate3D .getRNAMLForPDBFileAsString(sb.toString()); - AlignmentI al=null; + AlignmentI al = null; while (r.hasNext()) { FileParse fp = new InputStreamParser(r.next(), source.getDataName()); AlignmentI nal = new FormatAdapter().readFromFile(fp, "RNAML"); - if (al==null) + if (al == null) { al = nal; - } else { + } + else + { al.append(nal); } } diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java index ce9e334..676b3ba 100644 --- a/src/jalview/ws/jws2/AAConClient.java +++ b/src/jalview/ws/jws2/AAConClient.java @@ -106,7 +106,8 @@ public class AAConClient extends JabawsAlignCalcWorker { return CALC_ID; } - private static String CALC_ID="jabaws2.AACon"; + + private static String CALC_ID = "jabaws2.AACon"; public static AlignAnalysisUIText getAlignAnalysisUITest() { diff --git a/src/jalview/ws/jws2/AADisorderClient.java b/src/jalview/ws/jws2/AADisorderClient.java index c5fbf49..34969d1 100644 --- a/src/jalview/ws/jws2/AADisorderClient.java +++ b/src/jalview/ws/jws2/AADisorderClient.java @@ -50,6 +50,7 @@ public class AADisorderClient extends JabawsCalcWorker implements { private static final String THRESHOLD = "THRESHOLD"; + private static final String RANGE = "RANGE"; String typeName; @@ -123,7 +124,7 @@ public class AADisorderClient extends JabawsCalcWorker implements amap.get("Dydx").put(THRESHOLD, new double[] { 1, 0 }); amap.get("Dydx").put(RANGE, new float[] - { -1, +1 }); + { -1, +1 }); amap.put("SmoothedScore", new HashMap()); amap.get("SmoothedScore").put(INVISIBLE, INVISIBLE); @@ -137,17 +138,16 @@ public class AADisorderClient extends JabawsCalcWorker implements amap.get("COILS").put(THRESHOLD, new double[] { 1, 0.516 }); amap.get("COILS").put(RANGE, new float[] - { 0, 1 }); + { 0, 1 }); amap.get("HOTLOOPS").put(THRESHOLD, new double[] { 1, 0.6 }); amap.get("HOTLOOPS").put(RANGE, new float[] - { 0, 1 }); + { 0, 1 }); amap.get("REM465").put(THRESHOLD, new double[] { 1, 0.1204 }); amap.get("REM465").put(RANGE, new float[] - { 0, 1 }); - + { 0, 1 }); annotMap.put(compbio.ws.client.Services.IUPredWS.toString(), amap = new HashMap>()); @@ -156,18 +156,18 @@ public class AADisorderClient extends JabawsCalcWorker implements amap.get("Long").put(THRESHOLD, new double[] { 1, 0.5 }); amap.get("Long").put(RANGE, new float[] - { 0, 1 }); + { 0, 1 }); amap.get("Short").put(THRESHOLD, new double[] { 1, 0.5 }); amap.get("Short").put(RANGE, new float[] - { 0, 1 }); + { 0, 1 }); annotMap.put(compbio.ws.client.Services.JronnWS.toString(), amap = new HashMap>()); amap.put("JRonn", new HashMap()); amap.get("JRonn").put(THRESHOLD, new double[] { 1, 0.5 }); amap.get("JRonn").put(RANGE, new float[] - { 0, 1 }); + { 0, 1 }); } @Override @@ -203,14 +203,15 @@ public class AADisorderClient extends JabawsCalcWorker implements { boolean sameGroup = false; SequenceI dseq, aseq, seq = seqNames.get(seqId); - int base = seq.findPosition(start)-1; + int base = seq.findPosition(start) - 1; aseq = seq; while ((dseq = seq).getDatasetSequence() != null) { seq = seq.getDatasetSequence(); } ScoreHolder scores = null; - try { + try + { scores = scoremanager.getAnnotationForSequence(seqId); } catch (Exception q) { @@ -218,12 +219,14 @@ public class AADisorderClient extends JabawsCalcWorker implements .info("Couldn't recover disorder prediction for sequence " + seq.getName() + "(Prediction name was " - + seqId+")" + + seqId + + ")" + "\nSee http://issues.jalview.org/browse/JAL-1319 for one possible reason why disorder predictions might fail."); } float last = Float.NaN, val = Float.NaN; int lastAnnot = ourAnnot.size(); - if (scores!=null && scores.scores!=null) { + if (scores != null && scores.scores != null) + { for (Score scr : scores.scores) { @@ -275,21 +278,21 @@ public class AADisorderClient extends JabawsCalcWorker implements service.getServiceTypeURI() + "/" + scr.getMethod(), aseq, base + 1, scr); annot.graph = AlignmentAnnotation.LINE_GRAPH; - - Map styleMap = (annotTypeMap == null) ? null : annotTypeMap.get(scr.getMethod()); - + + Map styleMap = (annotTypeMap == null) ? null + : annotTypeMap.get(scr.getMethod()); + annot.visible = (styleMap == null || styleMap.get(INVISIBLE) == null); - double[] thrsh = (styleMap==null) ? null - : (double[]) styleMap.get( - THRESHOLD); - float[] range = (styleMap==null) ? null : (float[]) styleMap.get( - RANGE); - if (range!=null) + double[] thrsh = (styleMap == null) ? null + : (double[]) styleMap.get(THRESHOLD); + float[] range = (styleMap == null) ? null + : (float[]) styleMap.get(RANGE); + if (range != null) { annot.graphMin = range[0]; annot.graphMax = range[1]; } - if (styleMap==null || styleMap.get(DONTCOMBINE) == null) + if (styleMap == null || styleMap.get(DONTCOMBINE) == null) { { if (!sameGroup) diff --git a/src/jalview/ws/jws2/JabaParamStore.java b/src/jalview/ws/jws2/JabaParamStore.java index f454bb2..65f939a 100644 --- a/src/jalview/ws/jws2/JabaParamStore.java +++ b/src/jalview/ws/jws2/JabaParamStore.java @@ -184,12 +184,12 @@ public class JabaParamStore implements ParamDatastoreI String[] rgssorton = rgnames.toArray(new String[rgs.size()]); jalview.util.QuickSort.sort(rgssorton, rgssort); ArgumentI tmp1; - int i=0; - while (rgssort.length-i>i) + int i = 0; + while (rgssort.length - i > i) { - tmp1=rgssort[rgssort.length-i-1]; - rgssort[rgssort.length-i-1] = rgssort[i]; - rgssort[i++]=tmp1; + tmp1 = rgssort[rgssort.length - i - 1]; + rgssort[rgssort.length - i - 1] = rgssort[i]; + rgssort[i++] = tmp1; } return Arrays.asList(rgssort); } diff --git a/src/jalview/ws/jws2/JabaWsServerQuery.java b/src/jalview/ws/jws2/JabaWsServerQuery.java index e6c783f..2eb484b 100644 --- a/src/jalview/ws/jws2/JabaWsServerQuery.java +++ b/src/jalview/ws/jws2/JabaWsServerQuery.java @@ -119,14 +119,16 @@ public class JabaWsServerQuery implements Runnable jabasws2 = true; srv_set = registry.getSupportedServices(); - + // dan test - System.out.println("registry.getSupportedServices: " + srv_set.toString()); - + System.out.println("registry.getSupportedServices: " + + srv_set.toString()); + svccategories = registry.getServiceCategories(); - + // dan test -// System.out.println("registry.getServiceCategories: " + svccategories.toString()); + // System.out.println("registry.getServiceCategories: " + + // svccategories.toString()); } } catch (Exception ex) @@ -181,13 +183,14 @@ public class JabaWsServerQuery implements Runnable String description = registry.getServiceDescription(srv); - svc = Jws2InstanceFactory.newJws2Instance(jwsservers, srv.toString(), - cat.name, description, service); + svc = Jws2InstanceFactory.newJws2Instance(jwsservers, + srv.toString(), cat.name, description, service); } if (svc == null) { - svc = Jws2InstanceFactory.newJws2Instance(jwsservers, srv.toString(), - cat.name, "JABAWS 1 Alignment Service", service); + svc = Jws2InstanceFactory.newJws2Instance(jwsservers, + srv.toString(), cat.name, + "JABAWS 1 Alignment Service", service); } jws2Discoverer.addService(jwsservers, svc); } diff --git a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java index 3b3579d..43d7c63 100644 --- a/src/jalview/ws/jws2/JabawsAlignCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsAlignCalcWorker.java @@ -39,10 +39,7 @@ public abstract class JabawsAlignCalcWorker extends JabawsCalcWorker { super(alignViewport, alignPanel); } - - - - + public JabawsAlignCalcWorker(Jws2Instance service, AlignFrame alignFrame, WsParamSetI preset, List paramset) { @@ -50,7 +47,7 @@ public abstract class JabawsAlignCalcWorker extends JabawsCalcWorker } /** - * Recover any existing parameters for this service + * Recover any existing parameters for this service */ protected void initViewportParams() { @@ -67,11 +64,9 @@ public abstract class JabawsAlignCalcWorker extends JabawsCalcWorker */ public abstract String getCalcId(); - - - @Override - public void updateParameters(WsParamSetI newpreset, java.util.List newarguments) + public void updateParameters(WsParamSetI newpreset, + java.util.List newarguments) { super.updateParameters(newpreset, newarguments); initViewportParams(); diff --git a/src/jalview/ws/jws2/JabawsCalcWorker.java b/src/jalview/ws/jws2/JabawsCalcWorker.java index add8bd5..5223c52 100644 --- a/src/jalview/ws/jws2/JabawsCalcWorker.java +++ b/src/jalview/ws/jws2/JabawsCalcWorker.java @@ -57,11 +57,16 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { protected Jws2Instance service; + @SuppressWarnings("unchecked") protected SequenceAnnotation aaservice; + protected ScoreManager scoremanager; + protected WsParamSetI preset; + protected List arguments; + protected IProgressIndicator guiProgress; public JabawsCalcWorker(AlignViewportI alignViewport, @@ -100,7 +105,8 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker * @param newpreset * @param newarguments */ - public void updateParameters(final WsParamSetI newpreset, final List newarguments) + public void updateParameters(final WsParamSetI newpreset, + final List newarguments) { preset = newpreset; arguments = newarguments; @@ -135,9 +141,9 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker return; } long progressId = -1; - + int serverErrorsLeft = 3; - + String rslt = "JOB NOT DEFINED"; StringBuffer msg = new StringBuffer(); try @@ -146,15 +152,16 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { return; } - List seqs = getInputSequences(alignViewport - .getAlignment(), bySequence ? alignViewport.getSelectionGroup() : null); - + List seqs = getInputSequences( + alignViewport.getAlignment(), + bySequence ? alignViewport.getSelectionGroup() : null); + if (seqs == null) { calcMan.workerComplete(this); return; } - + AlignmentAnnotation[] aa = alignViewport.getAlignment() .getAlignmentAnnotation(); if (guiProgress != null) @@ -175,7 +182,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { throw new JobSubmissionException( "Invalid parameter set. Check Jalview implementation.", x); - + } } boolean finished = false; @@ -201,12 +208,12 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { System.err.println("FAILED TO CANCEL AACon job: " + rslt); } - + } catch (Exception x) { - + } - + return; } long cpos; @@ -222,7 +229,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker stats = aaservice.pullExecStatistics(rslt, rpos); } catch (Exception x) { - + if (x.getMessage().contains( "Position in a file could not be negative!")) { @@ -259,7 +266,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker rpos = stats.getNextPosition(); } } while (stats != null && rpos > cpos); - + if (!finished && status.equals(JobStatus.FAILED)) { try @@ -291,10 +298,10 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker } } } - + catch (JobSubmissionException x) { - + System.err.println("submission error with " + getServiceActionText() + " :"); x.printStackTrace(); @@ -304,18 +311,18 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker System.err.println("collection error:\nJob ID: " + rslt); x.printStackTrace(); calcMan.workerCannotRun(this); - + } catch (OutOfMemoryError error) { calcMan.workerCannotRun(this); - + // consensus = null; // hconsensus = null; ap.raiseOOMWarning(getServiceActionText(), error); } catch (Exception x) { calcMan.workerCannotRun(this); - + // consensus = null; // hconsensus = null; System.err @@ -323,7 +330,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker x.printStackTrace(); } finally { - + calcMan.workerComplete(this); if (ap != null) { @@ -346,7 +353,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker */ } } - + } @Override @@ -360,32 +367,42 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker public abstract String getServiceActionText(); protected boolean submitGaps = true; + protected boolean alignedSeqs = true; + protected boolean nucleotidesAllowed = false; + protected boolean proteinAllowed = false; + /** * record sequences for mapping result back to afterwards */ protected boolean bySequence = false; + protected Map seqNames; + protected boolean[] gapMap; + int realw; - int start,end; - public List getInputSequences(AlignmentI alignment, AnnotatedCollectionI inputSeqs) + int start, end; + + public List getInputSequences(AlignmentI alignment, + AnnotatedCollectionI inputSeqs) { if (alignment == null || alignment.getWidth() <= 0 - || alignment.getSequences() == null - || alignment.isNucleotide() ? !nucleotidesAllowed + || alignment.getSequences() == null || alignment.isNucleotide() ? !nucleotidesAllowed : !proteinAllowed) { return null; } - if (inputSeqs==null || inputSeqs.getWidth()<=0 || inputSeqs.getSequences()==null || inputSeqs.getSequences().size()<1) + if (inputSeqs == null || inputSeqs.getWidth() <= 0 + || inputSeqs.getSequences() == null + || inputSeqs.getSequences().size() < 1) { inputSeqs = alignment; } - + List seqs = new ArrayList(); int minlen = 10; @@ -395,13 +412,14 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker seqNames = new HashMap(); } gapMap = new boolean[0]; - start=inputSeqs.getStartRes(); - end=inputSeqs.getEndRes(); - + start = inputSeqs.getStartRes(); + end = inputSeqs.getEndRes(); for (SequenceI sq : ((List) inputSeqs.getSequences())) { - if (bySequence ? sq.findPosition(end+1) -sq.findPosition(start+1) > minlen - 1 : sq.getEnd() - sq.getStart() > minlen - 1) + if (bySequence ? sq.findPosition(end + 1) + - sq.findPosition(start + 1) > minlen - 1 : sq.getEnd() + - sq.getStart() > minlen - 1) { String newname = SeqsetUtils.unique_name(seqs.size() + 1); // make new input sequence with or without gaps @@ -433,7 +451,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { seqs.add(seq = new compbio.data.sequence.FastaSequence(newname, AlignSeq.extractGaps(jalview.util.Comparison.GapChars, - sq.getSequenceAsString(start,end+1)))); + sq.getSequenceAsString(start, end + 1)))); } if (seq.getSequence().length() > ln) { @@ -504,7 +522,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker { ap.paintAlignment(false); } - + Thread.sleep(200); } catch (Exception ex) { @@ -519,8 +537,9 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker return false; } - protected void createAnnotationRowsForScores(List ourAnnot, String calcId, - int alWidth, Score scr) + protected void createAnnotationRowsForScores( + List ourAnnot, String calcId, int alWidth, + Score scr) { // simple annotation row AlignmentAnnotation annotation = alignViewport.getAlignment() @@ -533,7 +552,8 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker } } - protected AlignmentAnnotation createAnnotationRowsForScores(List ourAnnot, String typeName, + protected AlignmentAnnotation createAnnotationRowsForScores( + List ourAnnot, String typeName, String calcId, SequenceI dseq, int base, Score scr) { System.out.println("Creating annotation on dseq:" + dseq.getStart() @@ -553,8 +573,8 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker return annotation; } - private void constructAnnotationFromScore(AlignmentAnnotation annotation, int base, - int alWidth, Score scr) + private void constructAnnotationFromScore(AlignmentAnnotation annotation, + int base, int alWidth, Score scr) { Annotation[] elm = new Annotation[alWidth]; Iterator vals = scr.getScores().iterator(); @@ -589,7 +609,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker } elm[i] = new Annotation("", "" + val, ' ', val); } - + annotation.annotations = elm; annotation.belowAlignment = true; if (x < 0) @@ -621,7 +641,7 @@ public abstract class JabawsCalcWorker extends AlignCalcWorker } } our.clear(); - + ap.adjustAnnotationHeight(); } } diff --git a/src/jalview/ws/jws2/Jws2Client.java b/src/jalview/ws/jws2/Jws2Client.java index 09ec5c5..2c96009 100644 --- a/src/jalview/ws/jws2/Jws2Client.java +++ b/src/jalview/ws/jws2/Jws2Client.java @@ -99,7 +99,8 @@ public abstract class Jws2Client extends jalview.ws.WSClient : new WsJobParameters(sh, preset); if (adjustingExisting) { - jobParams.setName(MessageManager.getString("label.adjusting_parameters_for_calculation")); + jobParams.setName(MessageManager + .getString("label.adjusting_parameters_for_calculation")); } if (!jobParams.showRunDialog()) { diff --git a/src/jalview/ws/jws2/Jws2Discoverer.java b/src/jalview/ws/jws2/Jws2Discoverer.java index f14e3c4..206bdc8 100644 --- a/src/jalview/ws/jws2/Jws2Discoverer.java +++ b/src/jalview/ws/jws2/Jws2Discoverer.java @@ -131,15 +131,16 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI Cache.log.debug("Old discovery thread has finished."); } running = true; - + // first set up exclusion list if needed final Set ignoredServices = new HashSet(); - for (String ignored:jalview.bin.Cache.getDefault("IGNORED_JABAWS_SERVICETYPES", Services.JpredWS.toString()).split("\\|")) + for (String ignored : jalview.bin.Cache.getDefault( + "IGNORED_JABAWS_SERVICETYPES", Services.JpredWS.toString()) + .split("\\|")) { ignoredServices.add(ignored); } - changeSupport.firePropertyChange("services", services, new Vector()); oldthread = Thread.currentThread(); try @@ -206,8 +207,9 @@ public class Jws2Discoverer implements Runnable, WSMenuEntryProviderI ; for (JabaWsServerQuery squery : qrys) { - if (squery.isRunning()){ - finished=false; + if (squery.isRunning()) + { + finished = false; } } if (aborted) diff --git a/src/jalview/ws/jws2/MsaWSClient.java b/src/jalview/ws/jws2/MsaWSClient.java index 8f9d3f0..37231fd 100644 --- a/src/jalview/ws/jws2/MsaWSClient.java +++ b/src/jalview/ws/jws2/MsaWSClient.java @@ -215,15 +215,21 @@ public class MsaWSClient extends Jws2Client if (submitGaps == true) { action = "Realign "; - msawsmenu = new JMenu(MessageManager.formatMessage("label.realign_with_params", new String[]{svcname})); - msawsmenu - .setToolTipText(MessageManager.getString("label.align_sequences_to_existing_alignment")); + msawsmenu = new JMenu(MessageManager.formatMessage( + "label.realign_with_params", new String[] + { svcname })); + msawsmenu.setToolTipText(MessageManager + .getString("label.align_sequences_to_existing_alignment")); rmsawsmenu.add(msawsmenu); } final boolean withGaps = submitGaps; - JMenuItem method = new JMenuItem(MessageManager.formatMessage("label.calcname_with_default_settings", new String[]{calcName})); - method.setToolTipText(MessageManager.formatMessage("label.action_with_default_settings", new String[]{action})); + JMenuItem method = new JMenuItem(MessageManager.formatMessage( + "label.calcname_with_default_settings", new String[] + { calcName })); + method.setToolTipText(MessageManager.formatMessage( + "label.action_with_default_settings", new String[] + { action })); method.addActionListener(new ActionListener() { @@ -241,8 +247,10 @@ public class MsaWSClient extends Jws2Client { // only add these menu options if the service has user-modifiable // arguments - method = new JMenuItem(MessageManager.getString("label.edit_settings_and_run")); - method.setToolTipText(MessageManager.getString("label.view_and_change_parameters_before_alignment")); + method = new JMenuItem( + MessageManager.getString("label.edit_settings_and_run")); + method.setToolTipText(MessageManager + .getString("label.view_and_change_parameters_before_alignment")); method.addActionListener(new ActionListener() { @@ -259,7 +267,9 @@ public class MsaWSClient extends Jws2Client List presets = service.getParamStore().getPresets(); if (presets != null && presets.size() > 0) { - JMenu presetlist = new JMenu(MessageManager.formatMessage("label.run_with_preset_params", new String[]{calcName})); + JMenu presetlist = new JMenu(MessageManager.formatMessage( + "label.run_with_preset_params", new String[] + { calcName })); for (final WsParamSetI preset : presets) { diff --git a/src/jalview/ws/jws2/MsaWSThread.java b/src/jalview/ws/jws2/MsaWSThread.java index 1a62f2d..f40c250 100644 --- a/src/jalview/ws/jws2/MsaWSThread.java +++ b/src/jalview/ws/jws2/MsaWSThread.java @@ -547,11 +547,14 @@ class MsaWSThread extends AWS2Thread implements WSClientI } wsInfo.setProgressText(jobs[job].getJobnum(), OutputHeader + cancelledMessage + "\n"); - } else { + } + else + { // if we hadn't submitted then just mark the job as cancelled. jobs[job].setSubjobComplete(true); - wsInfo.setStatus(jobs[job].getJobnum(), WebserviceInfo.STATE_CANCELLED_OK); - + wsInfo.setStatus(jobs[job].getJobnum(), + WebserviceInfo.STATE_CANCELLED_OK); + } } if (cancelled) diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index 126266b..5d0df8a 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -44,8 +44,9 @@ import compbio.metadata.Argument; /** * Client for the JABA RNA Alifold Service + * * @author daluke - Daniel Barton - * + * */ public class RNAalifoldClient extends JabawsAlignCalcWorker implements @@ -65,23 +66,24 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements { super(sh, alignFrame, preset, paramset); - //if (arguments == null) - // arguments = new ArrayList(); + // if (arguments == null) + // arguments = new ArrayList(); af = alignFrame; methodName = sh.serviceType; - alignedSeqs=true; - submitGaps=true; + alignedSeqs = true; + submitGaps = true; nucleotidesAllowed = true; proteinAllowed = false; initViewportParams(); } - + public String getCalcId() { return CALC_ID; } - private static String CALC_ID="jalview.ws.jws2.RNAalifoldClient"; + + private static String CALC_ID = "jalview.ws.jws2.RNAalifoldClient"; public static AlignAnalysisUIText getAlignAnalysisUITest() { @@ -218,7 +220,8 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements private AlignmentAnnotation constructAnnotationFromScoreHolder( AlignmentAnnotation annotation, String struct, TreeSet data) { - Annotation[] anns = new Annotation[gapMap!= null ? gapMap.length+1 : struct.length()]; + Annotation[] anns = new Annotation[gapMap != null ? gapMap.length + 1 + : struct.length()]; if (data != null && data.size() > 1 @@ -236,10 +239,10 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements basePairs.put(score.getRanges().first(), new Float(score .getScores().get(0))); } - - for (int i = 0,ri=0,iEnd=struct.length();i clnts = alignFrame.getViewport() - .getCalcManager() - .getRegisteredWorkersOfClass(clientClass); + .getCalcManager().getRegisteredWorkersOfClass(clientClass); JabawsAlignCalcWorker worker; if (clnts == null || clnts.size() == 0) { @@ -95,21 +95,20 @@ public class SequenceAnnotationWSClient extends Jws2Client { return; } - try { - worker = (JabawsAlignCalcWorker) (clientClass.getConstructor( - new Class[] { Jws2Instance.class, - AlignFrame.class, WsParamSetI.class, - List.class }).newInstance(new Object[] { sh, alignFrame, this.preset, paramset})); + try + { + worker = (JabawsAlignCalcWorker) (clientClass + .getConstructor(new Class[] + { Jws2Instance.class, AlignFrame.class, + WsParamSetI.class, List.class }) + .newInstance(new Object[] + { sh, alignFrame, this.preset, paramset })); } catch (Exception x) { x.printStackTrace(); - throw new Error("Implementation error",x); + throw new Error("Implementation error", x); } - alignFrame - .getViewport() - .getCalcManager() - .registerWorker( - worker); + alignFrame.getViewport().getCalcManager().registerWorker(worker); alignFrame.getViewport().getCalcManager().startWorker(worker); } @@ -166,7 +165,8 @@ public class SequenceAnnotationWSClient extends Jws2Client public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service, final AlignFrame alignFrame) { - if (registerAAConWSInstance(wsmenu, service, alignFrame)) { + if (registerAAConWSInstance(wsmenu, service, alignFrame)) + { // Alignment dependent analysis calculation WS gui return; } @@ -175,7 +175,9 @@ public class SequenceAnnotationWSClient extends Jws2Client String calcName = service.serviceType.substring(0, service.serviceType.length() - 2); - JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage("label.calcname_with_default_settings", new String[]{calcName})); + JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage( + "label.calcname_with_default_settings", new String[] + { calcName })); annotservice.addActionListener(new ActionListener() { @@ -190,9 +192,11 @@ public class SequenceAnnotationWSClient extends Jws2Client { // only add these menu options if the service has user-modifiable // arguments - annotservice = new JMenuItem(MessageManager.getString("label.edit_settings_and_run")); + annotservice = new JMenuItem( + MessageManager.getString("label.edit_settings_and_run")); annotservice - .setToolTipText(MessageManager.getString("label.view_and_change_parameters_before_running_calculation")); + .setToolTipText(MessageManager + .getString("label.view_and_change_parameters_before_running_calculation")); annotservice.addActionListener(new ActionListener() { @@ -232,7 +236,8 @@ public class SequenceAnnotationWSClient extends Jws2Client } else { - annotservice = new JMenuItem(MessageManager.getString("label.view_documentation")); + annotservice = new JMenuItem( + MessageManager.getString("label.view_documentation")); if (service.docUrl != null) { annotservice.addActionListener(new ActionListener() @@ -253,18 +258,19 @@ public class SequenceAnnotationWSClient extends Jws2Client } } - private boolean registerAAConWSInstance(final JMenu wsmenu, final Jws2Instance service, final AlignFrame alignFrame) { - final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; // AlignAnalysisUIText.aaConGUI.get(service.serviceType.toString()); - if (aaui==null) + final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; // + // AlignAnalysisUIText.aaConGUI.get(service.serviceType.toString()); + if (aaui == null) { // not an instantaneous calculation GUI type service return false; } - // create the instaneous calculation GUI bits and update state if existing GUI elements already present - + // create the instaneous calculation GUI bits and update state if existing + // GUI elements already present + JCheckBoxMenuItem _aaConEnabled = null; for (int i = 0; i < wsmenu.getItemCount(); i++) { @@ -283,7 +289,8 @@ public class SequenceAnnotationWSClient extends Jws2Client .getRegisteredWorkersOfClass(aaui.getClient()); if (aaconClient != null && aaconClient.size() > 0) { - JabawsAlignCalcWorker worker = (JabawsAlignCalcWorker) aaconClient.get(0); + JabawsAlignCalcWorker worker = (JabawsAlignCalcWorker) aaconClient + .get(0); if (!worker.service.hosturl.equals(service.hosturl)) { // javax.swing.SwingUtilities.invokeLater(new Runnable() @@ -307,8 +314,8 @@ public class SequenceAnnotationWSClient extends Jws2Client aaui.getAAconToggle()); aaConEnabled.setToolTipText("

" - + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + "

") - + ""); + + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + + "

") + ""); aaConEnabled.addActionListener(new ActionListener() { @Override @@ -332,8 +339,8 @@ public class SequenceAnnotationWSClient extends Jws2Client wsmenu.add(aaConEnabled); final JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings()); modifyParams.setToolTipText("

" - + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + "

") - + ""); + + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + + "

") + ""); modifyParams.addActionListener(new ActionListener() { @@ -351,12 +358,14 @@ public class SequenceAnnotationWSClient extends Jws2Client public void menuSelected(MenuEvent arg0) { // TODO: refactor to the implementing class. - if (alignFrame.getViewport().getAlignment() - .isNucleotide() ? aaui.isNa() : aaui.isPr()) { + if (alignFrame.getViewport().getAlignment().isNucleotide() ? aaui + .isNa() : aaui.isPr()) + { aaConEnabled.setEnabled(true); modifyParams.setEnabled(true); } - else { + else + { aaConEnabled.setEnabled(false); modifyParams.setEnabled(false); } @@ -392,7 +401,8 @@ public class SequenceAnnotationWSClient extends Jws2Client return true; } - private static void showAAConAnnotationSettingsFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) + private static void showAAConAnnotationSettingsFor( + final AlignAnalysisUIText aaui, AlignFrame alignFrame) { /* * preferred settings Whether AACon is automatically recalculated Which @@ -409,12 +419,14 @@ public class SequenceAnnotationWSClient extends Jws2Client } - private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) + private static void buildCurrentAAConWorkerFor( + final AlignAnalysisUIText aaui, AlignFrame alignFrame) { buildCurrentAAConWorkerFor(aaui, alignFrame, null); } - private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame, + private static void buildCurrentAAConWorkerFor( + final AlignAnalysisUIText aaui, AlignFrame alignFrame, Jws2Instance service) { /* @@ -440,13 +452,14 @@ public class SequenceAnnotationWSClient extends Jws2Client new SequenceAnnotationWSClient(fave, alignFrame, false); } - private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui) + private static AAConSettings createDefaultAAConSettings( + AlignAnalysisUIText aaui) { return createDefaultAAConSettings(aaui, null); } - private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui, - Jws2Instance service) + private static AAConSettings createDefaultAAConSettings( + AlignAnalysisUIText aaui, Jws2Instance service) { if (service != null) { @@ -484,7 +497,8 @@ public class SequenceAnnotationWSClient extends Jws2Client return new AAConSettings(true, service, null, null); } - private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, AlignFrame alignFrame) + private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, + AlignFrame alignFrame) { alignFrame.getViewport().getCalcManager() .removeRegisteredWorkersOfClass(aaui.getClient()); diff --git a/src/jalview/ws/jws2/dm/JabaOption.java b/src/jalview/ws/jws2/dm/JabaOption.java index 55b2797..f29b6ed 100644 --- a/src/jalview/ws/jws2/dm/JabaOption.java +++ b/src/jalview/ws/jws2/dm/JabaOption.java @@ -53,13 +53,15 @@ public class JabaOption implements jalview.ws.params.OptionI @Override public URL getFurtherDetails() { - try { - return new URL(opt.getBasicURL().toExternalForm()+"/"+opt.getFurtherDetails()); - } - catch (NullPointerException q) {} - catch (MalformedURLException q) + try + { + return new URL(opt.getBasicURL().toExternalForm() + "/" + + opt.getFurtherDetails()); + } catch (NullPointerException q) { - + } catch (MalformedURLException q) + { + } return null; } diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index 46362fc..7e9f668 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -53,11 +53,17 @@ public class Jws2Instance /** * - * @param hosturl Service endpoint - * @param serviceType Category for this service's analysis - * @param action text describing their action that service performs (eg 'aligning', 'analysing') - * @param description Description from JABAWS registry - * @param service JABAWS registry ID for service + * @param hosturl + * Service endpoint + * @param serviceType + * Category for this service's analysis + * @param action + * text describing their action that service performs (eg 'aligning', + * 'analysing') + * @param description + * Description from JABAWS registry + * @param service + * JABAWS registry ID for service */ public Jws2Instance(String hosturl, String serviceType, String action, String description, JABAService service) @@ -235,7 +241,9 @@ public class Jws2Instance { return "java:" + serviceType; } + jalview.ws.uimodel.AlignAnalysisUIText aaui; + public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI() { return aaui; diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java index 3ae0bc5..db50a9d 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java @@ -31,10 +31,13 @@ import jalview.ws.uimodel.AlignAnalysisUIText; public class Jws2InstanceFactory { private static HashMap aaConGUI; + private static String category_rewrite(String cat_name) { - return (cat_name != null && cat_name.equals("Prediction")) ? "Secondary Structure Prediction" : cat_name; + return (cat_name != null && cat_name.equals("Prediction")) ? "Secondary Structure Prediction" + : cat_name; } + private static void init() { if (aaConGUI == null) @@ -63,9 +66,9 @@ public class Jws2InstanceFactory JABAService service) { init(); - Jws2Instance svc = new Jws2Instance(jwsservers, serviceType, category_rewrite(name), - description, service); - + Jws2Instance svc = new Jws2Instance(jwsservers, serviceType, + category_rewrite(name), description, service); + svc.aaui = aaConGUI.get(serviceType.toString()); return svc; } diff --git a/src/jalview/ws/params/ParamManager.java b/src/jalview/ws/params/ParamManager.java index 9c6829f..60bee66 100644 --- a/src/jalview/ws/params/ParamManager.java +++ b/src/jalview/ws/params/ParamManager.java @@ -20,7 +20,6 @@ */ package jalview.ws.params; - /** * Interface implemented by classes for maintaining user's parameters in a * Jalview session diff --git a/src/jalview/ws/rest/RestClient.java b/src/jalview/ws/rest/RestClient.java index 21b9e53..5f827a9 100644 --- a/src/jalview/ws/rest/RestClient.java +++ b/src/jalview/ws/rest/RestClient.java @@ -81,8 +81,11 @@ public class RestClient extends WSClient implements WSClientI, { this(service2, alignFrame, false); } + boolean headless = false; - public RestClient(RestServiceDescription service2, AlignFrame alignFrame, boolean nogui) + + public RestClient(RestServiceDescription service2, AlignFrame alignFrame, + boolean nogui) { service = service2; af = alignFrame; @@ -228,6 +231,7 @@ public class RestClient extends WSClient implements WSClientI, * informative name for results */ public String viewTitle; + protected void constructJob() { service.setInvolvesFlags(); @@ -294,7 +298,8 @@ public class RestClient extends WSClient implements WSClientI, if (jobsthread.isValid()) { setWebserviceInfo(headless); - if (!headless) { + if (!headless) + { wsInfo.setthisService(this); jobsthread.setWebServiceInfo(wsInfo); } diff --git a/src/jalview/ws/rest/RestJob.java b/src/jalview/ws/rest/RestJob.java index 770824a..c4afd0c 100644 --- a/src/jalview/ws/rest/RestJob.java +++ b/src/jalview/ws/rest/RestJob.java @@ -90,13 +90,15 @@ public class RestJob extends AWsJob // get sequences for the alignmentI // get groups trimmed to alignment columns // get any annotation trimmed to start/end columns, too. - squniq = jalview.analysis.SeqsetUtils.uniquify(_input.getSequencesArray(), true); + squniq = jalview.analysis.SeqsetUtils.uniquify( + _input.getSequencesArray(), true); // prepare input // form alignment+groups+annotation,preprocess and then record references // for formatters ArrayList alinp = new ArrayList(); int paramsWithData = 0; - // TODO: JAL-715 - generalise the following validation logic for all parameter types + // TODO: JAL-715 - generalise the following validation logic for all + // parameter types // we cheat for moment - since we know a-priori what data is available and // what inputs we have implemented so far for (Map.Entry prm : rsd.inputParams.entrySet()) @@ -113,7 +115,9 @@ public class RestJob extends AWsJob && _input.getGroups() != null && _input.getGroups().size() >= -1 + prm.getValue().min) { - // the test above is not rigorous but fixes JAL-1298, since submission will fail if the partition set doesn't contain at least one partition + // the test above is not rigorous but fixes JAL-1298, since + // submission will fail if the partition set doesn't contain at + // least one partition alinp.add(prm.getValue()); } else diff --git a/src/jalview/ws/rest/params/SeqGroupIndexVector.java b/src/jalview/ws/rest/params/SeqGroupIndexVector.java index 1f568d6..30dc473 100644 --- a/src/jalview/ws/rest/params/SeqGroupIndexVector.java +++ b/src/jalview/ws/rest/params/SeqGroupIndexVector.java @@ -91,7 +91,7 @@ public class SeqGroupIndexVector extends InputType implements // assume that alignment is properly ordered so groups form consecutive // blocks ArrayList gl = new ArrayList(); - int p = 0,lowest=al.getHeight(), highest=0; + int p = 0, lowest = al.getHeight(), highest = 0; List sgs; synchronized (sgs = al.getGroups()) { @@ -108,13 +108,13 @@ public class SeqGroupIndexVector extends InputType implements for (SequenceI sq : sg.getSequencesInOrder(al)) { p = al.findIndex(sq); - if (lowest>p) + if (lowest > p) { - lowest=p; + lowest = p; } - if (highest 0) { - if (lowest-1>minsize) + if (lowest - 1 > minsize) { gl.add(0, new int[] - { 0, lowest-2}); + { 0, lowest - 2 }); } - if ((al.getHeight()-1-highest)>minsize) + if ((al.getHeight() - 1 - highest) > minsize) { - gl.add(new int[] { highest+1, al.getHeight()-1}); + gl.add(new int[] + { highest + 1, al.getHeight() - 1 }); } } else diff --git a/src/jalview/ws/seqfetcher/ASequenceFetcher.java b/src/jalview/ws/seqfetcher/ASequenceFetcher.java index cf98538..afdb516 100644 --- a/src/jalview/ws/seqfetcher/ASequenceFetcher.java +++ b/src/jalview/ws/seqfetcher/ASequenceFetcher.java @@ -275,10 +275,11 @@ public class ASequenceFetcher DbSourceProxy[] l = dblist.values().toArray(new DbSourceProxy[0]); int i = 0; String[] nm = new String[l.length]; - // make sure standard dbs appear first, followed by reference das sources, followed by anything else. + // make sure standard dbs appear first, followed by reference das sources, + // followed by anything else. for (DbSourceProxy s : l) { - nm[i++] = ""+s.getTier()+s.getDbName().toLowerCase(); + nm[i++] = "" + s.getTier() + s.getDbName().toLowerCase(); } jalview.util.QuickSort.sort(nm, l); dbs = new ArrayList(); diff --git a/src/jalview/ws/seqfetcher/DbSourceProxy.java b/src/jalview/ws/seqfetcher/DbSourceProxy.java index 8542fdc..c45a465 100644 --- a/src/jalview/ws/seqfetcher/DbSourceProxy.java +++ b/src/jalview/ws/seqfetcher/DbSourceProxy.java @@ -140,7 +140,7 @@ public interface DbSourceProxy /** * Tier for this data source - * + * * @return 0 - primary datasource, 1 - das primary source, 2 - secondary */ public int getTier(); diff --git a/test/jalview/analysis/DnaTranslation.java b/test/jalview/analysis/DnaTranslation.java index 7047bbe..708ee21 100644 --- a/test/jalview/analysis/DnaTranslation.java +++ b/test/jalview/analysis/DnaTranslation.java @@ -89,7 +89,6 @@ public class DnaTranslation + "GCTACAACCATCCCTTCAGACAGGATCAGAAGAACTTAAATCATTATATAATACAGTAGCAACCCTCTATTG\n" + "TGTACATCAAAGGATAGAGATAAAAGACACCAAGGAAGCTTTAGAA\n"; - @Test public void translationWithUntranslatableCodonsTest() { @@ -98,8 +97,9 @@ public class DnaTranslation jalview.datamodel.AlignmentI alf = null; try { - alf = new jalview.io.FormatAdapter().readFile(JAL_1312_example_align_fasta, - jalview.io.FormatAdapter.PASTE, "FASTA"); + alf = new jalview.io.FormatAdapter().readFile( + JAL_1312_example_align_fasta, jalview.io.FormatAdapter.PASTE, + "FASTA"); } catch (IOException x) { x.printStackTrace(); diff --git a/test/jalview/analysis/TestAlignSeq.java b/test/jalview/analysis/TestAlignSeq.java index 31d4658..ca4f18d 100644 --- a/test/jalview/analysis/TestAlignSeq.java +++ b/test/jalview/analysis/TestAlignSeq.java @@ -30,24 +30,26 @@ import org.junit.Test; /** * Test the alignment -> Mapping routines + * * @author jimp - * + * */ public class TestAlignSeq { - SequenceI s1,s2,s3; + SequenceI s1, s2, s3; + /** * @throws java.lang.Exception */ @Before public void setUp() throws Exception { - s1 = new Sequence("Seq1","ASDFAQQQRRRSSS"); + s1 = new Sequence("Seq1", "ASDFAQQQRRRSSS"); s1.setStart(3); - s2 = new Sequence("Seq2","ASDFA"); + s2 = new Sequence("Seq2", "ASDFA"); s2.setStart(5); - s3 = new Sequence("Seq1","SDFAQQQSSS"); + s3 = new Sequence("Seq1", "SDFAQQQSSS"); } @@ -57,16 +59,18 @@ public class TestAlignSeq */ public void TestGetMappingForS1() { - jalview.analysis.AlignSeq as = jalview.analysis.AlignSeq.doGlobalNWAlignment(s1, s2, AlignSeq.PEP); - System.out.println("s1: "+as.getAStr1()); - System.out.println("s2: "+as.getAStr2()); - - Mapping s1tos2=as.getMappingFromS1(false); + jalview.analysis.AlignSeq as = jalview.analysis.AlignSeq + .doGlobalNWAlignment(s1, s2, AlignSeq.PEP); + System.out.println("s1: " + as.getAStr1()); + System.out.println("s2: " + as.getAStr2()); + + Mapping s1tos2 = as.getMappingFromS1(false); System.out.println(s1tos2.getMap().toString()); - for (int i=s2.getStart();i 4096); + if (worker.exit == null) + { + worker.interrupt(); + Thread.currentThread().interrupt(); + worker.process.destroy(); + fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). [" + + harg + "]"); } - _switch=true; - String jalview_input = "examples/uniref50.fa"; - String jalview_output = "test_uniref50_out.eps"; - String cmd = ""+_harg+" -open "+ jalview_input + " -eps " + jalview_output; - String harg = _harg+(withAwt ? "-Djava.awt.headless=true":" NO AWT.HEADLESS"); - System.out.println("Testing with Headless argument: '"+harg+"'\n"); - Worker worker = jalviewDesktopRunner(withAwt, cmd, 9000); - assertTrue("Didn't create an output EPS file.["+harg+"]", new File("test_uniref50_out.eps").exists()); - assertTrue("Didn't create an EPS file with any content["+harg+"]", new File("test_uniref50_out.eps").length()>4096); - if (worker.exit == null){ - worker.interrupt(); - Thread.currentThread().interrupt(); - worker.process.destroy(); - fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). ["+harg+"]"); + } while (!withAwt); } - } while (!withAwt); - } } -// @Test -// public void testJalview2XMLDataset() throws Exception -// { -// String jalview_input = "examples/uniref50.fa"; -// String jalview_output = "test_uniref50_out.eps"; -// String cmd = ""+" -open "+ jalview_input + " -eps " + jalview_output; -// //String harg = _harg+(withAwt ? "-Djava.awt.headless=true":" NO AWT.HEADLESS"); -// System.out.println("Testing with Headless argument: '"+harg+"'\n"); -// Worker worker = jalviewDesktopRunner(withAwt, cmd, 9000); -// assertTrue("Didn't create an output EPS file.["+harg+"]", new File("test_uniref50_out.eps").exists()); -// assertTrue("Didn't create an EPS file with any content["+harg+"]", new File("test_uniref50_out.eps").length()>4096); -// if (worker.exit == null){ -// worker.interrupt(); -// Thread.currentThread().interrupt(); -// worker.process.destroy(); -// fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). ["+harg+"]"); -// } -// } + // @Test + // public void testJalview2XMLDataset() throws Exception + // { + // String jalview_input = "examples/uniref50.fa"; + // String jalview_output = "test_uniref50_out.eps"; + // String cmd = ""+" -open "+ jalview_input + " -eps " + jalview_output; + // //String harg = _harg+(withAwt ? + // "-Djava.awt.headless=true":" NO AWT.HEADLESS"); + // System.out.println("Testing with Headless argument: '"+harg+"'\n"); + // Worker worker = jalviewDesktopRunner(withAwt, cmd, 9000); + // assertTrue("Didn't create an output EPS file.["+harg+"]", new + // File("test_uniref50_out.eps").exists()); + // assertTrue("Didn't create an EPS file with any content["+harg+"]", new + // File("test_uniref50_out.eps").length()>4096); + // if (worker.exit == null){ + // worker.interrupt(); + // Thread.currentThread().interrupt(); + // worker.process.destroy(); + // fail("Jalview did not exit after EPS generation (try running test again to verify - timeout at 9000ms). ["+harg+"]"); + // } + // } } diff --git a/test/jalview/ext/jmol/PDBFileWithJmolTest.java b/test/jalview/ext/jmol/PDBFileWithJmolTest.java index 2410e4f..900e47c 100644 --- a/test/jalview/ext/jmol/PDBFileWithJmolTest.java +++ b/test/jalview/ext/jmol/PDBFileWithJmolTest.java @@ -32,7 +32,7 @@ import org.junit.Test; /** * @author jimp - * + * */ public class PDBFileWithJmolTest { @@ -40,16 +40,26 @@ public class PDBFileWithJmolTest @Test public void test() throws Exception { - PDBFileWithJmol jtest=new PDBFileWithJmol("./examples/1GAQ.txt", jalview.io.AppletFormatAdapter.FILE); - Vector seqs=jtest.getSeqs(); - - assertTrue("No sequences extracted from testfile\n"+(jtest.hasWarningMessage() ? jtest.getWarningMessage(): "(No warnings raised)"), seqs!=null && seqs.size()>0); - for (SequenceI sq:seqs) + PDBFileWithJmol jtest = new PDBFileWithJmol("./examples/1GAQ.txt", + jalview.io.AppletFormatAdapter.FILE); + Vector seqs = jtest.getSeqs(); + + assertTrue( + "No sequences extracted from testfile\n" + + (jtest.hasWarningMessage() ? jtest.getWarningMessage() + : "(No warnings raised)"), + seqs != null && seqs.size() > 0); + for (SequenceI sq : seqs) { - AlignmentI al = new Alignment(new SequenceI[] { sq}); + AlignmentI al = new Alignment(new SequenceI[] + { sq }); if (!al.isNucleotide()) { - assertTrue("No secondary structure assigned for protein sequence.",sq.getAnnotation()!=null && sq.getAnnotation().length>=1 && sq.getAnnotation()[0].hasIcons); + assertTrue( + "No secondary structure assigned for protein sequence.", + sq.getAnnotation() != null + && sq.getAnnotation().length >= 1 + && sq.getAnnotation()[0].hasIcons); } } } diff --git a/test/jalview/ext/paradise/TestAnnotate3D.java b/test/jalview/ext/paradise/TestAnnotate3D.java index dca7bf8..6635f0d 100644 --- a/test/jalview/ext/paradise/TestAnnotate3D.java +++ b/test/jalview/ext/paradise/TestAnnotate3D.java @@ -46,10 +46,11 @@ public class TestAnnotate3D @Test public void test1GIDbyId() throws Exception { - // use same ID as standard tests given at https://bitbucket.org/fjossinet/pyrna-rest-clients + // use same ID as standard tests given at + // https://bitbucket.org/fjossinet/pyrna-rest-clients Iterator ids = Annotate3D.getRNAMLForPDBId("1GID"); assertTrue("Didn't retrieve 1GID by id.", ids != null); - testRNAMLcontent(ids,null); + testRNAMLcontent(ids, null); } @Test @@ -122,7 +123,8 @@ public class TestAnnotate3D assertTrue("No data returned by Annotate3D", sb.length() > 0); AlignmentI al = new FormatAdapter().readFile(sb.toString(), FormatAdapter.PASTE, "RNAML"); - if (al==null || al.getHeight()==0) { + if (al == null || al.getHeight() == 0) + { System.out.println(sb.toString()); } assertTrue("No alignment returned.", al != null); diff --git a/test/jalview/gui/JAL1353bugdemo.java b/test/jalview/gui/JAL1353bugdemo.java index 425a373..438a208 100644 --- a/test/jalview/gui/JAL1353bugdemo.java +++ b/test/jalview/gui/JAL1353bugdemo.java @@ -54,7 +54,8 @@ public class JAL1353bugdemo public static void tearDownAfterClass() throws Exception { } - volatile boolean finish=false; + + volatile boolean finish = false; @Test public void test() @@ -62,85 +63,93 @@ public class JAL1353bugdemo Cache.initLogger(); // final Desktop foo = new Desktop(); final JFrame cfoo = new JFrame("Crash Java"); - final JDesktopPane foo=new JDesktopPane(); - foo.setPreferredSize(new Dimension(600,800)); + final JDesktopPane foo = new JDesktopPane(); + foo.setPreferredSize(new Dimension(600, 800)); cfoo.setSize(600, 800); final JInternalFrame cont = new JInternalFrame("My Frame"); JTextArea evt; cont.setPreferredSize(new Dimension(400, 300)); - cont.add(evt=new JTextArea("Click here and drag text over this window to freeze java.\n\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\n")); + cont.add(evt = new JTextArea( + "Click here and drag text over this window to freeze java.\n\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\nThis is a dummy string. See teh dummy string go.\n")); cont.pack(); - foo.add("A frame",cont); + foo.add("A frame", cont); foo.setVisible(true); foo.setEnabled(true); foo.doLayout(); cfoo.add(foo); final JMenu jm = new JMenu("Do"); - JMenuItem jmi=new JMenuItem("this"); + JMenuItem jmi = new JMenuItem("this"); jm.add(jmi); evt.addMouseListener(new MouseListener() { - + @Override public void mouseReleased(MouseEvent e) { } - + @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub - + } - + @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub - + } - + @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub - + } - + @Override public void mouseClicked(MouseEvent e) { -// JFrame parent = new JFrame(); -// parent.setBounds(foo.getBounds()); -// JPanel oo = new JPanel(); -// parent.add(oo); -// oo.setVisible(true); -// parent.setVisible(true); - EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", foo);//);cont.getRootPane()); - assert(end!=null); - finish=true; + // JFrame parent = new JFrame(); + // parent.setBounds(foo.getBounds()); + // JPanel oo = new JPanel(); + // parent.add(oo); + // oo.setVisible(true); + // parent.setVisible(true); + EditNameDialog end = new EditNameDialog("Sequence Name", + "Sequence Description", "label 1", "Label 2", + "Try and drag between the two text fields", foo);// );cont.getRootPane()); + assert (end != null); + finish = true; } }); cont.setVisible(true); jmi.addActionListener(new ActionListener() { - + @Override public void actionPerformed(ActionEvent arg0) { - EditNameDialog end =new EditNameDialog("Sequence Name", "Sequence Description","label 1", "Label 2", "Try and drag between the two text fields", cont); - assert(end!=null); - finish=true; + EditNameDialog end = new EditNameDialog("Sequence Name", + "Sequence Description", "label 1", "Label 2", + "Try and drag between the two text fields", cont); + assert (end != null); + finish = true; } }); foo.setVisible(true); cfoo.setVisible(true); while (!finish) { - try { + try + { Thread.sleep(100); - } catch (InterruptedException x) {} + } catch (InterruptedException x) + { + } } } diff --git a/test/jalview/io/AnnotationFileIOTest.java b/test/jalview/io/AnnotationFileIOTest.java index 64ca141..18e008e 100644 --- a/test/jalview/io/AnnotationFileIOTest.java +++ b/test/jalview/io/AnnotationFileIOTest.java @@ -49,9 +49,10 @@ public class AnnotationFileIOTest @Test public void exampleAnnotationFileIO() throws Exception { - for (String[] testPair:TestFiles) + for (String[] testPair : TestFiles) { - testAnnotationFileIO(testPair[0], new File(testPair[1]), new File(testPair[2])); + testAnnotationFileIO(testPair[0], new File(testPair[1]), new File( + testPair[2])); } } @@ -65,11 +66,12 @@ public class AnnotationFileIOTest AlignmentI al = rf.readFile(ff, AppletFormatAdapter.FILE, new IdentifyFile().Identify(ff, AppletFormatAdapter.FILE)); - + // make sure dataset is initialised ? not sure about this for (int i = 0; i < al.getSequencesArray().length; ++i) { - al.getSequenceAt(i).setDatasetSequence(al.getSequenceAt(i).createDatasetSequence()); + al.getSequenceAt(i).setDatasetSequence( + al.getSequenceAt(i).createDatasetSequence()); } assertNotNull("Couldn't read supplied alignment data.", al); return al; @@ -77,9 +79,10 @@ public class AnnotationFileIOTest { e.printStackTrace(); } - fail("Couln't read the alignment in file '"+f.toString()+"'"); + fail("Couln't read the alignment in file '" + f.toString() + "'"); return null; } + /** * test alignment data in given file can be imported, exported and reimported * with no dataloss @@ -90,25 +93,48 @@ public class AnnotationFileIOTest * - label for IO class used to write and read back in the data from * f */ - public static void testAnnotationFileIO(String testname, File f, File annotFile) + public static void testAnnotationFileIO(String testname, File f, + File annotFile) { - System.out.println("Test: "+testname+"\nReading annotation file '"+annotFile+"' onto : " + f); + System.out.println("Test: " + testname + "\nReading annotation file '" + + annotFile + "' onto : " + f); String af = annotFile.getPath(); try { AlignmentI al = readAlignmentFile(f); - - assertTrue("Test "+testname+"\nAlignment was not annotated - annotation file not imported.",new AnnotationFile().readAnnotationFile(al, af, FormatAdapter.FILE)); - - String anfileout = new AnnotationFile().printAnnotations(al.getAlignmentAnnotation(), al.getGroups(), al.getProperties()); - assertTrue("Test "+testname+"\nAlignment annotation file was not regenerated. Null string",anfileout!=null); - assertTrue("Test "+testname+"\nAlignment annotation file was not regenerated. Empty string",anfileout.length()>"JALVIEW_ANNOTATION".length()); - System.out.println("Output annotation file:\n"+anfileout+"\n< "JALVIEW_ANNOTATION".length()); + + System.out.println("Output annotation file:\n" + anfileout + + "\n<0); + String tfile = File.createTempFile("JalviewTest", ".jvp") + .getAbsolutePath(); + AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( + inFile, FormatAdapter.FILE); + assertTrue("Didn't read input file " + inFile, af != null); + int olddsann = countDsAnn(af.getViewport()); + assertTrue("Didn't find any dataset annotations", olddsann > 0); af.rnahelicesColour_actionPerformed(null); - assertTrue("Couldn't apply RNA helices colourscheme",af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); - assertTrue("Failed to store as a project.",af.saveAlignment(tfile, "Jalview")); + assertTrue( + "Couldn't apply RNA helices colourscheme", + af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); + assertTrue("Failed to store as a project.", + af.saveAlignment(tfile, "Jalview")); af.closeMenuItem_actionPerformed(true); - af=null; - af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE); - assertTrue("Failed to import new project", af!=null); - int newdsann=countDsAnn(af.getViewport()); - assertTrue("Differing numbers of dataset sequence annotation\nOriginally "+olddsann+" and now "+newdsann,olddsann==newdsann); - System.out.println("Read in same number of annotations as originally present ("+olddsann+")"); - assertTrue("RNA helices colourscheme was not applied on import.",af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); + af = null; + af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, + FormatAdapter.FILE); + assertTrue("Failed to import new project", af != null); + int newdsann = countDsAnn(af.getViewport()); + assertTrue( + "Differing numbers of dataset sequence annotation\nOriginally " + + olddsann + " and now " + newdsann, + olddsann == newdsann); + System.out + .println("Read in same number of annotations as originally present (" + + olddsann + ")"); + assertTrue( + "RNA helices colourscheme was not applied on import.", + af.getViewport().getGlobalColourScheme() instanceof jalview.schemes.RNAHelicesColour); } + @Test public void testTCoffeeScores() throws Exception { - String inFile = "examples/uniref50.fa",inAnnot="examples/uniref50.score_ascii"; - String tfile = File.createTempFile("JalviewTest", ".jvp").getAbsolutePath(); - AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(inFile, FormatAdapter.FILE); - assertTrue("Didn't read input file "+inFile, af!=null); - af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null,null); + String inFile = "examples/uniref50.fa", inAnnot = "examples/uniref50.score_ascii"; + String tfile = File.createTempFile("JalviewTest", ".jvp") + .getAbsolutePath(); + AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( + inFile, FormatAdapter.FILE); + assertTrue("Didn't read input file " + inFile, af != null); + af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null); assertTrue( "Didn't set T-coffee colourscheme", af.getViewport().getGlobalColourScheme().getClass() @@ -113,26 +133,40 @@ public class Jalview2xmlTests jalview.schemes.ColourSchemeProperty.getColourName(af .getViewport().getGlobalColourScheme())) != null); - assertTrue("Failed to store as a project.",af.saveAlignment(tfile, "Jalview")); + assertTrue("Failed to store as a project.", + af.saveAlignment(tfile, "Jalview")); af.closeMenuItem_actionPerformed(true); - af=null; - af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE); - assertTrue("Failed to import new project", af!=null); - assertTrue("Didn't set T-coffee colourscheme for imported project.",af.getViewport().getGlobalColourScheme().getClass().equals(jalview.schemes.TCoffeeColourScheme.class)); - System.out.println("T-Coffee score shading successfully recovered from project."); + af = null; + af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, + FormatAdapter.FILE); + assertTrue("Failed to import new project", af != null); + assertTrue( + "Didn't set T-coffee colourscheme for imported project.", + af.getViewport().getGlobalColourScheme().getClass() + .equals(jalview.schemes.TCoffeeColourScheme.class)); + System.out + .println("T-Coffee score shading successfully recovered from project."); } + @Test public void testColourByAnnotScores() throws Exception { - String inFile = "examples/uniref50.fa",inAnnot="examples/testdata/uniref50_iupred.jva"; - String tfile = File.createTempFile("JalviewTest", ".jvp").getAbsolutePath(); - AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(inFile, FormatAdapter.FILE); - assertTrue("Didn't read input file "+inFile, af!=null); - af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null,null); - AlignmentAnnotation[] aa = af.getViewport().getAlignment().getSequenceAt(0).getAnnotation("IUPredWS (Short)"); - assertTrue("Didn't find any IUPred annotation to use to shade alignment.",aa!=null && aa.length>0); - AnnotationColourGradient cs = new jalview.schemes.AnnotationColourGradient(aa[0], null, AnnotationColourGradient.ABOVE_THRESHOLD); - AnnotationColourGradient gcs = new jalview.schemes.AnnotationColourGradient(aa[0], null, AnnotationColourGradient.BELOW_THRESHOLD); + String inFile = "examples/uniref50.fa", inAnnot = "examples/testdata/uniref50_iupred.jva"; + String tfile = File.createTempFile("JalviewTest", ".jvp") + .getAbsolutePath(); + AlignFrame af = new jalview.io.FileLoader().LoadFileWaitTillLoaded( + inFile, FormatAdapter.FILE); + assertTrue("Didn't read input file " + inFile, af != null); + af.loadJalviewDataFile(inAnnot, FormatAdapter.FILE, null, null); + AlignmentAnnotation[] aa = af.getViewport().getAlignment() + .getSequenceAt(0).getAnnotation("IUPredWS (Short)"); + assertTrue( + "Didn't find any IUPred annotation to use to shade alignment.", + aa != null && aa.length > 0); + AnnotationColourGradient cs = new jalview.schemes.AnnotationColourGradient( + aa[0], null, AnnotationColourGradient.ABOVE_THRESHOLD); + AnnotationColourGradient gcs = new jalview.schemes.AnnotationColourGradient( + aa[0], null, AnnotationColourGradient.BELOW_THRESHOLD); cs.setSeqAssociated(true); gcs.setSeqAssociated(true); af.changeColour(cs); @@ -144,56 +178,71 @@ public class Jalview2xmlTests sg.addSequence(af.getViewport().getAlignment().getSequenceAt(1), false); sg.addSequence(af.getViewport().getAlignment().getSequenceAt(2), true); af.alignPanel.alignmentChanged(); - assertTrue("Failed to store as a project.",af.saveAlignment(tfile, "Jalview")); + assertTrue("Failed to store as a project.", + af.saveAlignment(tfile, "Jalview")); af.closeMenuItem_actionPerformed(true); - af=null; - af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, FormatAdapter.FILE); - assertTrue("Failed to import new project", af!=null); - + af = null; + af = new jalview.io.FileLoader().LoadFileWaitTillLoaded(tfile, + FormatAdapter.FILE); + assertTrue("Failed to import new project", af != null); + // check for group and alignment colourschemes - - ColourSchemeI _rcs=af.getViewport().getGlobalColourScheme(); - ColourSchemeI _rgcs=af.getViewport().getAlignment().getGroups().get(0).cs; - assertTrue("Didn't recover global colourscheme",_rcs!=null); - assertTrue("Didn't recover annotation colour global scheme",_rcs instanceof AnnotationColourGradient); + + ColourSchemeI _rcs = af.getViewport().getGlobalColourScheme(); + ColourSchemeI _rgcs = af.getViewport().getAlignment().getGroups() + .get(0).cs; + assertTrue("Didn't recover global colourscheme", _rcs != null); + assertTrue("Didn't recover annotation colour global scheme", + _rcs instanceof AnnotationColourGradient); AnnotationColourGradient __rcs = (AnnotationColourGradient) _rcs; - assertTrue("Annotation colourscheme wasn't sequence associated",__rcs.isSeqAssociated()); + assertTrue("Annotation colourscheme wasn't sequence associated", + __rcs.isSeqAssociated()); - - boolean diffseqcols=false,diffgseqcols=false; - SequenceI[] sqs=af.getViewport().getAlignment().getSequencesArray(); - for (int p=0,pSize=af.getViewport().getAlignment().getWidth();p orig_groups=new HashMap(),new_groups=new HashMap(); + Map orig_groups = new HashMap(), new_groups = new HashMap(); if (aa_new != null && aa_original != null) { for (int i = 0; i < aa_original.length; i++) { - if (aa_new.length>i) { - assertTrue("Different alignment annotation at position "+i, - equalss(aa_original[i], aa_new[i])); + if (aa_new.length > i) + { + assertTrue("Different alignment annotation at position " + i, + equalss(aa_original[i], aa_new[i])); // compare graphGroup or graph properties - needed to verify JAL-1299 - assertTrue("Graph type not identical.",aa_original[i].graph==aa_new[i].graph); - assertTrue("Visibility not identical.", aa_original[i].visible==aa_new[i].visible); + assertTrue("Graph type not identical.", + aa_original[i].graph == aa_new[i].graph); + assertTrue("Visibility not identical.", + aa_original[i].visible == aa_new[i].visible); assertTrue( "Threshold line not identical.", aa_original[i].threshold == null ? aa_new[i].threshold == null : aa_original[i].threshold .equals(aa_new[i].threshold)); // graphGroup may differ, but pattern should be the same - Integer o_ggrp=new Integer(aa_original[i].graphGroup+2),n_ggrp=new Integer(aa_new[i].graphGroup+2); - BitSet orig_g=orig_groups.get(o_ggrp),new_g=new_groups.get(n_ggrp); - if (orig_g==null) { - orig_groups.put(o_ggrp,orig_g= new BitSet()); + Integer o_ggrp = new Integer(aa_original[i].graphGroup + 2), n_ggrp = new Integer( + aa_new[i].graphGroup + 2); + BitSet orig_g = orig_groups.get(o_ggrp), new_g = new_groups + .get(n_ggrp); + if (orig_g == null) + { + orig_groups.put(o_ggrp, orig_g = new BitSet()); } - if (new_g==null) { - new_groups.put(n_ggrp, new_g=new BitSet()); + if (new_g == null) + { + new_groups.put(n_ggrp, new_g = new BitSet()); } - assertTrue("Graph Group pattern differs at annotation "+i, orig_g.equals(new_g)); - orig_g.set(i); new_g.set(i); - } else { - System.err.println("No matching annotation row for "+aa_original[i].toString()); + assertTrue("Graph Group pattern differs at annotation " + i, + orig_g.equals(new_g)); + orig_g.set(i); + new_g.set(i); + } + else + { + System.err.println("No matching annotation row for " + + aa_original[i].toString()); } } } @@ -293,23 +308,28 @@ public class StockholmFileTest { if (annot_or.annotations.length != annot_new.annotations.length) { - System.err.println("Different lengths for annotation row elements: "+annot_or.annotations.length +"!="+ annot_new.annotations.length); + System.err.println("Different lengths for annotation row elements: " + + annot_or.annotations.length + "!=" + + annot_new.annotations.length); return false; } for (int i = 0; i < annot_or.annotations.length; i++) { - Annotation an_or=annot_or.annotations[i],an_new=annot_new.annotations[i]; - if (an_or != null - && an_new!= null) + Annotation an_or = annot_or.annotations[i], an_new = annot_new.annotations[i]; + if (an_or != null && an_new != null) { - if (!an_or.displayCharacter.trim() - .equals(an_new.displayCharacter.trim()) - || !(""+an_or.secondaryStructure).trim().equals((""+an_new.secondaryStructure).trim()) + if (!an_or.displayCharacter.trim().equals( + an_new.displayCharacter.trim()) + || !("" + an_or.secondaryStructure).trim().equals( + ("" + an_new.secondaryStructure).trim()) || (an_or.description != an_new.description && (an_or.description == null || an_new.description == null || !an_or.description .equals(an_new.description)))) { - System.err.println("Annotation Element Mismatch\nElement "+i+" in original: "+annot_or.annotations[i].toString()+"\nElement "+i+" in new: "+annot_new.annotations[i].toString()); + System.err.println("Annotation Element Mismatch\nElement " + i + + " in original: " + annot_or.annotations[i].toString() + + "\nElement " + i + " in new: " + + annot_new.annotations[i].toString()); return false; } } @@ -320,7 +340,16 @@ public class StockholmFileTest } else { - System.err.println("Annotation Element Mismatch\nElement "+i+" in original: "+(annot_or.annotations[i]==null ? "is null" : annot_or.annotations[i].toString())+"\nElement "+i+" in new: "+(annot_new.annotations[i] == null ? "is null" : annot_new.annotations[i].toString())); + System.err.println("Annotation Element Mismatch\nElement " + + i + + " in original: " + + (annot_or.annotations[i] == null ? "is null" + : annot_or.annotations[i].toString()) + + "\nElement " + + i + + " in new: " + + (annot_new.annotations[i] == null ? "is null" + : annot_new.annotations[i].toString())); return false; } } diff --git a/test/jalview/io/TCoffeeScoreFileTest.java b/test/jalview/io/TCoffeeScoreFileTest.java index 0277884..2558989 100644 --- a/test/jalview/io/TCoffeeScoreFileTest.java +++ b/test/jalview/io/TCoffeeScoreFileTest.java @@ -39,159 +39,217 @@ import fr.orsay.lri.varna.exceptions.ExceptionLoadingFailed; import fr.orsay.lri.varna.exceptions.ExceptionPermissionDenied; import fr.orsay.lri.varna.exceptions.ExceptionUnmatchedClosingParentheses; -public class TCoffeeScoreFileTest { - - final static File SCORE_FILE = new File("test/jalview/io/tcoffee.score_ascii"); - final static File ALIGN_FILE = new File("test/jalview/io/tcoffee.fasta_aln"); - - @Test - public void testReadHeader() throws IOException { - - TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(),AppletFormatAdapter.FILE); - assertTrue(scoreFile.getWarningMessage(),scoreFile.isValid()); - - Header header = scoreFile.header; - assertNotNull(header); - assertEquals( "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", header.head ); - assertEquals( 90, header.score ); - assertEquals( 89, header.getScoreFor("1PHT") ); - assertEquals( 90, header.getScoreFor("1BB9") ); - assertEquals( 94, header.getScoreFor("1UHC") ); - assertEquals( 94, header.getScoreFor("1YCS") ); - assertEquals( 93, header.getScoreFor("1OOT") ); - assertEquals( 94, header.getScoreFor("1ABO") ); - assertEquals( 94, header.getScoreFor("1FYN") ); - assertEquals( 94, header.getScoreFor("1QCF") ); - assertEquals( 90, header.getScoreFor("cons") ); - } - - - @Test - public void testWrongFile() { - try { - TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), FormatAdapter.FILE); - assertFalse(result.isValid()); - } - catch (IOException x) - { - assertTrue("File not found exception thrown",x instanceof FileNotFoundException); - } - } - - @Test - public void testHeightAndWidth() throws IOException { - TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE); - assertTrue(result.isValid()); - assertEquals( 8, result.getHeight() ); - assertEquals( 83, result.getWidth() ); - } - - @Test - public void testReadBlock( ) throws IOException { - - String BLOCK = "\n" + - "\n" + - "\n" + - "1PHT 999999999999999999999999998762112222543211112134\n" + - "1BB9 99999999999999999999999999987-------4322----2234 \n" + - "1UHC 99999999999999999999999999987-------5321----2246\n" + - "1YCS 99999999999999999999999999986-------4321----1-35\n" + - "1OOT 999999999999999999999999999861-------3------1135 \n" + - "1ABO 99999999999999999999999999986-------422-------34\n" + - "1FYN 99999999999999999999999999985-------32--------35\n" + - "1QCF 99999999999999999999999999974-------2---------24\n" + - "cons 999999999999999999999999999851000110321100001134\n" + - "\n" + - "\n"; - FileParse source=new FileParse(BLOCK, FormatAdapter.PASTE); - Block block = TCoffeeScoreFile.readBlock(source, 0); - - assertNotNull(block); - assertEquals( "999999999999999999999999998762112222543211112134", block.getScoresFor("1PHT") ); - assertEquals( "99999999999999999999999999987-------4322----2234", block.getScoresFor("1BB9") ); - assertEquals( "99999999999999999999999999987-------5321----2246", block.getScoresFor("1UHC") ); - assertEquals( "99999999999999999999999999986-------4321----1-35", block.getScoresFor("1YCS") ); - assertEquals( "999999999999999999999999999861-------3------1135", block.getScoresFor("1OOT") ); - assertEquals( "99999999999999999999999999986-------422-------34", block.getScoresFor("1ABO") ); - assertEquals( "99999999999999999999999999985-------32--------35", block.getScoresFor("1FYN") ); - assertEquals( "99999999999999999999999999974-------2---------24", block.getScoresFor("1QCF") ); - assertEquals( "999999999999999999999999999851000110321100001134", block.getConsensus() ); - } - - @Test - public void testParse() throws IOException { - - TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), FormatAdapter.FILE); - - assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", parser.getScoresFor("1PHT") ); - assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", parser.getScoresFor("1BB9") ); - assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", parser.getScoresFor("1UHC") ); - assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", parser.getScoresFor("1YCS") ); - assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", parser.getScoresFor("1OOT") ); - assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", parser.getScoresFor("1ABO") ); - assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", parser.getScoresFor("1FYN") ); - assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", parser.getScoresFor("1QCF") ); - assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", parser.getScoresFor("cons") ); - } - - - @Test - public void testGetAsList() throws IOException { - - TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE); - assertTrue(parser.getWarningMessage(),parser.isValid()); - List scores = parser.getScoresList(); - assertEquals( "999999999999999999999999998762112222543211112134----------5666642367889999999999889", scores.get(0) ); - assertEquals( "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", scores.get(1) ); - assertEquals( "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", scores.get(2) ); - assertEquals( "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", scores.get(3) ); - assertEquals( "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", scores.get(4) ); - assertEquals( "99999999999999999999999999986-------422-------34----------687774--56779999999999889", scores.get(5) ); - assertEquals( "99999999999999999999999999985-------32--------35----------6888842356789999999999889", scores.get(6) ); - assertEquals( "99999999999999999999999999974-------2---------24----------6878742356789999999999889", scores.get(7) ); - assertEquals( "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", scores.get(8) ); - - } - - - @Test - public void testGetAsArray() throws IOException { - - TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(),FormatAdapter.FILE); - assertTrue(parser.getWarningMessage(),parser.isValid()); - byte[][] scores = parser.getScoresArray(); - - assertEquals( 9, scores[0][0] ); - assertEquals( 9, scores[1][0] ); - assertEquals( 9, scores[2][0] ); - assertEquals( 9, scores[3][0] ); - assertEquals( 9, scores[4][0] ); - assertEquals( 9, scores[5][0] ); - assertEquals( 9, scores[6][0] ); - assertEquals( 9, scores[7][0] ); - assertEquals( 9, scores[8][0] ); - - assertEquals( 5, scores[0][36] ); - assertEquals( 4, scores[1][36] ); - assertEquals( 5, scores[2][36] ); - assertEquals( 4, scores[3][36] ); - assertEquals( -1, scores[4][36] ); - assertEquals( 4, scores[5][36] ); - assertEquals( 3, scores[6][36] ); - assertEquals( 2, scores[7][36] ); - assertEquals( 3, scores[8][36] ); - - } - - @Test - public void testHeightAndWidthWithResidueNumbers() throws Exception { - String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers"; - TCoffeeScoreFile result = new TCoffeeScoreFile(file, FormatAdapter.FILE); - assertTrue(result.isValid()); - assertEquals( 5, result.getHeight() ); - assertEquals( 84, result.getWidth() ); - } - - - +public class TCoffeeScoreFileTest +{ + + final static File SCORE_FILE = new File( + "test/jalview/io/tcoffee.score_ascii"); + + final static File ALIGN_FILE = new File( + "test/jalview/io/tcoffee.fasta_aln"); + + @Test + public void testReadHeader() throws IOException + { + + TCoffeeScoreFile scoreFile = new TCoffeeScoreFile(SCORE_FILE.getPath(), + AppletFormatAdapter.FILE); + assertTrue(scoreFile.getWarningMessage(), scoreFile.isValid()); + + Header header = scoreFile.header; + assertNotNull(header); + assertEquals( + "T-COFFEE, Version_9.02.r1228 (2012-02-16 18:15:12 - Revision 1228 - Build 336)", + header.head); + assertEquals(90, header.score); + assertEquals(89, header.getScoreFor("1PHT")); + assertEquals(90, header.getScoreFor("1BB9")); + assertEquals(94, header.getScoreFor("1UHC")); + assertEquals(94, header.getScoreFor("1YCS")); + assertEquals(93, header.getScoreFor("1OOT")); + assertEquals(94, header.getScoreFor("1ABO")); + assertEquals(94, header.getScoreFor("1FYN")); + assertEquals(94, header.getScoreFor("1QCF")); + assertEquals(90, header.getScoreFor("cons")); + } + + @Test + public void testWrongFile() + { + try + { + TCoffeeScoreFile result = new TCoffeeScoreFile(ALIGN_FILE.getPath(), + FormatAdapter.FILE); + assertFalse(result.isValid()); + } catch (IOException x) + { + assertTrue("File not found exception thrown", + x instanceof FileNotFoundException); + } + } + + @Test + public void testHeightAndWidth() throws IOException + { + TCoffeeScoreFile result = new TCoffeeScoreFile(SCORE_FILE.getPath(), + FormatAdapter.FILE); + assertTrue(result.isValid()); + assertEquals(8, result.getHeight()); + assertEquals(83, result.getWidth()); + } + + @Test + public void testReadBlock() throws IOException + { + + String BLOCK = "\n" + "\n" + "\n" + + "1PHT 999999999999999999999999998762112222543211112134\n" + + "1BB9 99999999999999999999999999987-------4322----2234 \n" + + "1UHC 99999999999999999999999999987-------5321----2246\n" + + "1YCS 99999999999999999999999999986-------4321----1-35\n" + + "1OOT 999999999999999999999999999861-------3------1135 \n" + + "1ABO 99999999999999999999999999986-------422-------34\n" + + "1FYN 99999999999999999999999999985-------32--------35\n" + + "1QCF 99999999999999999999999999974-------2---------24\n" + + "cons 999999999999999999999999999851000110321100001134\n" + + "\n" + "\n"; + FileParse source = new FileParse(BLOCK, FormatAdapter.PASTE); + Block block = TCoffeeScoreFile.readBlock(source, 0); + + assertNotNull(block); + assertEquals("999999999999999999999999998762112222543211112134", + block.getScoresFor("1PHT")); + assertEquals("99999999999999999999999999987-------4322----2234", + block.getScoresFor("1BB9")); + assertEquals("99999999999999999999999999987-------5321----2246", + block.getScoresFor("1UHC")); + assertEquals("99999999999999999999999999986-------4321----1-35", + block.getScoresFor("1YCS")); + assertEquals("999999999999999999999999999861-------3------1135", + block.getScoresFor("1OOT")); + assertEquals("99999999999999999999999999986-------422-------34", + block.getScoresFor("1ABO")); + assertEquals("99999999999999999999999999985-------32--------35", + block.getScoresFor("1FYN")); + assertEquals("99999999999999999999999999974-------2---------24", + block.getScoresFor("1QCF")); + assertEquals("999999999999999999999999999851000110321100001134", + block.getConsensus()); + } + + @Test + public void testParse() throws IOException + { + + TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), + FormatAdapter.FILE); + + assertEquals( + "999999999999999999999999998762112222543211112134----------5666642367889999999999889", + parser.getScoresFor("1PHT")); + assertEquals( + "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", + parser.getScoresFor("1BB9")); + assertEquals( + "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", + parser.getScoresFor("1UHC")); + assertEquals( + "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", + parser.getScoresFor("1YCS")); + assertEquals( + "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", + parser.getScoresFor("1OOT")); + assertEquals( + "99999999999999999999999999986-------422-------34----------687774--56779999999999889", + parser.getScoresFor("1ABO")); + assertEquals( + "99999999999999999999999999985-------32--------35----------6888842356789999999999889", + parser.getScoresFor("1FYN")); + assertEquals( + "99999999999999999999999999974-------2---------24----------6878742356789999999999889", + parser.getScoresFor("1QCF")); + assertEquals( + "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", + parser.getScoresFor("cons")); + } + + @Test + public void testGetAsList() throws IOException + { + + TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), + FormatAdapter.FILE); + assertTrue(parser.getWarningMessage(), parser.isValid()); + List scores = parser.getScoresList(); + assertEquals( + "999999999999999999999999998762112222543211112134----------5666642367889999999999889", + scores.get(0)); + assertEquals( + "99999999999999999999999999987-------4322----22341111111111676653-355679999999999889", + scores.get(1)); + assertEquals( + "99999999999999999999999999987-------5321----2246----------788774--66789999999999889", + scores.get(2)); + assertEquals( + "99999999999999999999999999986-------4321----1-35----------78777--356789999999999889", + scores.get(3)); + assertEquals( + "999999999999999999999999999861-------3------1135----------78877--356789999999997-67", + scores.get(4)); + assertEquals( + "99999999999999999999999999986-------422-------34----------687774--56779999999999889", + scores.get(5)); + assertEquals( + "99999999999999999999999999985-------32--------35----------6888842356789999999999889", + scores.get(6)); + assertEquals( + "99999999999999999999999999974-------2---------24----------6878742356789999999999889", + scores.get(7)); + assertEquals( + "99999999999999999999999999985100011032110000113400100000006877641356789999999999889", + scores.get(8)); + + } + + @Test + public void testGetAsArray() throws IOException + { + + TCoffeeScoreFile parser = new TCoffeeScoreFile(SCORE_FILE.getPath(), + FormatAdapter.FILE); + assertTrue(parser.getWarningMessage(), parser.isValid()); + byte[][] scores = parser.getScoresArray(); + + assertEquals(9, scores[0][0]); + assertEquals(9, scores[1][0]); + assertEquals(9, scores[2][0]); + assertEquals(9, scores[3][0]); + assertEquals(9, scores[4][0]); + assertEquals(9, scores[5][0]); + assertEquals(9, scores[6][0]); + assertEquals(9, scores[7][0]); + assertEquals(9, scores[8][0]); + + assertEquals(5, scores[0][36]); + assertEquals(4, scores[1][36]); + assertEquals(5, scores[2][36]); + assertEquals(4, scores[3][36]); + assertEquals(-1, scores[4][36]); + assertEquals(4, scores[5][36]); + assertEquals(3, scores[6][36]); + assertEquals(2, scores[7][36]); + assertEquals(3, scores[8][36]); + + } + + @Test + public void testHeightAndWidthWithResidueNumbers() throws Exception + { + String file = "test/jalview/io/tcoffee.score_ascii_with_residue_numbers"; + TCoffeeScoreFile result = new TCoffeeScoreFile(file, FormatAdapter.FILE); + assertTrue(result.isValid()); + assertEquals(5, result.getHeight()); + assertEquals(84, result.getWidth()); + } + } diff --git a/test/jalview/schemes/DnaCodonTests.java b/test/jalview/schemes/DnaCodonTests.java index 664d2d2..d8529f8 100644 --- a/test/jalview/schemes/DnaCodonTests.java +++ b/test/jalview/schemes/DnaCodonTests.java @@ -41,46 +41,69 @@ public class DnaCodonTests @Test public void testAmbiguityCodeGeneration() { - assertTrue(ResidueProperties.ambiguityCodes.size()>0); + assertTrue(ResidueProperties.ambiguityCodes.size() > 0); } + @Test - public void testAmbiguityCodon() { - for (String ac:ResidueProperties.ambiguityCodes.keySet()) + public void testAmbiguityCodon() + { + for (String ac : ResidueProperties.ambiguityCodes.keySet()) { - assertTrue("Couldn't resolve GGN as glycine codon",ResidueProperties.codonHash2.get("GG"+ac).equals("G")); + assertTrue("Couldn't resolve GGN as glycine codon", + ResidueProperties.codonHash2.get("GG" + ac).equals("G")); } } + @Test - public void regenerateCodonTable() { - for (Map.Entry codon:ResidueProperties.codonHash2.entrySet()) + public void regenerateCodonTable() + { + for (Map.Entry codon : ResidueProperties.codonHash2 + .entrySet()) { - System.out.println("ResidueProperties.codonHash2.set(\""+codon.getKey()+"\", \""+codon.getValue()+"\");"); + System.out.println("ResidueProperties.codonHash2.set(\"" + + codon.getKey() + "\", \"" + codon.getValue() + "\");"); } } + @Test - public void checkOldCodonagainstNewCodonTable() { - // note - this test will be removed once the old codon table (including Vectors) is removed - String additional="",failtrans="",differentTr=""; - for (Object aa:ResidueProperties.codonHash.keySet()) + public void checkOldCodonagainstNewCodonTable() + { + // note - this test will be removed once the old codon table (including + // Vectors) is removed + String additional = "", failtrans = "", differentTr = ""; + for (Object aa : ResidueProperties.codonHash.keySet()) { - String amacid=(String) aa; - for (Object codons:((Vector)ResidueProperties.codonHash.get(amacid))) + String amacid = (String) aa; + for (Object codons : ((Vector) ResidueProperties.codonHash + .get(amacid))) { String codon = (String) codons; String trans = ResidueProperties.codonTranslate(codon); String oldtrans = ResidueProperties._codonTranslate(codon); - if (trans==null) { - additional+="\nOld translation table includes additional codons for "+amacid+" : "+codon; + if (trans == null) + { + additional += "\nOld translation table includes additional codons for " + + amacid + " : " + codon; } - if (oldtrans==null) { - failtrans+=("\nold translation routine failed for old translation entry (aa was "+amacid+" codon was "+codon+")"); + if (oldtrans == null) + { + failtrans += ("\nold translation routine failed for old translation entry (aa was " + + amacid + " codon was " + codon + ")"); } if (!oldtrans.equals(trans)) { - differentTr+=("\nDifferent translation for old and new routines: "+amacid+" "+codon+" => expected "+oldtrans+" and got "+trans); + differentTr += ("\nDifferent translation for old and new routines: " + + amacid + + " " + + codon + + " => expected " + + oldtrans + + " and got " + trans); } } } - assertTrue(""+additional+"\n"+failtrans+"\n"+differentTr,additional.length()==0 && failtrans.length()==0 && differentTr.length()==0); + assertTrue("" + additional + "\n" + failtrans + "\n" + differentTr, + additional.length() == 0 && failtrans.length() == 0 + && differentTr.length() == 0); } } diff --git a/test/jalview/schemes/ScoreMatrixPrinter.java b/test/jalview/schemes/ScoreMatrixPrinter.java index d058c24..88d234e 100644 --- a/test/jalview/schemes/ScoreMatrixPrinter.java +++ b/test/jalview/schemes/ScoreMatrixPrinter.java @@ -26,27 +26,29 @@ import java.util.Map; import org.junit.Test; - -public class ScoreMatrixPrinter +public class ScoreMatrixPrinter { @Test public void printAllMatrices() { - for (Map.Entry sm: ResidueProperties.scoreMatrices.entrySet()) + for (Map.Entry sm : ResidueProperties.scoreMatrices + .entrySet()) { - System.out.println("Matrix "+sm.getKey()); + System.out.println("Matrix " + sm.getKey()); System.out.println(sm.getValue().toString()); } } + @Test public void printHTMLMatrices() { - for (Map.Entry _sm: ResidueProperties.scoreMatrices.entrySet()) + for (Map.Entry _sm : ResidueProperties.scoreMatrices + .entrySet()) { if (_sm.getValue() instanceof ScoreMatrix) { ScoreMatrix sm = (ScoreMatrix) _sm.getValue(); - System.out.println("Matrix "+_sm.getKey()); + System.out.println("Matrix " + _sm.getKey()); System.out.println(sm.outputMatrix(true)); } } diff --git a/test/jalview/ws/PDBSequenceFetcherTest.java b/test/jalview/ws/PDBSequenceFetcherTest.java index fc23faa..5a9e954 100644 --- a/test/jalview/ws/PDBSequenceFetcherTest.java +++ b/test/jalview/ws/PDBSequenceFetcherTest.java @@ -34,6 +34,7 @@ public class PDBSequenceFetcherTest { SequenceFetcher sf; + @Before public void setUp() throws Exception { @@ -43,25 +44,25 @@ public class PDBSequenceFetcherTest @Test public void testPdbPerChainRetrieve() throws Exception { - List sps = sf - .getSourceProxy("PDB"); + List sps = sf.getSourceProxy("PDB"); AlignmentI response = sps.get(0).getSequenceRecords("1QIPA"); - assertTrue(response!=null); - assertTrue(response.getHeight()==1); + assertTrue(response != null); + assertTrue(response.getHeight() == 1); } + @Test public void testRnaSeqRetrieve() throws Exception { - List sps = sf - .getSourceProxy("PDB"); + List sps = sf.getSourceProxy("PDB"); AlignmentI response = sps.get(0).getSequenceRecords("2GIS"); - assertTrue(response!=null); - assertTrue(response.getHeight()==1); - for (SequenceI sq:response.getSequences()) + assertTrue(response != null); + assertTrue(response.getHeight() == 1); + for (SequenceI sq : response.getSequences()) { - assertTrue("No annotation transfered to sequence.",sq.getAnnotation().length>0); - assertTrue("No PDBEntry on sequence.",sq.getPDBId().size()>0); - assertTrue("No RNA annotation on sequence.", sq.getRNA()!=null); + assertTrue("No annotation transfered to sequence.", + sq.getAnnotation().length > 0); + assertTrue("No PDBEntry on sequence.", sq.getPDBId().size() > 0); + assertTrue("No RNA annotation on sequence.", sq.getRNA() != null); } } diff --git a/test/jalview/ws/gui/Jws2ParamView.java b/test/jalview/ws/gui/Jws2ParamView.java index 2883585..64edf44 100644 --- a/test/jalview/ws/gui/Jws2ParamView.java +++ b/test/jalview/ws/gui/Jws2ParamView.java @@ -61,13 +61,15 @@ public class Jws2ParamView serviceTests.add("AAConWS".toLowerCase()); } - public static Jws2Discoverer disc=null; + public static Jws2Discoverer disc = null; + @BeforeClass public static void setUpBeforeClass() throws Exception { disc = JalviewJabawsTestUtils.getJabawsDiscoverer(); - + } + @Test public void testJws2Gui() { diff --git a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java index 58aa019..db7d505 100644 --- a/test/jalview/ws/jabaws/DisorderAnnotExportImport.java +++ b/test/jalview/ws/jabaws/DisorderAnnotExportImport.java @@ -100,16 +100,17 @@ public class DisorderAnnotExportImport ; } while (af.getViewport().getCalcManager().isWorking()); AlignmentI orig_alig = af.getViewport().getAlignment(); - // NOTE: Consensus annotation row cannot be exported and reimported faithfully - so we remove them + // NOTE: Consensus annotation row cannot be exported and reimported + // faithfully - so we remove them List toremove = new ArrayList(); - for (AlignmentAnnotation aa:orig_alig.getAlignmentAnnotation()) + for (AlignmentAnnotation aa : orig_alig.getAlignmentAnnotation()) { if (aa.autoCalculated) { toremove.add(aa); } } - for (AlignmentAnnotation aa:toremove) + for (AlignmentAnnotation aa : toremove) { orig_alig.deleteAnnotation(aa); } diff --git a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java index 892f7fb..ba78107 100644 --- a/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java +++ b/test/jalview/ws/jabaws/JalviewJabawsTestUtils.java @@ -31,7 +31,7 @@ import org.junit.Test; public class JalviewJabawsTestUtils { - + @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -54,30 +54,31 @@ public class JalviewJabawsTestUtils fail("Not yet implemented"); } - public static jalview.ws.jws2.Jws2Discoverer getJabawsDiscoverer() { + public static jalview.ws.jws2.Jws2Discoverer getJabawsDiscoverer() + { jalview.ws.jws2.Jws2Discoverer disc = jalview.ws.jws2.Jws2Discoverer .getDiscoverer(); int p = 0; - String svcurls=""; + String svcurls = ""; Vector services = new Vector(); for (String url : JalviewJabawsTestUtils.serviceUrls) { - svcurls+=url+"; "; + svcurls += url + "; "; services.add(url); } ; Jws2Discoverer.setServiceUrls(services); - + try { disc.run(); } catch (Exception e) { e.printStackTrace(); - fail("Aborting. Problem discovering services. Tried "+svcurls); + fail("Aborting. Problem discovering services. Tried " + svcurls); } - assertTrue("Failed to discover any services at ", - disc.getServices().size() > 0); + assertTrue("Failed to discover any services at ", disc.getServices() + .size() > 0); return disc; } diff --git a/test/jalview/ws/jabaws/RNAStructExportImport.java b/test/jalview/ws/jabaws/RNAStructExportImport.java index 519a946..61e0782 100644 --- a/test/jalview/ws/jabaws/RNAStructExportImport.java +++ b/test/jalview/ws/jabaws/RNAStructExportImport.java @@ -201,9 +201,9 @@ public class RNAStructExportImport } } alifoldClient = new RNAalifoldClient(rnaalifoldws, af, null, opts); - + af.getViewport().getCalcManager().startWorker(alifoldClient); - + do { try @@ -214,39 +214,58 @@ public class RNAStructExportImport } ; } while (af.getViewport().getCalcManager().isWorking()); - AutoCalcSetting oldacs = af.getViewport().getCalcIdSettingsFor(alifoldClient.getCalcId()); + AutoCalcSetting oldacs = af.getViewport().getCalcIdSettingsFor( + alifoldClient.getCalcId()); String oldsettings = oldacs.getWsParamFile(); // write out parameters - jalview.gui.AlignFrame nalf=null; - assertTrue("Couldn't write out the Jar file",new Jalview2XML(false).SaveAlignment(af, "testRnalifold_param.jar","trial parameter writeout")); - assertTrue("Couldn't read back the Jar file",(nalf = new Jalview2XML(false).LoadJalviewAlign("testRnalifold_param.jar"))!=null); - if (nalf!=null) + jalview.gui.AlignFrame nalf = null; + assertTrue("Couldn't write out the Jar file", + new Jalview2XML(false).SaveAlignment(af, + "testRnalifold_param.jar", "trial parameter writeout")); + assertTrue("Couldn't read back the Jar file", (nalf = new Jalview2XML( + false).LoadJalviewAlign("testRnalifold_param.jar")) != null); + if (nalf != null) { - AutoCalcSetting acs = af.getViewport().getCalcIdSettingsFor(alifoldClient.getCalcId()); - assertTrue("Calc ID settings not recovered from viewport stash", acs.equals(oldacs)); - assertTrue("Serialised Calc ID settings not identical to those recovered from viewport stash", acs.getWsParamFile().equals(oldsettings)); - JMenu nmenu=new JMenu(); - new SequenceAnnotationWSClient().attachWSMenuEntry(nmenu, rnaalifoldws, af); - assertTrue("Couldn't get menu entry for service",nmenu.getItemCount()>0); - for (Component itm: nmenu.getMenuComponents()) + AutoCalcSetting acs = af.getViewport().getCalcIdSettingsFor( + alifoldClient.getCalcId()); + assertTrue("Calc ID settings not recovered from viewport stash", + acs.equals(oldacs)); + assertTrue( + "Serialised Calc ID settings not identical to those recovered from viewport stash", + acs.getWsParamFile().equals(oldsettings)); + JMenu nmenu = new JMenu(); + new SequenceAnnotationWSClient().attachWSMenuEntry(nmenu, + rnaalifoldws, af); + assertTrue("Couldn't get menu entry for service", + nmenu.getItemCount() > 0); + for (Component itm : nmenu.getMenuComponents()) { if (itm instanceof JMenuItem) { JMenuItem i = (JMenuItem) itm; - if (i.getText().equals(rnaalifoldws.getAlignAnalysisUI().getAAconToggle())) - { + if (i.getText().equals( + rnaalifoldws.getAlignAnalysisUI().getAAconToggle())) + { i.doClick(); break; - } + } } } while (af.getViewport().isCalcInProgress()) { - try { Thread.sleep(200); - } catch (Exception x) {}; + try + { + Thread.sleep(200); + } catch (Exception x) + { + } + ; } - AutoCalcSetting acs2 = af.getViewport().getCalcIdSettingsFor(alifoldClient.getCalcId()); - assertTrue("Calc ID settings after recalculation has not been recovered.", acs2.getWsParamFile().equals(oldsettings)); + AutoCalcSetting acs2 = af.getViewport().getCalcIdSettingsFor( + alifoldClient.getCalcId()); + assertTrue( + "Calc ID settings after recalculation has not been recovered.", + acs2.getWsParamFile().equals(oldsettings)); } } } diff --git a/test/jalview/ws/rest/ShmmrRSBSService.java b/test/jalview/ws/rest/ShmmrRSBSService.java index f3b3491..6f111d0 100644 --- a/test/jalview/ws/rest/ShmmrRSBSService.java +++ b/test/jalview/ws/rest/ShmmrRSBSService.java @@ -56,7 +56,9 @@ public class ShmmrRSBSService "foo=',',min='foo',max='1,2,3',fa=','", ",").length == 4); assertTrue("separatorListToArray is faulty.", RestServiceDescription.separatorListToArray( - "minsize='2', sep=','", ",").length != 2); // probably should come as 2 + "minsize='2', sep=','", ",").length != 2); // probably + // should come as + // 2 } @Test @@ -68,27 +70,37 @@ public class ShmmrRSBSService testRsdExchange("Test using default Shmmr service", RestClient.makeShmmrRestClient().service)); } + @Test public void testShmmrServiceDataprep() throws Exception { RestClient _rc = RestClient.makeShmmrRestClient(); assertNotNull(_rc); - AlignFrame alf = new jalview.io.FileLoader(false).LoadFileWaitTillLoaded("examples/testdata/smad.fa", jalview.io.FormatAdapter.FILE); - assertNotNull("Couldn't find test data.",alf); + AlignFrame alf = new jalview.io.FileLoader(false) + .LoadFileWaitTillLoaded("examples/testdata/smad.fa", + jalview.io.FormatAdapter.FILE); + assertNotNull("Couldn't find test data.", alf); alf.loadJalviewDataFile("examples/testdata/smad_groups.jva", jalview.io.FormatAdapter.FILE, null, null); - assertTrue("Couldn't load the test data's annotation file (should be 5 groups but found "+alf.getViewport().getAlignment().getGroups().size()+").", alf.getViewport().getAlignment().getGroups().size()==5); - + assertTrue( + "Couldn't load the test data's annotation file (should be 5 groups but found " + + alf.getViewport().getAlignment().getGroups().size() + + ").", alf.getViewport().getAlignment().getGroups() + .size() == 5); + RestClient rc = new RestClient(_rc.service, alf, true); - - - - assertNotNull("Couldn't creat RestClient job.",rc); + + assertNotNull("Couldn't creat RestClient job.", rc); jalview.bin.Cache.initLogger(); - RestJob rjb = new RestJob(0, new RestJobThread(rc),rc.av.getAlignment(),null); - rjb.setAlignmentForInputs(rc.service.getInputParams().values(), rc.av.getAlignment()); - for (Map.Entry e:rc.service.getInputParams().entrySet()) { - System.out.println("For Input '"+e.getKey()+":\n"+e.getValue().formatForInput(rjb).getContentLength()); + RestJob rjb = new RestJob(0, new RestJobThread(rc), + rc.av.getAlignment(), null); + rjb.setAlignmentForInputs(rc.service.getInputParams().values(), + rc.av.getAlignment()); + for (Map.Entry e : rc.service.getInputParams() + .entrySet()) + { + System.out.println("For Input '" + e.getKey() + ":\n" + + e.getValue().formatForInput(rjb).getContentLength()); } } diff --git a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java index 9e5639d..07167bd 100644 --- a/test/jalview/ws/seqfetcher/DbRefFetcherTest.java +++ b/test/jalview/ws/seqfetcher/DbRefFetcherTest.java @@ -36,7 +36,7 @@ import org.junit.Test; /** * @author jimp - * + * */ public class DbRefFetcherTest { @@ -61,35 +61,37 @@ public class DbRefFetcherTest public void testStandardProtDbs() { String[] defdb = DBRefSource.PROTEINDBS; - List srces = new ArrayList(); - for (String ddb : defdb) - { - SequenceFetcher sfetcher= new SequenceFetcher(); - List srcesfordb = sfetcher.getSourceProxy(ddb); - - if (srcesfordb != null) - { - srces.addAll(srcesfordb); - } - } - DbSourceProxy uniprot=null; - int i=0; - // append the selected sequence sources to the default dbs - for (DbSourceProxy s:srces) - { - if (s.getDbSource().equalsIgnoreCase(DBRefSource.UNIPROT)) + List srces = new ArrayList(); + for (String ddb : defdb) { - i++; + SequenceFetcher sfetcher = new SequenceFetcher(); + List srcesfordb = sfetcher.getSourceProxy(ddb); + + if (srcesfordb != null) + { + srces.addAll(srcesfordb); + } } - - if (s instanceof jalview.ws.dbsources.Uniprot) + DbSourceProxy uniprot = null; + int i = 0; + // append the selected sequence sources to the default dbs + for (DbSourceProxy s : srces) { - uniprot = s; - break; + if (s.getDbSource().equalsIgnoreCase(DBRefSource.UNIPROT)) + { + i++; + } + + if (s instanceof jalview.ws.dbsources.Uniprot) + { + uniprot = s; + break; + } } - } - - assertTrue("Failed to find Uniprot source as first source amongst "+srces.size()+" sources (source was at position "+i+")", uniprot!=null && i<2); + + assertTrue("Failed to find Uniprot source as first source amongst " + + srces.size() + " sources (source was at position " + i + ")", + uniprot != null && i < 2); } }