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
DataSet
s and vice versa.
Here are two small examples how to create a
RichSequenceIterator
that can be used to create
a DataSet
.
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
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BioJavaAdapter
public BioJavaAdapter()
sequenceIteratorToDataSet
public static DataSet sequenceIteratorToDataSet(SequenceIterator it,
FeatureFilter filter)
throws Exception
- This method creates a new
DataSet
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 iteratorfilter
- null
or an arbitrary feature filter that
determines which features will be adopted
- Returns:
- the
Sequence
s in it
converted to a DataSet
- Throws:
Exception
- if something went wrong
dataSetToSequenceIterator
public static SequenceIterator dataSetToSequenceIterator(DataSet sample,
boolean flat)
throws WrongAlphabetException,
BioException
- Creates a
SequenceIterator
from the DataSet
sample
preserving as much annotation as possible. This
method works only for discrete alphabets.
- Parameters:
sample
- the DataSet
flat
- indicates 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
SequenceIterator
- Throws:
WrongAlphabetException
- if the alphabet of the DataSet
is not discrete
BioException
- if forwarded from BioJava