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.io.File;
|
---|
18 | import java.io.FilenameFilter;
|
---|
19 | import java.util.Collection;
|
---|
20 | import java.util.Iterator;
|
---|
21 | import java.util.LinkedList;
|
---|
22 | import java.util.List;
|
---|
23 | import java.util.logging.Level;
|
---|
24 |
|
---|
25 | import de.ugoe.cs.autoquest.CommandHelpers;
|
---|
26 | import de.ugoe.cs.autoquest.eventcore.Event;
|
---|
27 | import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
|
---|
28 | import de.ugoe.cs.autoquest.plugin.alignment.seqgen.RandomSequenceGenerator;
|
---|
29 | import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
|
---|
30 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.DifferenceSubstitutionMatrix;
|
---|
31 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
|
---|
32 | import de.ugoe.cs.autoquest.tasktrees.manager.TaskTreeManager;
|
---|
33 | import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
|
---|
34 | import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskInstanceComparator;
|
---|
35 | import de.ugoe.cs.autoquest.tasktrees.temporalrelation.TaskHandlingStrategy;
|
---|
36 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
|
---|
37 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
|
---|
38 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance;
|
---|
39 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IUserSession;
|
---|
40 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder;
|
---|
41 | import de.ugoe.cs.autoquest.usageprofiles.SymbolMap;
|
---|
42 | import de.ugoe.cs.util.console.Command;
|
---|
43 | import de.ugoe.cs.util.console.Console;
|
---|
44 | import de.ugoe.cs.util.console.GlobalDataContainer;
|
---|
45 |
|
---|
46 | /**
|
---|
47 | * <p>
|
---|
48 | * Command to generate a binary alignment of two sequences
|
---|
49 | * </p>
|
---|
50 | *
|
---|
51 | * @author Steffen Herbold
|
---|
52 | * @version 1.0
|
---|
53 | */
|
---|
54 | public class CMDbinaryAlignment implements Command {
|
---|
55 |
|
---|
56 | /*
|
---|
57 | * (non-Javadoc)
|
---|
58 | *
|
---|
59 | * @see de.ugoe.cs.util.console.Command#run(java.util.List)
|
---|
60 | */
|
---|
61 | public void run(List<Object> parameters) {
|
---|
62 | String sequencesName;
|
---|
63 | String algorithm;
|
---|
64 | try {
|
---|
65 | sequencesName = (String) parameters.get(0);
|
---|
66 | if (parameters.size() > 1) {
|
---|
67 | algorithm = (String) parameters.get(1);
|
---|
68 | }
|
---|
69 | } catch (Exception e) {
|
---|
70 | throw new IllegalArgumentException();
|
---|
71 | }
|
---|
72 |
|
---|
73 | Collection<List<Event>> sequences = new LinkedList<List<Event>>();
|
---|
74 | sequences = (Collection<List<Event>>) GlobalDataContainer.getInstance()
|
---|
75 | .getData(sequencesName);
|
---|
76 | if(sequences != null) {
|
---|
77 | Console.println("Number of sequences: " + sequences.size());
|
---|
78 |
|
---|
79 | SimpleSequenceGenerator gen = new SimpleSequenceGenerator();
|
---|
80 | gen.generate(sequences);
|
---|
81 | int[] seq1 = gen.get(0);
|
---|
82 | int[] seq2 = gen.get(0);
|
---|
83 | SmithWaterman sw = new SmithWaterman(seq1, seq2,
|
---|
84 | new NearbySubstitutionMatrix(seq1, seq2, 10));
|
---|
85 |
|
---|
86 | //printDPMatrix();
|
---|
87 | System.out.println();
|
---|
88 | sw.printAlignments();
|
---|
89 | // sw.getMatches();
|
---|
90 | }
|
---|
91 | }
|
---|
92 |
|
---|
93 |
|
---|
94 | /*
|
---|
95 | * (non-Javadoc)
|
---|
96 | *
|
---|
97 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
98 | */
|
---|
99 | @Override
|
---|
100 | public String help() {
|
---|
101 | return "binaryAlignment <sequencesName> {<algorithm>}";
|
---|
102 | }
|
---|
103 |
|
---|
104 | }
|
---|