diff --git a/Makefile b/Makefile index 3f3397e..99bdc2f 100644 --- a/Makefile +++ b/Makefile @@ -52,8 +52,8 @@ JAR_FILE=japsa.jar LIB_DIR=libs #List of external libraries -##EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar jaligner.jar -EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar jaligner.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar javax.json-1.0.4.jar slf4j-api-1.7.25.jar slf4j-simple-1.7.25.jar jfxrt.jar +##EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar +EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar javax.json-1.0.4.jar slf4j-api-1.7.25.jar slf4j-simple-1.7.25.jar jfxrt.jar ########################################################################### ##What this scripts does: diff --git a/libs/jaligner.jar b/libs/jaligner.jar deleted file mode 100644 index 145a976..0000000 Binary files a/libs/jaligner.jar and /dev/null differ diff --git a/makefile.dev b/makefile.dev index e78c27c..0e8cb55 100644 --- a/makefile.dev +++ b/makefile.dev @@ -56,8 +56,8 @@ LIB_DIR=libs #List of external libraries -#EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar jaligner.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar jfxrt.jar -EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar jaligner.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar javax.json-1.0.4.jar slf4j-api-1.7.25.jar slf4j-simple-1.7.25.jar jfxrt.jar +#EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar jfxrt.jar +EXT_LIBS=colloquial.jar commons-math3-3.0.jar jhdf5.jar jhdfobj.jar htsjdk-1.126.jar guava-18.0.jar jcommon-1.0.23.jar jfreechart-1.0.19.jar JRIEngine.jar JRI.jar gs-core-1.3.jar gs-ui-1.3.jar gs-algo-1.3.jar javax.json-api-1.0.jar javax.json-1.0.4.jar slf4j-api-1.7.25.jar slf4j-simple-1.7.25.jar jfxrt.jar ########################################################################### ##What this scripts does: diff --git a/src/dev/java/japsadev/bio/hts/barcode/BarCodeAnalysis.java b/src/dev/java/japsadev/bio/hts/barcode/BarCodeAnalysis.java index 9c2a4f2..ccbdaf9 100644 --- a/src/dev/java/japsadev/bio/hts/barcode/BarCodeAnalysis.java +++ b/src/dev/java/japsadev/bio/hts/barcode/BarCodeAnalysis.java @@ -1,11 +1,11 @@ package japsadev.bio.hts.barcode; + import java.io.File; import java.io.IOException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Comparator; -import jaligner.matrix.MatrixLoaderException; import japsa.seq.Alphabet; import japsa.seq.Sequence; import japsa.seq.SequenceOutputStream; @@ -88,20 +88,10 @@ public void setThreshold(double ident){ SCORE_THRES = ident; } - //alignment matrix - float[][] scores = { - { 2.7f, -4.5f, -4.5f, -4.5f}, - { -4.5f, 2.7f, -4.5f, -4.5f}, - { -4.5f, -4.5f, 2.7f, -4.5f}, - { -4.5f, -4.5f, -4.5f, 2.7f} - }; - - private jaligner.matrix.Matrix matrix = jaligner.matrix.MatrixGenerator.generate(2.7f, -4.5f); - float openPenalty = 4.7f, extendPenalty = 1.6f; /* * Trying to clustering MinION read data into different samples based on the barcode */ - public void clustering(String dataFile) throws IOException, InterruptedException, MatrixLoaderException{ + public void clustering(String dataFile) throws IOException, InterruptedException{ SequenceReader reader; if(dataFile.equals("-")) reader = SequenceReader.getReader(System.in); @@ -115,18 +105,15 @@ public void clustering(String dataFile) throws IOException, InterruptedException rr = new double[nSamples], //right-reversed rf = new double[nSamples]; //right-forward - jaligner.Alignment alignmentLF = new jaligner.Alignment(), - alignmentLR = new jaligner.Alignment(), - alignmentRF = new jaligner.Alignment(), - alignmentRR = new jaligner.Alignment(); - jaligner.Sequence js5,js3, jBarcodeLeft, jBarcodeRight; - jaligner.Alignment bestLeftAlignment = new jaligner.Alignment(), - bestRightAlignment = new jaligner.Alignment(); + SWGAlignment alignmentLF = new SWGAlignment(), + alignmentLR = new SWGAlignment(), + alignmentRF = new SWGAlignment(), + alignmentRR = new SWGAlignment(); + + SWGAlignment bestLeftAlignment = new SWGAlignment(), + bestRightAlignment = new SWGAlignment(); + -// Sequence barcodeSeq = new Sequence(Alphabet.DNA4(),barcodeLen,"barcode"); -// Sequence tipSeq = new Sequence(Alphabet.DNA4(),SCAN_WINDOW,"tip"); -// -// BarcodeAlignment barcodeAlignment = new BarcodeAlignment(barcodeSeq, tipSeq); while ((seq = reader.nextSequence(Alphabet.DNA())) != null){ if(seq.length() < barcodeLen*4){ @@ -136,7 +123,6 @@ public void clustering(String dataFile) throws IOException, InterruptedException //alignment algorithm is applied here. For the beginning, Smith-Waterman local pairwise alignment is used s5 = seq.subSequence(0, SCAN_WINDOW); -// s3=seq.subSequence(seq.length()-SCAN_WINDOW,seq.length()); s3 = Alphabet.DNA.complement(seq.subSequence(seq.length()-SCAN_WINDOW,seq.length())); @@ -150,29 +136,11 @@ public void clustering(String dataFile) throws IOException, InterruptedException Sequence barcodeLeft = barCodesLeft.get(i); Sequence barcodeRight = barCodesRight.get(i); //rc of right barcode sequence -// barcodeAlignment.setBarcodeSequence(barcodeLeft); -// barcodeAlignment.setReadSequence(s5); -// lf[i]=barcodeAlignment.align(); -// -// barcodeAlignment.setReadSequence(Alphabet.DNA.complement(s3)); -// lr[i]=barcodeAlignment.align(); -// -// barcodeAlignment.setBarcodeSequence(barcodeRight); -// barcodeAlignment.setReadSequence(Alphabet.DNA.complement(s3)); -// rr[i]=barcodeAlignment.align(); -// -// barcodeAlignment.setReadSequence(s5); -// rf[i]=barcodeAlignment.align(); - js5 = new jaligner.Sequence(s5.toString()); - js3 = new jaligner.Sequence(s3.toString()); - jBarcodeLeft = new jaligner.Sequence(barcodeLeft.toString()); - jBarcodeRight = new jaligner.Sequence(barcodeRight.toString()); - - alignmentLF = jaligner.SmithWatermanGotoh.align(js5, jBarcodeLeft, matrix, openPenalty, extendPenalty); - alignmentLR = jaligner.SmithWatermanGotoh.align(js3, jBarcodeLeft, matrix, openPenalty, extendPenalty); - alignmentRF = jaligner.SmithWatermanGotoh.align(js5, jBarcodeRight, matrix, openPenalty, extendPenalty); - alignmentRR = jaligner.SmithWatermanGotoh.align(js3, jBarcodeRight, matrix, openPenalty, extendPenalty); + alignmentLF = SWGAlignment.align(s5, barcodeLeft); + alignmentLR = SWGAlignment.align(s3, barcodeLeft); + alignmentRF = SWGAlignment.align(s5, barcodeRight); + alignmentRR = SWGAlignment.align(s3, barcodeRight); lf[i] = alignmentLF.getIdentity()/(float)Math.max(barcodeLeft.length(),alignmentLF.getLength()); lr[i] = alignmentLR.getIdentity()/(float)Math.max(barcodeLeft.length(),alignmentLR.getLength()); @@ -221,10 +189,7 @@ public void clustering(String dataFile) throws IOException, InterruptedException String retval=""; DecimalFormat twoDForm = new DecimalFormat("#.##"); - if(bestScore < SCORE_THRES || distance < DIST_THRES -// || bestLeftAlignment.getLength() < 0.8 * bestLeftAlignment.getOriginalSequence2().length() -// || bestRightAlignment.getLength() < 0.8 * bestRightAlignment.getOriginalSequence2().length() - ){ + if(bestScore < SCORE_THRES || distance < DIST_THRES ){ //Logging.info("Unknown sequence " + seq.getName()); retval = "unknown:"+Double.valueOf(twoDForm.format(bestScore))+":"+Double.valueOf(twoDForm.format(distance))+"|0-0:0-0|"; seq.setName(retval + seq.getName()); @@ -275,9 +240,9 @@ public void clustering(String dataFile) throws IOException, InterruptedException } //display jaligner.Alignment. TODO: convert to ours - public void printAlignment(jaligner.Alignment alignment){ - String origSeq1 = alignment.getOriginalSequence1().getSequence(), - origSeq2 = alignment.getOriginalSequence2().getSequence(), + public void printAlignment(SWGAlignment alignment){ + String origSeq1 = alignment.getOriginalSequence1().toString(), + origSeq2 = alignment.getOriginalSequence2().toString(), alnSeq1 = new String(alignment.getSequence1()), alnSeq2 = new String(alignment.getSequence2()); int start1 = alignment.getStart1(), diff --git a/src/dev/java/japsadev/bio/hts/barcode/BarcodeAlignment.java b/src/dev/java/japsadev/bio/hts/barcode/BarcodeAlignment.java deleted file mode 100644 index ce66bf9..0000000 --- a/src/dev/java/japsadev/bio/hts/barcode/BarcodeAlignment.java +++ /dev/null @@ -1,279 +0,0 @@ -/***************************************************************************** - * Copyright (c) Minh Duc Cao, Monash Uni & UQ, All rights reserved. * - * * - * Redistribution and use in source and binary forms, with or without * - * modification, are permitted provided that the following conditions * - * are met: * - * * - * 1. Redistributions of source code must retain the above copyright notice, * - * this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright * - * notice, this list of conditions and the following disclaimer in the * - * documentation and/or other materials provided with the distribution. * - * 3. Neither the names of the institutions nor the names of the contributors* - * may be used to endorse or promote products derived from this software * - * without specific prior written permission. * - * * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * - * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - ****************************************************************************/ - -/**************************************************************************** - * Revision History - * 22 Nov 2016 - Minh Duc Cao: Started - * - ****************************************************************************/ -package japsadev.bio.hts.barcode; - - -import japsa.seq.Sequence; - -/** - * Implement based on jaligner from Ahmed Moustafa - * See license below - */ - -public final class BarcodeAlignment { - - /** - * Traceback direction stop - */ - public static final byte STOP = 0; - /** - * Traceback direction left - */ - public static final byte LEFT = 1; - /** - * Traceback direction diagonal - */ - public static final byte DIAGONAL = 2; - /** - * Traceback direction up - */ - public static final byte UP = 3; - - public BarcodeAlignment(Sequence s1, Sequence s2) { - super(); - this.barcodeSequence = s1; - this.readSequence = s2; - - m = s1.length() + 1; - n = s2.length() + 1; - - //Initilise the arrays - pointers = new byte[m * n]; - sizesOfVerticalGaps = new short[m * n]; - sizesOfHorizontalGaps = new short[m * n]; - } - - Sequence barcodeSequence; - Sequence readSequence; - int m,n; - byte[] pointers; - short[] sizesOfVerticalGaps; - short[] sizesOfHorizontalGaps; - //BLOSSOM62 - //double [][] scores = - // {{4.0,0.0,0.0,0.0}, - // {0.0,9.0,-3.0,-1.0}, - // {0.0,-3.0,6.0,-2.0}, - // {0.0,-1.0,-2.0,5.0} - // }; - - //poreFUME's scores - double openPenalty = 4.7; - double extendPenalty = 1.6; - - double [][] scores = { - { 2.7, -4.5, -4.5, -4.5}, - { -4.5, 2.7, -4.5, -4.5}, - { -4.5, -4.5, 2.7, -4.5}, - { -4.5, -4.5, -4.5, 2.7} - }; - - - private int cellRow; - /** - * Column of the cell - */ - private int cellCol; - /** - * Alignment score at this cell - */ - private double cellScore; - - - public void setBarcodeSequence(Sequence seq){ - barcodeSequence = seq; - } - - public void setReadSequence(Sequence seq){ - readSequence = seq; - } - - - - public double align() { - // Initializes the boundaries of the traceback matrix to STOP. - for (int i = 0, k = 0; i < m; i++, k += n) { - pointers[k] = STOP; - } - for (int j = 1; j < n; j++) { - pointers[j] = STOP; - } - - for (int i = 0, k = 0; i < m; i++, k += n) { - for (int j = 0; j < n; j++) { - sizesOfVerticalGaps[k + j] = sizesOfHorizontalGaps[k + j] = 1; - } - } - return construct(); - } - - /** - * Constructs directions matrix for the traceback - * - * @param barcodeSequence - * sequence #1 - * @param readSequence - * sequence #2 - * @param scores - * scoring matrix - * @param openPenalty - * open gap penalty - * @param extendPenalty - * extend gap penalty - * @return The cell where the traceback starts. - */ - private double construct() { - //logger.info("Started..."); - //long start = System.currentTimeMillis(); - - double f; // score of alignment x1...xi to y1...yi if xi aligns to yi - double[] g = new double[n]; // score if xi aligns to a gap after yi - double h; // score if yi aligns to a gap after xi - double[] v = new double[n]; // best score of alignment x1...xi to - // y1...yi - double vDiagonal; - - g[0] = Float.NEGATIVE_INFINITY; - h = Float.NEGATIVE_INFINITY; - v[0] = 0; - - for (int j = 1; j < n; j++) { - g[j] = Float.NEGATIVE_INFINITY; - v[j] = 0; - } - - double similarityScore, g1, g2, h1, h2; - - cellScore = Float.NEGATIVE_INFINITY; - //Cell cell = new Cell(); - - for (int i = 1, k = n; i < m; i++, k += n) { - h = Float.NEGATIVE_INFINITY; - vDiagonal = v[0]; - for (int j = 1, l = k + 1; j < n; j++, l++) { - similarityScore = scores[barcodeSequence.getBase(i-1)][readSequence.getBase(j-1)]; - - // Fill the matrices - f = vDiagonal + similarityScore; - - g1 = g[j] - extendPenalty; - g2 = v[j] - openPenalty; - if (g1 > g2) { - g[j] = g1; - sizesOfVerticalGaps[l] = (short) (sizesOfVerticalGaps[l - n] + 1); - } else { - g[j] = g2; - } - - h1 = h - extendPenalty; - h2 = v[j - 1] - openPenalty; - if (h1 > h2) { - h = h1; - sizesOfHorizontalGaps[l] = (short) (sizesOfHorizontalGaps[l - 1] + 1); - } else { - h = h2; - } - - vDiagonal = v[j]; - v[j] = maximum(f, g[j], h, 0); - - // Determine the traceback direction - if (v[j] == 0) { - pointers[l] = STOP; - } else if (v[j] == f) { - pointers[l] = DIAGONAL; - } else if (v[j] == g[j]) { - pointers[l] = UP; - } else { - pointers[l] = LEFT; - } - - // Set the traceback start at the current cell i, j and score - if (v[j] > cellScore) { - cellRow = i; - cellCol = j; - cellScore = v[j]; - //cell.set(i, j, v[j]); - } - } - } - return cellScore; - } - - - /** - * Returns the maximum of 4 float numbers. - * - * @param a - * float #1 - * @param b - * float #2 - * @param c - * float #3 - * @param d - * float #4 - * @return The maximum of a, b, c and d. - */ - private static double maximum(double a, double b, double c, double d) { - if (a > b) { - if (a > c) { - return a > d ? a : d; - } else { - return c > d ? c : d; - } - } else if (b > c) { - return b > d ? b : d; - } else { - return c > d ? c : d; - } - } - -} - -/** - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ diff --git a/src/dev/java/japsadev/bio/hts/barcode/SWGAlignment.java b/src/dev/java/japsadev/bio/hts/barcode/SWGAlignment.java index 9de1d18..fceaa9a 100644 --- a/src/dev/java/japsadev/bio/hts/barcode/SWGAlignment.java +++ b/src/dev/java/japsadev/bio/hts/barcode/SWGAlignment.java @@ -1,8 +1,9 @@ package japsadev.bio.hts.barcode; - +/** + * Implement based on jaligner from Ahmed Moustafa + * See license below + */ import java.text.DecimalFormat; - -import jaligner.Cell; import japsa.seq.Sequence; public class SWGAlignment { @@ -61,25 +62,43 @@ /** * Scoring matrix */ -// private Matrix matrix; - //poreFUME's scores - - float [][] matrix = { - { 2.7f, -4.5f, -4.5f, -4.5f}, - { -4.5f, 2.7f, -4.5f, -4.5f}, - { -4.5f, -4.5f, 2.7f, -4.5f}, - { -4.5f, -4.5f, -4.5f, 2.7f} + +// //poreFUME's scores +// static float [][] matrix = { +// { 2.7f, -4.5f, -4.5f, -4.5f}, +// { -4.5f, 2.7f, -4.5f, -4.5f}, +// { -4.5f, -4.5f, 2.7f, -4.5f}, +// { -4.5f, -4.5f, -4.5f, 2.7f} +// }; +// /** +// * Gap open cost +// */ +// static float open=4.7f; +// +// /** +// * Gap extend cost +// */ +// static float extend=1.6f; + + //HOXD70 scoring scheme (F Chiaromonte, VB Yap, W Miller, PSB 2002:115-126) + static float [][] matrix = { + { 91f, -114f, -31f, -123f}, + { -114f, 100f, -125f, -31f}, + { -31f, -125f, 100f, -114f}, + { -123f, -31f, -114f, 91f} }; /** * Gap open cost */ - private float open=4.7f; + static float open=400f; /** * Gap extend cost */ - private float extend=1.6f; - + static float extend=30f; + + + /** * Alignment score */ @@ -161,7 +180,7 @@ public float getExtend() { * The extend to set. */ public void setExtend(float extend) { - this.extend = extend; + SWGAlignment.extend = extend; } /** @@ -206,7 +225,7 @@ public float getOpen() { * The open to set. */ public void setOpen(float open) { - this.open = open; + SWGAlignment.open = open; } /** @@ -461,7 +480,11 @@ public int getGaps2() { return count; } - + /**************************************************************************************** + **************************************************************************************** + ***************************Static functions for the algorithm ************************** + **************************************************************************************** + ****************************************************************************************/ /** * Aligns two sequences by Smith-Waterman (local) @@ -481,7 +504,7 @@ public int getGaps2() { * @see Sequence * @see Matrix */ - public SWGAlignment align(Sequence s1, Sequence s2) { + public static SWGAlignment align(Sequence s1, Sequence s2) { int m = s1.length() + 1; int n = s2.length() + 1; @@ -534,7 +557,7 @@ public SWGAlignment align(Sequence s1, Sequence s2) { * extend gap penalty * @return The cell where the traceback starts. */ - private Cell construct(Sequence s1, Sequence s2, byte[] pointers, short[] sizesOfVerticalGaps, + private static Cell construct(Sequence s1, Sequence s2, byte[] pointers, short[] sizesOfVerticalGaps, short[] sizesOfHorizontalGaps) { char[] a1 = s1.charSequence(); @@ -567,7 +590,8 @@ private Cell construct(Sequence s1, Sequence s2, byte[] pointers, short[] sizesO h = Float.NEGATIVE_INFINITY; vDiagonal = v[0]; for (int j = 1, l = k + 1; j < n; j++, l++) { - similarityScore = matrix[a1[i - 1]][a2[j - 1]]; +// similarityScore = matrix[a1[i - 1]][a2[j - 1]]; + similarityScore = matrix[s1.getBase(i-1)][s2.getBase(j-1)]; // Fill the matrices f = vDiagonal + similarityScore; @@ -629,7 +653,7 @@ private Cell construct(Sequence s1, Sequence s2, byte[] pointers, short[] sizesO * @see Cell * @see Alignment */ - private SWGAlignment traceback(Sequence s1, Sequence s2, byte[] pointers, Cell cell, short[] sizesOfVerticalGaps, + private static SWGAlignment traceback(Sequence s1, Sequence s2, byte[] pointers, Cell cell, short[] sizesOfVerticalGaps, short[] sizesOfHorizontalGaps) { char[] a1 = s1.charSequence(); @@ -685,7 +709,8 @@ private SWGAlignment traceback(Sequence s1, Sequence s2, byte[] pointers, Cell c reversed3[len3++] = MARKUP_IDENTITY; identity++; similarity++; - } else if (matrix[c1][c2] > 0) { +// } else if (matrix[c1][c2] > 0) { + } else if (matrix[s1.getBase(i)][s2.getBase(j)] > 0) { reversed3[len3++] = MARKUP_SIMILARITY; similarity++; } else { @@ -759,4 +784,92 @@ private static float maximum(float a, float b, float c, float d) { return b; } + + static class Cell { + /** + * Row of the cell + */ + private int row; + /** + * Column of the cell + */ + private int col; + /** + * Alignment score at this cell + */ + private float score; + + /** + * Constructor + */ + public Cell() { + super(); + this.row = 0; + this.col = 0; + this.score = Float.NEGATIVE_INFINITY; + } + /** + * @return Returns the col. + */ + public int getCol() { + return this.col; + } + /** + * @param col The col to set. + */ + public void setCol(int col) { + this.col = col; + } + /** + * @return Returns the row. + */ + public int getRow() { + return this.row; + } + /** + * @param row The row to set. + */ + public void setRow(int row) { + this.row = row; + } + /** + * @return Returns the score. + */ + public float getScore() { + return this.score; + } + /** + * @param score The score to set. + */ + public void setScore(float score) { + this.score = score; + } + + /** + * Sets the row, column and score of the cell. + * @param row The row to set. + * @param col The col to set. + * @param score The score to set. + */ + public void set(int row, int col, float score) { + this.row = row; + this.col = col; + this.score = score; + } + } } +/** + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ \ No newline at end of file diff --git a/src/dev/java/japsadev/tools/BarCodeAnalysisCmd.java b/src/dev/java/japsadev/tools/BarCodeAnalysisCmd.java index 36a6fef..f2abe6a 100644 --- a/src/dev/java/japsadev/tools/BarCodeAnalysisCmd.java +++ b/src/dev/java/japsadev/tools/BarCodeAnalysisCmd.java @@ -2,7 +2,6 @@ import java.io.IOException; -import jaligner.matrix.MatrixLoaderException; import japsa.util.CommandLine; import japsa.util.deploy.Deployable; import japsadev.bio.hts.barcode.*; @@ -27,7 +26,7 @@ public BarCodeAnalysisCmd(){ addBoolean("print", false, "Print out demultiplexed reads to corresponding FASTA file or not."); addStdHelp(); } - public static void main(String[] args) throws IOException, InterruptedException, MatrixLoaderException{ + public static void main(String[] args) throws IOException, InterruptedException{ CommandLine cmdLine = new BarCodeAnalysisCmd (); args = cmdLine.stdParseLine(args); diff --git a/src/main/java/japsa/tools/bio/np/BarCodeAnalysisCmd.java b/src/main/java/japsa/tools/bio/np/BarCodeAnalysisCmd.java index 89e5691..592b517 100644 --- a/src/main/java/japsa/tools/bio/np/BarCodeAnalysisCmd.java +++ b/src/main/java/japsa/tools/bio/np/BarCodeAnalysisCmd.java @@ -2,7 +2,6 @@ import java.io.IOException; -import jaligner.matrix.MatrixLoaderException; import japsa.util.CommandLine; import japsa.util.deploy.Deployable; import japsa.bio.np.barcode.*; @@ -26,7 +25,7 @@ public BarCodeAnalysisCmd(){ addBoolean("print", false, "Print out demultiplexed reads to corresponding FASTA file or not."); addStdHelp(); } - public static void main(String[] args) throws IOException, InterruptedException, MatrixLoaderException{ + public static void main(String[] args) throws IOException, InterruptedException{ CommandLine cmdLine = new BarCodeAnalysisCmd (); args = cmdLine.stdParseLine(args);