--- /dev/null
+JALVIEW_ANNOTATION
+
+SEQUENCE_GROUP mygrpa 1 10 -1 FER_CAPAA FER_SPIOL FER1_MAIZE
+SEQUENCE_GROUP another group 150 250 -1 FER1_MAIZE
+
action.show_chain = Show Chain\r
action.show_group = Show Group\r
action.fetch_db_references = Fetch DB References\r
+action.edit = Edit\r
+action.view_flanking_regions = Show flanking regions\r
+label.view_flanking_regions = Show sequence data either side of the subsequences involved in this alignment\r
label.str = Str:\r
label.seq = Seq:\r
label.structures_manager = Structures Manager\r
label.principal_component_analysis = Principal Component Analysis\r
label.average_distance_identity = Average Distance Using % Identity\r
label.neighbour_joining_identity = Neighbour Joining Using % Identity\r
+label.treecalc_title = {0} Using {1}\r
+label.tree_calc_av = Average Distance\r
+label.tree_calc_nj = Neighbour Joining\r
+label.select_score_model = Select score model\r
+label.score_model_pid = % Identity\r
+label.score_model_blosum62 = BLOSUM62\r
+label.score_model_pam250 = PAM 250\r
+label.score_model_conservation = Physicochemical property conservation\r
+label.score_model_enhconservation = Physicochemical property conservation\r
label.status_bar = Status bar\r
label.out_to_textbox = Output to Textbox\r
label.clustalx = Clustalx\r
label.state_queueing = queuing\r
label.state_running = running\r
label.state_complete = complete\r
+label.state_completed = finished\r
label.state_job_cancelled = job cancelled!!\r
label.state_job_error = job error!\r
label.server_error_try_later = Server Error! (try later)\r
label.edit_name_and_description_current_group = Edit name and description of current group.\r
label.view_structure_for = View structure for {0}\r
label.view_all_structures = View all {0} structures.\r
+label.view_all_representative_structures = View all {0} representative structures.\r
+label.open_new_jmol_view_with_all_representative_structures_associated_current_selection_superimpose_using_alignment = "Opens a new Jmol view with all representative structures\nassociated with the current selection\nsuperimposed with the current alignment."\r
label.associate_structure_with_sequence = Associate Structure with Sequence\r
label.from_file = from file\r
label.enter_pdb_id = Enter PDB Id\r
label.blasting_for_unidentified_sequence = BLASTing for unidentified sequences
label.select_columns_containing = Select columns containing\r
label.select_columns_not_containing = Select columns that do not contain\r
-\r
+option.trim_retrieved_seqs = Trim retrieved sequences\r
+label.trim_retrieved_sequences = When the reference sequence is longer than the sequence that you are working with, only keep the relevant subsequences.\r
--- /dev/null
+package jalview.analysis;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import jalview.datamodel.SequenceI;
+import jalview.datamodel.AlignmentI;
+
+/**
+ * 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
+ * @param core
+ * @param flankSize
+ * @return AlignmentI
+ */
+ public static AlignmentI expandContext(AlignmentI core, int flankSize)
+ {
+ List<SequenceI> sq = new ArrayList<SequenceI>();
+ int maxoffset = 0;
+ for (SequenceI s:core.getSequences())
+ {
+ SequenceI newSeq = s.deriveSequence();
+ if (newSeq.getStart()>maxoffset && newSeq.getDatasetSequence().getStart()<s.getStart())
+ {
+ maxoffset = newSeq.getStart();
+ }
+ sq.add(newSeq);
+ }
+ if (flankSize>-1) {
+ maxoffset = flankSize;
+ }
+ // now add offset to create a new expanded alignment
+ for (SequenceI s:sq)
+ {
+ SequenceI ds = s;
+ while (ds.getDatasetSequence()!=null) {
+ ds=ds.getDatasetSequence();
+ }
+ 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;
+
+ // build new flanked sequence
+
+ // compute gap padding to start of flanking sequence
+ int offset=maxoffset - ustream_ds;
+
+ // padding is gapChar x ( maxoffset - min(ustream_ds, flank)
+ if (flankSize>=0) {
+ if (flankSize<ustream_ds)
+ {
+ // take up to flankSize residues
+ offset = maxoffset-flankSize;
+ ustream_ds = flankSize;
+ }
+ if (flankSize<dstream_ds)
+ {
+ dstream_ds=flankSize;
+ }
+ }
+ char[] upstream = new String(ds.getSequence(s.getStart()-1-ustream_ds, s.getStart()-1)).toLowerCase().toCharArray();
+ char[] downstream = new String(ds.getSequence(s_end-1,s_end+1+dstream_ds)).toLowerCase().toCharArray();
+ char[] coreseq=s.getSequence();
+ char[] nseq = new char[offset+upstream.length+downstream.length+coreseq.length];
+ char c = core.getGapCharacter();
+ // TODO could lowercase the flanking regions
+ int p=0;
+ for (; p<offset;p++)
+ {
+ nseq[p] = c;
+ }
+// s.setSequence(new String(upstream).toLowerCase()+new String(coreseq) + new String(downstream).toLowerCase());
+ System.arraycopy(upstream, 0, nseq, p, upstream.length);
+ System.arraycopy(coreseq, 0, nseq, p+upstream.length, coreseq.length);
+ System.arraycopy(downstream, 0, nseq, p+coreseq.length+upstream.length, downstream.length);
+ s.setSequence(new String(nseq));
+ s.setStart(s.getStart()-ustream_ds);
+ s.setEnd(s_end+downstream.length);
+ }
+ AlignmentI newAl = new jalview.datamodel.Alignment(sq.toArray(new SequenceI[0]));
+ newAl.setDataset(core.getDataset());
+ return newAl;
+ }
+}
import java.util.*;
+import jalview.api.analysis.ScoreModelI;
import jalview.datamodel.*;
import jalview.io.*;
import jalview.schemes.*;
noseqs = i++;
- distance = findDistances(this.seqData
- .getSequenceStrings(Comparison.GapChars.charAt(0)));
+ distance = findDistances();
// System.err.println("Made distances");// dbg
makeLeaves();
// System.err.println("Made leaves");// dbg
}
/**
- * DOCUMENT ME!
+ * Calculate a distance matrix given the sequence input data and score model
*
- * @return DOCUMENT ME!
+ * @return similarity matrix used to compute tree
*/
- public float[][] findDistances(String[] sequenceString)
+ public float[][] findDistances()
{
+
float[][] distance = new float[noseqs][noseqs];
- if (pwtype.equals("PID"))
- {
- for (int i = 0; i < (noseqs - 1); i++)
- {
- for (int j = i; j < noseqs; j++)
- {
- if (j == i)
- {
- distance[i][i] = 0;
- }
- else
- {
- distance[i][j] = 100 - Comparison.PID(sequenceString[i],
- sequenceString[j]);
-
- distance[j][i] = distance[i][j];
- }
- }
- }
- }
- else
- {
// Pairwise substitution score (with no gap penalties)
- ScoreMatrix pwmatrix = ResidueProperties.getScoreMatrix(pwtype);
- if (pwmatrix == null)
+ ScoreModelI _pwmatrix = ResidueProperties.getScoreModel(pwtype);
+ if (_pwmatrix == null)
{
- pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62");
+ _pwmatrix = ResidueProperties.getScoreMatrix("BLOSUM62");
}
- int maxscore = 0;
- int end = sequenceString[0].length();
- for (int i = 0; i < (noseqs - 1); i++)
- {
- for (int j = i; j < noseqs; j++)
- {
- int score = 0;
-
- for (int k = 0; k < end; k++)
- {
- try
- {
- score += pwmatrix.getPairwiseScore(
- sequenceString[i].charAt(k),
- sequenceString[j].charAt(k));
- } catch (Exception ex)
- {
- System.err.println("err creating BLOSUM62 tree");
- ex.printStackTrace();
- }
- }
-
- distance[i][j] = (float) score;
-
- if (score > maxscore)
- {
- maxscore = score;
- }
- }
- }
-
- for (int i = 0; i < (noseqs - 1); i++)
- {
- for (int j = i; j < noseqs; j++)
- {
- distance[i][j] = (float) maxscore - distance[i][j];
- distance[j][i] = distance[i][j];
- }
- }
-
- }
+ distance = _pwmatrix.findDistances(seqData);
return distance;
- // else
- /*
- * else if (pwtype.equals("SW")) { float max = -1;
- *
- * for (int i = 0; i < (noseqs - 1); i++) { for (int j = i; j < noseqs; j++)
- * { AlignSeq as = new AlignSeq(sequence[i], sequence[j], "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];
- * } } }/
- */
+
}
/**
*/
public PCA(String[] s, boolean nucleotides)
{
+ this(s, nucleotides, null);
+ }
+ public PCA(String[] s, boolean nucleotides, String s_m)
+ {
BinarySequence[] bs = new BinarySequence[s.length];
int ii = 0;
BinarySequence[] bs2 = new BinarySequence[s.length];
ii = 0;
-
- String sm = nucleotides ? "DNA" : "BLOSUM62";
- ScoreMatrix smtrx = ResidueProperties.getScoreMatrix(sm);
+ ScoreMatrix smtrx = null;
+ String sm=s_m;
+ if (sm!=null)
+ {
+ smtrx = ResidueProperties.getScoreMatrix(sm);
+ }
+ if (smtrx==null)
+ {
+ // either we were given a non-existent score matrix or a scoremodel that isn't based on a pairwise symbol score matrix
+ smtrx = ResidueProperties.getScoreMatrix(sm=(nucleotides ? "DNA" : "BLOSUM62"));
+ }
details.append("PCA calculation using " + sm
+ " sequence similarity matrix\n========\n\n");
while ((ii < s.length) && (s[ii] != null))
--- /dev/null
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.util.Comparison;
+
+public class PIDScoreModel implements ScoreModelI
+{
+
+ @Override
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ String[] sequenceString = seqData
+ .getSequenceStrings(Comparison.GapChars.charAt(0));
+ int noseqs = sequenceString.length;
+ float[][] distance = new float[noseqs][noseqs];
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ if (j == i)
+ {
+ distance[i][i] = 0;
+ }
+ else
+ {
+ distance[i][j] = 100 - Comparison.PID(sequenceString[i],
+ sequenceString[j]);
+
+ distance[j][i] = distance[i][j];
+ }
+ }
+ }
+ return distance;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "PID";
+ }
+
+ @Override
+ public boolean isDNA()
+ {
+ return true;
+ }
+
+ @Override
+ public boolean isProtein()
+ {
+ return true;
+ }
+
+}
--- /dev/null
+package jalview.analysis.scoremodels;
+
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.schemes.ScoreMatrix;
+import jalview.util.Comparison;
+
+public abstract class PairwiseSeqScoreModel implements ScoreModelI
+{
+ abstract public int getPairwiseScore(char c, char d);
+
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ String[] sequenceString = seqData
+ .getSequenceStrings(Comparison.GapChars.charAt(0));
+ int noseqs = sequenceString.length;
+ float[][] distance = new float[noseqs][noseqs];
+
+ int maxscore = 0;
+ int end = sequenceString[0].length();
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ int score = 0;
+
+ for (int k = 0; k < end; k++)
+ {
+ try
+ {
+ score += getPairwiseScore(sequenceString[i].charAt(k),
+ sequenceString[j].charAt(k));
+ } catch (Exception ex)
+ {
+ System.err.println("err creating " + getName() + " tree");
+ ex.printStackTrace();
+ }
+ }
+
+ distance[i][j] = (float) score;
+
+ if (score > maxscore)
+ {
+ maxscore = score;
+ }
+ }
+ }
+
+ for (int i = 0; i < (noseqs - 1); i++)
+ {
+ for (int j = i; j < noseqs; j++)
+ {
+ distance[i][j] = (float) maxscore - distance[i][j];
+ distance[j][i] = distance[i][j];
+ }
+ }
+ return distance;
+ }
+
+ abstract public int[][] getMatrix();
+}
\ No newline at end of file
--- /dev/null
+package jalview.analysis.scoremodels;
+
+import jalview.analysis.AlignSeq;
+import jalview.api.analysis.ScoreModelI;
+import jalview.datamodel.AlignmentView;
+import jalview.datamodel.SequenceI;
+import jalview.util.Comparison;
+
+public class SWScoreModel implements ScoreModelI
+{
+
+ @Override
+ public float[][] findDistances(AlignmentView seqData)
+ {
+ 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];
+ } }
+
+ return distance;
+ }
+
+ @Override
+ public String getName()
+ {
+ return "Smith Waterman Score";
+ }
+ @Override
+ public boolean isDNA()
+ {
+ return true;
+ }
+ @Override
+ public boolean isProtein()
+ {
+ return true;
+ }
+ public String toString() {
+ return "Score between two sequences aligned with Smith Waterman with default Peptide/Nucleotide matrix";
+ }
+}
--- /dev/null
+package jalview.api.analysis;
+
+import jalview.datamodel.AlignmentView;
+
+public interface ScoreModelI
+{
+
+ float[][] findDistances(AlignmentView seqData);
+
+ String getName();
+
+ boolean isDNA();
+
+ boolean isProtein();
+
+}
menu1.setLabel(MessageManager.getString("action.show"));
showColumns.setLabel(MessageManager.getString("label.all_columns"));
showSeqs.setLabel(MessageManager.getString("label.all_sequences"));
- menu2.setLabel(MessageManager.getString("aciton.hide"));
+ 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"));
*/
private Vector scGroups;
+ private boolean isNa=false;
+ /**
+ * false if the view concerns peptides
+ * @return
+ */
+ public boolean isNa()
+ {
+ return isNa;
+ }
+
/**
* Group defined over SeqCigars. Unlike AlignmentI associated groups, each
* SequenceGroup hold just the essential properties for the group, but no
(selectedRegionOnly ? selection : null)),
(selectedRegionOnly && selection != null) ? selection
.getStartRes() : 0);
+ isNa = alignment.isNucleotide();
// walk down SeqCigar array and Alignment Array - optionally restricted by
// selected region.
// test group membership for each sequence in each group, store membership
molsel.append(chainCd);
molsel.append("}");
}
- selcom[pdbfnum] = molsel.toString();
- selectioncom.append("((");
- selectioncom.append(selcom[pdbfnum].substring(1,
- selcom[pdbfnum].length() - 1));
- selectioncom.append(" )& ");
- selectioncom.append(pdbfnum + 1);
- selectioncom.append(".1)");
- if (pdbfnum < files.length - 1)
+ if (molsel.length() > 1)
{
- selectioncom.append("|");
+ selcom[pdbfnum] = molsel.toString();
+ selectioncom.append("((");
+ selectioncom.append(selcom[pdbfnum].substring(1,
+ selcom[pdbfnum].length() - 1));
+ selectioncom.append(" )& ");
+ selectioncom.append(pdbfnum + 1);
+ selectioncom.append(".1)");
+ if (pdbfnum < files.length - 1)
+ {
+ selectioncom.append("|");
+ }
+ } else {
+ selcom[pdbfnum] = null;
}
}
}
for (int pdbfnum = 0; pdbfnum < files.length; pdbfnum++)
{
- if (pdbfnum == refStructure)
+ if (pdbfnum == refStructure || selcom[pdbfnum]==null || selcom[refStructure]==null)
{
continue;
}
}
command.append(" ROTATE TRANSLATE;\n");
}
- System.out.println("Select regions:\n" + selectioncom.toString());
- evalStateCommand("select *; cartoons off; backbone; select ("
- + selectioncom.toString() + "); cartoons; ");
- // selcom.append("; ribbons; ");
- System.out.println("Superimpose command(s):\n" + command.toString());
-
- evalStateCommand(command.toString());
+ if (selectioncom.length() > 0)
+ {
+ System.out.println("Select regions:\n" + selectioncom.toString());
+ evalStateCommand("select *; cartoons off; backbone; select ("
+ + selectioncom.toString() + "); cartoons; ");
+ // selcom.append("; ribbons; ");
+ System.out
+ .println("Superimpose command(s):\n" + command.toString());
+
+ evalStateCommand(command.toString());
+ }
}
if (selectioncom.length() > 0)
{// finally, mark all regions that were superposed.
import jalview.analysis.AAFrequency;
import jalview.analysis.AlignmentSorter;
+import jalview.analysis.AlignmentUtils;
import jalview.analysis.Conservation;
import jalview.analysis.CrossRef;
import jalview.analysis.NJTree;
import jalview.analysis.SequenceIdMatcher;
import jalview.api.AlignViewControllerGuiI;
import jalview.api.AlignViewControllerI;
+import jalview.api.analysis.ScoreModelI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.ws.seqfetcher.DbSourceProxy;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Component;
import java.awt.GridLayout;
import java.awt.Rectangle;
import java.util.Vector;
import javax.swing.JButton;
+import javax.swing.JCheckBoxMenuItem;
import javax.swing.JEditorPane;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
setMenusFromViewport(viewport);
buildSortByAnnotationScoresMenu();
+ buildTreeMenu();
if (viewport.wrapAlignment)
{
wrapMenuItem_actionPerformed(null);
}
}
+ @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)
+ {
+ 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());
+
+ // TODO: maintain provenance of an alignment, rather than just make the
+ // title a concatenation of operations.
+ {
+ if (title.startsWith("Copied sequences"))
+ {
+ newtitle = title;
+ }
+ else
+ {
+ newtitle = newtitle.concat("- from " + title);
+ }
+ }
+
+ 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)
+ {
+ new OOMWarning("Viewing flanking region of alignment", oom);
+ }
+ }
/**
* DOCUMENT ME!
*
@Override
public void buildTreeMenu()
{
+ calculateTree.removeAll();
+ // build the calculate menu
+
+ for (final String type:new String[] {"NJ", "AV"})
+ {
+ 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())
+ {
+ String smn = MessageManager.getStringOrReturn(
+ "label.score_model_", sm.getName());
+ final String title = MessageManager.formatMessage(
+ "label.treecalc_title", treecalcnm, smn);
+ tm.setText(title);//
+ tm.addActionListener(new java.awt.event.ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ NewTreePanel(type, (String) pwtype, title);
+ }
+ });
+ calculateTree.add(tm);
+ }
+
+ }
+ }
sortByTreeMenu.removeAll();
Vector comps = (Vector) PaintRefresher.components.get(viewport
rfetch.setToolTipText(MessageManager.getString("label.retrieve_parse_sequence_database_records_alignment_or_selected_sequences"));\r
webService.add(rfetch);
+ final JCheckBoxMenuItem trimrs = new JCheckBoxMenuItem(MessageManager.getString("option.trim_retrieved_seqs"));
+ trimrs.setToolTipText(MessageManager.getString("label.trim_retrieved_sequences"));
+ trimrs.setSelected(Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true));
+ trimrs.addActionListener(new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e) {
+ trimrs.setSelected(trimrs.isSelected());
+ Cache.setProperty("TRIM_FETCHED_DATASET_SEQS", Boolean.valueOf(trimrs.isSelected()).toString());
+ };
+ });
+ rfetch.add(trimrs);
JMenuItem fetchr = new JMenuItem(MessageManager.getString("label.standard_databases"));\r
fetchr.setToolTipText(MessageManager.getString("label.fetch_embl_uniprot"));\r
fetchr.addActionListener(new ActionListener()
// need to wait around until script has finished
while (addingStructures ? lastnotify >= jmb.getLoadNotifiesHandled()
- : (jmb.isFinishedInit() && jmb.getPdbFile().length != jmb.pdbentry.length))
+ : (jmb.isFinishedInit() && jmb.getPdbFile()!=null && jmb.getPdbFile().length != jmb.pdbentry.length))
{
try
{
private String[] getDisplayedFeatureGroups()
{
String[] gps = null;
+ ArrayList<String> _gps = new ArrayList<String>();
if (fr != null)
{
if (fr.featureGroups != null)
{
Iterator en = fr.featureGroups.keySet().iterator();
- gps = new String[fr.featureColours.size()];
int g = 0;
boolean valid = false;
while (en.hasNext())
if (on != null && on.booleanValue())
{
valid = true;
- gps[g++] = gp;
+ _gps.add(gp);
}
}
- while (g < gps.length)
- {
- gps[g++] = null;
- }
if (!valid)
{
return null;
+ } else {
+ gps = new String[_gps.size()];
+ _gps.toArray(gps);
}
}
}
if (sq != dsq)
{ // make this dataset sequence sq's dataset sequence
sq.setDatasetSequence(dsq);
+ // and update the current dataset alignment
+ if (ds==null) {
+ if (dseqs!=null) {
+ if (!dseqs.contains(dsq))
+ {
+ dseqs.add(dsq);
+ }
+ } else {
+ if (ds.findIndex(dsq)<0)
+ {
+ ds.addSequence(dsq);
+ }
+ }
+ }
}
}
}
* sb.append(newres.substring(newres.length() - sq.getEnd() -
* dsq.getEnd())); dsq.setEnd(sq.getEnd()); }
*/
- dsq.setSequence(sb.toString());
+ dsq.setSequence(newres);
}
// TODO: merges will never happen if we 'know' we have the real dataset
// sequence - this should be detected when id==dssid
- System.err.println("DEBUG Notice: Merged dataset sequence"); // ("
+ System.err.println("DEBUG Notice: Merged dataset sequence (if you see this often, post at http://issues.jalview.org/browse/JAL-1474)"); // ("
// + (pre ? "prepended" : "") + " "
// + (post ? "appended" : ""));
}
package jalview.gui;
import java.util.*;
-
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
+
import javax.swing.*;
import jalview.datamodel.*;
import jalview.jbgui.*;
+import jalview.schemes.ResidueProperties;
import jalview.util.MessageManager;
import jalview.viewmodel.PCAModel;
Thread worker = new Thread(this);
worker.start();
}
-
+ @Override
+ protected void scoreMatrix_menuSelected()
+ {
+ scoreMatrixMenu.removeAll();
+ for (final String sm:ResidueProperties.scoreMatrices.keySet())
+ {
+ JCheckBoxMenuItem jm=new JCheckBoxMenuItem();
+ jm.setText(MessageManager.getStringOrReturn("label.score_model", sm));
+ jm.setSelected(pcaModel.getScore_matrix().equals(sm));
+ if (pcaModel.isNucleotide()==ResidueProperties.scoreMatrices.get(sm).isDNA())
+ {
+ final PCAPanel us = this;
+ jm.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ if (!pcaModel.getScore_matrix().equals((String) sm))
+ {
+ pcaModel.setScore_matrix((String) sm);
+ Thread worker = new Thread(us);
+ worker.start();
+ }
+ }
+ });
+ scoreMatrixMenu.add(jm);
+ }
+ }
+ }
public void bgcolour_actionPerformed(ActionEvent e)
{
Color col = JColorChooser.showDialog(this, "Select Background Colour",
if (!pcaModel.isNucleotide())
{
pcaModel.setNucleotide(true);
+ pcaModel.setScore_matrix("DNA");
Thread worker = new Thread(this);
worker.start();
}
if (pcaModel.isNucleotide())
{
pcaModel.setNucleotide(false);
+ pcaModel.setScore_matrix("BLOSUM62");
Thread worker = new Thread(this);
worker.start();
}
}
}
+
public void viewMenu_menuSelected()
{
buildAssociatedViewMenu();
buildGroupURLMenu(sg, groupLinks);
}
// Add a 'show all structures' for the current selection
- Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>();
+ Hashtable<String, PDBEntry> pdbe = new Hashtable<String, PDBEntry>(),reppdb=new Hashtable<String,PDBEntry>();
SequenceI sqass = null;
for (SequenceI sq : ap.av.getSequenceSelection())
{
.getPDBId();
if (pes != null)
{
+ reppdb.put(pes.get(0).getId(),pes.get(0));
for (PDBEntry pe : pes)
{
pdbe.put(pe.getId(), pe);
if (pdbe.size() > 0)
{
final PDBEntry[] pe = pdbe.values().toArray(
- new PDBEntry[pdbe.size()]);
- final JMenuItem gpdbview;
+ 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)})));\r
}
else
{
- structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_structures", new String[]{new Integer(pdbe.size()).toString()})));\r
+ structureMenu.add(gpdbview = new JMenuItem(MessageManager.formatMessage("label.view_all_structures", new String[]{new Integer(pdbe.size()).toString()}))); \r
}
gpdbview.setToolTipText(MessageManager.getString("label.open_new_jmol_view_with_all_structures_associated_current_selection_superimpose_using_alignment"));\r
gpdbview.addActionListener(new ActionListener()
new AppJmol(ap, pe, ap.av.collateForPDB(pe));
}
});
+ if (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"));
+ rpdbview.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ new AppJmol(ap, pr, ap.av.collateForPDB(pr));
+ }
+ });
+ }
}
}
else
else if (token.equalsIgnoreCase("SEQUENCE_GROUP"))
{
addGroup(al, st);
+ modified=true;
continue;
}
protected JMenuItem showTranslation = new JMenuItem();
protected JMenuItem extractScores = new JMenuItem();
+
+ protected JMenuItem expandAlignment = new JMenuItem();
protected JMenu showProducts = new JMenu();
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() {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ expand_newalign(e);
+ }
+ });
remove2LeftMenuItem.setText(MessageManager.getString("action.remove_left"));
remove2LeftMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(
java.awt.event.KeyEvent.VK_L, Toolkit.getDefaultToolkit()
sort.add(sortGroupMenuItem);
sort.add(sortPairwiseMenuItem);
sort.add(sortByTreeMenu);
- calculateTree.add(averageDistanceTreeMenuItem);
- calculateTree.add(neighbourTreeMenuItem);
- calculateTree.add(avDistanceTreeBlosumMenuItem);
- calculateTree.add(njTreeBlosumMenuItem);
jMenu2.add(htmlMenuItem);
jMenu2.add(epsFile);
jMenu2.add(createPNG);
selectMenu.add(unGroup);
selectMenu.add(grpsFromSelection);
selectMenu.add(deleteGroups);
+ calculateMenu.add(expandAlignment);
// TODO - determine if the listenToViewSelections button is needed : see bug
// JAL-574
// selectMenu.addSeparator();
{
}
+
+ protected void expand_newalign(ActionEvent e)
+ {
+ // TODO Auto-generated method stub
+
+ }
}
JMenu fileMenu = new JMenu();
JMenu saveMenu = new JMenu();
+
+ protected JMenu scoreMatrixMenu = new JMenu();
JMenuItem eps = new JMenuItem();
{
}
});
+ scoreMatrixMenu.setText(MessageManager.getString("label.select_score_model"));
+ scoreMatrixMenu.addMenuListener(new MenuListener()
+ {
+ public void menuSelected(MenuEvent e)
+ {
+ scoreMatrix_menuSelected();
+ }
+
+ public void menuDeselected(MenuEvent e)
+ {
+ }
+
+ public void menuCanceled(MenuEvent e)
+ {
+ }
+ });
showLabels.setText(MessageManager.getString("label.show_labels"));
showLabels.addActionListener(new ActionListener()
{
calcSettings.add(jvVersionSetting);
calcSettings.add(nuclSetting);
calcSettings.add(protSetting);
+ calcSettings.add(scoreMatrixMenu);
statusPanel.setLayout(statusPanelLayout);
statusBar.setFont(new java.awt.Font("Verdana", 0, 12));
// statusPanel.setBackground(Color.lightGray);
viewMenu.add(associateViewsMenu);
}
+ protected void scoreMatrix_menuSelected()
+ {
+ // TODO Auto-generated method stub
+
+ }
+
protected void resetButton_actionPerformed(ActionEvent e)
{
// TODO Auto-generated method stub
}
if ((threshold == 0) || aboveThreshold(c, j))
{
- if (j < annotation.annotations.length
+ if (annotation.annotations!=null && j < annotation.annotations.length
&& annotation.annotations[j] != null
&& !jalview.util.Comparison.isGap(c))
{
*/
package jalview.schemes;
+import jalview.analysis.scoremodels.PIDScoreModel;
+import jalview.api.analysis.ScoreModelI;
+
import java.util.*;
import java.util.List;
-
import java.awt.*;
public class ResidueProperties
{
- public static Hashtable scoreMatrices = new Hashtable();
+ public static Hashtable<String,ScoreModelI> scoreMatrices = new Hashtable();
// Stores residue codes/names and colours and other things
public static final int[] aaIndex; // aaHash version 2.1.1 and below
propHash.put("proline", proline);
propHash.put("polar", polar);
}
+ static
+ {
+ int[][][] propMatrix = new int[3][maxProteinIndex][maxProteinIndex];
+ for (int i=0;i<maxProteinIndex;i++)
+ {
+ String ic="";
+ if (aa.length<i) {
+ ic+=aa[i];
+ }
+ else {ic = "-";}
+ propMatrix[0][i][i]=propHash.size();
+ propMatrix[1][i][i]=propHash.size();
+ propMatrix[2][i][i]=propHash.size();
+ for (int j=i+1;j<maxProteinIndex; j++)
+ {
+ String jc="";
+ if (aa.length<j) {
+ jc+=aa[j];
+ }
+ else {jc = "-";}
+ propMatrix[0][i][j]=0;
+ propMatrix[1][i][j]=0;
+ propMatrix[2][i][j]=0;
+ for (Enumeration<String> en= (Enumeration<String>)propHash.keys(); en.hasMoreElements(); )
+ {
+ String ph = en.nextElement();
+ Map<String,Integer> pph=(Map<String,Integer>)propHash.get(ph);
+ propMatrix[0][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic) : -1;
+ propMatrix[1][i][j]+= pph.get(ic).equals(pph.get(jc)) ? 1 : -1;
+ propMatrix[2][i][j]+= pph.get(ic).equals(pph.get(jc)) ? pph.get(ic)*2 : 0;
+ }
+ }
+ }
+
+ scoreMatrices.put("Conservation Pos", new ScoreMatrix("Conservation Pos",propMatrix[0],0));
+ scoreMatrices.put("Conservation Both", new ScoreMatrix("Conservation Both",propMatrix[1],0));
+ scoreMatrices.put("Conservation EnhPos", new ScoreMatrix("Conservation EnhPos",propMatrix[2],0));
+ scoreMatrices.put("PID", new PIDScoreModel());
+ }
private ResidueProperties()
{
public static ScoreMatrix getScoreMatrix(String pwtype)
{
Object val = scoreMatrices.get(pwtype);
- if (val != null)
+ if (val != null && val instanceof ScoreMatrix)
{
return (ScoreMatrix) val;
}
return null;
}
+ /**
+ * get a ScoreModel based on its string name
+ *
+ * @param pwtype
+ * @return scoremodel of type pwtype or null
+ */
+ public static ScoreModelI getScoreModel(String pwtype)
+ {
+ return scoreMatrices.get(pwtype);
+ }
public static int getPAM250(char c, char d)
{
*/
package jalview.schemes;
-public class ScoreMatrix
+import jalview.analysis.scoremodels.PairwiseSeqScoreModel;
+import jalview.api.analysis.ScoreModelI;
+
+public class ScoreMatrix extends PairwiseSeqScoreModel implements ScoreModelI
{
String name;
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
/**
* reference to integer score matrix
* 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
+ */
ScoreMatrix(String name, int[][] matrix, int type)
{
this.matrix = matrix;
this.type = type;
+ this.name = name;
}
+ @Override
public boolean isDNA()
{
return type == 1;
}
-
+ @Override
public boolean isProtein()
{
return type == 0;
}
+ @Override
public int[][] getMatrix()
{
return matrix;
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)
+ * @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);
+ }
+ return name;
+ }
}
if (aan[an].autoCalculated && aan[an].groupRef != null)
{
oldrfs.add(aan[an].groupRef);
- alignment.deleteAnnotation(aan[an]);
- aan[an] = null;
+ alignment.deleteAnnotation(aan[an],false);
}
}
}
seqstrings = seqstrings2;
seqs = seqs2;
nucleotide = nucleotide2;
+ score_matrix = nucleotide2 ? "PID" : "BLOSUM62";
}
private volatile PCA pca;
AlignmentView seqstrings;
SequenceI[] seqs;
+
+ /**
+ * Score matrix used to calculate PC
+ */
+ String score_matrix;
/**
* use the identity matrix for calculating similarity between sequences.
public void run()
{
- pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide);
+ pca = new PCA(seqstrings.getSequenceStrings(' '), nucleotide, score_matrix);
pca.setJvCalcMode(jvCalcMode);
pca.run();
jvCalcMode = state;
}
+ public String getScore_matrix()
+ {
+ return score_matrix;
+ }
+
+ public void setScore_matrix(String score_matrix)
+ {
+ this.score_matrix = score_matrix;
+ }
+
}
private SequenceI[] alseqs;
+ /**
+ * when true - retrieved sequences will be trimmed to cover longest derived alignment sequence
+ */
+ private boolean trimDsSeqs=true;
+
public DBRefFetcher()
{
}
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
+ trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true);
if (sources == null)
{
// af.featureSettings_actionPerformed(null);
if (retrieved != null)
{
transferReferences(sdataset, dbsource.getDbSource(),
- retrieved);
+ retrieved,trimDsSeqs);
}
}
else
/**
* Verify local sequences in seqRefs against the retrieved sequence database
* records.
+ * @param trimDatasetSeqs
*
*/
void transferReferences(Vector sdataset, String dbSource,
- AlignmentI retrievedAl) // File
+ AlignmentI retrievedAl, boolean trimDatasetSeqs) // File
// file)
{
+ System.out.println("trimming ? "+trimDatasetSeqs);
if (retrievedAl == null || retrievedAl.getHeight() == 0)
{
return;
// mappings are made (but content matches retrieved set)
boolean updateRefFrame = sequence.getDBRef() == null
|| sequence.getDBRef().length == 0;
+ // TODO:
// verify sequence against the entry sequence
String nonGapped = AlignSeq.extractGaps("-. ",
// unknownSequences.remove(sequence);
int absEnd = absStart + nonGapped.length();
absStart += 1;
+ if (!trimDatasetSeqs) {
+ // insert full length sequence from record
+ sequence.setSequence(entry.getSequenceAsString());
+ sequence.setStart(entry.getStart());
+ }
if (updateRefFrame)
{
// finally, update local sequence reference frame if we're allowed
- sequence.setStart(absStart);
- sequence.setEnd(absEnd);
+ if (trimDatasetSeqs) {
+ // just fix start/end
+ sequence.setStart(absStart);
+ sequence.setEnd(absEnd);
+ }
// search for alignment sequences to update coordinate frame for
for (int alsq = 0; alsq < alseqs.length; alsq++)
{
{
private static final String THRESHOLD = "THRESHOLD";
+ private static final String RANGE = "RANGE";
String typeName;
amap.get("Dydx").put(DONTCOMBINE, DONTCOMBINE);
amap.get("Dydx").put(THRESHOLD, new double[]
{ 1, 0 });
+ amap.get("Dydx").put(RANGE, new float[]
+ { -1, +1 });
+
amap.put("SmoothedScore", new HashMap<String, Object>());
amap.get("SmoothedScore").put(INVISIBLE, INVISIBLE);
amap.put("RawScore", new HashMap<String, Object>());
amap.put("REM465", new HashMap<String, Object>());
amap.get("COILS").put(THRESHOLD, new double[]
{ 1, 0.516 });
+ amap.get("COILS").put(RANGE, new float[]
+ { 0, 1 });
+
amap.get("HOTLOOPS").put(THRESHOLD, new double[]
{ 1, 0.6 });
+ amap.get("HOTLOOPS").put(RANGE, new float[]
+ { 0, 1 });
amap.get("REM465").put(THRESHOLD, new double[]
{ 1, 0.1204 });
+ amap.get("REM465").put(RANGE, new float[]
+ { 0, 1 });
+
annotMap.put(compbio.ws.client.Services.IUPredWS.toString(),
amap = new HashMap<String, Map<String, Object>>());
amap.put("Short", new HashMap<String, Object>());
amap.get("Long").put(THRESHOLD, new double[]
{ 1, 0.5 });
+ amap.get("Long").put(RANGE, new float[]
+ { 0, 1 });
amap.get("Short").put(THRESHOLD, new double[]
{ 1, 0.5 });
+ amap.get("Short").put(RANGE, new float[]
+ { 0, 1 });
annotMap.put(compbio.ws.client.Services.JronnWS.toString(),
amap = new HashMap<String, Map<String, Object>>());
amap.put("JRonn", new HashMap<String, Object>());
amap.get("JRonn").put(THRESHOLD, new double[]
{ 1, 0.5 });
+ amap.get("JRonn").put(RANGE, new float[]
+ { 0, 1 });
}
@Override
service.getServiceTypeURI() + "/" + scr.getMethod(),
aseq, base + 1, scr);
annot.graph = AlignmentAnnotation.LINE_GRAPH;
- annot.visible = (annotTypeMap == null
- || annotTypeMap.get(scr.getMethod()) == null || annotTypeMap
- .get(scr.getMethod()).get(INVISIBLE) == null);
- double[] thrsh = (annotTypeMap == null || annotTypeMap
- .get(scr.getMethod()) == null) ? null
- : (double[]) annotTypeMap.get(scr.getMethod()).get(
+
+ Map<String,Object> 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);
- if (annotTypeMap == null
- || annotTypeMap.get(scr.getMethod()) == null
- || annotTypeMap.get(scr.getMethod()).get(DONTCOMBINE) == null)
+ 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 (!sameGroup)
--- /dev/null
+package jalview.analysis;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+import jalview.datamodel.Alignment;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.io.AppletFormatAdapter;
+
+public class AlignmentUtilsTests
+{
+ public static Sequence ts=new Sequence("short","ASDASDASDASDASDASDASDASDASDASDASDASDASD");
+ @Test
+ public void testExpandFlanks()
+ {
+ AlignmentI al = new Alignment(new Sequence[] {});
+ for (int i=4;i<14;i+=3)
+ {
+ SequenceI s1=ts.deriveSequence().getSubSequence(i, i+7);
+ al.addSequence(s1);
+ }
+ System.out.println(new AppletFormatAdapter().formatSequences("Clustal", al, true));
+ for (int flnk=-1;flnk<25; flnk++)
+ {
+ AlignmentI exp;
+ System.out.println("\nFlank size: "+flnk);
+ System.out.println(new AppletFormatAdapter().formatSequences("Clustal", exp=AlignmentUtils.expandContext(al, flnk), true));
+ if (flnk==-1) {
+ for (SequenceI sq:exp.getSequences())
+ {
+ String ung = sq.getSequenceAsString().replaceAll("-+", "");
+ assertTrue("Flanking sequence not the same as original dataset sequence.\n"+ung+"\n"+sq.getDatasetSequence().getSequenceAsString(),ung.equalsIgnoreCase(sq.getDatasetSequence().getSequenceAsString()));
+ }
+ }
+ }
+ }
+}
public class AnnotationFileIOTest
{
- static String TestFiles[][] = {{ "Test example annotation import/export","examples/uniref50.fa", "examples/testdata/example_annot_file.jva" }
- ,{"Test multiple combine annotation statements import/export","examples/uniref50.fa", "examples/testdata/test_combine_annot.jva"}
- ,{"Test multiple combine annotation statements with sequence_ref import/export","examples/uniref50.fa", "examples/testdata/uniref50_iupred.jva"}};
+ static String TestFiles[][] =
+ {
+ { "Test example annotation import/export", "examples/uniref50.fa",
+ "examples/testdata/example_annot_file.jva" },
+ { "Test multiple combine annotation statements import/export",
+ "examples/uniref50.fa",
+ "examples/testdata/test_combine_annot.jva" },
+ {
+ "Test multiple combine annotation statements with sequence_ref import/export",
+ "examples/uniref50.fa", "examples/testdata/uniref50_iupred.jva" },
+ {
+ "Test group only annotation file parsing results in parser indicating annotation was parsed",
+ "examples/uniref50.fa", "examples/testdata/test_grpannot.jva" } };
@Test
public void exampleAnnotationFileIO() throws Exception
*/
package jalview.schemes;
+import jalview.api.analysis.ScoreModelI;
+
import java.util.Map;
import org.junit.Test;
@Test
public void printAllMatrices()
{
- for (Map.Entry<String,ScoreMatrix> sm:((Map<String, ScoreMatrix>) ResidueProperties.scoreMatrices).entrySet())
+ for (Map.Entry<String,ScoreModelI> sm: ResidueProperties.scoreMatrices.entrySet())
{
System.out.println("Matrix "+sm.getKey());
System.out.println(sm.getValue().toString());
@Test
public void printHTMLMatrices()
{
- for (Map.Entry<String,ScoreMatrix> sm:((Map<String, ScoreMatrix>) ResidueProperties.scoreMatrices).entrySet())
+ for (Map.Entry<String,ScoreModelI> _sm: ResidueProperties.scoreMatrices.entrySet())
{
- System.out.println("Matrix "+sm.getKey());
- System.out.println(sm.getValue().outputMatrix(true));
+ if (_sm.getValue() instanceof ScoreMatrix)
+ {
+ ScoreMatrix sm = (ScoreMatrix) _sm.getValue();
+ System.out.println("Matrix "+_sm.getKey());
+ System.out.println(sm.outputMatrix(true));
+ }
}
}