public static SequencesReader createSequencesReader(final SequenceDataSource source) throws IOException {
  final List<byte[]> data=new ArrayList<>();
  final List<String> labels=new ArrayList<>();
  final List<Long> counts=new ArrayList<>();
  int min=Integer.MAX_VALUE;
  int max=Integer.MIN_VALUE;
  while (source.nextSequence()) {
    final byte[] b=new byte[source.currentLength()];
    System.arraycopy(source.sequenceData(),0,b,0,source.currentLength());
    data.add(b);
    labels.add(source.name());
    counts.add((long)source.currentLength());
    min=Math.min(min,source.currentLength());
    max=Math.max(max,source.currentLength());
  }
  final byte[][] dataArray=data.toArray(new byte[data.size()][]);
  final String[] labelsArray=labels.toArray(new String[labels.size()]);
  return new CompressedMemorySequencesReader(dataArray,labelsArray,ArrayUtils.asLongArray(counts),min,max,source.type());
}

public static SequencesReader createSequencesReader ( final SequenceDataSource source ) throws IOException { final List < byte [ ] > data = new ArrayList < > ( ) ; final List < String > labels = new ArrayList < > ( ) ; final List < Long > counts = new ArrayList < > ( ) ; int min = Integer . MAX_VALUE ; int max = Integer . MIN_VALUE ; while ( source . nextSequence ( ) ) { final byte [ ] b = new byte [ source . currentLength ( ) ] ; System . arraycopy ( source . sequenceData ( ) , 0 , b , 0 , source . currentLength ( ) ) ; data . add ( b ) ; labels . add ( source . name ( ) ) ; counts . add ( ( long ) source . currentLength ( ) ) ; min = Math . min ( min , source . currentLength ( ) ) ; max = Math . max ( max , source . currentLength ( ) ) ; } final byte [ ] [ ] dataArray = data . toArray ( new byte [ data . size ( ) ] [ ] ) ; final String [ ] labelsArray = labels . toArray ( new String [ labels . size ( ) ] ) ; return new CompressedMemorySequencesReader ( dataArray , labelsArray , ArrayUtils . asLongArray ( counts ) , min , max , source . type ( ) ) ; }
creates a sequences reader from the specified source . not optimised , intended only for testing
