/* * NibFileTest.java * JUnit based test * * Created on January 18, 2007, 5:02 PM */ package lab.seq; import junit.framework.*; import java.io.*; import org.biojava.bio.symbol.*; /** * Distributed under the GNU Library General Public License, v.2 or greater. * * @author jburdick */ public class NibFileTest extends TestCase { public NibFile nf; public NibFileTest(String testName) { super(testName); } protected void setUp() throws Exception { RandomAccessFile f = new RandomAccessFile("/home/jburdick/Desktop/chr18_chunk.nib", "r"); nf = new NibFile(f); } protected void tearDown() throws Exception { } /** * Test of getLength method, of class lab.seq.NibFile. */ public void testGetLength() { System.out.println("length is " + nf.getLength()); } private void printOneChunk(int start, int end, boolean plusStrand) throws IOException, IllegalSymbolException { System.out.println("chr21:" + start + "-" + end + ", " + (plusStrand ? "+" : "-") + " strand:" + nf.getSymbolListByLocation(start, end, plusStrand).seqString()); } /** * Test of getSequenceByLocation method, of class lab.seq.NibFile. */ public void testGetSequenceByLocation() throws Exception { System.out.println("getting chunks of sequence from hg18 chr. 19"); printOneChunk(1, 30, true); printOneChunk(1, 30, false); printOneChunk(1, 31, true); printOneChunk(1, 31, false); printOneChunk(2, 30, true); printOneChunk(2, 31, true); printOneChunk(5000, 5075, true); } }