forked from biojava/biojava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetchGenBank.java
More file actions
58 lines (47 loc) · 1.86 KB
/
Copy pathfetchGenBank.java
File metadata and controls
58 lines (47 loc) · 1.86 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
*Class Name:BIF618: Java for Biotechnology Applications
*Week#10-11, Discussion In-Class Exercise 1
*File Name: fetchGenBank
*Program author name: Samsus Saintloth
*/
import java.io.PrintStream;
import java.util.*;
import org.biojava.bio.*;
import org.biojavax.bio.db.ncbi.GenbankRichSequenceDB;
import org.biojavax.bio.db.ncbi.GenpeptRichSequenceDB;
import org.biojavax.bio.seq.RichSequence;
public class fetchGenBank {
public fetchGenBank() {
}
public static void main(String[] args) {
RichSequence seqRch;
GenbankRichSequenceDB grsdb = new GenbankRichSequenceDB();
Scanner input = new Scanner(System.in);
try {
System.out.println("Enter your name:");
String name = input.nextLine();
System.out.println("Enter a GenBank accession number or gi number:");
String id = input.nextLine();
System.out.println("Is this a DNA or protein sequence? (Enter 'DNA' or 'protein'):");
String type = input.nextLine().trim().toLowerCase();
if (type.equals("dna")) {
rs = grsdb.getRichSequence(id);
} else if (type.equals("protein")) {
GenpeptRichSequenceDB prsdb = new GenpeptRichSequenceDB();
rs = prsdb.getRichSequence(id);
} else {
System.out.println("Invalid type entered. Please enter 'DNA' or 'protein'.");
System.exit(1);
}
System.out.println("Sequence retrieved by: " + name);
PrintStream var10000 = System.out;
String fetchme = seqRch.getName();
var10000.println(var10001 + " | " + rs.getDescription());
System.out.println(seqRch.seqString());
System.out.println("Author name: Samsus Saintloth");
} catch (BioException var7) {
var7.printStackTrace();
System.exit(-1);
}
}
}