test for JWS-35 - check that range and first value of prediction for each method...
[jabaws.git] / testsrc / compbio / data / sequence / FastaGeneratorManager.java
1 /* Copyright (c) 2009 Peter Troshin\r
2  *  \r
3  *  JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0     \r
4  * \r
5  *  This library is free software; you can redistribute it and/or modify it under the terms of the\r
6  *  Apache License version 2 as published by the Apache Software Foundation\r
7  * \r
8  *  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
9  *  even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
10  *  License for more details.\r
11  * \r
12  *  A copy of the license is in apache_license.txt. It is also available here:\r
13  * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
14  * \r
15  * Any republication or derived work distributed in source code form\r
16  * must include this copyright and license notice.\r
17  */\r
18 \r
19 package compbio.data.sequence;\r
20 \r
21 import java.io.IOException;\r
22 import java.util.List;\r
23 \r
24 import compbio.util.FileUtil;\r
25 \r
26 public class FastaGeneratorManager {\r
27 \r
28         public static void main(String[] args) throws IOException {\r
29                 FastaSequenceGenerator fgen = new FastaSequenceGenerator(\r
30                                 FastaSequenceGenerator.SeqType.PROTEIN, 50);\r
31 \r
32                 List<FastaSequence> fslist = fgen.generateFasta(400);\r
33                 writeToFile(fslist, "SmallProtein.fasta");\r
34 \r
35                 fgen = new FastaSequenceGenerator(\r
36                                 FastaSequenceGenerator.SeqType.PROTEIN, 200);\r
37 \r
38                 fslist = fgen.generateFasta(500);\r
39                 writeToFile(fslist, "200x500Protein.fasta");\r
40 \r
41                 fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
42                                 1000);\r
43                 fslist = fgen.generateFasta(3000);\r
44                 writeToFile(fslist, "1000x3000Dna.fasta");\r
45 \r
46                 fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
47                                 50000);\r
48                 fslist = fgen.generateFasta(300);\r
49                 writeToFile(fslist, "50000x300Dna.fasta");\r
50                 System.out.println("Done");\r
51         }\r
52 \r
53         static void writeToFile(List<FastaSequence> fastalist, String filepath)\r
54                         throws IOException {\r
55                 StringBuilder sb = new StringBuilder();\r
56                 for (FastaSequence fs : fastalist) {\r
57                         sb.append(fs.getOnelineFasta() + "\n");\r
58                 }\r
59                 FileUtil.writeToFile(sb.toString(), filepath);\r
60         }\r
61 }\r