X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=test%2Fjalview%2Fanalysis%2FDnaAlignmentGenerator.java;h=60dd929ec22836871c1d0c0fb94080a64d142d2e;hb=95ebbef7b78bf266a8252bd479510be3c80cd234;hp=1b8964fb4bfd5d4eb4fe4dc5f18d3fc8a4dce21a;hpb=be32c14cd8e48fe0a207cd7030cb9cd46f894678;p=jalview.git diff --git a/test/jalview/analysis/DnaAlignmentGenerator.java b/test/jalview/analysis/DnaAlignmentGenerator.java index 1b8964f..60dd929 100644 --- a/test/jalview/analysis/DnaAlignmentGenerator.java +++ b/test/jalview/analysis/DnaAlignmentGenerator.java @@ -1,14 +1,37 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.analysis; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; +import jalview.gui.JvOptionPane; import jalview.io.FastaFile; import java.util.Arrays; import java.util.Random; +import org.testng.annotations.BeforeClass; + /** * Generates, and outputs in Fasta format, a random DNA alignment for given * sequence length and count. Will regenerate the same alignment each time if @@ -30,15 +53,23 @@ import java.util.Random; */ public class DnaAlignmentGenerator { + + @BeforeClass(alwaysRun = true) + public void setUpJvOptionPane() + { + JvOptionPane.setInteractiveMode(false); + JvOptionPane.setMockResponse(JvOptionPane.CANCEL_OPTION); + } + private static final char GAP = '-'; private static final char ZERO = '0'; - private static final char[] BASES = new char[] - { 'G', 'T', 'C', 'A' }; + private static final char[] BASES = new char[] { 'G', 'T', 'C', 'A' }; private Random random; - + + /** * Outputs a DNA 'alignment' where each position is a random choice from * 'GTCA-'. @@ -64,7 +95,7 @@ public class DnaAlignmentGenerator + " bases with " + gapPercentage + "% gaps and " + changePercentage + "% mutations (random seed = " + randomSeed + ")"); - System.out.println(new FastaFile().print(al.getSequencesArray())); + System.out.println(new FastaFile().print(al.getSequencesArray(), true)); } /**