Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.jstacs.data.bioJava
Class BioJavaAdapter

    java.lang.Object
      de.jstacs.data.bioJava.BioJavaAdapter

    public class BioJavaAdapter

extends Object

This class provides static methods to convert BioJava datatypes (`SequenceIterator`, `Sequence`) to `Sample`s and vice versa.
Here are two small examples how to create a `RichSequenceIterator` that can be used to create a sample.
`GenbankRichSequenceDB db = new GenbankRichSequenceDB();
org.biojava.bio.seq.Sequence seq = db.getSequence( id );
RichSequenceIterator iter = new RichSequence.IOTools.SingleRichSeqIterator(seq);
`
or
`RichSequenceIterator iter = RichSequence.IOTools.readFile( new File( fName ), null );`

Author:
  Jens Keilwagen, Jan Grau

Constructor Summary
`BioJavaAdapter()`

Method Summary
`static SequenceIterator` | `sampleToSequenceIterator(Sample sample, boolean flat)` Creates a `SequenceIterator` from `sample` preserving as much annotation as possible.
`static Sample` | `sequenceIteratorToSample(SequenceIterator it, FeatureFilter filter)` This method creates a new Sample from a `SequenceIterator`.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BioJavaAdapter

    public BioJavaAdapter()

Method Detail

### sequenceIteratorToSample

    public static Sample sequenceIteratorToSample(SequenceIterator it,
                                                  FeatureFilter filter)
                                           throws Exception

  This method creates a new Sample from a `SequenceIterator`. In cases, where BioJava does return `Sequence`s instead of a `SequenceIterator`, you can use a `SimpleSequenceIterator` to wrap them up.

  Parameters:
    `it` - the sequence iterator
    `filter` - `null` or an arbitrary feature filter, that determines which features will be adopted
  Returns:
    the `Sequence`s in `it` converted to a `Sample`
  Throws:
    `Exception`

### sampleToSequenceIterator

    public static SequenceIterator sampleToSequenceIterator(Sample sample,
                                                            boolean flat)
                                                     throws WrongAlphabetException,
                                                            BioException

  Creates a `SequenceIterator` from `sample` preserving as much annotation as possible. This method works only for discrete alphabets.

  Parameters:
    `sample` - the sample
    `flat` - true if the features should be flattened. This may be necessary to preserve all features, because some data formats do not support hierarchical features
  Returns:
    the corresponding sequence iterator
  Throws:
    `WrongAlphabetException` - is thrown if the alphabet of the sample is not discrete
    `BioException` - forwarded BioJava exceptions

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD