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

Last change on this file since 1450 was 1449, checked in by rkrimmel, 10 years ago
File size: 3.0 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
17
18import java.util.Collection;
19import java.util.LinkedList;
20import java.util.List;
21
22import de.ugoe.cs.autoquest.eventcore.Event;
23import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
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 = "sequences";
49                String algorithm;
50                try {
51                        sequencesName = (String) parameters.get(0);
52                        if (parameters.size() > 1) {
53                                algorithm = (String) parameters.get(1);
54                        }
55                } catch (Exception e) {
56                        throw new IllegalArgumentException();
57                }
58
59                Collection<List<Event>> sequences = new LinkedList<List<Event>>();
60                Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
61                if(obj != null) {
62                       
63                        if(obj.getClass().equals(sequences.getClass())) {
64                                sequences = (Collection<List<Event>>) obj;
65                        }
66                 
67                               
68                                        Console.println("Number of sequences: " + sequences.size());
69
70                                        SimpleSequenceGenerator gen = new SimpleSequenceGenerator();
71                                        gen.generate(sequences);
72                                        int[] seq1 = gen.get(0).getSequence();
73                                        int[] seq2 = gen.get(0).getSequence();
74                                        //ObjectDistanceSubstitionMatrix submat = new ObjectDistanceSubstitionMatrix();
75                                        //submat.generate(sequences);
76                                        //SmithWaterman sw = new SmithWaterman(seq1, seq2,
77                                        //              new NearbySubstitutionMatrix(seq1, seq2, 10));
78
79                                //sw.printDPMatrix();
80                                //System.out.println();
81                                //sw.printAlignments();
82                                // sw.getMatches();
83                                        System.out.println("foo");
84                                }
85                        }
86
87
88        /*
89         * (non-Javadoc)
90         *
91         * @see de.ugoe.cs.util.console.Command#help()
92         */
93        @Override
94        public String help() {
95                return "binaryAlignment <sequencesName> {<algorithm>}";
96        }
97
98}
Note: See TracBrowser for help on using the repository browser.