public static void main(String[] args) { File column = new File(args[0]); try { // how many different dbs are present LinkedHashMap dbs = new LinkedHashMap(); BufferedReader in = new BufferedReader(new FileReader(column)); String line; int index = 0; while ((line = in.readLine()) != null) { if (line.trim().length() == 0) continue; String[] tokens = line.split("\\|"); for (int i = 0; i < tokens.length; i += 2) { if (dbs.containsKey(tokens[i]) == false) { dbs.put(tokens[i], new Integer(index++)); } } } in.close(); // print header Iterator it = dbs.keySet().iterator(); while (it.hasNext()) { String c = (String) it.next(); System.out.print("Reporter BioSequence DatabaseEntry [" + c + "]\t"); } System.out.println(); // print lines in = new BufferedReader(new FileReader(column)); int numColumns = dbs.size(); while ((line = in.readLine()) != null) { if (line.trim().length() == 0) { System.out.println(); } else { String[] columns = new String[numColumns]; String[] tokens = line.split("\\|"); for (int i = 0; i < tokens.length; i += 2) { // System.out.println(line+"Tok"+tokens[i]); int columnIndex = ((Integer) dbs.get(tokens[i])).intValue(); if (columns[columnIndex] == null) columns[columnIndex] = tokens[i + 1]; else columns[columnIndex] = columns[columnIndex] + ";" + tokens[i + 1]; } // print it for (int i = 0; i < numColumns; i++) { if (columns[i] == null) columns[i] = ""; } System.out.println(Misc.stringArrayToString(columns, "\t")); } } in.close(); } catch (Exception e) { e.printStackTrace(); } }
public void checkPrintFiles() { LinkedHashMap<String, File> nameFile = new LinkedHashMap<String, File>(); nameFile.put("Reference directory", referenceDir); nameFile.put("Pipeline.jar", pJar); nameFile.put("Pipeline properties", truncPipePropFile); nameFile.put("Coverage QC bed", bedForCoverageQC); nameFile.put("Variant calling bed", bedForVarCalling); nameFile.put("Fasta genome reference", fastaReference); nameFile.put("Unfiltered bam", unfilteredBam); nameFile.put("Final bam", finalBam); nameFile.put("Final vcf", finalVcf); if (webRootForLinks != null) nameFile.put("Web links dir", webRootForLinks); nameFile.put("Final output dir", outputDirectory); boolean missingFile = false; System.out.println("\nResources (name exists path):"); for (String name : nameFile.keySet()) { File f = nameFile.get(name); boolean fExists = true; if (f == null) { fExists = false; missingFile = true; } else { fExists = f.exists(); if (fExists == false) missingFile = true; } System.out.println(name + "\t" + fExists + "\t" + f); } if (missingFile) Misc.printErrAndExit("\nMissing resources! See above."); }
public void checkPrintFields() { LinkedHashMap<String, String> nameField = new LinkedHashMap<String, String>(); nameField.put("Job ID", jobId); nameField.put("Sample ID", sampleId); nameField.put("Submitter", submitter); nameField.put("Analysis Type", analysisType); nameField.put("Minimum Align Depth", minimumReadDepth); nameField.put("Threads", threads); nameField.put("SnpEff Genome", snpEffGenome); // set output of booleans nameField.put("Upload Vars to NGSWeb", uploadVarsToNGSWeb + ""); boolean missingField = false; System.out.println("Fields:"); for (String name : nameField.keySet()) { String f = nameField.get(name); if (f == null || f.length() == 0) missingField = true; System.out.println(name + "\t" + f); } if (missingField) Misc.printErrAndExit("\nMissing Fields! See above."); }