List of usage examples for org.jdom2.output Format getPrettyFormat
public static Format getPrettyFormat()
From source file:es.upm.dit.xsdinferencer.Results.java
License:Apache License
/** * Converts a Map<String,Document> to a Map<String,String> with the same keys and String representations * of the documents as values.<br/> * The XMLs are generated using the format returned by {@link Format#getPrettyFormat()} and the system line separator. * For more information about this, see {@link Format}. * @param inputMap a map between Strings and Documents * @return a map between the Strings and the String representation of the documents (null if inputMap is null). *//*w w w . j a v a 2 s. c o m*/ private Map<String, String> getStringMapFromXMLMap(Map<String, Document> inputMap, TextMode textMode) { if (inputMap == null) { return null; } Map<String, String> results = new HashMap<>(inputMap.size()); Format xmlFormat = Format.getPrettyFormat(); xmlFormat.setLineSeparator(LineSeparator.SYSTEM); //xmlFormat.setTextMode(textMode); XMLOutputter outputter = new XMLOutputter(xmlFormat); for (String fileName : inputMap.keySet()) { Document currentDocument = inputMap.get(fileName); String xsdString = outputter.outputString(currentDocument); results.put(fileName, xsdString); } return ImmutableMap.copyOf(results); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsChipSeq.java
License:Open Source License
public void exportToXML(File output) throws IOException { Document configurationFile = new Document(); Comment comment = new Comment(COMMENT_CHIPSEQ); configurationFile.addContent(comment); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); Element bwaPath = new Element(BWA_PATH); bwaPath.addContent(this.getBwaPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(bwaPath); Element samtoolsPath = new Element(SAMTOOLS_PATH); samtoolsPath.addContent(this.getSamtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(samtoolsPath); Element picardPath = new Element(PICARD_PATH); picardPath.addContent(this.getPicardPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(picardPath); Element MACSPath = new Element(MACS_PATH); MACSPath.addContent(this.getMacsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(MACSPath); Element PythonPath = new Element(PYTHON_PATH); PythonPath.addContent(this.getPythonPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(PythonPath); Element BEDToolsPath = new Element(BED_TOOLS_PATH); BEDToolsPath.addContent(this.getBedtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BEDToolsPath); Element CCATPath = new Element(CCAT_PATH); CCATPath.addContent(this.getCcatPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(CCATPath); Element BedgraphtoWigPath = new Element(BGTW_PATH); BedgraphtoWigPath.addContent(this.getBedgraphtobigwigPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BedgraphtoWigPath); Element IDRPath = new Element(IDR_PATH); IDRPath.addContent(this.getIdrPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(IDRPath); Element PeakAnnotatorPath = new Element(PEAKANNOTATOR_PATH); PeakAnnotatorPath.addContent(this.getPeakannotatorPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(PeakAnnotatorPath); Element fastqcPath = new Element(FASTQC_PATH); fastqcPath.addContent(this.getFastqcPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(fastqcPath); if (!this.getNthr().equals(nthr_DV)) { Element nthr = new Element(NTHR); nthr.addContent(String.valueOf(this.getNthr())); configurationFile.getRootElement().addContent(nthr); }/* w w w. j a va2s. c om*/ if (!this.getJavaRam().equals(javaRam_DV)) { Element javaRam = new Element(JAVA_RAM); javaRam.addContent(this.getJavaRam()); configurationFile.getRootElement().addContent(javaRam); } Element queueSystem = new Element(QUEUE_SYSTEM); queueSystem.addContent(this.getQueueSystem().getDisplayName()); configurationFile.getRootElement().addContent(queueSystem); if (!this.getQueueName().equals(queueName_DV)) { Element queueName = new Element(QUEUE_NAME); queueName.addContent(this.getQueueName()); configurationFile.getRootElement().addContent(queueName); } if (!this.getMulticoreName().equals(multicoreName_DV)) { Element multicoreName = new Element(MULTICORE_NAME); multicoreName.addContent(this.getMulticoreName()); configurationFile.getRootElement().addContent(multicoreName); } if (!this.getMulticoreNumber().equals(multicoreNumber_DV)) { Element multicoreNumber = new Element(MULTICORE_NUMBER); multicoreNumber.addContent(String.valueOf(this.getMulticoreNumber())); configurationFile.getRootElement().addContent(multicoreNumber); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); // xmlOutput.output(configurationFile, new FileWriter(new File(output.getAbsolutePath()+".test"))); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsCNV.java
License:Open Source License
public void exportToXML(File output) throws IOException { Document configurationFile = new Document(); Comment comment = new Comment(COMMENT_VARIANT_CALLER); configurationFile.addContent(comment); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); Element bwaPath = new Element(BWA_PATH); bwaPath.addContent(this.getBwaPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(bwaPath); Element samtoolsPath = new Element(SAMTOOLS_PATH); samtoolsPath.addContent(this.getSamtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(samtoolsPath); Element gatkpath = new Element(GATK_PATH); gatkpath.addContent(this.getGatkpath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(gatkpath); Element picardPath = new Element(PICARD_PATH); picardPath.addContent(this.getPicardPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(picardPath); Element BFASTPath = new Element(BFAST_PATH); BFASTPath.addContent(this.getBfastPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BFASTPath); Element BEDToolsPath = new Element(BED_TOOLS_PATH); BEDToolsPath.addContent(this.getBedtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BEDToolsPath); Element CONTRAPath = new Element(CONTRA_PATH); CONTRAPath.addContent(this.getContraPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(CONTRAPath); Element fastqcPath = new Element(FASTQC_PATH); fastqcPath.addContent(this.getFastqcPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(fastqcPath); if (!this.getNthr().equals(nthr_DV)) { Element nthr = new Element(NTHR); nthr.addContent(String.valueOf(this.getNthr())); configurationFile.getRootElement().addContent(nthr); }/*from w w w . j a v a 2 s. c o m*/ if (!this.getJavaRam().equals(javaRam_DV)) { Element javaRam = new Element(JAVA_RAM); javaRam.addContent(this.getJavaRam()); configurationFile.getRootElement().addContent(javaRam); } Element queueSystem = new Element(QUEUE_SYSTEM); queueSystem.addContent(this.getQueueSystem().getDisplayName()); configurationFile.getRootElement().addContent(queueSystem); if (!this.getQueueName().equals(queueName_DV)) { Element queueName = new Element(QUEUE_NAME); queueName.addContent(this.getQueueName()); configurationFile.getRootElement().addContent(queueName); } if (!this.getMulticoreName().equals(multicoreName_DV)) { Element multicoreName = new Element(MULTICORE_NAME); multicoreName.addContent(this.getMulticoreName()); configurationFile.getRootElement().addContent(multicoreName); } if (!this.getMulticoreNumber().equals(multicoreNumber_DV)) { Element multicoreNumber = new Element(MULTICORE_NUMBER); multicoreNumber.addContent(String.valueOf(this.getMulticoreNumber())); configurationFile.getRootElement().addContent(multicoreNumber); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsMethylation.java
License:Open Source License
public void exportToXML(File output) throws IOException { Document configurationFile = new Document(); Comment comment = new Comment(COMMENT_METHYLATION); configurationFile.addContent(comment); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); Element bismarkPath = new Element(BISMARK_PATH); bismarkPath.addContent(this.getBismarkPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(bismarkPath); Element bowtiePath = new Element(BOWTIE_PATH); bowtiePath.addContent(this.getBowtiePath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(bowtiePath); Element picardPath = new Element(PICARD_PATH); picardPath.addContent(this.getPicardPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(picardPath); Element BEDToolsPath = new Element(BED_TOOLS_PATH); BEDToolsPath.addContent(this.getBedtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BEDToolsPath); Element fastxPath = new Element(FASTX_PATH); fastxPath.addContent(this.getFastxPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(fastxPath); Element filoPath = new Element(FILO_PATH); filoPath.addContent(this.getFiloPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(filoPath); Element fastqcPath = new Element(FASTQC_PATH); fastqcPath.addContent(this.getFastqcPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(fastqcPath); if (!this.getNthr().equals(nthr_DV)) { Element nthr = new Element(NTHR); nthr.addContent(String.valueOf(this.getNthr())); configurationFile.getRootElement().addContent(nthr); }/* w ww .ja va 2 s . c o m*/ if (!this.getJavaRam().equals(javaRam_DV)) { Element javaRam = new Element(JAVA_RAM); javaRam.addContent(this.getJavaRam()); configurationFile.getRootElement().addContent(javaRam); } Element queueSystem = new Element(QUEUE_SYSTEM); queueSystem.addContent(this.getQueueSystem().getDisplayName()); configurationFile.getRootElement().addContent(queueSystem); if (!this.getQueueName().equals(queueName_DV)) { Element queueName = new Element(QUEUE_NAME); queueName.addContent(this.getQueueName()); configurationFile.getRootElement().addContent(queueName); } if (!this.getMulticoreName().equals(multicoreName_DV)) { Element multicoreName = new Element(MULTICORE_NAME); multicoreName.addContent(this.getMulticoreName()); configurationFile.getRootElement().addContent(multicoreName); } if (!this.getMulticoreNumber().equals(multicoreNumber_DV)) { Element multicoreNumber = new Element(MULTICORE_NUMBER); multicoreNumber.addContent(String.valueOf(this.getMulticoreNumber())); configurationFile.getRootElement().addContent(multicoreNumber); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsSNV.java
License:Open Source License
public void exportToXML(File output) throws IOException { Document configurationFile = new Document(); Comment comment = new Comment(COMMENT_VARIANT_CALLER); configurationFile.addContent(comment); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); Element bwaPath = new Element(BWA_PATH); bwaPath.addContent(this.getBwaPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(bwaPath); Element samtoolsPath = new Element(SAMTOOLS_PATH); samtoolsPath.addContent(this.getSamtoolsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(samtoolsPath); Element gatkpath = new Element(GATK_PATH); gatkpath.addContent(this.getGatkpath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(gatkpath); Element picardPath = new Element(PICARD_PATH); picardPath.addContent(this.getPicardPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(picardPath); Element BFASTPath = new Element(BFAST_PATH); BFASTPath.addContent(this.getBfastPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(BFASTPath); Element fastqcPath = new Element(FASTQC_PATH); fastqcPath.addContent(this.getFastqcPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(fastqcPath); if (!this.getNthr().equals(nthr_DV)) { Element nthr = new Element(NTHR); nthr.addContent(String.valueOf(this.getNthr())); configurationFile.getRootElement().addContent(nthr); }/*from w w w . j a va 2 s. c o m*/ if (!this.getJavaRam().equals(javaRam_DV)) { Element javaRam = new Element(JAVA_RAM); javaRam.addContent(this.getJavaRam()); configurationFile.getRootElement().addContent(javaRam); } Element queueSystem = new Element(QUEUE_SYSTEM); queueSystem.addContent(this.getQueueSystem().getDisplayName()); configurationFile.getRootElement().addContent(queueSystem); if (!this.getQueueName().equals(queueName_DV)) { Element queueName = new Element(QUEUE_NAME); queueName.addContent(this.getQueueName()); configurationFile.getRootElement().addContent(queueName); } if (!this.getMulticoreName().equals(multicoreName_DV)) { Element multicoreName = new Element(MULTICORE_NAME); multicoreName.addContent(this.getMulticoreName()); configurationFile.getRootElement().addContent(multicoreName); } if (!this.getMulticoreNumber().equals(multicoreNumber_DV)) { Element multicoreNumber = new Element(MULTICORE_NUMBER); multicoreNumber.addContent(String.valueOf(this.getMulticoreNumber())); configurationFile.getRootElement().addContent(multicoreNumber); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.ChipSeqExperiment.java
License:Open Source License
public void generateXMLConfigurationFile(File output) throws IOException { Document configurationFile = new Document(); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_CHIPSEQ); Element genRef = new Element(GENREF); genRef.addContent(this.getGenRefPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(genRef); Element plattform = new Element(PLATTFORM); plattform.addContent(this.getPlattform().getDisplayName()); configurationFile.getRootElement().addContent(plattform); if (!this.checkCasava.equals(checkCasava_DV)) { Element checkCasava = new Element(CHECKCASAVA); checkCasava.addContent(this.getCheckCasava().toString()); configurationFile.getRootElement().addContent(checkCasava); }/* w w w . j ava 2s. c o m*/ Element dirOutBase = new Element(DIROUTBASE); dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dirOutBase); Element projectId = new Element(PROJECTID); projectId.addContent(this.getProjectId()); configurationFile.getRootElement().addContent(projectId); if (!this.getUserName().equals(userName_DV)) { Element userName = new Element(USERNAME); userName.addContent(this.getUserName()); configurationFile.getRootElement().addContent(userName); } Element inDirPreProcess = new Element(INDIRPREPROCESS); inDirPreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(inDirPreProcess); for (CSExperiment experiment : this.getExperiments()) { Element chipSeqExperiment = new Element(EXPERIMENT); for (ChipSeqUnit csUnit : experiment.getChipSeqUnits()) { Element csUnitElement = new Element(CHIPSEQUNIT); Sample sampleTreatment = csUnit.getSampleTreatment(); Element sampleTreatmentElement = new Element(SAMPLE_TREATMENT); Element sampleName = new Element(SAMPLE_NAME); sampleName.addContent(sampleTreatment.getSampleName()); sampleTreatmentElement.addContent(sampleName); Element sampleFiles = new Element(SAMPLE_FILES); sampleFiles.addContent(sampleTreatment.getSampleFiles()); sampleTreatmentElement.addContent(sampleFiles); Element sampleSuffix = new Element(SAMPLE_SUFFIX); sampleSuffix.addContent(sampleTreatment.getSampleSuffix()); sampleTreatmentElement.addContent(sampleSuffix); Element sampleType = new Element(SAMPLE_TYPE); sampleType.addContent(sampleTreatment.getSampleType().getDisplayName()); sampleTreatmentElement.addContent(sampleType); csUnitElement.addContent(sampleTreatmentElement); Sample sampleInput = csUnit.getSampleInput(); if (sampleInput.checkSample()) { Element sampleInputElement = new Element(SAMPLE_INPUT); Element sampleInputName = new Element(SAMPLE_NAME); sampleInputName.addContent(sampleInput.getSampleName()); sampleInputElement.addContent(sampleInputName); Element sampleInputFiles = new Element(SAMPLE_FILES); sampleInputFiles.addContent(sampleInput.getSampleFiles()); sampleInputElement.addContent(sampleInputFiles); Element sampleInputSuffix = new Element(SAMPLE_SUFFIX); sampleInputSuffix.addContent(sampleInput.getSampleSuffix()); sampleInputElement.addContent(sampleInputSuffix); Element sampleInputType = new Element(SAMPLE_TYPE); sampleInputType.addContent(sampleInput.getSampleType().getDisplayName()); sampleInputElement.addContent(sampleInputType); csUnitElement.addContent(sampleInputElement); } chipSeqExperiment.addContent(csUnitElement); } Element replicatesFlag = new Element(REPLICATES_FLAG); replicatesFlag.addContent(experiment.isReplicatesFlag() ? "1" : "0"); chipSeqExperiment.addContent(replicatesFlag); configurationFile.getRootElement().addContent(chipSeqExperiment); } Element chromSize = new Element(CHROMSIZE); chromSize.addContent(this.getChromSize().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(chromSize); if (!this.getPeakAnalysisType().equals(peakAnalysisType_DV)) { Element peakAnalysis = new Element(PEAKANALYSIS); peakAnalysis.addContent(this.getPeakAnalysisType().getDisplayName()); configurationFile.getRootElement().addContent(peakAnalysis); } if (this.getCcatConfigFile() != ccatConfigFile_DV) { Element ccaConfigFile = new Element(CCAT_CONFIG_FILE); ccaConfigFile.addContent(this.getCcatConfigFile().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(ccaConfigFile); } if (!this.getMacsExtraArgs().equals(macsExtraArgs_DV)) { Element macsExtraArgs = new Element(MACS_EXTRAARGS); macsExtraArgs.addContent(this.getMacsExtraArgs()); configurationFile.getRootElement().addContent(macsExtraArgs); } if (!this.getFastqc().equals(fastqc_DV)) { Element fastqc = new Element(FASTQC); fastqc.addContent(this.getFastqc().toString()); configurationFile.getRootElement().addContent(fastqc); } if (this.getAnnotFile() != annotFile_DV) { Element annotFile = new Element(ANNOTFILE); annotFile.addContent(this.getAnnotFile().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(annotFile); } if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) { Element queueProject = new Element(QUEUESGEPROJECT); queueProject.addContent(this.getQueueSGEProject().toString()); configurationFile.getRootElement().addContent(queueProject); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.CopyNumberVariationExperiment.java
License:Open Source License
public void generateXMLConfigurationFile(File output) throws IOException { Document configurationFile = new Document(); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_CNV); Element genRef = new Element(GENREF); genRef.addContent(this.getGenRefPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(genRef); Element dbSnpAnnot = new Element(DBSNPANNOT); dbSnpAnnot.addContent(this.getDbSnpAnnotPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dbSnpAnnot); Element indelAnnot = new Element(INDELANNOT); indelAnnot.addContent(this.getIndelAnnotPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(indelAnnot); Element intervals = new Element(INTERVALS); intervals.addContent(this.getIntervalsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(intervals); if (this.getKnownIndels().size() > 0) { for (KnownIndels kI : this.getKnownIndels()) { Element knownIndels = new Element(KNOWNINDELS); knownIndels.addContent(kI.getFile().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(knownIndels); }/*from w w w.j a va 2 s . co m*/ } Element plattform = new Element(PLATTFORM); plattform.addContent(this.getPlattform().getDisplayName()); configurationFile.getRootElement().addContent(plattform); if (!this.getCheckCasava().equals(checkCasava_DV)) { Element checkCasava = new Element(CHECKCASAVA); checkCasava.addContent(this.getCheckCasava().toString()); configurationFile.getRootElement().addContent(checkCasava); } Element dirOutBase = new Element(DIROUTBASE); dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dirOutBase); Element projectId = new Element(PROJECTID); projectId.addContent(this.getProjectId()); configurationFile.getRootElement().addContent(projectId); if (!this.getUserName().equals(userName_DV)) { Element userName = new Element(USERNAME); userName.addContent(this.getUserName()); configurationFile.getRootElement().addContent(userName); } Element dataInDirpreProcess = new Element(INDIRPREPROCESS); dataInDirpreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dataInDirpreProcess); for (Sample s : this.getSamples()) { Element sample = new Element(SAMPLE); Element sampleName = new Element(SAMPLE_NAME); sampleName.addContent(s.getSampleName()); sample.addContent(sampleName); Element sampleFiles = new Element(SAMPLE_FILES); sampleFiles.addContent(s.getSampleFiles()); sample.addContent(sampleFiles); Element sampleSuffix = new Element(SAMPLE_SUFFIX); sampleSuffix.addContent(s.getSampleSuffix()); sample.addContent(sampleSuffix); Element sampleType = new Element(SAMPLE_TYPE); sampleType.addContent(s.getSampleType().getDisplayName()); sample.addContent(sampleType); configurationFile.getRootElement().addContent(sample); } if (!this.getFastqc().equals(fastqc_DV)) { Element fastqc = new Element(FASTQC); fastqc.addContent(this.getFastqc().toString()); configurationFile.getRootElement().addContent(fastqc); } if (!this.getExtraContra().equals(extraContra_DV)) { Element extraContra = new Element(EXTRACONTRA); extraContra.addContent(this.getExtraContra().toString()); configurationFile.getRootElement().addContent(extraContra); } if (this.getBaseline() != baseline_DV) { Element baseline = new Element(BASELINE); baseline.addContent(this.getBaseline().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(baseline); } if (!this.getmDFlag().equals(mDFlag_DV)) { Element mDFlag = new Element(MDFLAG); mDFlag.addContent(this.getmDFlag().toString()); configurationFile.getRootElement().addContent(mDFlag); } if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) { Element queueSGEProject = new Element(QUEUESGEPROJECT); queueSGEProject.addContent(this.getQueueSGEProject().toString()); configurationFile.getRootElement().addContent(queueSGEProject); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.MethylationExperiment.java
License:Open Source License
public void generateXMLConfigurationFile(File output) throws IOException { Document configurationFile = new Document(); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_METHYLATION); Element referencePath = new Element(REFERENCEPATH); referencePath.addContent(this.getReferencePath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(referencePath); Element readsPath = new Element(READSPATH); readsPath.addContent(this.getReadsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(readsPath); Element projectCompletePath = new Element(PROJECT_COMPLETE_PATH); projectCompletePath.addContent(this.getProjectCompletePath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(projectCompletePath); Element plattform = new Element(PLATTFORM); plattform.addContent(this.getPlattform().getDisplayName()); configurationFile.getRootElement().addContent(plattform); Element methylType = new Element(METHYLTYPE); methylType.addContent(this.getMethylType().toString()); configurationFile.getRootElement().addContent(methylType); for (MethylationSample ms : this.getSamples()) { Element sample1 = new Element(SAMPLE1); sample1.addContent(ms.getSample1().getFile().getName()); configurationFile.getRootElement().addContent(sample1); }//from w w w.jav a 2 s . c om for (MethylationSample ms : this.getSamples()) { if (ms.getSample2() != null) { Element sample2 = new Element(SAMPLE2); sample2.addContent(ms.getSample2().getFile().getName()); configurationFile.getRootElement().addContent(sample2); } } if (!this.getSeedLength().equals(seedLength_DV)) { Element seedLength = new Element(SEED_LENGTH); seedLength.addContent(this.getSeedLength().toString()); configurationFile.getRootElement().addContent(seedLength); } if (!this.getNumMis().equals(numMis_DV)) { Element numMiss = new Element(NUM_MIS); numMiss.addContent(this.getNumMis().toString()); configurationFile.getRootElement().addContent(numMiss); } if (this.getIntervalsPath() != intervalsPath_DV) { Element intervalsPath = new Element(INTERVALS); intervalsPath.addContent(this.getIntervalsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(intervalsPath); } if (!this.getContextType().equals(contextType_DV)) { Element contextType = new Element(CONTEXT); contextType.addContent(this.getContextType().toString()); configurationFile.getRootElement().addContent(contextType); } if (!this.getTrimTagLength().equals(trimTagLength_DV)) { Element trimTagLength = new Element(TRIMTAGLENGTH); trimTagLength.addContent(this.getTrimTagLength()); configurationFile.getRootElement().addContent(trimTagLength); } if (!this.getMinQual().equals(minQual_DV)) { Element minQual = new Element(MINQUAL); minQual.addContent(this.getMinQual().toString()); configurationFile.getRootElement().addContent(minQual); } if (!this.getFastqc().equals(fastqc_DV)) { Element fastqc = new Element(FASTQC); fastqc.addContent(this.getFastqc().toString()); configurationFile.getRootElement().addContent(fastqc); } if (!this.getDepthFilter().equals(depthFilter_DV)) { Element depthFilter = new Element(DEPTHFILTER); depthFilter.addContent(this.getDepthFilter().toString()); configurationFile.getRootElement().addContent(depthFilter); } if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) { Element queueProject = new Element(QUEUESGEPROJECT); queueProject.addContent(this.getQueueSGEProject().toString()); configurationFile.getRootElement().addContent(queueProject); } if (!this.getMultiExec().equals(multiExec_DV)) { Element multiExec = new Element(MULTIEXEC); multiExec.addContent(this.getMultiExec().toString()); configurationFile.getRootElement().addContent(multiExec); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.SingleNucleotideVariantExperiment.java
License:Open Source License
public void generateXMLConfigurationFile(File output) throws IOException { Document configurationFile = new Document(); Element configData = new Element(CONFIG_DATA); configurationFile.setRootElement(configData); configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_SNV); Element genRef = new Element(GENREF); genRef.addContent(this.getGenRefPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(genRef); Element dbSnpAnnot = new Element(DBSNPANNOT); dbSnpAnnot.addContent(this.getDbSnpAnnotPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dbSnpAnnot); Element genomes1000Annot = new Element(GENOMES1000ANNOT); genomes1000Annot.addContent(this.getGenomes1000AnnotPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(genomes1000Annot); Element indelAnnot = new Element(INDELANNOT); indelAnnot.addContent(this.getIndelAnnotPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(indelAnnot); if (this.getIntervalsPath() != getIntervalsPath_DV()) { Element intervals = new Element(INTERVALS); intervals.addContent(this.getIntervalsPath().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(intervals); }// w ww. j a v a 2 s . com if (this.getKnownIndels().size() > 0) { for (KnownIndels kI : this.getKnownIndels()) { Element knownIndels = new Element(KNOWNINDELS); knownIndels.addContent(kI.getFile().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(knownIndels); } } Element plattform = new Element(PLATTFORM); plattform.addContent(this.getPlattform().getDisplayName()); configurationFile.getRootElement().addContent(plattform); if (!this.getCheckCasava().equals(checkCasava_DV)) { Element checkCasava = new Element(CHECKCASAVA); checkCasava.addContent(this.getCheckCasava().toString()); configurationFile.getRootElement().addContent(checkCasava); } Element dirOutBase = new Element(DIROUTBASE); dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dirOutBase); Element projectId = new Element(PROJECTID); projectId.addContent(this.getProjectId()); configurationFile.getRootElement().addContent(projectId); if (!this.getUserName().equals(userName_DV)) { Element userName = new Element(USERNAME); userName.addContent(this.getUserName()); configurationFile.getRootElement().addContent(userName); } Element dataInDirpreProcess = new Element(INDIRPREPROCESS); dataInDirpreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath()); configurationFile.getRootElement().addContent(dataInDirpreProcess); for (Sample s : this.getSamples()) { Element sample = new Element(SAMPLE); Element sampleName = new Element(SAMPLE_NAME); sampleName.addContent(s.getSampleName()); sample.addContent(sampleName); Element sampleFiles = new Element(SAMPLE_FILES); sampleFiles.addContent(s.getSampleFiles()); sample.addContent(sampleFiles); Element sampleSuffix = new Element(SAMPLE_SUFFIX); sampleSuffix.addContent(s.getSampleSuffix()); sample.addContent(sampleSuffix); Element sampleType = new Element(SAMPLE_TYPE); sampleType.addContent(s.getSampleType().getDisplayName()); sample.addContent(sampleType); configurationFile.getRootElement().addContent(sample); } if (!this.getCallingType().equals(callingType_DV)) { Element callingType = new Element(CALLYING_TYPE); callingType.addContent(this.getCallingType().toString()); configurationFile.getRootElement().addContent(callingType); } if (!this.getgATKoutputMode().equals(gATKoutputMode_DV)) { Element gATKoutputModeoutputMode = new Element(GATKOUTPUTMODE); gATKoutputModeoutputMode.addContent(this.getgATKoutputMode().toString()); configurationFile.getRootElement().addContent(gATKoutputModeoutputMode); } if (!this.getRsFilter().equals(rsFilter_DV)) { Element rsFilter = new Element(RSFILTER); rsFilter.addContent(this.getRsFilter().toString()); configurationFile.getRootElement().addContent(rsFilter); } if (!this.getrUbioSeqMode().equals(rUbioSeqMode_DV)) { Element rUbioSeq_Mode = new Element(RUBIOSEQMODE); rUbioSeq_Mode.addContent(this.getrUbioSeqMode().toString()); configurationFile.getRootElement().addContent(rUbioSeq_Mode); } if (!this.getFastqc().equals(fastqc_DV)) { Element fastqc = new Element(FASTQC); fastqc.addContent(this.getFastqc().toString()); configurationFile.getRootElement().addContent(fastqc); } if (!this.getvEPFlag().equals(vEPFlag_DV)) { Element vEPFlag = new Element(VEPFLAG); vEPFlag.addContent(this.getvEPFlag().toString()); configurationFile.getRootElement().addContent(vEPFlag); } if (!this.gettCFlag().equals(tCFlag_DV)) { Element tCFlag = new Element(TCFLAG); tCFlag.addContent(this.gettCFlag().toString()); configurationFile.getRootElement().addContent(tCFlag); } if (!this.getmDFlag().equals(mDFlag_DV)) { Element mDFlag = new Element(MDFLAG); mDFlag.addContent(this.getmDFlag().toString()); configurationFile.getRootElement().addContent(mDFlag); } if (!this.getStandCallConf().equals(standCallConf_DV)) { Element standCallConf = new Element(STANDCALLCONF); standCallConf.addContent(this.getStandCallConf().toString()); configurationFile.getRootElement().addContent(standCallConf); } if (!this.getStandEmitConf().equals(standEmitConf_DV)) { Element standEmitConf = new Element(STANDEMITCONF); standEmitConf.addContent(this.getStandEmitConf().toString()); configurationFile.getRootElement().addContent(standEmitConf); } if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) { Element queueSGEProject = new Element(QUEUESGEPROJECT); queueSGEProject.addContent(this.getQueueSGEProject().toString()); configurationFile.getRootElement().addContent(queueSGEProject); } if (this.getChoiceVqrsHardFilters().equals(VQRSHardFiltersChoice.VQRS) && this.getvQSRblockMills() != VQSRblockMills_DV && this.getvQSRblockHapMAp() != VQSRblockHapMAp_DV && this.getvQSRblockThousandG() != VQSRblockThousandG_DV) { Element vQSR_block = new Element(VQSRBLOCK); Element mills = new Element(MILLS); mills.addContent(this.getvQSRblockMills().getFile().getAbsolutePath()); vQSR_block.addContent(mills); Element hapmap = new Element(HAPMAP); hapmap.addContent(this.getvQSRblockHapMAp().getFile().getAbsolutePath()); vQSR_block.addContent(hapmap); Element thousandg = new Element(THOUSANDG); thousandg.addContent(this.getvQSRblockThousandG().getFile().getAbsolutePath()); vQSR_block.addContent(thousandg); configurationFile.getRootElement().addContent(vQSR_block); } if (this.getChoiceVqrsHardFilters().equals(VQRSHardFiltersChoice.HARDFILTERS) && (!this.getminQual().equals(minQual_DV) || !this.getdPmin().equals(DPmin_DV) || this.getHardFilters().size() > 0)) { Element hardFiltersBlock = new Element(HFILTERS); if (!this.getdPmin().equals(DPmin_DV)) { Element dpMin = new Element(DPMIN); dpMin.addContent(this.getdPmin().toString()); hardFiltersBlock.addContent(dpMin); } if (!this.getminQual().equals(minQual_DV)) { Element minQual = new Element(MINQUAL); minQual.addContent(this.getminQual().toString()); hardFiltersBlock.addContent(minQual); } for (HardFilter hF : this.getHardFilters()) { Element name = hF.getType().equals(HardFilter.HFilterType.SNP) ? new Element(HFILTER_NAME_SNP) : new Element(HFILTER_NAME_INDEL); name.addContent(hF.getName()); Element rule = hF.getType().equals(HardFilter.HFilterType.SNP) ? new Element(HFILTER_RULE_SNP) : new Element(HFILTER_RULE_INDEL); rule.addContent(hF.getRule()); hardFiltersBlock.addContent(name); hardFiltersBlock.addContent(rule); } configurationFile.getRootElement().addContent(hardFiltersBlock); } XMLOutputter xmlOutput = new XMLOutputter(); xmlOutput.setFormat(Format.getPrettyFormat()); xmlOutput.output(configurationFile, new FileWriter(output)); }
From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBufferedWriter.java
License:Open Source License
/** * Saves the hocrDocument/* w w w .java 2 s . c om*/ * @param hocrDocument the hocr document. * @param bw the buffered writer. */ @Override public void save(Document hocrDocument, BufferedWriter bw) { try { XMLOutputter xop = new XMLOutputter(Format.getPrettyFormat().setLineSeparator("\n")); xop.output(hocrDocument, bw); } catch (Exception ex) { ex.printStackTrace(System.err); } }