|
| 1 | +/* |
| 2 | + * BioJava development code |
| 3 | + * |
| 4 | + * This code may be freely distributed and modified under the |
| 5 | + * terms of the GNU Lesser General Public Licence. This should |
| 6 | + * be distributed with the code. If you do not have a copy, |
| 7 | + * see: |
| 8 | + * |
| 9 | + * http://www.gnu.org/copyleft/lesser.html |
| 10 | + * |
| 11 | + * Copyright for this code is held jointly by the individual |
| 12 | + * authors. These should be listed in @author doc comments. |
| 13 | + * |
| 14 | + * For more information on the BioJava project and its aims, |
| 15 | + * or to join the biojava-l mailing list, visit the home page |
| 16 | + * at: |
| 17 | + * |
| 18 | + * http://www.biojava.org/ |
| 19 | + * |
| 20 | + */ |
| 21 | +package org.biojava.nbio.alignment; |
| 22 | + |
| 23 | +import static org.junit.Assert.*; |
| 24 | + |
| 25 | +import org.biojava.nbio.core.alignment.template.Profile; |
| 26 | +import org.biojava.nbio.core.exceptions.CompoundNotFoundException; |
| 27 | +import org.biojava.nbio.core.sequence.DNASequence; |
| 28 | +import org.biojava.nbio.core.sequence.compound.NucleotideCompound; |
| 29 | +import org.biojava.nbio.core.util.ConcurrencyTools; |
| 30 | +import org.junit.Before; |
| 31 | +import org.junit.Ignore; |
| 32 | +import org.junit.Test; |
| 33 | + |
| 34 | +import java.util.ArrayList; |
| 35 | +import java.util.List; |
| 36 | + |
| 37 | +public class TestSubOptimalMSA { |
| 38 | + |
| 39 | + private List<DNASequence> sequences = new ArrayList<DNASequence>(); |
| 40 | + |
| 41 | + @Before |
| 42 | + public void setUp() { |
| 43 | + try { |
| 44 | + sequences.add(new DNASequence("TTGGGGCCTCTAAACGGGGTCTT")); |
| 45 | + sequences.add(new DNASequence("TTGGGGCCTCTAAACGGGTCTT")); |
| 46 | + sequences.add(new DNASequence("TTGGGGCTCTAACGGGTCTT")); |
| 47 | + } catch (CompoundNotFoundException e) { |
| 48 | + e.printStackTrace(); |
| 49 | + } |
| 50 | + } |
| 51 | + |
| 52 | + @Test |
| 53 | + public void gapPenalty52() { |
| 54 | + SimpleGapPenalty gapP = new SimpleGapPenalty((short) 5, (short) 2); |
| 55 | + Profile<DNASequence, NucleotideCompound> msa = Alignments |
| 56 | + .getMultipleSequenceAlignment(sequences, gapP); |
| 57 | + |
| 58 | + assertEquals("TTGGGGCCTCTAAACGGGGTCTT\n" |
| 59 | + + "TTGGGGCCTCTAAACGGG-TCTT\n" |
| 60 | + + "TTGGGGC-TCTAA-CGGG-TCTT\n", |
| 61 | + msa.toString()); |
| 62 | + |
| 63 | + ConcurrencyTools.shutdown(); |
| 64 | + } |
| 65 | + |
| 66 | + @Test @Ignore |
| 67 | + public void gapPenaltyDefault() { |
| 68 | + // Default is currently 10-1 |
| 69 | + SimpleGapPenalty gapP = new SimpleGapPenalty((short) 10, (short) 1); |
| 70 | + Profile<DNASequence, NucleotideCompound> msa = Alignments |
| 71 | + .getMultipleSequenceAlignment(sequences, gapP); |
| 72 | + |
| 73 | + // TODO test not passing (see issue 288 in github) - Aleix 03.2016 |
| 74 | + assertEquals("TTGGGGCCTCTAAACGGGGTCTT\n" |
| 75 | + + "TTGGGGCCTCTAAACGGG-TCTT\n" |
| 76 | + + "TTGGGGC-TCTAA-CGGG-TCTT\n", |
| 77 | + msa.toString()); |
| 78 | + |
| 79 | + ConcurrencyTools.shutdown(); |
| 80 | + } |
| 81 | +} |
0 commit comments