--- /dev/null
+/* Copyright (c) 2009 Peter Troshin\r
+ * \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * \r
+ * This library is free software; you can redistribute it and/or modify it under the terms of the\r
+ * Apache License version 2 as published by the Apache Software Foundation\r
+ * \r
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without\r
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache \r
+ * License for more details.\r
+ * \r
+ * A copy of the license is in apache_license.txt. It is also available here:\r
+ * @see: http://www.apache.org/licenses/LICENSE-2.0.txt\r
+ * \r
+ * Any republication or derived work distributed in source code form\r
+ * must include this copyright and license notice.\r
+ */\r
+\r
+package compbio.data.sequence;\r
+\r
+import java.io.IOException;\r
+import java.util.List;\r
+\r
+import compbio.util.FileUtil;\r
+\r
+public class FastaGeneratorManager {\r
+\r
+ public static void main(String[] args) throws IOException {\r
+ FastaSequenceGenerator fgen = new FastaSequenceGenerator(\r
+ FastaSequenceGenerator.SeqType.PROTEIN, 50);\r
+\r
+ List<FastaSequence> fslist = fgen.generateFasta(400);\r
+ writeToFile(fslist, "SmallProtein.fasta");\r
+\r
+ fgen = new FastaSequenceGenerator(\r
+ FastaSequenceGenerator.SeqType.PROTEIN, 200);\r
+\r
+ fslist = fgen.generateFasta(500);\r
+ writeToFile(fslist, "200x500Protein.fasta");\r
+\r
+ fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
+ 1000);\r
+ fslist = fgen.generateFasta(3000);\r
+ writeToFile(fslist, "1000x3000Dna.fasta");\r
+\r
+ fgen = new FastaSequenceGenerator(FastaSequenceGenerator.SeqType.DNA,\r
+ 50000);\r
+ fslist = fgen.generateFasta(300);\r
+ writeToFile(fslist, "50000x300Dna.fasta");\r
+ System.out.println("Done");\r
+ }\r
+\r
+ static void writeToFile(List<FastaSequence> fastalist, String filepath)\r
+ throws IOException {\r
+ StringBuilder sb = new StringBuilder();\r
+ for (FastaSequence fs : fastalist) {\r
+ sb.append(fs.getOnelineFasta() + "\n");\r
+ }\r
+ FileUtil.writeToFile(sb.toString(), filepath);\r
+ }\r
+}\r