();
14 | while(inn.getParent()!=null){
15 | path.add(inn.getParent());
16 | inn = inn.getParent();
17 | }
18 | if(path.contains((Node)out)){
19 | ret ++;
20 | }
21 | return ret;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/src/jebl/evolution/align/scores/ScoreMatrix.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.align.scores;
2 |
3 | /**
4 | * @author Alexei Drummond
5 | *
6 | * @version $Id: ScoreMatrix.java 360 2006-06-22 07:42:48Z pepster $
7 | */
8 | public interface ScoreMatrix {
9 | /**
10 | *
11 | * @return human readable name
12 | */
13 | public String getName();
14 |
15 | /**
16 | * @return the score for matching char x with char y
17 | */
18 | float getScore(char x, char y);
19 |
20 | /**
21 | * @return a string containing the valid characters for this score matrix.
22 | */
23 | String getAlphabet();
24 | }
25 |
--------------------------------------------------------------------------------
/src/jebl/evolution/align/package.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | jebl.evolution.align package
5 |
6 |
7 |
8 | Provides classes and interfaces for pairwise alignment of two sequences.
9 | All major algorithms including Smith-Waterman and Needleman-Wunsch
10 | are implemented.
11 |
12 | Some of the classes in this package are based on source code by Peter Sestoft, sestoft@dina.kvl.dk.
13 | His original source code can be at
14 | http://www.dina.kvl.dk/~sestoft/bsa.html
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/jebl/evolution/align/scores/AminoAcidScores.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.align.scores;
2 |
3 | /**
4 | * @author Alexei Drummond
5 | *
6 | * @version $Id: AminoAcidScores.java 360 2006-06-22 07:42:48Z pepster $
7 | */
8 | public class AminoAcidScores extends Scores {
9 |
10 | private String residues = "ARNDCQEGHILKMFPSTWYV";
11 |
12 | public String getName() {
13 | return toString();
14 | }
15 |
16 | public final String getAlphabet() { return residues + getExtraResidues(); }
17 |
18 |
19 | public AminoAcidScores() {
20 | }
21 |
22 | public AminoAcidScores(float m, float n) {
23 | buildScores(m, n);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/jade/reconstruct/area/AncSplit.java:
--------------------------------------------------------------------------------
1 | package jade.reconstruct.area;
2 |
3 | public class AncSplit {
4 | public AncSplit(int [] ancdists, int [][] descdists, double weight, double likelihood){
5 | this.weight = weight;
6 | this.likelihood = likelihood;
7 | this.ancdist = ancdists;
8 | this.descdists = descdists;
9 | }
10 | private double weight;
11 | private double likelihood;
12 | private int [][] descdists;
13 | private int [] ancdist;
14 |
15 | public double get_weight(){return weight;}
16 | public double get_like(){return likelihood;}
17 | public int [] get_ancdist(){return ancdist;}
18 | public int [][] get_descdists(){return descdists;}
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/src/jebl/evolution/sequences/Sequences.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Sequences.java
3 | *
4 | * (c) 2002-2005 JEBL Development Core Team
5 | *
6 | * This package may be distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 | package jebl.evolution.sequences;
10 |
11 | import jebl.evolution.taxa.Taxon;
12 |
13 | import java.util.Set;
14 |
15 | /**
16 | * A set of sequence objects.
17 | *
18 | * @author Andrew Rambaut
19 | * @author Alexei Drummond
20 | *
21 | * @version $Id: Sequences.java 185 2006-01-23 23:03:18Z rambaut $
22 | */
23 | public interface Sequences {
24 |
25 | Set getSequences();
26 |
27 | Sequence getSequence(Taxon taxon);
28 | }
29 |
--------------------------------------------------------------------------------
/src/jebl/math/MatrixCalcException.java:
--------------------------------------------------------------------------------
1 | package jebl.math;
2 |
3 |
4 | public class MatrixCalcException extends Exception{
5 | public MatrixCalcException() { super(); }
6 | public MatrixCalcException(String message) { super(message); }
7 |
8 | public static class NotSquareMatrixException extends MatrixCalcException {
9 | public NotSquareMatrixException() { super(); }
10 | public NotSquareMatrixException(String message) { super(message); }
11 | }
12 | public static class PositiveDefiniteException extends MatrixCalcException {
13 | public PositiveDefiniteException() { super(); }
14 | public PositiveDefiniteException(String message) { super(message); }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/org/virion/jam/html/HTMLViewer.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.html;
2 |
3 | import javax.swing.*;
4 | import java.awt.*;
5 |
6 | /**
7 | * General-purpose class to display HTML in a standalone frame.
8 | */
9 | public class HTMLViewer extends JFrame {
10 |
11 | private JEditorPane editorPane;
12 |
13 | public HTMLViewer(String title, String html) {
14 | super(title);
15 | getContentPane().setLayout(new BorderLayout());
16 | editorPane = new JEditorPane("text/html", html);
17 | editorPane.setEditable(false);
18 | getContentPane().add(new JScrollPane(editorPane), BorderLayout.CENTER);
19 | }
20 | }
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/jebl/evolution/align/scores/Hamming.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.align.scores;
2 |
3 |
4 | /**
5 | * @author Andrew Rambaut
6 | *
7 | * @version $Id: Hamming.java 185 2006-01-23 23:03:18Z rambaut $
8 | */
9 |
10 | public class Hamming extends NucleotideScores {
11 |
12 | private final float[][] residueScores = {
13 |
14 | /* A C G T U */
15 | { 0},
16 | { -1, 0},
17 | { -1, -1, 0},
18 | { -1, -1, -1, 0},
19 | { -1, -1, -1, 0, 0}};
20 |
21 | public Hamming() { buildScores(residueScores); }
22 |
23 | public String toString() {
24 | return "Hamming (0/-1)";
25 | }
26 | }
--------------------------------------------------------------------------------
/src/org/virion/jam/controlpanels/ControlPalette.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.controlpanels;
2 |
3 | import javax.swing.*;
4 |
5 | /**
6 | * Date: 20/03/2006
7 | * Time: 10:23:21
8 | *
9 | * @author Joseph Heled
10 | * @version $Id: ControlPalette.java 482 2006-10-25 06:30:57Z twobeers $
11 | */
12 | public interface ControlPalette {
13 |
14 | JPanel getPanel();
15 |
16 | void addControlsProvider(ControlsProvider provider, boolean addAtStart);
17 |
18 | void fireControlsChanged();
19 |
20 | void addControlPanelListener(ControlPaletteListener listener);
21 |
22 | void removeControlPanelListener(ControlPaletteListener listener);
23 |
24 | void setupControls();
25 | }
26 |
--------------------------------------------------------------------------------
/src/jade/data/TransitionPenaltyTable.java:
--------------------------------------------------------------------------------
1 | // TransitionPenaltyTable.java
2 | //
3 | // (c) 1999-2001 PAL Development Core Team
4 | //
5 | // This package may be distributed under the
6 | // terms of the Lesser GNU General Public License (LGPL)
7 |
8 |
9 | package jade.data;
10 |
11 |
12 | /**
13 | * Implements a table of transition penalties for a particular datatype.
14 | * Used for alignment scoring.
15 | *
16 | * @version $Id: TransitionPenaltyTable.java,v 1.2 2001/07/13 14:39:13 korbinian Exp $
17 | *
18 | * @author Alexei Drummond
19 | */
20 | public interface TransitionPenaltyTable {
21 |
22 | double penalty(int a, int b);
23 | DataType getDataType();
24 | }
25 |
--------------------------------------------------------------------------------
/src/jebl/evolution/alignments/Alignment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Alignment.java
3 | *
4 | * (c) 2005-2006 JEBL Development Team
5 | *
6 | * This package is distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 | package jebl.evolution.alignments;
10 |
11 | import jebl.evolution.sequences.Sequence;
12 | import jebl.evolution.sequences.Sequences;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * @author Andrew Rambaut
18 | * @author Alexei Drummond
19 | *
20 | * @version $Id: Alignment.java 314 2006-05-03 01:21:14Z alexeidrummond $
21 | */
22 | public interface Alignment extends Sequences, Patterns {
23 |
24 | List getSequenceList();
25 |
26 | int getSiteCount();
27 | }
28 |
--------------------------------------------------------------------------------
/src/jebl/evolution/graphs/Node.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Node.java
3 | *
4 | * (c) 2005 JEBL Development Team
5 | *
6 | * This package is distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 | package jebl.evolution.graphs;
10 |
11 | import jebl.util.Attributable;
12 |
13 | /**
14 | * Represents a node in a graph or tree. In general it is
15 | * used only as a handle to traverse a graph or tree structure and
16 | * it has no methods or instance variables.
17 | *
18 | * @author Andrew Rambaut
19 | * @author Alexei Drummond
20 | *
21 | * @version $Id: Node.java 295 2006-04-14 14:59:10Z rambaut $
22 | */
23 | public interface Node extends Attributable {
24 |
25 | int getDegree();
26 | }
27 |
--------------------------------------------------------------------------------
/src/jebl/evolution/alignments/BootstrappedAlignment.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.alignments;
2 |
3 | import jebl.math.Random;
4 |
5 | /**
6 | * Date: 15/01/2006
7 | * Time: 10:13:50
8 | *
9 | * @author Joseph Heled
10 | * @version $Id: BootstrappedAlignment.java 585 2006-12-15 15:48:59Z twobeers $
11 | *
12 | */
13 | public class BootstrappedAlignment extends ResampledAlignment {
14 |
15 | public BootstrappedAlignment(Alignment srcAlignment) {
16 | final int nSites = srcAlignment.getSiteCount();
17 | int[] sites = new int[nSites];
18 |
19 | for(int n = 0; n < nSites; ++n) {
20 | sites[n] = Random.nextInt(nSites);
21 | }
22 |
23 | init(srcAlignment, sites);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/org/virion/jam/toolbar/ToolbarOptions.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.toolbar;
2 |
3 | /**
4 | * @author rambaut
5 | * Date: Oct 18, 2005
6 | * Time: 10:23:01 PM
7 | */
8 | public final class ToolbarOptions {
9 |
10 | public static final int ICON_AND_TEXT = 0;
11 | public static final int ICON_ONLY = 1;
12 | public static final int TEXT_ONLY = 2;
13 |
14 | public ToolbarOptions(int display, boolean smallSize) {
15 | this.display = display;
16 | this.smallSize = smallSize;
17 | }
18 |
19 | public int getDisplay() {
20 | return display;
21 | }
22 |
23 | public boolean getSmallSize() {
24 | return smallSize;
25 | }
26 |
27 | private int display = ICON_AND_TEXT;
28 | private boolean smallSize = false;
29 | }
30 |
--------------------------------------------------------------------------------
/src/jade/math/ProbDistribution.java:
--------------------------------------------------------------------------------
1 | /*
2 | * ProbDistribution.java
3 | *
4 | * Created on August 9, 2005, 3:09 PM
5 | *
6 | * To change this template, choose Tools | Options and locate the template under
7 | * the Source Creation and Management node. Right-click the template and choose
8 | * Open. You can then make changes to the template in the Source Editor.
9 | */
10 |
11 | package jade.math;
12 |
13 | /**
14 | *
15 | * @author stephensmith
16 | */
17 | public interface ProbDistribution {
18 | /**
19 | *@return double value
20 | */
21 | public double getValue();
22 |
23 | /**
24 | *@return the integral of the probability density function from 0 to x
25 | */
26 | public double getPDF(double x);
27 | }
28 |
--------------------------------------------------------------------------------
/src/jebl/evolution/trees/HashPair.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.trees;
2 |
3 | /**
4 | * A pair suitable for use in a HashMap.
5 | *
6 | * @author Joseph Heled
7 | *
8 | * @version $Id: HashPair.java 544 2006-11-28 00:06:19Z twobeers $
9 | */
10 |
11 | class HashPair {
12 | HashPair(T a, T b) {
13 | first = a;
14 | second = b;
15 | }
16 |
17 | public int hashCode() {
18 | return first.hashCode() + second.hashCode();
19 | }
20 |
21 | public boolean equals(Object x) {
22 | if( x instanceof HashPair ) {
23 | return ((HashPair) x).first.equals(first) && ((HashPair )x).second.equals(second);
24 | }
25 | return false;
26 | }
27 |
28 | public final T first;
29 | public final T second;
30 | }
--------------------------------------------------------------------------------
/src/jebl/evolution/align/MultipleAligner.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.align;
2 |
3 | import jebl.evolution.alignments.Alignment;
4 | import jebl.evolution.sequences.Sequence;
5 | import jebl.evolution.trees.RootedTree;
6 | import jebl.util.ProgressListener;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * @author Joseph Heled
12 | * @version $Id: MultipleAligner.java 482 2006-10-25 06:30:57Z twobeers $
13 | * Date: 6/05/2006 Time: 08:08:22
14 | */
15 | public interface MultipleAligner {
16 | Alignment doAlign(List seqs, RootedTree guideTree, ProgressListener progress);
17 |
18 | Alignment doAlign(Alignment a1, Alignment a2, ProgressListener progress);
19 |
20 | Alignment doAlign(Alignment alignment, Sequence sequence, ProgressListener progress);
21 | }
22 |
--------------------------------------------------------------------------------
/src/jebl/evolution/io/ImmediateSequenceImporter.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.io;
2 |
3 | import jebl.evolution.sequences.Sequence;
4 | import jebl.util.ProgressListener;
5 |
6 | import java.io.IOException;
7 |
8 | /**
9 | *
10 | * A sequence importer sending the sequences back one by one, which makes it
11 | * possible to import larger documents if handled wisely on the other side.
12 | *
13 | * @author Joseph Heled
14 | * @version $Id: ImmediateSequenceImporter.java 465 2006-10-04 04:24:20Z twobeers $
15 | *
16 | */
17 | public interface ImmediateSequenceImporter {
18 | public interface Callback {
19 | void add(Sequence seq);
20 | }
21 |
22 | void importSequences(Callback callback, ProgressListener progressListener) throws IOException, ImportException;
23 | }
24 |
--------------------------------------------------------------------------------
/src/jebl/evolution/io/SequenceImporter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * SequenceImporter.java
3 | *
4 | * (c) 2002-2005 BEAST Development Core Team
5 | *
6 | * This package may be distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 |
10 | package jebl.evolution.io;
11 |
12 | import jebl.evolution.sequences.Sequence;
13 |
14 | import java.io.IOException;
15 | import java.util.List;
16 |
17 | /**
18 | * Interface for importers that do sequences
19 | *
20 | * @author Andrew Rambaut
21 | * @author Alexei Drummond
22 | *
23 | * @version $Id: SequenceImporter.java 442 2006-09-05 21:59:20Z matt_kearse $
24 | */
25 | public interface SequenceImporter {
26 |
27 | /**
28 | * importSequences.
29 | */
30 | List importSequences() throws IOException, ImportException;
31 | }
32 |
--------------------------------------------------------------------------------
/src/jade/reconstruct/area/BayesChain.java:
--------------------------------------------------------------------------------
1 | package jade.reconstruct.area;
2 |
3 | import java.util.*;
4 |
5 | public class BayesChain {
6 | public BayesChain(double disp_sliding_window,double ext_sliding_window){
7 | this.disp_sliding_window = disp_sliding_window;
8 | this.ext_sliding_window = ext_sliding_window;
9 | }
10 | public double score;
11 | public double vag;
12 | public double ext;
13 | public double ext_sliding_window;
14 | public double disp_sliding_window;
15 | public double next_ext(double cur){
16 | return Math.abs(cur -(ext_sliding_window/2)+(ext_sliding_window*ran.nextDouble()));
17 | }
18 | public double next_disp(double cur){
19 | return Math.abs(cur -(disp_sliding_window/2)+(disp_sliding_window*ran.nextDouble()));
20 | }
21 | private Random ran = new Random();
22 | }
23 |
--------------------------------------------------------------------------------
/src/jebl/evolution/io/TreeExporter.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.io;
2 |
3 | import jebl.evolution.alignments.Alignment;
4 | import jebl.evolution.trees.Tree;
5 |
6 | import java.io.IOException;
7 | import java.util.Collection;
8 |
9 | /**
10 | * @author Andrew Rambaut
11 | * @author Alexei Drummond
12 | *
13 | * @version $Id: TreeExporter.java 429 2006-08-26 18:17:39Z rambaut $
14 | */
15 | public interface TreeExporter {
16 |
17 | /**
18 | * Export a single tree
19 | * @param tree
20 | * @throws IOException
21 | */
22 | void exportTree(Tree tree) throws IOException;
23 |
24 | /**
25 | * Export a collection of trees
26 | * @param trees
27 | * @throws IOException
28 | */
29 | void exportTrees(Collection extends Tree> trees) throws IOException;
30 | }
31 |
--------------------------------------------------------------------------------
/src/jade/reconstruct/area/P.java:
--------------------------------------------------------------------------------
1 | /*
2 | * P.java
3 | *
4 | * Created on April 11, 2005, 9:30 PM
5 | */
6 |
7 | package jade.reconstruct.area;
8 |
9 |
10 | /**
11 | *
12 | * @author stephensmith
13 | */
14 | public class P {
15 |
16 | /** Creates a new instance of P */
17 | public P(Q qin) {
18 | q=qin;
19 | me = new MatrixExponential(q.getQ().length);
20 | me.updateByRelativeRates(q.getQ());
21 | }
22 |
23 | public double getRateChangeProbability(int row, int column){
24 | return me.getTransitionProbability(row,column);
25 | }
26 |
27 | public void setBL(double b){
28 | me.setDistance(b);
29 | }
30 |
31 | //private double [][]arr;
32 | //private double bl;
33 | private Q q;
34 | private MatrixExponential me;
35 | }
36 |
--------------------------------------------------------------------------------
/src/jebl/evolution/align/PairwiseAligner.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.align;
2 |
3 | import jebl.evolution.sequences.Sequence;
4 | import jebl.evolution.alignments.Alignment;
5 | import jebl.util.ProgressListener;
6 |
7 | /**
8 | * @author Joseph Heled
9 | * @version $Id: PairwiseAligner.java 315 2006-05-03 02:13:54Z alexeidrummond $
10 | *
11 | */
12 | public interface PairwiseAligner {
13 |
14 | public class Result {
15 | final public Alignment alignment;
16 | final public double score;
17 |
18 | Result(Alignment alignment, double score) {
19 | this.alignment = alignment;
20 | this.score = score;
21 | }
22 | }
23 |
24 | Result doAlignment(Sequence seq1, Sequence seq2, ProgressListener progress);
25 |
26 | double getScore(Sequence seq1, Sequence seq2);
27 | }
28 |
--------------------------------------------------------------------------------
/src/jebl/evolution/sequences/TranslatedSequence.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.sequences;
2 |
3 | /**
4 | * @author rambaut
5 | * Date: Jul 27, 2005
6 | * Time: 12:48:31 AM
7 | */
8 | public class TranslatedSequence extends FilteredSequence {
9 |
10 | public TranslatedSequence(Sequence source, GeneticCode geneticCode) {
11 | super(source);
12 |
13 | this.geneticCode = geneticCode;
14 | }
15 |
16 | protected State[] filterSequence(Sequence source) {
17 | return jebl.evolution.sequences.Utils.translate(source.getStates(), geneticCode);
18 | }
19 |
20 | /**
21 | * @return the type of symbols that this sequence is made up of.
22 | */
23 | public SequenceType getSequenceType() {
24 | return SequenceType.AMINO_ACID;
25 | }
26 |
27 | private final GeneticCode geneticCode;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/src/org/virion/jam/panels/StatusBar.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.panels;
2 |
3 | import javax.swing.*;
4 | import java.awt.*;
5 |
6 | /**
7 | * @author rambaut
8 | * Date: Oct 12, 2004
9 | * Time: 12:18:09 AM
10 | */
11 | public class StatusBar extends StatusPanel {
12 | public StatusBar(String initialText) {
13 | super(initialText);
14 |
15 | setBorder(BorderFactory.createCompoundBorder(
16 | BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray),
17 | BorderFactory.createEmptyBorder(2, 12, 2, 12)));
18 | // panel.setBackground(new Color(0.0F, 0.0F, 0.0F, 0.05F));
19 |
20 | }
21 |
22 | public void paintComponent(Graphics g) {
23 | super.paintComponent(g);
24 | g.setColor(new Color(0.0F, 0.0F, 0.0F, 0.05F));
25 | g.fillRect(0, 0, getWidth(), getHeight());
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/jebl/evolution/sequences/CodonState.java:
--------------------------------------------------------------------------------
1 | /*
2 | * CodonState.java
3 | *
4 | * (c) 2002-2005 JEBL Development Core Team
5 | *
6 | * This package may be distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 | package jebl.evolution.sequences;
10 |
11 | /**
12 | * @author Andrew Rambaut
13 | * @author Alexei Drummond
14 | *
15 | * @version $Id: CodonState.java 225 2006-02-16 14:50:36Z rambaut $
16 | */
17 | public final class CodonState extends State {
18 |
19 | CodonState(String name, String stateCode, int index) {
20 | super(name, stateCode, index);
21 | }
22 |
23 | CodonState(String name, String stateCode, int index, CodonState[] ambiguities) {
24 | super(name, stateCode, index, ambiguities);
25 | }
26 |
27 | public boolean isGap() {
28 | return this == Codons.GAP_STATE;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/jebl/evolution/aligners/Aligner.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.aligners;
2 |
3 | import jebl.evolution.alignments.Alignment;
4 | import jebl.evolution.sequences.Sequence;
5 | import jebl.util.ProgressListener;
6 |
7 | import java.util.Collection;
8 |
9 | /**
10 | *
11 | * As of 2006-12-06, this interface is not used anywhere in JEBL, and it doesn't have
12 | * any implementing classes. It is only a proposed future alternative to the existing
13 | * abstract class Align
14 | *
15 | * @author Andrew Rambaut
16 | * @author Alexei Drummond
17 | * @version $Id: Aligner.java 559 2006-12-06 22:20:38Z twobeers $
18 | */
19 | public interface Aligner {
20 |
21 | Alignment alignSequences(Collection sequences);
22 |
23 | void addProgressListener(ProgressListener listener);
24 |
25 | void removeProgressListener(ProgressListener listener);
26 | }
27 |
--------------------------------------------------------------------------------
/src/jebl/gui/trees/treeviewer/painters/AbstractPainter.java:
--------------------------------------------------------------------------------
1 | package jebl.gui.trees.treeviewer.painters;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * @author Andrew Rambaut
8 | * @version $Id: AbstractPainter.java 181 2006-01-23 17:31:10Z rambaut $
9 | */
10 | public abstract class AbstractPainter implements Painter {
11 | public void addPainterListener(PainterListener listener) {
12 | listeners.add(listener);
13 | }
14 |
15 | public void removePainterListener(PainterListener listener) {
16 | listeners.remove(listener);
17 | }
18 |
19 | public void firePainterChanged() {
20 | for (PainterListener listener : listeners) {
21 | listener.painterChanged();
22 | }
23 | }
24 | private final List listeners = new ArrayList();
25 | }
26 |
--------------------------------------------------------------------------------
/src/org/virion/jam/panels/SearchPanelListener.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.panels;
2 |
3 | /**
4 | * An interface for listeners to the SearchPanel class.
5 | * @author Andrew Rambaut
6 | * Date: Jul 26, 2004
7 | * Time: 5:37:15 PM
8 | */
9 | public interface SearchPanelListener {
10 |
11 | /**
12 | * Called when the user requests a search by pressing return having
13 | * typed a search string into the text field. If the continuousUpdate
14 | * flag is true then this method is called when the user types into
15 | * the text field.
16 | * @param searchString the user's search string
17 | */
18 | void searchStarted(String searchString);
19 |
20 | /**
21 | * Called when the user presses the cancel search button or presses
22 | * escape while the search is in focus.
23 | */
24 | void searchStopped();
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/src/jade/math/IncompleteGammaFunctionSeries.java:
--------------------------------------------------------------------------------
1 | /*
2 | * IncompleteGammaFunctionSeries.java
3 | *
4 | * Created on August 19, 2005, 11:21 AM
5 | *
6 | * author: Stephen A. Smith
7 | */
8 |
9 | package jade.math;
10 |
11 | /**
12 | *
13 | * @author stephensmith
14 | */
15 | public class IncompleteGammaFunctionSeries extends InfiniteSeries{
16 |
17 | /** Creates a new instance of IncompleteGammaFunctionSeries */
18 | public IncompleteGammaFunctionSeries(double x) {
19 | alpha = x;
20 | }
21 |
22 | protected void computeTermAt(int n){
23 | sum += 1;
24 | lastTerm *= x/sum;
25 | return;
26 | }
27 |
28 | protected double initialValue(){
29 | lastTerm = 1/alpha;
30 | sum = alpha;
31 | return lastTerm;
32 | }
33 |
34 | private double alpha;
35 | private double sum;
36 | }
37 |
--------------------------------------------------------------------------------
/src/jade/simulate/ExtinctionFunction.java:
--------------------------------------------------------------------------------
1 | package jade.simulate;
2 |
3 | public class ExtinctionFunction {
4 | public ExtinctionFunction(double intime, double endtime, double value){
5 | start = intime;
6 | end = endtime;
7 | this.value = value;
8 | }
9 | public double getStartTime(){return start;}
10 | public double getEndTime(){return end;}
11 | public double getFunction(){
12 | return value;
13 | }
14 | public void setTimes(double intime, double endtime){
15 | start = intime;
16 | end = endtime;
17 | }
18 | public String toString(){
19 | String x = "";
20 | x = "from "+start+" to "+end+" connection is 0 else extinction is "+value;
21 | return x;
22 | }
23 | //start time
24 | private double start;
25 | //end time
26 | private double end;
27 | //value
28 | private double value;
29 | }
30 |
--------------------------------------------------------------------------------
/src/jade/math/IncompleteGammaFunctionFraction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * IncompleteGammaFunctionFraction.java
3 | *
4 | * Created on August 19, 2005, 12:27 PM
5 | *
6 | * author: Stephen A. Smith
7 | */
8 |
9 | package jade.math;
10 |
11 | /**
12 | *
13 | * @author stephensmith
14 | */
15 | public class IncompleteGammaFunctionFraction extends ContinuedFraction{
16 |
17 | /** Creates a new instance of IncompleteGammaFunctionFraction */
18 | public IncompleteGammaFunctionFraction(double a) {
19 | alpha = a;
20 | }
21 |
22 | protected void computeFactorsAt(int n){
23 | sum+=2;
24 | factors[0] = (alpha-n)*n;
25 | factors[1] = sum;
26 | return;
27 | }
28 |
29 | protected double initialValue(){
30 | sum = x-alpha+1;
31 | return sum;
32 | }
33 |
34 | private double alpha;
35 | private double sum;
36 | }
37 |
--------------------------------------------------------------------------------
/src/org/virion/jam/demo/DemoMenuBarFactory.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.demo;
2 |
3 | import org.virion.jam.framework.*;
4 | import org.virion.jam.mac.*;
5 | import org.virion.jam.demo.menus.DemoMenuFactory;
6 |
7 |
8 | public class DemoMenuBarFactory extends DefaultMenuBarFactory {
9 |
10 | public DemoMenuBarFactory() {
11 | if (org.virion.jam.mac.Utils.isMacOSX()) {
12 | registerMenuFactory(new MacFileMenuFactory(true));
13 | registerMenuFactory(new DefaultEditMenuFactory());
14 | registerMenuFactory(new DemoMenuFactory());
15 | registerMenuFactory(new MacWindowMenuFactory());
16 | registerMenuFactory(new MacHelpMenuFactory());
17 | } else {
18 | registerMenuFactory(new DefaultFileMenuFactory(true));
19 | registerMenuFactory(new DefaultEditMenuFactory());
20 | registerMenuFactory(new DemoMenuFactory());
21 | registerMenuFactory(new DefaultHelpMenuFactory());
22 | }
23 | }
24 |
25 | }
--------------------------------------------------------------------------------
/src/jebl/evolution/substmodel/AminoAcidModel.java:
--------------------------------------------------------------------------------
1 | // AminoAcidModel.java
2 | //
3 | // (c) 1999-2001 PAL Development Core Team
4 | //
5 | // This package may be distributed under the
6 | // terms of the Lesser GNU General Public License (LGPL)
7 |
8 | package jebl.evolution.substmodel;
9 |
10 | import jebl.evolution.sequences.SequenceType;
11 |
12 |
13 | /**
14 | * base class of rate matrices for amino acids
15 | *
16 | * @version $Id: AminoAcidModel.java 185 2006-01-23 23:03:18Z rambaut $
17 | *
18 | * @author Korbinian Strimmer
19 | */
20 | public abstract class AminoAcidModel extends AbstractRateMatrix
21 | {
22 |
23 | //
24 | // Protected stuff
25 | //
26 |
27 | // Constructor
28 | protected AminoAcidModel(double[] f)
29 | {
30 | // Dimension = 20
31 | super(20);
32 |
33 | setSequenceType(SequenceType.AMINO_ACID);
34 | setFrequencies(f);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/jebl/evolution/alignments/JackknifedAlignment.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.alignments;
2 |
3 | import jebl.math.Random;
4 |
5 | /**
6 | * Date: 17/01/2006
7 | * Time: 08:18:32
8 | *
9 | * @author Joseph Heled
10 | * @version $Id: JackknifedAlignment.java 482 2006-10-25 06:30:57Z twobeers $
11 | *
12 | */
13 | public class JackknifedAlignment extends ResampledAlignment {
14 | public JackknifedAlignment(Alignment srcAlignment, double percent) {
15 | final int nSites = srcAlignment.getSiteCount();
16 | final int nNewSites = (int)Math.ceil(nSites * percent);
17 | int[] sites = new int[nSites];
18 |
19 | for(int n = 0; n < nSites; ++n) {
20 | sites[n] = n;
21 | }
22 |
23 | Random.shuffle(sites);
24 |
25 | int[] newSites = new int[nNewSites];
26 | System.arraycopy(sites, 0, newSites, 0, nNewSites);
27 | init(srcAlignment, newSites);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/org/virion/jam/framework/MultiDocMenuBarFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 Biomatters LTD. All Rights Reserved.
3 | */
4 |
5 | package org.virion.jam.framework;
6 |
7 | import org.virion.jam.mac.MacFileMenuFactory;
8 | import org.virion.jam.mac.MacHelpMenuFactory;
9 | import org.virion.jam.mac.MacWindowMenuFactory;
10 |
11 |
12 | public class MultiDocMenuBarFactory extends DefaultMenuBarFactory {
13 |
14 |
15 | public MultiDocMenuBarFactory() {
16 | if (org.virion.jam.mac.Utils.isMacOSX()) {
17 | registerMenuFactory(new MacFileMenuFactory(true));
18 | registerMenuFactory(new DefaultEditMenuFactory());
19 | registerMenuFactory(new MacHelpMenuFactory());
20 | registerMenuFactory(new MacWindowMenuFactory());
21 | } else {
22 | registerMenuFactory(new DefaultFileMenuFactory(true));
23 | registerMenuFactory(new DefaultEditMenuFactory());
24 | registerMenuFactory(new DefaultHelpMenuFactory());
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/src/org/virion/jam/framework/SingleDocMenuBarFactory.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2005 Biomatters LTD. All Rights Reserved.
3 | */
4 |
5 | package org.virion.jam.framework;
6 |
7 | import org.virion.jam.mac.MacFileMenuFactory;
8 | import org.virion.jam.mac.MacHelpMenuFactory;
9 | import org.virion.jam.mac.MacWindowMenuFactory;
10 |
11 |
12 | public class SingleDocMenuBarFactory extends DefaultMenuBarFactory {
13 |
14 | public SingleDocMenuBarFactory() {
15 | if (org.virion.jam.mac.Utils.isMacOSX()) {
16 | registerMenuFactory(new MacFileMenuFactory(false));
17 | registerMenuFactory(new DefaultEditMenuFactory());
18 | registerMenuFactory(new MacWindowMenuFactory());
19 | registerMenuFactory(new MacHelpMenuFactory());
20 | } else {
21 | registerMenuFactory(new DefaultFileMenuFactory(false));
22 | registerMenuFactory(new DefaultEditMenuFactory());
23 | registerMenuFactory(new DefaultHelpMenuFactory());
24 | }
25 | }
26 |
27 | }
--------------------------------------------------------------------------------
/src/jebl/util/AttributableHelper.java:
--------------------------------------------------------------------------------
1 | package jebl.util;
2 |
3 | import java.util.Collections;
4 | import java.util.HashMap;
5 | import java.util.Map;
6 | import java.util.Set;
7 |
8 | /**
9 | * @author rambaut
10 | * Date: Nov 27, 2005
11 | * Time: 1:31:50 PM
12 | */
13 | public class AttributableHelper implements Attributable {
14 |
15 | public void setAttribute(String name, Object value) {
16 | attributeMap.put(name, value);
17 | }
18 |
19 | public Object getAttribute(String name) {
20 | return attributeMap.get(name);
21 | }
22 |
23 | public void removeAttribute(String name) {
24 | attributeMap.remove(name);
25 | }
26 |
27 | public Set getAttributeNames() {
28 | return attributeMap.keySet();
29 | }
30 |
31 | public Map getAttributeMap() {
32 | return Collections.unmodifiableMap(attributeMap);
33 | }
34 |
35 | Map attributeMap = new HashMap();
36 | }
37 |
38 |
--------------------------------------------------------------------------------
/src/jade/runners/ConcatMain.java:
--------------------------------------------------------------------------------
1 | package jade.runners;
2 |
3 | import java.util.*;
4 |
5 | import jade.data.*;
6 |
7 | public class ConcatMain {
8 | public ConcatMain(String [] args){
9 | if(args.length<1){
10 | printInfo();
11 | System.exit(0);
12 | }
13 | else{
14 | ArrayList files = new ArrayList();
15 | for(int i=0;i
9 | * created on 04.12.2006 15:15:54
10 | */
11 | public enum IllegalCharacterPolicy {
12 | abort("Abort"),
13 | strip("Strip offending characters"),
14 | askUser("Ask");
15 |
16 | public final String description;
17 | IllegalCharacterPolicy(String description) {
18 | this.description = description;
19 | }
20 |
21 | public static IllegalCharacterPolicy instanceOf(String description) {
22 | for (IllegalCharacterPolicy p : values()) {
23 | if (p.description.equals(description)) {
24 | return p;
25 | }
26 | }
27 | return null;
28 | }
29 |
30 | public String toString() {
31 | return description;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/org/virion/jam/framework/MenuFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * MenuBarFactory.java
3 | */
4 |
5 | package org.virion.jam.framework;
6 |
7 | import javax.swing.*;
8 |
9 | public interface MenuFactory {
10 |
11 | public final static int LEFT = 0;
12 | public final static int CENTER = 1;
13 | public final static int RIGHT = 2;
14 |
15 | /**
16 | * Give the name of this menu. If multiple MenuFactories are
17 | * registered with the same name, then these will be appended
18 | * into a single actual menu.
19 | */
20 | String getMenuName();
21 |
22 | /**
23 | * This method should populate the menu with menu items. Reference
24 | * can be made to the frame in order to get Actions.
25 | * @param menu
26 | * @param frame
27 | */
28 | void populateMenu(JMenu menu, AbstractFrame frame);
29 |
30 | /**
31 | * Returns the preferred alignment of the menu in the menu bar. This
32 | * should be one of MenuFactory.LEFT, MenuFactory.CENTER or MenuFactory.RIGHT.
33 | * @return the alignment
34 | */
35 | int getPreferredAlignment();
36 | }
--------------------------------------------------------------------------------
/src/org/virion/jam/util/SimpleLongTask.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.util;
2 |
3 | public abstract class SimpleLongTask extends LongTask {
4 |
5 | boolean background = false;
6 | private SwingWorker worker = null;
7 | public int current = 0;
8 | public int length = 1;
9 | public boolean pleaseStop = false;
10 | public String message = "";
11 | public String description = "";
12 |
13 | /**
14 | * Called to find out how much work needs
15 | * to be done.
16 | */
17 | public int getLengthOfTask() {
18 | return length;
19 | }
20 |
21 | /**
22 | * Called to find out how much has been done.
23 | */
24 | public int getCurrent() {
25 | return current;
26 | }
27 |
28 | /**
29 | * Called to stop task.
30 | */
31 | public void stop() {
32 | pleaseStop = true;
33 | }
34 |
35 | public String getMessage() {
36 | return message;
37 | }
38 |
39 | public String getDescription() {
40 | return description;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/jebl/math/UnivariateFunction.java:
--------------------------------------------------------------------------------
1 | // UnivariateFunction.java
2 | //
3 | // (c) 2006- JEBL development team
4 | //
5 | // based on LGPL code from the Phylogenetic Analysis Library (PAL),
6 | // http://www.cebl.auckland.ac.nz/pal-project/
7 | // which is (c) 1999-2001 PAL Development Core Team
8 | //
9 | // This package may be distributed under the
10 | // terms of the Lesser GNU General Public License (LGPL)
11 |
12 |
13 | package jebl.math;
14 |
15 |
16 | /**
17 | * interface for a function of one variable
18 | *
19 | * @author Korbinian Strimmer
20 | */
21 | public interface UnivariateFunction
22 | {
23 | /**
24 | * compute function value
25 | *
26 | * @param argument function argument
27 | *
28 | * @return function value
29 | */
30 | double evaluate(double argument);
31 |
32 | /**
33 | * get lower bound of argument
34 | *
35 | * @return lower bound
36 | */
37 | double getLowerBound();
38 |
39 | /**
40 | * get upper bound of argument
41 | *
42 | * @return upper bound
43 | */
44 | double getUpperBound();
45 | }
46 |
--------------------------------------------------------------------------------
/src/jebl/gui/trees/treeviewer_dev/painters/AbstractPainter.java:
--------------------------------------------------------------------------------
1 | package jebl.gui.trees.treeviewer_dev.painters;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * @author Andrew Rambaut
8 | * @version $Id: AbstractPainter.java 373 2006-07-01 15:18:27Z rambaut $
9 | */
10 | public abstract class AbstractPainter implements Painter {
11 | public void addPainterListener(PainterListener listener) {
12 | listeners.add(listener);
13 | }
14 |
15 | public void removePainterListener(PainterListener listener) {
16 | listeners.remove(listener);
17 | }
18 |
19 | public void firePainterChanged() {
20 | for (PainterListener listener : listeners) {
21 | listener.painterChanged();
22 | }
23 | }
24 |
25 | public void firePainterSettingsChanged() {
26 | for (PainterListener listener : listeners) {
27 | listener.painterSettingsChanged();
28 | }
29 | }
30 |
31 | private final List listeners = new ArrayList();
32 | }
33 |
--------------------------------------------------------------------------------
/src/org/virion/jam/html/SimpleLinkListener.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.html;
2 |
3 |
4 | import javax.swing.event.*;
5 |
6 | import org.virion.jam.util.BrowserLauncher;
7 |
8 | /**
9 | * iSeek prototype. Codename seekquence.
10 | *
11 | * This class listens to Hyperlink Events, and opens the url in a browser window.
12 | *
13 | * Open a browser from a Java application on Windows, Unix, or Macintosh.
14 | * see http://ostermiller.org/utils/Browser.html for more information
15 | *
16 | * @author Nasser
17 | * @version $Id: SimpleLinkListener.java 183 2006-01-23 21:29:48Z rambaut $
18 | * Date: 26/01/2005
19 | * Time: 11:54:50
20 | */
21 | public class SimpleLinkListener implements HyperlinkListener {
22 |
23 | public void hyperlinkUpdate(HyperlinkEvent he) {
24 |
25 | if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
26 | try{
27 | BrowserLauncher.openURL(he.getDescription());
28 | }catch(Exception ioe){
29 | ioe.printStackTrace();
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/jade/math/InfiniteSeries.java:
--------------------------------------------------------------------------------
1 | /*
2 | * InfiniteSeries.java
3 | *
4 | * Created on August 19, 2005, 11:24 AM
5 | *
6 | * author: Stephen A. Smith
7 | */
8 |
9 | package jade.math;
10 |
11 | /**
12 | *
13 | * @author stephensmith
14 | */
15 | public abstract class InfiniteSeries extends IterativeProcess{
16 |
17 | /** Creates a new instance of InfiniteSeries */
18 | public InfiniteSeries() {
19 | }
20 |
21 | protected abstract void computeTermAt(int n);
22 | public double evaluateIteration(){
23 | computeTermAt(getIterations());
24 | result+=lastTerm;
25 | return relativePrecision(Math.abs(lastTerm), Math.abs(result));
26 | }
27 | public double getResult(){
28 | return result;
29 | }
30 | public void initializeIterations(){
31 | result = initialValue();
32 | }
33 | protected abstract double initialValue();
34 | public void setArgument(double r){
35 | x = r;
36 | return;
37 | }
38 |
39 | private double result;
40 | protected double x;
41 | protected double lastTerm;
42 | }
43 |
--------------------------------------------------------------------------------
/src/jebl/evolution/alignments/Patterns.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Patterns.java
3 | *
4 | * (c) 2005 JEBL Development Team
5 | *
6 | * This package is distributed under the
7 | * Lesser Gnu Public Licence (LGPL)
8 | */
9 | package jebl.evolution.alignments;
10 |
11 | import jebl.evolution.sequences.SequenceType;
12 | import jebl.evolution.taxa.Taxon;
13 |
14 | import java.util.List;
15 |
16 | /**
17 | * An interface representing a set of site patterns.
18 | *
19 | * @author Andrew Rambaut
20 | * @author Alexei Drummond
21 | *
22 | * @version $Id: Patterns.java 185 2006-01-23 23:03:18Z rambaut $
23 | */
24 | public interface Patterns {
25 |
26 | int getPatternCount();
27 |
28 | int getPatternLength();
29 |
30 | /**
31 | * Get a list of all the patterns
32 | * @return the list
33 | */
34 | List getPatterns();
35 |
36 | /**
37 | * @return the list of taxa that the state values correspond to.
38 | */
39 | List getTaxa();
40 |
41 | /**
42 | * @return the data type of the states in these site patterns.
43 | */
44 | SequenceType getSequenceType();
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/src/org/virion/jam/mac/MacWindowMenuFactory.java:
--------------------------------------------------------------------------------
1 | package org.virion.jam.mac;
2 |
3 | import org.virion.jam.framework.MenuFactory;
4 | import org.virion.jam.framework.AbstractFrame;
5 | import org.virion.jam.framework.Application;
6 | import org.virion.jam.framework.MenuBarFactory;
7 |
8 | import javax.swing.*;
9 | import java.awt.event.KeyEvent;
10 |
11 | /**
12 | * @author rambaut
13 | * Date: Dec 26, 2004
14 | * Time: 11:03:39 AM
15 | */
16 | public class MacWindowMenuFactory implements MenuFactory {
17 | public String getMenuName() {
18 | return "Window";
19 | }
20 |
21 | public void populateMenu(JMenu menu, AbstractFrame frame) {
22 |
23 | Application application = Application.getApplication();
24 |
25 | JMenuItem item;
26 |
27 | item = new JMenuItem(frame.getZoomWindowAction());
28 | menu.add(item);
29 |
30 | item = new JMenuItem(frame.getMinimizeWindowAction());
31 | item.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, MenuBarFactory.MENU_MASK));
32 | menu.add(item);
33 |
34 | }
35 |
36 | public int getPreferredAlignment() {
37 | return RIGHT;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/jebl/evolution/treemetrics/BilleraMetric.java:
--------------------------------------------------------------------------------
1 | package jebl.evolution.treemetrics;
2 |
3 | import jebl.evolution.taxa.Taxon;
4 | import jebl.evolution.trees.RootedTree;
5 | import jebl.evolution.trees.TreeBiPartitionInfo;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | /**
11 | * Billera tree distance - sum of change in branch lengths required to transform one tree to the second
12 | *
13 | * Note that this interface is not optimal for a large set where all pairs are required.
14 | * Creating TreeBiPartitionInfo's as a pre step is better unless memory is an issue.
15 | *
16 | * @author Joseph Heled
17 | * @version $Id$
18 | */
19 | public class BilleraMetric implements RootedTreeMetric {
20 | public double getMetric(RootedTree tree1, RootedTree tree2) {
21 | List taxa = new ArrayList(tree1.getTaxa());
22 | TreeBiPartitionInfo p1 = new TreeBiPartitionInfo(tree1, taxa);
23 | TreeBiPartitionInfo p2 = new TreeBiPartitionInfo(tree2, taxa);
24 | return TreeBiPartitionInfo.distance(p1, p2, TreeBiPartitionInfo.DistanceNorm.NORM1);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/jade/math/NormalDistribution.java:
--------------------------------------------------------------------------------
1 | /*
2 | * NormalDistribution.java
3 | *
4 | * Created on August 9, 2005, 3:24 PM
5 | *
6 | * author: Stephen A. Smith
7 | */
8 |
9 | package jade.math;
10 |
11 | import java.util.*;
12 | /**
13 | *
14 | * @author stephensmith
15 | */
16 | public class NormalDistribution implements ProbDistribution{
17 |
18 | /** Creates a new instance of NormalDistribution */
19 | public NormalDistribution() {
20 | }
21 |
22 | public NormalDistribution(double mean, double stdev){
23 | this.mean = mean;
24 | this.stdev = stdev;
25 | }
26 |
27 | public void setStDev(double stdev){ this.stdev = stdev; }
28 |
29 | public void setMean(double mean){ this.mean = mean; }
30 |
31 | public double getValue(){
32 | return (r.nextGaussian()*stdev)+mean;
33 | }
34 |
35 | public double getPDF(double x){
36 | //add error function
37 | return (x-mean)/stdev;
38 | }
39 |
40 | //private methods
41 | private double stdev;
42 | private double mean;
43 | private Random r = new Random();
44 | }
45 |
--------------------------------------------------------------------------------
/src/org/virion/jam/panels/RuleModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | * RuleModel.java
3 | */
4 |
5 | package org.virion.jam.panels;
6 |
7 |
8 | /**
9 | * RuleModel.
10 | *
11 | * @author Andrew Rambaut
12 | * @version $Id: RuleModel.java 182 2006-01-23 21:24:01Z rambaut $
13 | */
14 |
15 |
16 | public interface RuleModel {
17 |
18 | /**
19 | * Returns an array of strings to be presented as a combo box which
20 | * are available fields to define rules on.
21 | *
22 | * @return the field names
23 | */
24 | Object[] getFields();
25 |
26 | /**
27 | * Returns an array of strings to be presented as a combo box which
28 | * are possible rule conditions for the specified field.
29 | *
30 | * @return the condition names
31 | */
32 | Object[] getConditions(Object field);
33 |
34 | /**
35 | * Returns an array of strings to be presented as a combo box which
36 | * are possible values for the field. Should return null if a text
37 | * box is required.
38 | *
39 | * @return the values
40 | */
41 | Object[] getValues(Object field, Object condition);
42 |
43 | }
--------------------------------------------------------------------------------
/src/org/virion/jam/console/ConsoleMenuBarFactory.java:
--------------------------------------------------------------------------------
1 | /**
2 | * ConsoleMenuBarFactory.java
3 | */
4 |
5 | package org.virion.jam.console;
6 |
7 | import org.virion.jam.framework.*;
8 | import org.virion.jam.mac.MacFileMenuFactory;
9 | import org.virion.jam.mac.MacHelpMenuFactory;
10 | import org.virion.jam.mac.MacWindowMenuFactory;
11 |
12 | public class ConsoleMenuBarFactory extends DefaultMenuBarFactory {
13 |
14 | public ConsoleMenuBarFactory() {
15 | // org.virion stuff shouldn't be called from here - it's a separate project!
16 |
17 | // no its not. This class is part of JAM.
18 | if (org.virion.jam.mac.Utils.isMacOSX()) {
19 | //if (System.getProperty("mrj.version") != null) {
20 | registerMenuFactory(new MacFileMenuFactory(false));
21 | registerMenuFactory(new DefaultEditMenuFactory());
22 | registerMenuFactory(new MacWindowMenuFactory());
23 | registerMenuFactory(new MacHelpMenuFactory());
24 | } else {
25 | registerMenuFactory(new DefaultFileMenuFactory(false));
26 | registerMenuFactory(new DefaultEditMenuFactory());
27 | registerMenuFactory(new DefaultHelpMenuFactory());
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/src/jade/data/DataType.java:
--------------------------------------------------------------------------------
1 | package jade.data;
2 |
3 | public interface DataType {
4 | char UNKNOWN_CHARACTER = '?';
5 |
6 | char DEFAULT_GAP_CHARACTER = '-';
7 |
8 | /*
9 | * types of data
10 | */
11 | int BINARYDATATYPE = 0;
12 |
13 | int NUCLEOTIDEDATATYPE = 1;
14 |
15 | int NUMERICDATATYPE = 2;
16 |
17 | int CONTDATATYPE = 3;
18 |
19 | int UNKNOWN = 666;
20 |
21 | char[] SUGGESTED_GAP_CHARACTERS = { DEFAULT_GAP_CHARACTER, '_', '.' };
22 |
23 | int SUGGESTED_GAP_STATE = -2;
24 |
25 | int SUGGESTED_UNKNOWN_STATE = -1;
26 |
27 | String NUCLEOTIDE_DESCRIPTION = "nucleotide";
28 |
29 | String BINARY_DESCRIPTION = "binary";
30 |
31 | String GAP_BALANCED_DESCRIPTION = "gap balanced";
32 |
33 | String getDescription();
34 |
35 | int getState(char c);
36 |
37 | char getChar(int state);
38 |
39 | int getNumStates();
40 |
41 | char getSuggestedChar(char c);
42 |
43 | int getTypeID();
44 |
45 | boolean isUnknownState(int state);
46 |
47 | boolean isUnknownChar(char c);
48 |
49 | boolean hasGapCharacter();
50 |
51 | boolean isGapChar(char c);
52 |
53 | boolean isGapState(int state);
54 |
55 | int getSuggestedGapState();
56 |
57 | int getSuggestedUnknownState();
58 | }
59 |
--------------------------------------------------------------------------------
/src/jebl/gui/trees/treeviewer/decorators/AttributeBranchDecorator.java:
--------------------------------------------------------------------------------
1 | package jebl.gui.trees.treeviewer.decorators;
2 |
3 | import jebl.evolution.graphs.Node;
4 | import jebl.evolution.trees.Tree;
5 |
6 | import java.awt.*;
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | /**
11 | * @author Andrew Rambaut
12 | * @version $Id: AttributeBranchDecorator.java 181 2006-01-23 17:31:10Z rambaut $
13 | */
14 | public class AttributeBranchDecorator implements BranchDecorator {
15 | public AttributeBranchDecorator(String attributeName, Map