View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2010 utgenome.org
3    *
4    *  Licensed under the Apache License, Version 2.0 (the "License");
5    *  you may not use this file except in compliance with the License.
6    *  You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   *  Unless required by applicable law or agreed to in writing, software
11   *  distributed under the License is distributed on an "AS IS" BASIS,
12   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   *  See the License for the specific language governing permissions and
14   *  limitations under the License.
15   *--------------------------------------------------------------------------*/
16  //--------------------------------------
17  // utgb-core Project
18  //
19  // AXTAlignment.java
20  // Since: 2010/11/26
21  //
22  //--------------------------------------
23  package org.utgenome.format.axt;
24  
25  import java.io.IOException;
26  import java.io.Writer;
27  
28  /**
29   * Record in AXT format
30   * 
31   * @author leo
32   * 
33   */
34  public class AXTAlignment {
35  
36  	public int num;
37  	public String s_chr;
38  	public int s_start;
39  	public int s_end;
40  	public String d_chr;
41  	public int d_start;
42  	public int d_end;
43  	public String strand;
44  	public int score;
45  
46  	public String primaryAssembly;
47  	public String aligningAssembly;
48  
49  	public void toAXT(Writer out) throws IOException {
50  		out.append(Integer.toString(num));
51  		out.append("\t");
52  		out.append(s_chr);
53  		out.append("\t");
54  		out.append(Integer.toString(s_start));
55  		out.append("\t");
56  		out.append(Integer.toString(s_end));
57  		out.append("\t");
58  		out.append(d_chr);
59  		out.append("\t");
60  		out.append(Integer.toString(d_start));
61  		out.append("\t");
62  		out.append(Integer.toString(d_end));
63  		out.append("\t");
64  		out.append(strand);
65  		out.append("\t");
66  		out.append(Integer.toString(score));
67  		out.append("\n");
68  
69  		out.append(primaryAssembly);
70  		out.append("\n");
71  		out.append(aligningAssembly);
72  		out.append("\n");
73  		out.append("\n");
74  	}
75  
76  	@Override
77  	public boolean equals(Object obj) {
78  
79  		AXTAlignment other = AXTAlignment.class.cast(obj);
80  		if (num != other.num)
81  			return false;
82  		if (!s_chr.equals(other.s_chr))
83  			return false;
84  		if (s_start != other.s_start)
85  			return false;
86  		if (s_end != other.s_end)
87  			return false;
88  		if (!d_chr.equals(other.d_chr))
89  			return false;
90  		if (d_start != other.d_start)
91  			return false;
92  		if (d_end != other.d_end)
93  			return false;
94  		if (!primaryAssembly.equals(other.primaryAssembly))
95  			return false;
96  		if (!aligningAssembly.equals(other.aligningAssembly))
97  			return false;
98  		if (score != other.score)
99  			return false;
100 
101 		return true;
102 	}
103 
104 }