/** * Transforms the given strings to the TCSAlignmentToolbox Sequence format * using the given alphabet. If the given alphabet does not specify a symbol * that is contained in your input, an UnsupportedOperationIndex is thrown. * * @param strings your data. The input format can be either a plain string, * where each character is interpreted as a distinct symbol or a string of * symbols separated by a vertical bar '|' character. * @param alphabet the alphabet containing all symbols of your data space. * * @return the TCSAlignmentToolbox Sequence representation of your data. */ public static Sequence[] toSequences(Collection<String> strings, Alphabet alphabet) { final Sequence[] out = new Sequence[strings.size()]; int s = 0; for (final String string : strings) { out[s] = new Sequence(string, alphabet); s++; } return out; }
sequences[s] = new Sequence(nodeSpec); for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]);
sequences[s] = new Sequence(nodeSpec); for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]);
final Sequence[] sequences = new Sequence[arrays.length]; for (int s = 0; s < arrays.length; s++) { sequences[s] = new Sequence(nodeSpec); for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]);
/** * Transforms the given arrays to sequences. It is assumed that each * entry arrays[s] is a sequence. * Your sequences are allowed to have different lengths. * * @param arrays an array of double arrays that shall be converted to * sequences. * * @return an array of Sequences. */ public static Sequence[] toSequences(@NonNull double[][] arrays) { final KeywordSpecification[] keywordSpecs = {new VectorialKeywordSpecification(1, STDKEYWORD)}; final NodeSpecification nodeSpec = new NodeSpecification(keywordSpecs); final Sequence[] sequences = new Sequence[arrays.length]; for (int s = 0; s < arrays.length; s++) { sequences[s] = new Sequence(nodeSpec); for (int i = 0; i < arrays[s].length; i++) { final Node node = new Node(sequences[s]); node.setValue(0, new VectorialValue(new double[]{arrays[s][i]})); sequences[s].add(node); } } return sequences; }
final Random rand = new Random(); for (int n = 0; n < N; n++) { out[n] = new Sequence(nodeSpec); for (int l = 0; l < L; l++) { final Node node = new Node(out[n]);