Skip to content

EoulsanOM Standalone

Laurent Jourdren edited this page Mar 26, 2015 · 2 revisions

Using Eoulsan object model without the Eoulsan workflow engine

WARNING: This documentation is outdated and will soon be updated.

Introduction

The object model of Eoulsan (handling reads, filtering alignments...) can be used without launching the Eoulsan "engine". Only the classes of the fr.ens.transcriptome.eoulsan.bio package and sub-package (and exceptions) can be used. Other classes like DataFile, DataFormat cannot used outside the Eoulsan engine.

Sample code

Here the sample code count the number of reads of FASTQ file that pass the Illumina filter (Filter flag of Illumina Id generated by Casava 1.8 is to N).

import java.io.File;
import java.io.FileNotFoundException;

import fr.ens.transcriptome.eoulsan.EoulsanException;
import fr.ens.transcriptome.eoulsan.bio.IlluminaReadId;
import fr.ens.transcriptome.eoulsan.bio.ReadSequence;
import fr.ens.transcriptome.eoulsan.bio.io.FastqReader;
import fr.ens.transcriptome.eoulsan.bio.io.ReadSequenceReader;

public class EoulsanOMSample {

  public static void main(String[] args) throws FileNotFoundException,
      EoulsanException {

    final ReadSequenceReader reader = new FastqReader(new File("sample.fastq"));

    IlluminaReadId irid = null;
    int passingIlluminaFilter = 0;
    int count = 0;

    for (ReadSequence read : reader) {

      if (irid == null)
        irid = new IlluminaReadId(read);
      else
        irid.parse(read);

      if (!irid.isFiltered())
        passingIlluminaFilter++;

      count++;
    }

    System.out.println("There is "
        + passingIlluminaFilter + " / " + count
        + " reads that pass Illumina filter.");
  }

}

Compile code

The compilation is like any Java source code. We set the path to the eoulsan.jar file in the classpath.

$ javac -cp eoulsan.jar EoulsanOMSample.java

Run code

Running the sample is also very standard:

$ java -cp eoulsan.jar:. EoulsanOMSample