[1544] | 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 |
|
---|
| 18 | import java.util.Collection;
|
---|
| 19 | import java.util.LinkedList;
|
---|
| 20 | import java.util.List;
|
---|
| 21 |
|
---|
| 22 | import de.ugoe.cs.autoquest.eventcore.Event;
|
---|
| 23 | import de.ugoe.cs.autoquest.plugin.alignment.SmithWaterman;
|
---|
| 24 | import de.ugoe.cs.autoquest.plugin.alignment.seqgen.SimpleSequenceGenerator;
|
---|
| 25 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.NearbySubstitutionMatrix;
|
---|
| 26 | import de.ugoe.cs.autoquest.plugin.alignment.substitution.ObjectDistanceSubstitionMatrix;
|
---|
| 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 | *
|
---|
| 36 | * @author Ralph Krimmel
|
---|
| 37 | * @version 1.0
|
---|
| 38 | */
|
---|
| 39 | public class CMDgenerateSubstitutionMatrix 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 | try {
|
---|
| 50 | sequencesName = (String) parameters.get(0);
|
---|
| 51 | } catch (Exception e) {
|
---|
| 52 | throw new IllegalArgumentException();
|
---|
| 53 | }
|
---|
| 54 |
|
---|
| 55 | Collection<List<Event>> sequences = new LinkedList<List<Event>>();
|
---|
| 56 | Object obj = GlobalDataContainer.getInstance().getData(sequencesName);
|
---|
| 57 | if(obj != null) {
|
---|
| 58 |
|
---|
| 59 | if(obj.getClass().equals(sequences.getClass())) {
|
---|
| 60 | sequences = (Collection<List<Event>>) obj;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | Console.println("Number of sequences: " + sequences.size());
|
---|
| 65 |
|
---|
| 66 | SimpleSequenceGenerator gen = new SimpleSequenceGenerator();
|
---|
| 67 | gen.generate(sequences);
|
---|
| 68 | gen.print();
|
---|
| 69 | GlobalDataContainer.getInstance().addData("numberSequences", gen);
|
---|
| 70 |
|
---|
| 71 |
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 | }
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | * (non-Javadoc)
|
---|
| 80 | *
|
---|
| 81 | * @see de.ugoe.cs.util.console.Command#help()
|
---|
| 82 | */
|
---|
| 83 | @Override
|
---|
| 84 | public String help() {
|
---|
| 85 | return "generateSubstitutionMatrix <NumberSequencesName> {<algorithm>}";
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 |
|
---|
| 89 | }
|
---|