1 /*--------------------------------------------------------------------------
2 * Copyright 2007 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 Common Project
18 //
19 // FASTASequence.java
20 // Since: Jun 4, 2007
21 //
22 // $URL$
23 // $Author$
24 //--------------------------------------
25 package org.utgenome.format.fasta;
26
27 /**
28 * A FASTASequence represents an entry in FASTA files
29 *
30 * @author leo
31 *
32 */
33 public class FASTASequence {
34 private String sequence = "";
35 private String descriptionLine;
36
37 /**
38 * @param _sequence
39 * @param _description
40 */
41 public FASTASequence(String rawDescription, String sequence) {
42 this.descriptionLine = rawDescription;
43 this.sequence = sequence;
44 }
45
46 public FASTASequence() {
47 }
48
49 /**
50 * Extract a sequence name from the description line
51 *
52 * @return
53 */
54 public String getSequenceName() {
55 return CompactFASTA.pickSequenceName(descriptionLine);
56 }
57
58 public String getDescriptionLine() {
59 return descriptionLine;
60 }
61
62 public String getSequence() {
63 return sequence;
64 }
65
66 public void setSequence(String sequence) {
67 this.sequence = sequence;
68 }
69
70 @Override
71 public String toString() {
72 return descriptionLine + ":" + sequence;
73 }
74 }