Search in sources :

Example 1 with FastaSequence

use of com.github.lindenb.jvarkit.util.bio.fasta.FastaSequence in project jvarkit by lindenb.

the class TestNg01 method testRefGenomeFactoryForFile.

@Test
public void testRefGenomeFactoryForFile() throws IOException {
    final ReferenceGenomeFactory rgf = new ReferenceGenomeFactory();
    rgf.setBufferSize(2);
    final ReferenceGenome ref = rgf.open(TOY_FA);
    final FastaSequenceReader fsr = new FastaSequenceReader();
    final List<FastaSequence> seqs = fsr.readAll(new File(TOY_FA));
    Assert.assertEquals(seqs.size(), ref.size());
    for (int i = 0; i < seqs.size(); i++) {
        Assert.assertEquals(ref.getContig(i).length(), seqs.get(i).length());
        Assert.assertEquals(ref.getContig(i).getContig(), seqs.get(i).getName());
        for (int x = 0; x < ref.getContig(i).length(); ++x) {
            Assert.assertEquals(ref.getContig(i).charAt(x), seqs.get(i).charAt(x));
        }
    }
    ref.close();
}
Also used : ReferenceGenome(com.github.lindenb.jvarkit.util.bio.fasta.ReferenceGenome) ReferenceGenomeFactory(com.github.lindenb.jvarkit.util.bio.fasta.ReferenceGenomeFactory) FastaSequence(com.github.lindenb.jvarkit.util.bio.fasta.FastaSequence) File(java.io.File) FastaSequenceReader(com.github.lindenb.jvarkit.util.bio.fasta.FastaSequenceReader) Test(org.testng.annotations.Test)

Aggregations

FastaSequence (com.github.lindenb.jvarkit.util.bio.fasta.FastaSequence)1 FastaSequenceReader (com.github.lindenb.jvarkit.util.bio.fasta.FastaSequenceReader)1 ReferenceGenome (com.github.lindenb.jvarkit.util.bio.fasta.ReferenceGenome)1 ReferenceGenomeFactory (com.github.lindenb.jvarkit.util.bio.fasta.ReferenceGenomeFactory)1 File (java.io.File)1 Test (org.testng.annotations.Test)1