Package com.googlecode.gaal.data.api

Examples of com.googlecode.gaal.data.api.IntSequence


        }
    }

    public void visualizeSuffixes(Drawing drawing) {
        for (int i = 0; i < sequence.size(); i++) {
            IntSequence subSequence = sequence.subSequence(i, sequence.size());
            drawing.drawCell(0, i, Integer.toString(i), TikzConstants.RED_CELL);

            for (int j = 0; j < subSequence.size(); j++) {
                drawing.drawCell(j + 1, i, symbolTable.toToken(subSequence.get(j)).toString(), Integer.toString(i + j),
                        TikzConstants.LIGHT_BLUE_CELL);
            }
        }
    }
View Full Code Here


            }
        }
    }

    public void visualizeEmbeddedSuffixes(Drawing drawing, SuffixArray sa, Interval interval, int windowSize) {
        IntSequence indices = interval.indices();
        int lcp = interval.lcp();
        for (int i = 0; i < interval.size(); i++) {
            int start = indices.get(i);
            drawing.drawCell(0, i, Integer.toString(start), TikzConstants.RED_CELL);
            IntSequence subSequence = sequence.subSequence(start, sequence.size());
            for (int k = 0; k < subSequence.size(); k++) {
                if (k < lcp) {
                    drawing.drawCell(k + 1, i, symbolTable.toToken(subSequence.get(k)).toString(),
                            Integer.toString(start + k), TikzConstants.LIGHT_BLUE_CELL);
                } else {
                    drawing.drawCell(k + 1, i, symbolTable.toToken(subSequence.get(k)).toString(),
                            Integer.toString(start + k), TikzConstants.BLUE_CELL);
                }
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void visualizeWindow(Drawing drawing, SuffixArray sa, Interval interval, int windowSize) {
        IntSequence indices = interval.indices();
        int lcp = interval.lcp();
        for (int i = 0; i < interval.size(); i++) {
            int start = indices.get(i) + lcp;
            drawing.drawCell(0, i, Integer.toString(start), TikzConstants.RED_CELL);
            IntSequence subSequence = sequence.subSequence(start, sequence.size());
            for (int k = 0; k < subSequence.size(); k++) {
                if (k < windowSize) {
                    drawing.drawCell(k + 1, i, symbolTable.toToken(subSequence.get(k)).toString(),
                            Integer.toString(start + k), TikzConstants.GREEN_CELL);
                } else {
                    drawing.drawCell(k + 1, i, symbolTable.toToken(subSequence.get(k)).toString(),
                            Integer.toString(start + k), TikzConstants.LIGHT_BLUE_CELL);
                }
            }
        }
    }
View Full Code Here

            }
        }
    }

    public void visualizeEmbeddedSuffixesInWindow(Drawing drawing, SuffixArray sa, Interval interval, int windowSize) {
        IntSequence indices = interval.indices();
        int lcp = interval.lcp();
        int[] inverseSuffixTable = sa.getInverseSuffixTable();
        SortedMap<Integer, Integer> embeddedSuffixTableIndices = new TreeMap<Integer, Integer>();
        int counter = 0;
        for (int i = 0; i < interval.size(); i++) {
            int start = indices.get(i) + lcp;
            for (int j = start; j < start + windowSize && j < sequence.size(); j++) {
                drawing.drawCell(0, counter, Integer.toString(j), TikzConstants.RED_CELL);
                drawing.drawCell(1, counter, Integer.toString(inverseSuffixTable[j]), TikzConstants.GREEN_CELL);
                IntSequence subSequence = sequence.subSequence(j, sequence.size());
                Integer startIndex = embeddedSuffixTableIndices.get(inverseSuffixTable[j]);
                if (startIndex == null || startIndex < start) {
                    embeddedSuffixTableIndices.put(inverseSuffixTable[j], start);
                }
                for (int k = 0; k < subSequence.size(); k++) {
                    drawing.drawCell(k + 2, counter, symbolTable.toToken(subSequence.get(k)).toString(),
                            Integer.toString(j + k), TikzConstants.LIGHT_BLUE_CELL);
                }
                counter++;
            }
        }
View Full Code Here

    public void visualizeEmbeddedSuffixTable(Drawing drawing, SuffixArray sa) {
        int[] inverseSuffixTable = sa.getInverseSuffixTable();
        int[] suffixTable = sa.getSuffixTable();
        for (int i = 0; i < suffixTable.length; i++) {
            IntSequence subSequence = sequence.subSequence(suffixTable[i], sequence.size());
            drawing.drawCell(0, i, String.format("%d", suffixTable[i]), TikzConstants.RED_CELL);
            drawing.drawCell(1, i, Integer.toString(inverseSuffixTable[suffixTable[i]]), TikzConstants.GREEN_CELL);
            for (int j = 0; j < subSequence.size(); j++) {
                drawing.drawCell(j + 2, i, symbolTable.toToken(subSequence.get(j)).toString(),
                        Integer.toString(suffixTable[i] + j), TikzConstants.LIGHT_BLUE_CELL);
            }
        }
    }
View Full Code Here

    public void visualizeLcpInSuffixTable(Drawing drawing, SuffixArray sa) {
        int[] suffixTable = sa.getSuffixTable();
        int[] lcpTable = sa.getLcpTable();
        for (int i = 0; i < suffixTable.length; i++) {
            IntSequence subSequence = sequence.subSequence(suffixTable[i], sequence.size());
            int lcp = lcpTable[i];
            drawing.drawCell(0, i, Integer.toString(lcp), TikzConstants.GREEN_CELL);

            NodeStyle style = null;
            if (lcp > 0)
                style = TikzConstants.CELL_STYLES[lcp];
            for (int j = 0; j < subSequence.size(); j++) {
                NodeStyle cellStyle;
                if (j < lcp) {
                    cellStyle = style;
                } else {
                    cellStyle = TikzConstants.LIGHT_BLUE_CELL;
                }
                drawing.drawCell(j + 1, i, symbolTable.toToken(subSequence.get(j)).toString(),
                        Integer.toString(suffixTable[i] + j), cellStyle);
            }
        }
    }
View Full Code Here

    }

    public void visualizeSuffixTable(Drawing drawing, SuffixArray sa) {
        int[] suffixTable = sa.getSuffixTable();
        for (int i = 0; i < suffixTable.length; i++) {
            IntSequence subSequence = sequence.subSequence(suffixTable[i], sequence.size());
            drawing.drawCell(0, i, String.format("%d", suffixTable[i]), TikzConstants.RED_CELL);

            for (int j = 0; j < subSequence.size(); j++) {
                drawing.drawCell(j + 1, i, symbolTable.toToken(subSequence.get(j)).toString(),
                        Integer.toString(suffixTable[i] + j), TikzConstants.LIGHT_BLUE_CELL);
            }
        }
    }
View Full Code Here

        }
    }

    private void markInterval(Interval interval, EmbeddedInterval embeddedInterval, int[] styleArray, int length,
            int windowSize) {
        IntSequence indices = interval.indices();
        int lcp = interval.lcp();
        if (length < 1) {
            length = lcp;
        }
        for (int i = 0; i < indices.size(); i++) {
            int style = i;
            if (embeddedInterval != null) {
                IntSequence embeddedIndices = embeddedInterval.indices();
                int minDistance = windowSize + 1;
                for (int k = 0; k < embeddedIndices.size(); k++) {
                    int distance = embeddedIndices.get(k) - indices.get(i) - lcp;
                    if (distance >= 0 && distance < minDistance) {
                        minDistance = distance;
                    }
                }
                if (minDistance > windowSize) {
View Full Code Here

            Interval node = iterator.next();
            Integer style = styleMap.get(node);
            if (style != null) {
                NodeStyle nodeStyle = TikzConstants.CELL_STYLES[style];
                for (int i = node.left(); i <= node.right(); i++) {
                    IntSequence subSequence = sequence.subSequence(suffixTable[i], suffixTable[i] + node.lcp());
                    for (int j = 0; j < subSequence.size(); j++) {
                        if (!usedCells[i][j]) {
                            usedCells[i][j] = true;
                            drawing.drawCell(i, j, symbolTable.toToken(subSequence.get(j)).toString(), nodeStyle);
                        }
                    }
                }
            }
        }

        for (int i = 0; i < suffixTable.length; i++) {
            IntSequence subSequence = sequence.subSequence(suffixTable[i], sequence.size());

            for (int j = 0; j < subSequence.size(); j++) {
                if (!usedCells[i][j]) {
                    drawing.drawCell(i, j, symbolTable.toToken(subSequence.get(j)).toString(),
                            TikzConstants.LIGHT_BLUE_CELL);
                }
            }
        }
    }
View Full Code Here

                    number);
        }
    }

    public static IntSequence removeIntervening(EmbeddedInterval interval) {
        IntSequence indices = interval.indices();
        IntSequence embeddingIndices = interval.embeddingIndices();
        System.out.format("ind:%s\n", indices);
        System.out.format("emb:%s\n", embeddingIndices);
        BitSet removedIndices = new BitSet(embeddingIndices.size());
        for (int i = 0; i < embeddingIndices.size(); i++) {
            if (!removedIndices.get(i)) {
                int index = indices.get(i);
                int embeddingIndex = embeddingIndices.get(i);
                for (int j = 0; j < embeddingIndices.size(); j++) {
                    if (i != j && !removedIndices.get(j) && embeddingIndices.get(j) == embeddingIndex) {
                        System.out.format("%d=%d\n", embeddingIndices.get(j), embeddingIndex);
                        if (indices.get(j) > index) {
                            System.out.format("removing i=%d\n", i);
                            removedIndices.set(i);
                        } else {
                            System.out.format("removing j=%d\n", j);
View Full Code Here

TOP

Related Classes of com.googlecode.gaal.data.api.IntSequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.