// Path: src/thesaurus/util/ThesaurusIO.java
// public class ThesaurusIO {
// 
//     private static String spaceRepeat(int n) {
//         StringBuilder sb = new StringBuilder();
//         for (int i = 0; i < n; i++) {
//             sb.append(" ");
//         }
//         return (sb.toString());
//     }
// 
//     public static void printHelpItem(String key, String description) {
//         int keylength = key.length();
// 
//         // split the description into multiple lines
//         String[] dtokens = description.split(" ");
//         ArrayList<String> dlines = new ArrayList<String>();
//         String nowline = "";
//         int nowtoken = 0;
//         while (nowtoken < dtokens.length) {
//             if (nowline.length() > 50) {
//                 dlines.add(nowline + "\n");
//                 nowline = "";
//             }
//             nowline += dtokens[nowtoken] + " ";
//             nowtoken++;
//         }
//         dlines.add(nowline + "\n");
// 
// 
//         StringBuilder sb = new StringBuilder();
//         if (key.length() < 30) {
//             sb.append("  ").append(key);
//             sb.append(spaceRepeat(26 - keylength));
//         } else {
//             sb.append("  ").append(key).append("\n");
//             sb.append(spaceRepeat(28));
//         }
//         sb.append("- ").append(dlines.get(0));
//         for (int i = 1; i < dlines.size(); i++) {
//             sb.append(spaceRepeat(30)).append(dlines.get(i));
//         }
// 
//         System.out.print(sb.toString());
//     }
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import jsequtils.file.BufferedReaderMaker;
import jsequtils.file.OutputStreamMaker;
import thesaurus.util.ThesaurusIO;
/*
 * Copyright 2014 Tomasz Konopka.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package thesaurus.make;


/**
 * Create an annotated vtf file, i.e. a vtf file with additional dbSNP ids.
 *
 * @author tkonopka
 */
public class ThesaurusAnnotateVtf extends ThesaurusMapTool {

    private String output = "stdout";
    private File dbfile = null;
    private File vtffile = null;

    private void printAnnotateVtfHelp() {
        System.out.println("GeneticThesaurus annotatevtf: adds ids (eg. dbSNP) into a vtf file");
        System.out.println();
        System.out.println("Usage: java -jar GeneticThesaurus.jar annotatevtf ");
        System.out.println();
        System.out.println("Core options:");
        ThesaurusIO.printHelpItem("--vtf <File>", "input vtf file");
        ThesaurusIO.printHelpItem("--database <File>", "database file, e.g. dbSNP");
        ThesaurusIO.printHelpItem("--output <String>", "output file");
        System.out.println();
    }

    /**
     *
     * @param args
     * @return
     */
    private boolean parseAnnotateVtfParameters(String[] args) {
// Path: src/thesaurus/util/ThesaurusIO.java
// public class ThesaurusIO {
// 
//     private static String spaceRepeat(int n) {
//         StringBuilder sb = new StringBuilder();
//         for (int i = 0; i < n; i++) {
//             sb.append(" ");
//         }
//         return (sb.toString());
//     }
// 
//     public static void printHelpItem(String key, String description) {
//         int keylength = key.length();
// 
//         // split the description into multiple lines
//         String[] dtokens = description.split(" ");
//         ArrayList<String> dlines = new ArrayList<String>();
//         String nowline = "";
//         int nowtoken = 0;
//         while (nowtoken < dtokens.length) {
//             if (nowline.length() > 50) {
//                 dlines.add(nowline + "\n");
//                 nowline = "";
//             }
//             nowline += dtokens[nowtoken] + " ";
//             nowtoken++;
//         }
//         dlines.add(nowline + "\n");
// 
// 
//         StringBuilder sb = new StringBuilder();
//         if (key.length() < 30) {
//             sb.append("  ").append(key);
//             sb.append(spaceRepeat(26 - keylength));
//         } else {
//             sb.append("  ").append(key).append("\n");
//             sb.append(spaceRepeat(28));
//         }
//         sb.append("- ").append(dlines.get(0));
//         for (int i = 1; i < dlines.size(); i++) {
//             sb.append(spaceRepeat(30)).append(dlines.get(i));
//         }
// 
//         System.out.print(sb.toString());
//     }
// }


// Path: src/thesaurus/make/ThesaurusAnnotateVtf.java
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
import jsequtils.file.BufferedReaderMaker;
import jsequtils.file.OutputStreamMaker;
import thesaurus.util.ThesaurusIO;

/*
 * Copyright 2014 Tomasz Konopka.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package thesaurus.make;


/**
 * Create an annotated vtf file, i.e. a vtf file with additional dbSNP ids.
 *
 * @author tkonopka
 */
public class ThesaurusAnnotateVtf extends ThesaurusMapTool {

    private String output = "stdout";
    private File dbfile = null;
    private File vtffile = null;

    private void printAnnotateVtfHelp() {
        System.out.println("GeneticThesaurus annotatevtf: adds ids (eg. dbSNP) into a vtf file");
        System.out.println();
        System.out.println("Usage: java -jar GeneticThesaurus.jar annotatevtf ");
        System.out.println();
        System.out.println("Core options:");
        ThesaurusIO.printHelpItem("--vtf <File>", "input vtf file");
        ThesaurusIO.printHelpItem("--database <File>", "database file, e.g. dbSNP");
        ThesaurusIO.printHelpItem("--output <String>", "output file");
        System.out.println();
    }

    /**
     *
     * @param args
     * @return
     */
    private boolean parseAnnotateVtfParameters(String[] args) {
        OptionParser prs = new OptionParser();