List of usage examples for org.jdom2.input SAXBuilder SAXBuilder
public SAXBuilder()
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 .j ava2s . 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.ConfigProgramPathsSNV.java
License:Open Source License
public void loadDataFromFile(File editFile) { loadDefaultParameters(editFile);//from 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 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.experiments.ChipSeqExperiment.java
License:Open Source License
public static String getWorkingDirectory(File inputFile) { SAXBuilder saxBuilder = new SAXBuilder(); try {//from w w w . j a v a2s . c o 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 w ww . ja v a2 s . 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); } }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.CopyNumberVariationExperiment.java
License:Open Source License
public void loadDataFromFile(File editFile) throws InvalidRubioSeqParameterException { SAXBuilder saxBuilder = new SAXBuilder(); try {/*from www . j a v a2s .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 dbSnpAnnot = configData.getChild(DBSNPANNOT); if (validElement(dbSnpAnnot)) { this.setDbSnpAnnotPath(Utils.getRUbioSeqFile(dbSnpAnnot.getValue())); } Element indelAnnot = configData.getChild(INDELANNOT); if (validElement(indelAnnot)) { this.setIndelAnnotPath(Utils.getRUbioSeqFile(indelAnnot.getValue())); } Element intervals = configData.getChild(INTERVALS); if (validElement(intervals)) { this.setIntervalsPath(Utils.getRUbioSeqFile(intervals.getValue())); } for (Element knownIndels : configData.getChildren(KNOWNINDELS)) { if (validElement(knownIndels)) { KnownIndels kI = new KnownIndels(); kI.setFile(Utils.getRUbioSeqFile(knownIndels.getValue())); this.knownIndels.add(kI); } } 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 sampleElement : configData.getChildren(SAMPLE)) { Sample newSample = new Sample(); Element sampleName = sampleElement.getChild(SAMPLE_NAME); if (validElement(sampleName)) { newSample.setSampleName(sampleName.getValue()); } Element sampleFiles = sampleElement.getChild(SAMPLE_FILES); if (validElement(sampleFiles)) { newSample.setSampleFiles(sampleFiles.getValue()); } Element sampleSuffix = sampleElement.getChild(SAMPLE_SUFFIX); if (validElement(sampleSuffix)) { newSample.setSampleSuffix(sampleSuffix.getValue()); } Element sampleType = sampleElement.getChild(SAMPLE_TYPE); if (validElement(sampleType)) { newSample.setSampleType( sampleType.getValue().equals("1") ? SampleType.SingleEnd : SampleType.PairedEnd); } this.getSamples().add(newSample); } Element fastqc = configData.getChild(FASTQC); if (validElement(fastqc)) { this.setFastqc(Integer.valueOf(fastqc.getValue())); } Element extraContra = configData.getChild(EXTRACONTRA); if (validElement(extraContra)) { this.setExtraContra(extraContra.getValue()); } Element baseline = configData.getChild(BASELINE); if (validElement(baseline)) { this.setBaseline(Utils.getRUbioSeqFile(baseline.getValue())); } Element mDFlag = configData.getChild(MDFLAG); if (validElement(mDFlag)) { this.setmDFlag(Integer.valueOf(mDFlag.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); } }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.ExperimentUtils.java
License:Open Source License
public static ExperimentType getExperimentType(File inputFile) throws InvalidRubioSeqParameterException { if (inputFile.isDirectory() || !inputFile.canRead() || !inputFile.getName().endsWith(".xml")) { return null; }/*from ww w . ja v a 2 s . co m*/ SAXBuilder saxBuilder = new SAXBuilder(); try { Document document = saxBuilder.build(inputFile); Element configData = document.getRootElement(); String branch = configData.getAttributeValue(ExperimentUtils.BRANCH); if (branch == null) { throw new InvalidRubioSeqParameterException(ExperimentUtils.BRANCH_MISSING_MESSAGE); } else { if (branch.equals(BRANCH_METHYLATION)) { return ExperimentType.Methylation; } else if (branch.equals(BRANCH_SNV)) { return ExperimentType.SNV; } else if (branch.equals(BRANCH_CNV)) { return ExperimentType.CNV; } else if (branch.equals(BRANCH_CHIPSEQ)) { return ExperimentType.CHIPSeq; } } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.MethylationExperiment.java
License:Open Source License
public static String getWorkingDirectory(File inputFile) { SAXBuilder saxBuilder = new SAXBuilder(); try {//from w ww . java 2s . c om Document document = saxBuilder.build(inputFile); Element configData = document.getRootElement(); Element projectCompletePath = configData.getChild(PROJECT_COMPLETE_PATH); return projectCompletePath.getValue(); } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return ""; }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.MethylationExperiment.java
License:Open Source License
public void loadDataFromFile(File editFile) throws InvalidRubioSeqParameterException { SAXBuilder saxBuilder = new SAXBuilder(); try {//w ww . j av a2 s. c om Document document = saxBuilder.build(editFile); Element configData = document.getRootElement(); Element referencePath = configData.getChild(REFERENCEPATH); if (validElement(referencePath)) { this.setReferencePath(Utils.getRUbioSeqFile(referencePath.getValue())); } Element intervals = configData.getChild(INTERVALS); if (validElement(intervals)) { this.setIntervalsPath(Utils.getRUbioSeqFile(intervals.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("fastq")) { this.setPlattform(PlattformTech.FASTQ); } } Element projectCompletePath = configData.getChild(PROJECT_COMPLETE_PATH); if (validElement(projectCompletePath)) { this.setProjectCompletePath(Utils.getRUbioSeqFile(projectCompletePath.getValue(), false)); } Element readsPath = configData.getChild(READSPATH); if (validElement(readsPath)) { this.setReadsPath(Utils.getRUbioSeqFile(readsPath.getValue())); } Iterator<Element> sample1It = configData.getChildren(SAMPLE1).iterator(); Iterator<Element> sample2It = configData.getChildren(SAMPLE2).iterator(); this.samples = new LinkedList<MethylationSample>(); while (sample1It.hasNext()) { MethylationSample newMS = new MethylationSample(); Element sample1 = sample1It.next(); if (validElement(sample1)) { newMS.setSample1(Utils.getRUbioSeqFile( Utils.getDirectoryNameWithFinalSlash(this.getReadsPath().getFile().getAbsolutePath()) + sample1.getValue())); } if (sample2It.hasNext()) { Element sample2 = sample2It.next(); if (validElement(sample2)) { newMS.setSample2(Utils.getRUbioSeqFile(Utils.getDirectoryNameWithFinalSlash( this.getReadsPath().getFile().getAbsolutePath()) + sample2.getValue())); } } this.getSamples().add(newMS); } Element seedLength = configData.getChild(SEED_LENGTH); if (validElement(seedLength)) { this.setSeedLength(Integer.valueOf(seedLength.getValue())); } Element numMiss = configData.getChild(NUM_MIS); if (validElement(numMiss)) { this.setNumMis(Integer.valueOf(numMiss.getValue())); } Element minQual = configData.getChild(MINQUAL); if (validElement(minQual)) { this.setNumMis(Integer.valueOf(minQual.getValue())); } Element depthFilter = configData.getChild(DEPTHFILTER); if (validElement(depthFilter)) { this.setDepthFilter(Double.valueOf(depthFilter.getValue())); } Element methylType = configData.getChild(METHYLTYPE); if (validElement(methylType)) { String methylTypeValue = methylType.getValue().toUpperCase(); if (methylTypeValue.equals("LISTER")) { this.setMethylType(MethylType.LISTER); } else if (methylTypeValue.equals("COKUS")) { this.setMethylType(MethylType.COKUS); } } Element contextType = configData.getChild(CONTEXT); if (validElement(contextType)) { String contextTypeValue = contextType.getValue(); if (contextTypeValue.equals("ALL")) { this.setContextType(ContextType.ALL); } else if (contextTypeValue.equals("CpG")) { this.setContextType(ContextType.CPG); } else if (contextTypeValue.equals("CHG")) { this.setContextType(ContextType.CHG); } else if (contextTypeValue.equals("CHH")) { this.setContextType(ContextType.CHH); } } Element multiExec = configData.getChild(MULTIEXEC); if (validElement(multiExec)) { this.setMultiExec(Integer.valueOf(multiExec.getValue())); } Element trimTagLenght = configData.getChild(TRIMTAGLENGTH); if (validElement(trimTagLenght)) { this.setTrimTagLength(trimTagLenght.getValue()); } Element fastqc = configData.getChild(FASTQC); if (validElement(fastqc)) { this.setFastqc(Integer.valueOf(fastqc.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); } }
From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.SingleNucleotideVariantExperiment.java
License:Open Source License
public void loadDataFromFile(File editFile) throws InvalidRubioSeqParameterException { SAXBuilder saxBuilder = new SAXBuilder(); try {//from ww w . j av a 2s. co 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 dbSnpAnnot = configData.getChild(DBSNPANNOT); if (validElement(dbSnpAnnot)) { this.setDbSnpAnnotPath(Utils.getRUbioSeqFile(dbSnpAnnot.getValue())); } Element genomes1000Annot = configData.getChild(GENOMES1000ANNOT); if (validElement(genomes1000Annot)) { this.setGenomes1000AnnotPath(Utils.getRUbioSeqFile(genomes1000Annot.getValue())); } Element indelAnnot = configData.getChild(INDELANNOT); if (validElement(indelAnnot)) { this.setIndelAnnotPath(Utils.getRUbioSeqFile(indelAnnot.getValue())); } Element intervals = configData.getChild(INTERVALS); if (validElement(intervals)) { this.setIntervalsPath(Utils.getRUbioSeqFile(intervals.getValue())); } for (Element knownIndels : configData.getChildren(KNOWNINDELS)) { if (validElement(knownIndels)) { KnownIndels kI = new KnownIndels(); kI.setFile(Utils.getRUbioSeqFile(knownIndels.getValue())); this.knownIndels.add(kI); } } 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 sampleElement : configData.getChildren(SAMPLE)) { Sample newSample = new Sample(); Element sampleName = sampleElement.getChild(SAMPLE_NAME); if (validElement(sampleName)) { newSample.setSampleName(sampleName.getValue()); } Element sampleFiles = sampleElement.getChild(SAMPLE_FILES); if (validElement(sampleFiles)) { newSample.setSampleFiles(sampleFiles.getValue()); } Element sampleSuffix = sampleElement.getChild(SAMPLE_SUFFIX); if (validElement(sampleSuffix)) { newSample.setSampleSuffix(sampleSuffix.getValue()); } Element sampleType = sampleElement.getChild(SAMPLE_TYPE); if (validElement(sampleType)) { newSample.setSampleType( sampleType.getValue().equals("1") ? SampleType.SingleEnd : SampleType.PairedEnd); } this.getSamples().add(newSample); } Element callingType = configData.getChild(CALLYING_TYPE); if (validElement(callingType)) { String callingTypeValue = callingType.getValue().toUpperCase(); if (callingTypeValue.equals("SNP")) { this.setCallingType(CallingType.SNP); } else if (callingTypeValue.equals("INDEL")) { this.setCallingType(CallingType.INDEL); } else if (callingTypeValue.equals("BOTH")) { this.setCallingType(CallingType.BOTH); } } Element gATKoutputModeoutputMode = configData.getChild(GATKOUTPUTMODE); if (validElement(gATKoutputModeoutputMode)) { String gatkOutputModeValue = gATKoutputModeoutputMode.getValue().toUpperCase(); if (gatkOutputModeValue.equals("EMIT_VARIANTS_ONLY")) { this.setgATKoutputMode(GATKoutputMode.EMIT_VARIANTS_ONLY); } else if (gatkOutputModeValue.equals("EMIT_ALL_SITES")) { this.setgATKoutputMode(GATKoutputMode.EMIT_ALL_SITES); } else if (gatkOutputModeValue.equals("EMIT_ALL_CONFIDENT_SITES")) { this.setgATKoutputMode(GATKoutputMode.EMIT_ALL_CONFIDENT_SITES); } } Element rsFilter = configData.getChild(RSFILTER); if (validElement(rsFilter)) { this.setRsFilter(Integer.valueOf(rsFilter.getValue())); } Element rUbioSeq_Mode = configData.getChild(RUBIOSEQMODE); if (validElement(rUbioSeq_Mode)) { this.setrUbioSeqMode(Integer.valueOf(rUbioSeq_Mode.getValue())); } Element fastqc = configData.getChild(FASTQC); if (validElement(fastqc)) { this.setFastqc(Integer.valueOf(fastqc.getValue())); } Element vEPFlag = configData.getChild(VEPFLAG); if (validElement(vEPFlag)) { this.setvEPFlag(Integer.valueOf(vEPFlag.getValue())); } Element tCFlag = configData.getChild(TCFLAG); if (validElement(tCFlag)) { this.settCFlag(Integer.valueOf(tCFlag.getValue())); } Element mDFlag = configData.getChild(MDFLAG); if (validElement(mDFlag)) { this.setmDFlag(Integer.valueOf(mDFlag.getValue())); } Element standCallConf = configData.getChild(STANDCALLCONF); if (validElement(standCallConf)) { this.setStandCallConf(Double.valueOf(standCallConf.getValue())); } Element standEmitConf = configData.getChild(STANDEMITCONF); if (validElement(standEmitConf)) { this.setStandEmitConf(Double.valueOf(standEmitConf.getValue())); } Element queueSGEProject = configData.getChild(QUEUESGEPROJECT); if (validElement(queueSGEProject)) { this.setQueueSGEProject(queueSGEProject.getValue()); } Element vqsrBlock = configData.getChild(VQSRBLOCK); if (vqsrBlock != null) { this.setChoiceVqrsHardFilters(VQRSHardFiltersChoice.VQRS); Element mills = vqsrBlock.getChild(MILLS); if (validElement(mills)) { this.setvQSRblockMills(Utils.getRUbioSeqFile(mills.getValue())); } Element hapmap = vqsrBlock.getChild(HAPMAP); if (validElement(hapmap)) { this.setvQSRblockHapMAp(Utils.getRUbioSeqFile(hapmap.getValue())); } Element thousandg = vqsrBlock.getChild(THOUSANDG); if (validElement(thousandg)) { this.setvQSRblockThousandG(Utils.getRUbioSeqFile(thousandg.getValue())); } } Element hardFiltersBlock = configData.getChild(HFILTERS); if (hardFiltersBlock != null) { this.setChoiceVqrsHardFilters(VQRSHardFiltersChoice.HARDFILTERS); Element dpMin = hardFiltersBlock.getChild(DPMIN); if (validElement(dpMin)) { this.setdPmin(Integer.valueOf(dpMin.getValue())); } Element minQual = hardFiltersBlock.getChild(MINQUAL); if (validElement(minQual)) { this.setminQual(Integer.valueOf(minQual.getValue())); } Iterator<Element> hFilterNameSNP = hardFiltersBlock.getChildren(HFILTER_NAME_SNP).iterator(); Iterator<Element> hFilterRuleSNP = hardFiltersBlock.getChildren(HFILTER_RULE_SNP).iterator(); while (hFilterNameSNP.hasNext() && hFilterRuleSNP.hasNext()) { Element hFilterNameSNPElement = hFilterNameSNP.next(); Element hFilterRuleSNPElement = hFilterRuleSNP.next(); HardFilter newHardFilter = new HardFilter(); newHardFilter.setName(hFilterNameSNPElement.getValue()); newHardFilter.setRule(hFilterRuleSNPElement.getValue()); newHardFilter.setType(HFilterType.SNP); this.getHardFilters().add(newHardFilter); } Iterator<Element> hFilterNameINDEL = hardFiltersBlock.getChildren(HFILTER_NAME_INDEL).iterator(); Iterator<Element> hFilterRuleINDEL = hardFiltersBlock.getChildren(HFILTER_RULE_INDEL).iterator(); while (hFilterNameINDEL.hasNext() && hFilterRuleINDEL.hasNext()) { Element hFilterNameINDELElement = hFilterNameINDEL.next(); Element hFilterRuleINDELElement = hFilterRuleINDEL.next(); HardFilter newHardFilter = new HardFilter(); newHardFilter.setName(hFilterNameINDELElement.getValue()); newHardFilter.setRule(hFilterRuleINDELElement.getValue()); newHardFilter.setType(HFilterType.INDEL); this.getHardFilters().add(newHardFilter); } } } catch (JDOMException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { throw new InvalidRubioSeqParameterException(InvalidRubioSeqParameterException.DEFAULT_MESSAGE); } }
From source file:esiptestbed.mudrod.main.MudrodEngine.java
License:Apache License
/** * Load the configuration provided at <a href= * "https://github.com/mudrod/mudrod/blob/master/core/src/main/resources/config.xml">config.xml</a>. * //from www. j a va 2 s . com * @return a populated {@link java.util.Properties} object. */ public Properties loadConfig() { SAXBuilder saxBuilder = new SAXBuilder(); InputStream configStream = MudrodEngine.class.getClassLoader().getResourceAsStream("config.xml"); Document document; try { document = saxBuilder.build(configStream); Element rootNode = document.getRootElement(); List<Element> paraList = rootNode.getChildren("para"); for (int i = 0; i < paraList.size(); i++) { Element paraNode = paraList.get(i); props.put(paraNode.getAttributeValue("name"), paraNode.getTextTrim()); } } catch (JDOMException | IOException e) { LOG.error("Exception whilst retreiving or processing XML contained within 'config.xml'!", e); } return getConfig(); }