@Test public void testLoadFastaSequences() { BiojavaSequence seq = null; try { // Test read Protein as fasta seq = biojava.loadSequence(TestData.getPathToAAFastaSequence()); assertNotNull(seq); assertEquals("SEQUENCE", seq.getPlainSequence().trim().toUpperCase()); // Test read DNA as fasta seq = biojava.loadSequence(TestData.getPathToDNAFastaSequence()); assertNotNull(seq); assertEquals("GATTACA", seq.getPlainSequence().trim().toUpperCase()); /* //Test read RNA as fasta seq = biojava.loadSequence( TestData.getPathToRNAFastaSequence() ); assertNotNull( seq ); assertEquals( "GAUUACA", seq.getPlainSequence().trim().toUpperCase() ); */ } catch (IOException e) { fail(e.getMessage()); } catch (Exception e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } }
@Test public void testDNAtoRNA() { BiojavaSequence seq = null; try { seq = biojava.loadSequence(TestData.getPathToDNAFastaSequence()); } catch (IOException e1) { LogUtils.debugTrace(logger, e1); fail(e1.getMessage()); } catch (Exception e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } assertNotNull(seq); assertTrue(seq instanceof BiojavaDNASequence); BiojavaDNASequence dnaSeq = (BiojavaDNASequence) seq; try { assertEquals("GATTACA", seq.getPlainSequence().trim().toUpperCase()); BiojavaRNASequence rnaSeq; rnaSeq = biojava.DNAtoRNA(dnaSeq); assertEquals("GAUUACA", rnaSeq.getPlainSequence().trim().toUpperCase()); } catch (IOException e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } catch (Exception e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } }
/* @Test public void testRNAtoDNA() { BiojavaSequence seq = biojava.createSequence("GAUUACA"); assertNotNull(seq); assertTrue(seq instanceof BiojavaRNASequence); BiojavaRNASequence rnaSeq = (BiojavaRNASequence) seq; try { //Check correctly read assertEquals( "GAUUACA", rnaSeq.getPlainSequence().trim().toUpperCase() ); BiojavaDNASequence dnaSeq = biojava.RNAtoDNA(rnaSeq); //Check correctly converted assertEquals( "GATTACA", dnaSeq.getPlainSequence().trim().toUpperCase() ); } catch (IOException e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } catch (Exception e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } } */ @Test public void testLoadFastaSequenceCollection() throws BioclipseException, IOException { BiojavaSequenceList sequenceCollection = null; sequenceCollection = biojava.loadSequences(TestData.getPathToMultipleSequences()); assertNotNull(sequenceCollection); assertEquals(2, sequenceCollection.size()); // Check individual sequences BiojavaSequence seq1 = sequenceCollection.get(0); BiojavaSequence seq2 = sequenceCollection.get(1); try { assertEquals(341, seq1.getPlainSequence().length()); assertEquals(342, seq2.getPlainSequence().length()); } catch (IOException e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } }
@Test public void testToFasta() { BiojavaSequence seq = null; try { seq = biojava.loadSequence(TestData.getPathToAAFastaSequence()); // seq = biojava.loadSequence( TestData.getPathToFosbFastaSequence() ); } catch (IOException e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } catch (Exception e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } assertNotNull(seq); // assertEquals( "Sequence", seq.getName()); try { assertEquals("SEQUENCE", seq.getPlainSequence().trim()); } catch (IOException e) { LogUtils.debugTrace(logger, e); fail(e.getMessage()); } }