[1314] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany
|
---|
| 2 | //
|
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License");
|
---|
| 4 | // you may not use this file except in compliance with the License.
|
---|
| 5 | // You may obtain a copy of the License at
|
---|
| 6 | //
|
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 8 | //
|
---|
| 9 | // Unless required by applicable law or agreed to in writing, software
|
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS,
|
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
| 12 | // See the License for the specific language governing permissions and
|
---|
| 13 | // limitations under the License.
|
---|
| 14 |
|
---|
| 15 | package de.ugoe.cs.autoquest.plugin.alignment.commands;
|
---|
| 16 |
|
---|
| 17 | import java.util.Collection;
|
---|
| 18 | import java.util.LinkedList;
|
---|
| 19 | import java.util.List;
|
---|
| 20 |
|
---|
| 21 | import de.ugoe.cs.autoquest.eventcore.Event;
|
---|
| 22 | import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
|
---|
[1542] | 23 | import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SequenceGenerator;
|
---|
[1323] | 24 | import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
|
---|
| 25 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
|
---|
[1330] | 26 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
|
---|
[1314] | 27 | import de.ugoe.cs.util.console.Command;
|
---|
| 28 | import de.ugoe.cs.util.console.Console;
|
---|
| 29 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
| 30 |
|
---|
| 31 | /**
|
---|
| 32 | * <p>
|
---|
| 33 | * Command to generate a binary alignment of two sequences
|
---|
| 34 | * </p>
|
---|
| 35 | *
|
---|
[1330] | 36 | * @author Ralph Krimmel
|
---|
[1314] | 37 | * @version 1.0
|
---|
| 38 | */
|
---|
| 39 | public class CMDbinaryAlignment implements Command {
|
---|
| 40 |
|
---|
| 41 | /*
|
---|
| 42 | * (non-Javadoc)
|
---|
| 43 | *
|
---|
| 44 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
| 45 | */
|
---|
[1449] | 46 | @SuppressWarnings("unchecked")
|
---|
[1314] | 47 | public void run(List<Object> parameters) {
|
---|
[1542] | 48 | String sequencesName = "numberSequences";
|
---|
| 49 | String substitutionName = "substitutionMatrix";
|
---|
| 50 | String algorithm = "smithwaterman";
|
---|
[1314] | 51 | try {
|
---|
| 52 | sequencesName = (String) parameters.get(0);
|
---|
[1542] | 53 | substitutionName = (String) parameters.get(1);
|
---|
| 54 | if (parameters.size() > 2) {
|
---|
| 55 | algorithm = (String) parameters.get(2);
|
---|
[1314] | 56 | }
|
---|
| 57 | } catch (Exception e) {
|
---|
| 58 | throw new IllegalArgumentException();
|
---|
| 59 | }
|
---|
| 60 |
|
---|
[1542] | 61 | SimpleSequenceGenerator gen;
|
---|
[1330] | 62 | Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
|
---|
[1542] | 63 | if (obj != null) {
|
---|
[1543] | 64 | if (obj instanceof SimpleSequenceGenerator) {
|
---|
[1542] | 65 | gen = (SimpleSequenceGenerator) obj;
|
---|
| 66 | Console.println("Number of sequences: " + gen.sequenceCount());
|
---|
| 67 |
|
---|
| 68 | int[] seq1 = gen.get(0).getSequence();
|
---|
| 69 | int[] seq2 = gen.get(0).getSequence();
|
---|
[1449] | 70 |
|
---|
[1542] | 71 | ObjectDistanceSubstitionMatrix submat = new
|
---|
| 72 | ObjectDistanceSubstitionMatrix();
|
---|
| 73 | submat.generate(sequences);
|
---|
| 74 | // SmithWaterman sw = new SmithWaterman(seq1, seq2,
|
---|
| 75 | // new NearbySubstitutionMatrix(seq1, seq2, 10));
|
---|
| 76 | // sw.printDPMatrix();
|
---|
| 77 | // System.out.println();
|
---|
| 78 | // sw.printAlignments();
|
---|
| 79 | // sw.getMatches();
|
---|
| 80 | System.out.println("foo");
|
---|
[1314] | 81 |
|
---|
[1542] | 82 | } else {
|
---|
| 83 | Console.printerr("No number sequences generated. Please run the generateNumberSequences before.");
|
---|
| 84 |
|
---|
[1323] | 85 | }
|
---|
[1314] | 86 |
|
---|
[1542] | 87 | }
|
---|
[1323] | 88 |
|
---|
[1542] | 89 | }
|
---|
| 90 |
|
---|
[1314] | 91 | /*
|
---|
| 92 | * (non-Javadoc)
|
---|
| 93 | *
|
---|
| 94 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 95 | */
|
---|
| 96 | @Override
|
---|
| 97 | public String help() {
|
---|
[1542] | 98 | return "binaryAlignment <sequencesName> <substitutionMatrixname> {<algorithm>}";
|
---|
[1314] | 99 | }
|
---|
| 100 |
|
---|
| 101 | }
|
---|