Example usage for org.jdom2 Element getValue

List of usage examples for org.jdom2 Element getValue

Introduction

In this page you can find the example usage for org.jdom2 Element getValue.

Prototype

@Override
public String getValue() 

Source Link

Document

Returns the XPath 1.0 string value of this element, which is the complete, ordered content of all text node descendants of this element (i.e. the text that's left after all references are resolved and all other markup is stripped out.)

Usage

From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsChipSeq.java

License:Open Source License

public boolean validElement(Element e) {
    return e != null && e.getValue() != null && !e.getValue().equals("");
}

From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.configuration.ConfigProgramPathsChipSeq.java

License:Open Source License

public void loadDataFromFile(File editFile) {

    loadDefaultParameters(editFile);/*from w  w  w.  j a va  2  s  .co 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 picardPath = configData.getChild(PICARD_PATH);
        if (validElement(picardPath)) {
            this.setPicardPath(Utils.getRUbioSeqFile(picardPath.getValue()));
        }

        Element MACSPath = configData.getChild(MACS_PATH);
        if (validElement(MACSPath)) {
            this.setMacsPath(Utils.getRUbioSeqFile(MACSPath.getValue()));
        }

        Element PythonPath = configData.getChild(PYTHON_PATH);
        if (validElement(PythonPath)) {
            this.setPythonPath(Utils.getRUbioSeqFile(PythonPath.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 BedgraphtoWigPath = configData.getChild(BGTW_PATH);
        if (validElement(BedgraphtoWigPath)) {
            this.setBedgraphtobigwigPath(Utils.getRUbioSeqFile(BedgraphtoWigPath.getValue()));
        }

        Element IDRPath = configData.getChild(IDR_PATH);
        if (validElement(IDRPath)) {
            this.setIdrPath(Utils.getRUbioSeqFile(IDRPath.getValue()));
        }

        Element PeakAnnotatorPath = configData.getChild(PEAKANNOTATOR_PATH);
        if (validElement(PeakAnnotatorPath)) {
            this.setPeakannotatorPath(Utils.getRUbioSeqFile(PeakAnnotatorPath.getValue()));
        }

        Element CCATPath = configData.getChild(CCAT_PATH);
        if (validElement(CCATPath)) {
            this.setCcatPath(Utils.getRUbioSeqFile(CCATPath.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);
        System.err.println("\n\n\t QUEUE_SYSTEM = " + queueSystem + "\n");
        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 loadDataFromFile(File editFile) {

    loadDefaultParameters(editFile);/*  w  ww .ja va 2  s.co  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 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.ConfigProgramPathsMethylation.java

License:Open Source License

public void loadDataFromFile(File editFile) {

    loadDefaultParameters(editFile);/*  ww w .j a  v a 2s  .  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  w  w .j a v a 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.experiments.ChipSeqExperiment.java

License:Open Source License

public static String getWorkingDirectory(File inputFile) {
    SAXBuilder saxBuilder = new SAXBuilder();
    try {//from w w w  . j av  a2  s.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 {//  w w w  .  j  av 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 {//  ww  w  . ja  v a  2 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 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.MethylationExperiment.java

License:Open Source License

public static String getWorkingDirectory(File inputFile) {
    SAXBuilder saxBuilder = new SAXBuilder();
    try {/*from  ww  w .ja  v  a 2 s. 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 {//from   ww w  . j av a  2  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);
    }
}