public class BioJavaAdapter extends Object
SequenceIterator
, Sequence
) to
DataSet
s and vice versa.
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);
RichSequenceIterator iter = RichSequence.IOTools.readFile( new File( fName ), null );
Modifier and Type | Field and Description |
---|---|
static String |
ANNOTATION_ID
A generic annotation ID for new annotations
|
Constructor and Description |
---|
BioJavaAdapter() |
Modifier and Type | Method and Description |
---|---|
static SequenceIterator |
dataSetToSequenceIterator(DataSet sample,
boolean flat,
boolean alwaysUseDNAAlphabet)
|
static DataSet |
sequenceIteratorToDataSet(SequenceIterator it,
FeatureFilter filter,
AlphabetContainer con)
This method creates a new
DataSet from a SequenceIterator . |
public static final String ANNOTATION_ID
public static DataSet sequenceIteratorToDataSet(SequenceIterator it, FeatureFilter filter, AlphabetContainer con) throws Exception
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.it
- the sequence iteratorfilter
- null
or an arbitrary feature filter that
determines which features will be adoptedcon
- the AlphabetContainer
to use for the returned DataSet
Sequence
s in it
converted to a DataSet
Exception
- if something went wrongpublic static SequenceIterator dataSetToSequenceIterator(DataSet sample, boolean flat, boolean alwaysUseDNAAlphabet) throws WrongAlphabetException, BioException
SequenceIterator
from the DataSet
sample
preserving as much annotation as possible. This
method works only for discrete alphabets.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 featuresalwaysUseDNAAlphabet
- if true
, always use a DNA alphabetSequenceIterator
WrongAlphabetException
- if the alphabet of the DataSet
is not discreteBioException
- if forwarded from BioJava