Skip to content

Commit ecf75d3

Browse files
committed
Added Hsp.getAlignment() test
1 parent 38a811a commit ecf75d3

File tree

1 file changed

+114
-0
lines changed
  • biojava-core/src/test/java/org/biojava/nbio/core/search/io

1 file changed

+114
-0
lines changed
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* To change this license header, choose License Headers in Project Properties.
3+
* To change this template file, choose Tools | Templates
4+
* and open the template in the editor.
5+
*/
6+
package org.biojava.nbio.core.search.io;
7+
8+
import org.biojava.nbio.alignment.template.SequencePair;
9+
import org.biojava.nbio.core.search.io.blast.BlastHspBuilder;
10+
import org.biojava.nbio.core.sequence.DNASequence;
11+
import org.biojava.nbio.core.sequence.compound.NucleotideCompound;
12+
import org.junit.After;
13+
import org.junit.AfterClass;
14+
import org.junit.Before;
15+
import org.junit.BeforeClass;
16+
import org.junit.Test;
17+
import static org.junit.Assert.*;
18+
import org.junit.Ignore;
19+
20+
/**
21+
*
22+
* @author pavanpa
23+
*/
24+
public class HspTest {
25+
26+
Hsp hspImpl = new BlastHspBuilder()
27+
.setHspNum(1)
28+
.setHspBitScore(377.211)
29+
.setHspEvalue(8.04143e-093)
30+
.setHspQueryFrom(1)
31+
.setHspQueryTo(224)
32+
.setHspHitFrom(1035)
33+
.setHspHitTo(811)
34+
.setHspQueryFrame(-1)
35+
.setHspIdentity(213)
36+
.setHspPositive(213)
37+
.setHspGaps(5)
38+
.setHspAlignLen(227)
39+
.setHspQseq("CTGACGACAGCCATGCACCACCTGTCTCGACTTTCCCCCGAAGGGCACCTAATGTATCTCTACCTCGTTAGTCGGATGTCAAGACCTGGTAAGGTTTTTTCGCGTATCTTCGAATTAAACCACATACTCCACTGCTTGTGCGG-CCCCCGTCAATTCCTTTGAGTTTCAACCTTGCGGCCGTACTCCC-AGGTGGA-TACTTATTGTGTTAACTCCGGCACGGAAGG")
40+
.setHspHseq("CTGACGACAACCATGCACCACCTGTCTCAACTTTCCCC-GAAGGGCACCTAATGTATCTCTACTTCGTTAGTTGGATGTCAAGACCTGGTAAGGTT-CTTCGCGTTGCTTCGAATTAAACCACATACTCCACTGCTTGTGCGGGCCCCCGTCAATTCCTTTGAGTTTCAACCTTGCGGTCGTACTCCCCAGGTGGATTACTTATTGTGTTAACTCCGGCACAGAAGG")
41+
.setHspIdentityString("||||||||| |||||||||||||||||| ||||||||| |||||||||||||||||||||||| |||||||| ||||||||||||||||||||||| ||||||| |||||||||||||||||||||||||||||||||||| |||||||||||||||||||||||||||||||||| ||||||||| ||||||| |||||||||||||||||||||||| |||||")
42+
.createBlastHsp();
43+
44+
public HspTest() {
45+
}
46+
47+
@BeforeClass
48+
public static void setUpClass() {
49+
}
50+
51+
@AfterClass
52+
public static void tearDownClass() {
53+
}
54+
55+
@Before
56+
public void setUp() {
57+
}
58+
59+
@After
60+
public void tearDown() {
61+
}
62+
63+
/**
64+
* Test of hashCode method, of class Hsp.
65+
*/
66+
@Test
67+
@Ignore public void testHashCode() {
68+
System.out.println("hashCode");
69+
Hsp instance = null;
70+
int expResult = 0;
71+
int result = instance.hashCode();
72+
assertEquals(expResult, result);
73+
// TODO review the generated test code and remove the default call to fail.
74+
fail("The test case is a prototype.");
75+
}
76+
77+
/**
78+
* Test of equals method, of class Hsp.
79+
*/
80+
@Test
81+
@Ignore public void testEquals() {
82+
System.out.println("equals");
83+
Object o = null;
84+
Hsp instance = null;
85+
boolean expResult = false;
86+
boolean result = instance.equals(o);
87+
assertEquals(expResult, result);
88+
// TODO review the generated test code and remove the default call to fail.
89+
fail("The test case is a prototype.");
90+
}
91+
92+
/**
93+
* Test of getAlignment method, of class Hsp.
94+
*/
95+
@Test
96+
public void testGetAlignment() {
97+
System.out.println("getAlignment");
98+
99+
SequencePair<DNASequence, NucleotideCompound> aln = hspImpl.getAlignment();
100+
101+
StringBuilder s = new StringBuilder();
102+
s.append(hspImpl.getHspQseq());
103+
s.append(String.format("%n"));
104+
s.append(hspImpl.getHspHseq());
105+
s.append(String.format("%n"));
106+
107+
String expResult = s.toString();
108+
109+
String result = aln.toString();
110+
111+
assertEquals(expResult, result);
112+
}
113+
114+
}

0 commit comments

Comments
 (0)