List of usage examples for org.jdom2 Document getRootElement
public Element getRootElement()
Element
for this Document
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 v a 2s .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)); // 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 loadDataFromFile(File editFile) { loadDefaultParameters(editFile);/*w ww . j a v a2 s. com*/ SAXBuilder saxBuilder = new SAXBuilder(); try { Document document = saxBuilder.build(editFile); Element configData = document.getRootElement(); Element bwaPath = configData.getChild(BWA_PATH); if (validElement(bwaPath)) { this.setBwaPath(Utils.getRUbioSeqFile(bwaPath.getValue())); } Element samtoolsPath = configData.getChild(SAMTOOLS_PATH); if (validElement(samtoolsPath)) { this.setSamtoolsPath(Utils.getRUbioSeqFile(samtoolsPath.getValue())); } Element gatkpath = configData.getChild(GATK_PATH); if (validElement(gatkpath)) { this.setGatkpath(Utils.getRUbioSeqFile(gatkpath.getValue())); } Element picardPath = configData.getChild(PICARD_PATH); if (validElement(picardPath)) { this.setPicardPath(Utils.getRUbioSeqFile(picardPath.getValue())); } Element BFASTPath = configData.getChild(BFAST_PATH); if (validElement(BFASTPath)) { this.setBfastPath(Utils.getRUbioSeqFile(BFASTPath.getValue())); } Element fastqcPath = configData.getChild(FASTQC_PATH); if (validElement(fastqcPath)) { this.setFastqcPath(Utils.getRUbioSeqFile(fastqcPath.getValue())); } Element BEDToolsPath = configData.getChild(BED_TOOLS_PATH); if (validElement(BEDToolsPath)) { this.setBedtoolsPath(Utils.getRUbioSeqFile(BEDToolsPath.getValue())); } Element CONTRAPath = configData.getChild(CONTRA_PATH); if (validElement(CONTRAPath)) { this.setContraPath(Utils.getRUbioSeqFile(CONTRAPath.getValue())); } Element nthr = configData.getChild(NTHR); if (validElement(nthr)) { try { this.setNthr(Integer.valueOf(nthr.getValue())); } catch (Exception e) { } } Element javaRam = configData.getChild(JAVA_RAM); if (validElement(javaRam)) { this.setJavaRam(javaRam.getValue()); } Element queueSystem = configData.getChild(QUEUE_SYSTEM); if (validElement(queueSystem)) { String queueSystemValue = queueSystem.getValue().toUpperCase(); if (queueSystemValue.equals("SGE")) { this.setQueueSystem(QueueSystem.SGE); } else if (queueSystemValue.equals("PBS")) { this.setQueueSystem(QueueSystem.PBS); } else if (queueSystemValue.equals("NONE")) { this.setQueueSystem(QueueSystem.NONE); } } Element queueName = configData.getChild(QUEUE_NAME); if (validElement(queueName)) { this.setQueueName(queueName.getValue()); } Element multicoreName = configData.getChild(MULTICORE_NAME); if (validElement(multicoreName)) { this.setMulticoreName(multicoreName.getValue()); } Element multicoreNumber = configData.getChild(MULTICORE_NUMBER); if (validElement(multicoreNumber)) { try { this.setMulticoreNumber(Integer.valueOf(multicoreNumber.getValue())); } catch (Exception e) { } } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
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); }//ww w . j ava2s. com 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 loadDataFromFile(File editFile) { loadDefaultParameters(editFile);// ww w.ja va 2 s. c o m SAXBuilder saxBuilder = new SAXBuilder(); try { Document document = saxBuilder.build(editFile); Element configData = document.getRootElement(); Element bismarkPath = configData.getChild(BISMARK_PATH); if (validElement(bismarkPath)) { this.setBismarkPath(Utils.getRUbioSeqFile(bismarkPath.getValue())); } Element bowtiePath = configData.getChild(BOWTIE_PATH); if (validElement(bowtiePath)) { this.setBowtiePath(Utils.getRUbioSeqFile(bowtiePath.getValue())); } Element picardPath = configData.getChild(PICARD_PATH); if (validElement(picardPath)) { this.setPicardPath(Utils.getRUbioSeqFile(picardPath.getValue())); } Element fastqcPath = configData.getChild(FASTQC_PATH); if (validElement(fastqcPath)) { this.setFastqcPath(Utils.getRUbioSeqFile(fastqcPath.getValue())); } Element BEDToolsPath = configData.getChild(BED_TOOLS_PATH); if (validElement(BEDToolsPath)) { this.setBedtoolsPath(Utils.getRUbioSeqFile(BEDToolsPath.getValue())); } Element fastxPath = configData.getChild(FASTX_PATH); if (validElement(fastxPath)) { this.setFastxPath(Utils.getRUbioSeqFile(fastxPath.getValue())); } Element filoPath = configData.getChild(FILO_PATH); if (validElement(filoPath)) { this.setFiloPath(Utils.getRUbioSeqFile(filoPath.getValue())); } Element nthr = configData.getChild(NTHR); if (validElement(nthr)) { try { this.setNthr(Integer.valueOf(nthr.getValue())); } catch (Exception e) { } } Element javaRam = configData.getChild(JAVA_RAM); if (validElement(javaRam)) { this.setJavaRam(javaRam.getValue()); } Element queueSystem = configData.getChild(QUEUE_SYSTEM); if (validElement(queueSystem)) { String queueSystemValue = queueSystem.getValue().toUpperCase(); if (queueSystemValue.equals("SGE")) { this.setQueueSystem(QueueSystem.SGE); } else if (queueSystemValue.equals("PBS")) { this.setQueueSystem(QueueSystem.PBS); } else if (queueSystemValue.equals("NONE")) { this.setQueueSystem(QueueSystem.NONE); } } Element queueName = configData.getChild(QUEUE_NAME); if (validElement(queueName)) { this.setQueueName(queueName.getValue()); } Element multicoreName = configData.getChild(MULTICORE_NAME); if (validElement(multicoreName)) { this.setMulticoreName(multicoreName.getValue()); } Element multicoreNumber = configData.getChild(MULTICORE_NUMBER); if (validElement(multicoreNumber)) { try { this.setMulticoreNumber(Integer.valueOf(multicoreNumber.getValue())); } catch (Exception e) { } } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
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 w w.j a va2 s.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)); }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsSNV.java
License:Open Source License
public void loadDataFromFile(File editFile) { loadDefaultParameters(editFile);/*from w w w .ja va 2 s . c o m*/ SAXBuilder saxBuilder = new SAXBuilder(); try { Document document = saxBuilder.build(editFile); Element configData = document.getRootElement(); Element bwaPath = configData.getChild(BWA_PATH); if (validElement(bwaPath)) { this.setBwaPath(Utils.getRUbioSeqFile(bwaPath.getValue())); } Element samtoolsPath = configData.getChild(SAMTOOLS_PATH); if (validElement(samtoolsPath)) { this.setSamtoolsPath(Utils.getRUbioSeqFile(samtoolsPath.getValue())); } Element gatkpath = configData.getChild(GATK_PATH); if (validElement(gatkpath)) { this.setGatkpath(Utils.getRUbioSeqFile(gatkpath.getValue())); } Element picardPath = configData.getChild(PICARD_PATH); if (validElement(picardPath)) { this.setPicardPath(Utils.getRUbioSeqFile(picardPath.getValue())); } Element BFASTPath = configData.getChild(BFAST_PATH); if (validElement(BFASTPath)) { this.setBfastPath(Utils.getRUbioSeqFile(BFASTPath.getValue())); } Element fastqcPath = configData.getChild(FASTQC_PATH); if (validElement(fastqcPath)) { this.setFastqcPath(Utils.getRUbioSeqFile(fastqcPath.getValue())); } Element nthr = configData.getChild(NTHR); if (validElement(nthr)) { try { this.setNthr(Integer.valueOf(nthr.getValue())); } catch (Exception e) { } } Element javaRam = configData.getChild(JAVA_RAM); if (validElement(javaRam)) { this.setJavaRam(javaRam.getValue()); } Element queueSystem = configData.getChild(QUEUE_SYSTEM); if (validElement(queueSystem)) { String queueSystemValue = queueSystem.getValue().toUpperCase(); if (queueSystemValue.equals("SGE")) { this.setQueueSystem(QueueSystem.SGE); } else if (queueSystemValue.equals("PBS")) { this.setQueueSystem(QueueSystem.PBS); } else if (queueSystemValue.equals("NONE")) { this.setQueueSystem(QueueSystem.NONE); } } Element queueName = configData.getChild(QUEUE_NAME); if (validElement(queueName)) { this.setQueueName(queueName.getValue()); } Element multicoreName = configData.getChild(MULTICORE_NAME); if (validElement(multicoreName)) { this.setMulticoreName(multicoreName.getValue()); } Element multicoreNumber = configData.getChild(MULTICORE_NUMBER); if (validElement(multicoreNumber)) { try { this.setMulticoreNumber(Integer.valueOf(multicoreNumber.getValue())); } catch (Exception e) { } } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
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); }/* w ww .ja va 2s. 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); }/*from w ww . jav a 2s.co 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.ChipSeqExperiment.java
License:Open Source License
public static String getWorkingDirectory(File inputFile) { SAXBuilder saxBuilder = new SAXBuilder(); try {//from w ww . jav a2s . co m Document document = saxBuilder.build(inputFile); Element configData = document.getRootElement(); Element dirOutBase = configData.getChild(DIROUTBASE); Element projectId = configData.getChild(PROJECTID); if (dirOutBase.getValue().endsWith("/")) { return dirOutBase.getValue() + projectId.getValue(); } else { return dirOutBase.getValue() + "/" + projectId.getValue(); } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return ""; }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.ChipSeqExperiment.java
License:Open Source License
public void loadDataFromFile(File editFile) throws InvalidRubioSeqParameterException { SAXBuilder saxBuilder = new SAXBuilder(); try {/*from ww w. j a v a 2s. c o m*/ Document document = saxBuilder.build(editFile); Element configData = document.getRootElement(); Element genRef = configData.getChild(GENREF); if (validElement(genRef)) { this.setGenRefPath(Utils.getRUbioSeqFile(genRef.getValue())); } Element plattform = configData.getChild(PLATTFORM); if (validElement(plattform)) { String plattformValue = plattform.getValue().toLowerCase(); if (plattformValue.equals("illumina")) { this.setPlattform(PlattformTech.ILLUMINA); } else if (plattformValue.equals("ion")) { this.setPlattform(PlattformTech.ION); } else if (plattformValue.equals("solid")) { this.setPlattform(PlattformTech.SOLID); } } Element checkCasava = configData.getChild(CHECKCASAVA); if (validElement(checkCasava)) { this.setCheckCasava(Integer.valueOf(checkCasava.getValue())); } Element dirOutBase = configData.getChild(DIROUTBASE); if (validElement(dirOutBase)) { this.setDirOutBase(Utils.getRUbioSeqFile(dirOutBase.getValue())); } Element projectId = configData.getChild(PROJECTID); if (validElement(projectId)) { this.setProjectId(projectId.getValue()); } Element userName = configData.getChild(USERNAME); if (validElement(userName)) { this.setUserName(userName.getValue()); } Element dataInDirpreProcess = configData.getChild(INDIRPREPROCESS); if (validElement(dataInDirpreProcess)) { this.setDataInDirpreProcess(Utils.getRUbioSeqFile(dataInDirpreProcess.getValue())); } for (Element experimentElement : configData.getChildren(EXPERIMENT)) { CSExperiment newExperiment = new CSExperiment(); for (Element csUnitElement : experimentElement.getChildren(CHIPSEQUNIT)) { ChipSeqUnit newCSUnit = new ChipSeqUnit(); Sample sampleTreatment = new Sample(); newCSUnit.setSampleTreatment(sampleTreatment); Element sampleTreatmentElement = csUnitElement.getChild(SAMPLE_TREATMENT); Element sampleName = sampleTreatmentElement.getChild(SAMPLE_NAME); sampleTreatment.setSampleName(sampleName.getValue()); Element sampleFiles = sampleTreatmentElement.getChild(SAMPLE_FILES); sampleTreatment.setSampleFiles(sampleFiles.getValue()); Element sampleSuffix = sampleTreatmentElement.getChild(SAMPLE_SUFFIX); sampleTreatment.setSampleSuffix(sampleSuffix.getValue()); Element sampleType = sampleTreatmentElement.getChild(SAMPLE_TYPE); sampleTreatment.setSampleType( sampleType.getValue().equals("1") ? SampleType.SingleEnd : SampleType.PairedEnd); Element sampleInputElement = csUnitElement.getChild(SAMPLE_INPUT); if (sampleInputElement != null) { Sample sampleInput = new Sample(); newCSUnit.setSampleInput(sampleInput); Element sampleInputName = sampleInputElement.getChild(SAMPLE_NAME); sampleInput.setSampleName(sampleInputName.getValue()); Element sampleInputFiles = sampleInputElement.getChild(SAMPLE_FILES); sampleInput.setSampleFiles(sampleInputFiles.getValue()); Element sampleInputSuffix = sampleInputElement.getChild(SAMPLE_SUFFIX); sampleInput.setSampleSuffix(sampleInputSuffix.getValue()); Element sampleInputType = sampleInputElement.getChild(SAMPLE_TYPE); sampleInput.setSampleType(sampleInputType.getValue().equals("1") ? SampleType.SingleEnd : SampleType.PairedEnd); } newExperiment.getChipSeqUnits().add(newCSUnit); } Element replicatesFlag = experimentElement.getChild(REPLICATES_FLAG); newExperiment.setReplicatesFlag(replicatesFlag.getValue().equals("1") ? true : false); this.getExperiments().add(newExperiment); } Element chromSize = configData.getChild(CHROMSIZE); if (validElement(chromSize)) { this.setChromSize(Utils.getRUbioSeqFile(chromSize.getValue())); } Element peakAnalysis = configData.getChild(PEAKANALYSIS); if (validElement(peakAnalysis)) { String peakAnalysisValue = peakAnalysis.getValue().toLowerCase(); if (peakAnalysisValue.equals("sharp")) { this.setPeakAnalysisType(PeakAnalysisType.SHARP); } else if (peakAnalysisValue.equals("broad")) { this.setPeakAnalysisType(PeakAnalysisType.BROAD); } else if (peakAnalysisValue.equals("both")) { this.setPeakAnalysisType(PeakAnalysisType.BOTH); } } Element ccaConfigFile = configData.getChild(CCAT_CONFIG_FILE); if (validElement(ccaConfigFile)) { this.setCcatConfigFile(Utils.getRUbioSeqFile(ccaConfigFile.getValue())); } Element macsExtraArgs = configData.getChild(MACS_EXTRAARGS); if (validElement(macsExtraArgs)) { this.setMacsExtraArgs(macsExtraArgs.getValue()); } Element fastqc = configData.getChild(FASTQC); if (validElement(fastqc)) { this.setFastqc(Integer.valueOf(fastqc.getValue())); } Element annotFile = configData.getChild(ANNOTFILE); if (validElement(annotFile)) { this.setAnnotFile(Utils.getRUbioSeqFile(annotFile.getValue())); } Element queueSGEProject = configData.getChild(QUEUESGEPROJECT); if (validElement(queueSGEProject)) { this.setQueueSGEProject(queueSGEProject.getValue()); } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { throw new InvalidRubioSeqParameterException(InvalidRubioSeqParameterException.DEFAULT_MESSAGE); } }