-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFasta.java
More file actions
41 lines (33 loc) · 978 Bytes
/
Fasta.java
File metadata and controls
41 lines (33 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Peter Edge
* CSCI 5481 Final Project
*
* This file contains the Fasta class, used to represent fasta sequences.
*
*/
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.io.IOException;
import java.util.ArrayList;
import java.lang.StringBuilder;
public class Fasta {
// header and sequence of the fasta file
String header;
String sequence;
// see if the sequence is being stored in reverse order of original
boolean isReversed;
Fasta(){};
Fasta(String h, String s, boolean ir){
header = h;
sequence = s;
isReversed = ir;
}
// reverse the sequence and set the isReversed tag.
Fasta reverse(){
return new Fasta(header ,(new StringBuilder(sequence)).reverse().toString(), !isReversed);
}
@Override
public String toString(){
return ("header: " + header + "\n" + "sequence: " + sequence + "\n" + "isReversed: " + isReversed);
}
}