Skip to content

Commit 3f87f06

Browse files
committed
new unit test for stockholm file parsing
git-svn-id: http://code.open-bio.org/repos/biojava/biojava-live/trunk@9836 7c6358e6-4a41-0410-a743-a5b2a554c398
1 parent 9bf57f5 commit 3f87f06

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package org.biojava3.alignment.io;
2+
3+
import java.io.BufferedReader;
4+
import java.io.IOException;
5+
import java.io.InputStream;
6+
import java.io.InputStreamReader;
7+
import java.util.zip.GZIPInputStream;
8+
9+
import org.biojava3.core.sequence.template.AbstractSequence;
10+
11+
12+
import junit.framework.TestCase;
13+
14+
public class TestStockholmParser extends TestCase {
15+
16+
// public void testStockholmParser(){
17+
//
18+
// InputStream inStream = this.getClass().getResourceAsStream("/test.sth");
19+
//
20+
// StockholmFileParser fileParser = new StockholmFileParser();
21+
//
22+
// BufferedReader buf;
23+
// if (inStream == null) {
24+
// fail("input stream is null!");
25+
// }
26+
//
27+
// buf = new BufferedReader(new InputStreamReader(inStream));
28+
//
29+
// try {
30+
// StockholmStructure data = fileParser.parseFile(buf);
31+
// System.out.println(data);
32+
//
33+
// assertTrue(data.getBioSequences().size()==5);
34+
//
35+
// AbstractSequence<?> seq = data.getBioSequences().get(0);
36+
// assertTrue(seq != null );
37+
//
38+
// assertEquals(seq.getSequenceAsString(),"MTCRAQLIAVPRASSLAEAIACAQKMRVSRVPVYERS");
39+
//
40+
// } catch (Exception e) {
41+
//
42+
// e.printStackTrace();
43+
// fail(e.getMessage());
44+
// }
45+
//
46+
//
47+
// }
48+
49+
public void testPiwi(){
50+
try {
51+
InputStream inStream = new GZIPInputStream(this.getClass().getResourceAsStream("/piwi.sth.gz"));
52+
53+
assertNotNull(inStream);
54+
55+
StockholmFileParser fileParser = new StockholmFileParser();
56+
57+
StockholmStructure data = fileParser.parse(inStream);
58+
59+
assertTrue("Did not get enough sequences!", data.getBioSequences().size()==20);
60+
61+
AbstractSequence<?> seq = data.getBioSequences().get(0);
62+
assertTrue(seq != null );
63+
64+
assertTrue(seq.getSequenceAsString().length() > 20);
65+
66+
} catch (Exception e) {
67+
68+
e.printStackTrace();
69+
fail(e.getMessage());
70+
}
71+
72+
73+
}
74+
75+
}

0 commit comments

Comments
 (0)