- this(s, false);
- }
-
- /**
- * Creates a new PCA object. By default, uses blosum62 matrix to generate
- * sequence similarity matrices
- *
- * @param s
- * Set of sequences to perform PCA on
- * @param nucleotides
- * if true, uses standard DNA/RNA matrix for sequence similarity
- * calculation.
- */
- public PCA(String[] s, boolean nucleotides)
- {
- this(s, nucleotides, null);
- }
-
- public PCA(String[] s, boolean nucleotides, String s_m)
- {
- this.seqs = s;
-
- // BinarySequence[] bs = new BinarySequence[s.length];
- // int ii = 0;
- //
- // while ((ii < s.length) && (s[ii] != null))
- // {
- // bs[ii] = new BinarySequence(s[ii], nucleotides);
- // bs[ii].encode();
- // ii++;
- // }
- //
- // BinarySequence[] bs2 = new BinarySequence[s.length];
- scoreMatrix = null;
- String sm = s_m;
- if (sm != null)
- {
- scoreMatrix = ResidueProperties.getScoreMatrix(sm);
- }
- if (scoreMatrix == null)
- {
- // either we were given a non-existent score matrix or a scoremodel that
- // isn't based on a pairwise symbol score matrix
- scoreMatrix = ResidueProperties
- .getScoreMatrix(sm = (nucleotides ? "DNA" : "BLOSUM62"));
- }
- details.append("PCA calculation using " + sm
- + " sequence similarity matrix\n========\n\n");
- // ii = 0;
- // while ((ii < s.length) && (s[ii] != null))
- // {
- // bs2[ii] = new BinarySequence(s[ii], nucleotides);
- // if (scoreMatrix != null)
- // {
- // try
- // {
- // bs2[ii].matrixEncode(scoreMatrix);
- // } catch (InvalidSequenceTypeException x)
- // {
- // details.append("Unexpected mismatch of sequence type and score matrix. Calculation will not be valid!\n\n");
- // }
- // }
- // ii++;
- // }
- //
- // int count = 0;
- // while ((count < bs.length) && (bs[count] != null))
- // {
- // count++;
- // }
- //
- // double[][] seqmat = new double[count][];
- // double[][] seqmat2 = new double[count][];
- //
- // int i = 0;
- // while (i < count)
- // {
- // seqmat[i] = bs[i].getDBinary();
- // seqmat2[i] = bs2[i].getDBinary();
- // i++;
- // }
- //
- // /*
- // * using a SparseMatrix to hold the encoded sequences matrix
- // * greatly speeds up matrix multiplication as these are mostly zero
- // */
- // m = new SparseMatrix(seqmat);
- // m2 = new Matrix(seqmat2);
-