Debian Codegraph @

display/src/amap/Alignment.java

raw
1
2 //============================================================================
3 //
4 // file: Alignment.java
5 //
6 // Copyright (c) 2007, Michael E. Smoot
7 //
8 // This program is free software; you can redistribute it and/or modify it
9 // under the terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 2 of the License, or (at your
11 // option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 // for more details.
17 //
18 // You should have received a copy of the GNU General Public License along
19 // with this program; if not, write to the Free Software Foundation, Inc.,
20 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //
22 //============================================================================
23
24 package amap;
25
26 import java.util.*;
27
28 public class Alignment {
29
30 Map<String,String> seqs;
31 Map<String,String> colors;
32 List<String> keys;
33 double nWeight;
34
35 public Alignment(List<String> keys, Map<String,String> seqs, Map<String,String> colors, double nWeight) {
36 this.keys = keys;
37 this.seqs = seqs;
38 this.colors = colors;
39 this.nWeight = nWeight;
40 }
41
42 public List<String> getOrderedKeys() {
43 return keys;
44 }
45
46 public Map<String,String> getSequences() {
47 return seqs;
48 }
49
50 public Map<String,String> getColors() {
51 return colors;
52 }
53
54 public double getWeight() {
55 return nWeight;
56 }
57
58 public String toString() {
59 StringBuffer sb = new StringBuffer();
60 sb.append("Weight = ");
61 sb.append((new Double(nWeight)).toString());
62 sb.append("\n");
63 for ( String key : seqs.keySet() ) {
64 sb.append(key);
65 sb.append("\t");
66 sb.append(seqs.get(key));
67 sb.append("\n");
68 }
69 sb.append("\n");
70 sb.append("\n");
71
72 return sb.toString();
73 }
74
75 public String toMultiFasta() {
76 StringBuffer sb = new StringBuffer();
77 for ( String key : keys ) {
78 sb.append(">");
79 sb.append(key);
80 sb.append("\n");
81 sb.append(seqs.get(key));
82 sb.append("\n");
83 }
84 return sb.toString();
85 }
86 }