source: trunk/autoquest-plugin-alignment/src/main/java/de/ugoe/cs/autoquest/plugin/alignment/commands/CMDbinaryAlignment.java @ 1543

Last change on this file since 1543 was 1543, checked in by rkrimmel, 10 years ago

Changing device

File size: 3.2 KB
Line 
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
15package de.ugoe.cs.autoquest.plugin.alignment.commands;
16
17import java.util.Collection;
18import java.util.LinkedList;
19import java.util.List;
20
21import de.ugoe.cs.autoquest.eventcore.Event;
22import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
23import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SequenceGenerator;
24import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
25import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
26import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
27import de.ugoe.cs.util.console.Command;
28import de.ugoe.cs.util.console.Console;
29import de.ugoe.cs.util.console.GlobalDataContainer;
30
31/**
32 * <p>
33 * Command to generate a binary alignment of two sequences
34 * </p>
35 *
36 * @author Ralph Krimmel
37 * @version 1.0
38 */
39public class CMDbinaryAlignment implements Command {
40
41        /*
42         * (non-Javadoc)
43         *
44         * @see de.ugoe.cs.util.console.Command#run(java.util.List)
45         */
46        @SuppressWarnings("unchecked")
47        public void run(List<Object> parameters) {
48                String sequencesName = "numberSequences";
49                String substitutionName = "substitutionMatrix";
50                String algorithm = "smithwaterman";
51                try {
52                        sequencesName = (String) parameters.get(0);
53                        substitutionName = (String) parameters.get(1);
54                        if (parameters.size() > 2) {
55                                algorithm = (String) parameters.get(2);
56                        }
57                } catch (Exception e) {
58                        throw new IllegalArgumentException();
59                }
60
61                SimpleSequenceGenerator gen;
62                Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
63                if (obj != null) {
64                        if (obj instanceof SimpleSequenceGenerator) {
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();
70                               
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");
81
82                        } else {
83                                Console.printerr("No number sequences generated. Please run the generateNumberSequences before.");
84                               
85                        }
86
87                                        }
88
89        }
90
91        /*
92         * (non-Javadoc)
93         *
94         * @see de.ugoe.cs.util.console.Command#help()
95         */
96        @Override
97        public String help() {
98                return "binaryAlignment <sequencesName> <substitutionMatrixname> {<algorithm>}";
99        }
100
101}
Note: See TracBrowser for help on using the repository browser.