From 38299bef6dfd4b713f615781e631dcb66e1155f2 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Fri, 7 Apr 2006 12:52:29 +0000 Subject: [PATCH] ModellerOutput set in preferences --- src/jalview/bin/Cache.java | 1 + src/jalview/gui/Preferences.java | 8 ++++++- src/jalview/io/PIRFile.java | 45 ++++++++++++++++++++++++++++------- src/jalview/jbgui/GPreferences.java | 13 +++++++++- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 9702a92..eb503d5 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -213,6 +213,7 @@ public class Cache //LOAD USERDEFINED COLOURS jalview.gui.UserDefinedColours.initUserColourSchemes( getProperty("USER_DEFINED_COLOURS")); + jalview.io.PIRFile.useModellerOutput = Cache.getDefault("PIR_MODELLER", false); } diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index 8cbe03f..9ac8acf 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -150,7 +150,10 @@ public class Preferences extends GPreferences pileupjv.setSelected( Cache.getDefault("PILEUP_JVSUFFIX", true) ); pirjv.setSelected( Cache.getDefault("PIR_JVSUFFIX", true) ); + modellerOutput.setSelected( Cache.getDefault("PIR_MODELLER", false)); + autoCalculateConsCheck.setSelected( Cache.getDefault("AUTO_CALC_CONSENSUS", true)); + padGaps.setSelected( Cache.getDefault("PAD_GAPS", false)); /**************************************************** * Set up Connections @@ -278,10 +281,13 @@ public class Preferences extends GPreferences Cache.applicationProperties.setProperty("PFAM_JVSUFFIX", Boolean.toString(pfamjv.isSelected()) ); Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX", Boolean.toString(pileupjv.isSelected()) ); Cache.applicationProperties.setProperty("PIR_JVSUFFIX", Boolean.toString(pirjv.isSelected()) ); + Cache.applicationProperties.setProperty("PIR_MODELLER", Boolean.toString(modellerOutput.isSelected()) ); + jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected(); Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS", Boolean.toString(autoCalculateConsCheck.isSelected())); - + Cache.applicationProperties.setProperty("PAD_GAPS", + Boolean.toString(padGaps.isSelected())); Cache.saveProperties(); try { diff --git a/src/jalview/io/PIRFile.java b/src/jalview/io/PIRFile.java index 6d6e525..b958456 100755 --- a/src/jalview/io/PIRFile.java +++ b/src/jalview/io/PIRFile.java @@ -26,6 +26,8 @@ import jalview.datamodel.*; public class PIRFile extends AlignFile { + public static boolean useModellerOutput = false; + Vector words = new Vector(); //Stores the words in a line after splitting public PIRFile() @@ -47,6 +49,7 @@ public class PIRFile { StringBuffer sequence; String line = null; + ModellerDescription md; while ( (line = nextLine()) != null) { @@ -93,8 +96,9 @@ public class PIRFile } seqs.addElement(newSeq); - ModellerDescription md = new ModellerDescription(newSeq. - getDescription()); + + md = new ModellerDescription(newSeq. + getDescription()); md.updateSequenceI(newSeq); } } @@ -111,17 +115,28 @@ public class PIRFile int len = 72; StringBuffer out = new StringBuffer(); int i = 0; + ModellerDescription md; while ( (i < s.length) && (s[i] != null)) { String seq = s[i].getSequence(); seq = seq + "*"; + if (is_NA) { - // modeller doesn't really do nucleotides, so we don't do anything fancy - // Nucleotide sequence tags should have a >DL; prefix - out.append(">N1;" + s[i].getName() + "\n"); // JBPNote Should change >P to >N + // modeller doesn't really do nucleotides, so we don't do anything fancy + // Official tags area as follows, for now we'll use P1 and DL + // Protein (complete) P1 + // Protein (fragment) F1 + // DNA (linear) Dl + // DNA (circular) DC + // RNA (linear) RL + // RNA (circular) RC + // tRNA N3 + // other functional RNA N1 + + out.append(">N1;" + s[i].getName() + "\n"); if (s[i].getDescription() == null) { out.append(s[i].getName() + " " + @@ -135,9 +150,23 @@ public class PIRFile } else { - out.append(">P1;" + s[i].getName() + "\n"); - ModellerDescription md = new ModellerDescription(s[i]); - out.append(md.getDescriptionLine() + "\n"); + + if(useModellerOutput) + { + out.append(">P1;" + s[i].getName() + "\n"); + md = new ModellerDescription(s[i]); + out.append(md.getDescriptionLine() + "\n"); + } + else + { + out.append(">P1;" + printId(s[i]) + "\n"); + if (s[i].getDescription() != null) + out.append(s[i].getDescription() + "\n"); + else + out.append(s[i].getName() + " " + + (s[i].getEnd() - s[i].getStart() + 1) + + " residues\n"); + } } int nochunks = (seq.length() / len) + 1; diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 58c7743..8a51aee 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -106,6 +106,8 @@ public class GPreferences extends JPanel protected JCheckBox smoothFont = new JCheckBox(); JPanel calcTab = new JPanel(); protected JCheckBox autoCalculateConsCheck = new JCheckBox(); + protected JCheckBox padGaps = new JCheckBox(); + protected JCheckBox modellerOutput = new JCheckBox(); /** * Creates a new GPreferences object. */ @@ -360,8 +362,15 @@ public class GPreferences extends JPanel smoothFont.setHorizontalTextPosition(SwingConstants.LEADING); smoothFont.setText("Smooth Font"); calcTab.setLayout(null); + autoCalculateConsCheck.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); autoCalculateConsCheck.setText("AutoCalculate Consensus"); - autoCalculateConsCheck.setBounds(new Rectangle(16, 29, 209, 23)); + autoCalculateConsCheck.setBounds(new Rectangle(21, 52, 209, 23)); + padGaps.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + padGaps.setText("Pad gaps when editing"); + padGaps.setBounds(new Rectangle(22, 94, 168, 23)); + modellerOutput.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); + modellerOutput.setText("Use Modeller Output"); + modellerOutput.setBounds(new Rectangle(228, 226, 168, 23)); jPanel2.add(fullScreen); jPanel2.add(annotations); @@ -444,8 +453,10 @@ public class GPreferences extends JPanel jPanel11.add(pfamjv); jPanel11.add(pileupjv); jPanel11.add(pirjv); + exportTab.add(modellerOutput); tabbedPane.add(calcTab, "Calculations"); calcTab.add(autoCalculateConsCheck); + calcTab.add(padGaps); exportTab.add(epsLabel); exportTab.add(epsRendering); -- 1.7.10.2