|
30 | 30 |
|
31 | 31 | import java.util.SortedSet; |
32 | 32 |
|
33 | | -/** The cookbook recipe for how to request Pfam annotations for a protein sequence using the Hmmer3 service |
| 33 | +/** |
| 34 | + * The cookbook recipe for how to request Pfam annotations for a protein sequence using the Hmmer3 service |
34 | 35 | * |
35 | 36 | * @author Andreas Prlic |
36 | 37 | * @since 3.0.3 |
37 | 38 | */ |
38 | 39 | public class HmmerDemo { |
39 | 40 |
|
40 | | - public static void main(String[] args){ |
| 41 | + public static void main(String[] args) throws Exception { |
41 | 42 |
|
42 | | - try { |
43 | | - // first we get a UniProt sequence |
44 | | - String uniProtID = "P08487"; |
45 | | - ProteinSequence seq = getUniprot(uniProtID); |
46 | 43 |
|
| 44 | + // first we get a UniProt sequence |
| 45 | + String uniProtID = "P08487"; |
| 46 | + ProteinSequence seq = getUniprot(uniProtID); |
47 | 47 |
|
48 | | - // now we submit this sequence to the Hmmer web site |
49 | | - RemoteHmmerScan hmmer = new RemoteHmmerScan(); |
50 | 48 |
|
51 | | - SortedSet<HmmerResult> results = hmmer.scan(seq); |
| 49 | + // now we submit this sequence to the Hmmer web site |
| 50 | + RemoteHmmerScan hmmer = new RemoteHmmerScan(); |
52 | 51 |
|
53 | | - // and now let's print out the obtained annotations |
| 52 | + SortedSet<HmmerResult> results = hmmer.scan(seq); |
54 | 53 |
|
55 | | - System.out.println(String.format("#\t%15s\t%10s\t%s\t%s\t%8s\t%s", |
56 | | - "Domain","ACC", "Start","End","eValue","Description")); |
| 54 | + // and now let's print out the obtained annotations |
57 | 55 |
|
58 | | - int counter = 0; |
59 | | - for (HmmerResult hmmerResult : results) { |
60 | | - //System.out.println(hmmerResult); |
| 56 | + System.out.println(String.format("#\t%15s\t%10s\t%s\t%s\t%8s\t%s", |
| 57 | + "Domain","ACC", "Start","End","eValue","Description")); |
61 | 58 |
|
62 | | - for ( HmmerDomain domain : hmmerResult.getDomains()) { |
63 | | - counter++; |
64 | | - System.out.println(String.format("%d\t%15s\t%10s\t%5d\t%5d\t%.2e\t%s", |
65 | | - counter, |
66 | | - hmmerResult.getName(), domain.getHmmAcc(), |
67 | | - domain.getSqFrom(),domain.getSqTo(), |
68 | | - domain.getEvalue(), hmmerResult.getDesc() |
69 | | - )); |
| 59 | + int counter = 0; |
| 60 | + for (HmmerResult hmmerResult : results) { |
| 61 | + //System.out.println(hmmerResult); |
70 | 62 |
|
71 | | - } |
| 63 | + for ( HmmerDomain domain : hmmerResult.getDomains()) { |
| 64 | + counter++; |
| 65 | + System.out.println(String.format("%d\t%15s\t%10s\t%5d\t%5d\t%.2e\t%s", |
| 66 | + counter, |
| 67 | + hmmerResult.getName(), domain.getHmmAcc(), |
| 68 | + domain.getSqFrom(),domain.getSqTo(), |
| 69 | + domain.getEvalue(), hmmerResult.getDesc() |
| 70 | + )); |
72 | 71 |
|
73 | 72 | } |
74 | 73 |
|
75 | | - } catch (Exception e) { |
76 | | - // TODO Auto-generated catch block |
77 | | - e.printStackTrace(); |
78 | 74 | } |
| 75 | + |
| 76 | + |
79 | 77 | } |
80 | 78 |
|
81 | | - /** Fetch a protein sequence from the UniProt web site |
| 79 | + /** |
| 80 | + * Fetch a protein sequence from the UniProt web site |
82 | 81 | * |
83 | 82 | * @param uniProtID |
84 | 83 | * @return a Protein Sequence |
|
0 commit comments