Example usage for org.jdom2 Element setAttribute

List of usage examples for org.jdom2 Element setAttribute

Introduction

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

Prototype

public Element setAttribute(final String name, final String value) 

Source Link

Document

This sets an attribute value for this element.

Usage

From source file:es.upm.dit.xsdinferencer.generation.generatorimpl.statisticsgeneration.StatisticResultsDocGeneratorImpl.java

License:Apache License

/**
 * This method generates an element with all the info contained on a {@link ComplexTypeStatisticsEntry} object
 * @param elementName the name of the generated element
 * @param complexType the complex type described by the entry
 * @param complexTypeStatisticsEntry the entry
 * @param elementInfoElementName the name of the element that describes the elements info
 * @param elementInfoSubElementName the name of the element that describes the info of each element
 * @param attributeInfoElementName the name of the element that describes the attributes info
 * @param attributeInfoSubElementName the name of the element that describes the info of each attributes
 * @param valuesInfoElementName the name of the element with the values info
 * @param valuesInfoSubElementName the name of the elements which contains all the info of each concrete value (on each node)
 * @param subpatternsInfoElementName the name of the element that describes the subpatterns info
 * @return An element with all the information described
 *//* ww w . j av a 2 s  .c om*/
protected Element generateComplexTypeEntry(String elementName, ComplexType complexType,
        ComplexTypeStatisticsEntry complexTypeStatisticsEntry, String elementInfoElementName,
        String elementInfoSubElementName, String attributeInfoElementName, String attributeInfoSubElementName,
        String valuesInfoElementName, String valuesInfoSubElementName, String subpatternsInfoElementName) {
    Element complexTypeStatisticsEntryElement = new Element("complexType", STATISTICS_NAMESPACE);
    complexTypeStatisticsEntryElement.setAttribute("name", complexType.getName());
    Element elementsAtComplexTypeElement = generateNodesOfComplexTypesInfoElements(elementInfoElementName,
            elementInfoSubElementName, complexTypeStatisticsEntry.getElementInfo(), valuesInfoElementName,
            valuesInfoSubElementName, complexTypeStatisticsEntry.getValuesInfo(),
            complexTypeStatisticsEntry.getStatisticsOfNumericValuesOfNodes(), "numericValuesStatistics");
    complexTypeStatisticsEntryElement.addContent(elementsAtComplexTypeElement);
    Element attributesAtComplexTypeElement = generateNodesOfComplexTypesInfoElements(attributeInfoElementName,
            attributeInfoSubElementName, complexTypeStatisticsEntry.getAttributeOccurrencesInfo(),
            valuesInfoElementName, valuesInfoSubElementName, complexTypeStatisticsEntry.getValuesInfo(),
            complexTypeStatisticsEntry.getStatisticsOfNumericValuesOfNodes(), "numericValuesStatistics");
    complexTypeStatisticsEntryElement.addContent(attributesAtComplexTypeElement);
    Element subpatternsInfoElement = generateSubpatternsInfoElement(subpatternsInfoElementName,
            complexTypeStatisticsEntry.getSubpatternsInfo());
    complexTypeStatisticsEntryElement.addContent(subpatternsInfoElement);
    return complexTypeStatisticsEntryElement;
}

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 ww w . ja  va 2 s . c  o m

    Element dirOutBase = new Element(DIROUTBASE);
    dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dirOutBase);

    Element projectId = new Element(PROJECTID);
    projectId.addContent(this.getProjectId());
    configurationFile.getRootElement().addContent(projectId);

    if (!this.getUserName().equals(userName_DV)) {
        Element userName = new Element(USERNAME);
        userName.addContent(this.getUserName());
        configurationFile.getRootElement().addContent(userName);
    }

    Element inDirPreProcess = new Element(INDIRPREPROCESS);
    inDirPreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(inDirPreProcess);

    for (CSExperiment experiment : this.getExperiments()) {
        Element chipSeqExperiment = new Element(EXPERIMENT);

        for (ChipSeqUnit csUnit : experiment.getChipSeqUnits()) {
            Element csUnitElement = new Element(CHIPSEQUNIT);

            Sample sampleTreatment = csUnit.getSampleTreatment();

            Element sampleTreatmentElement = new Element(SAMPLE_TREATMENT);

            Element sampleName = new Element(SAMPLE_NAME);
            sampleName.addContent(sampleTreatment.getSampleName());
            sampleTreatmentElement.addContent(sampleName);

            Element sampleFiles = new Element(SAMPLE_FILES);
            sampleFiles.addContent(sampleTreatment.getSampleFiles());
            sampleTreatmentElement.addContent(sampleFiles);

            Element sampleSuffix = new Element(SAMPLE_SUFFIX);
            sampleSuffix.addContent(sampleTreatment.getSampleSuffix());
            sampleTreatmentElement.addContent(sampleSuffix);

            Element sampleType = new Element(SAMPLE_TYPE);
            sampleType.addContent(sampleTreatment.getSampleType().getDisplayName());
            sampleTreatmentElement.addContent(sampleType);

            csUnitElement.addContent(sampleTreatmentElement);

            Sample sampleInput = csUnit.getSampleInput();
            if (sampleInput.checkSample()) {

                Element sampleInputElement = new Element(SAMPLE_INPUT);

                Element sampleInputName = new Element(SAMPLE_NAME);
                sampleInputName.addContent(sampleInput.getSampleName());
                sampleInputElement.addContent(sampleInputName);

                Element sampleInputFiles = new Element(SAMPLE_FILES);
                sampleInputFiles.addContent(sampleInput.getSampleFiles());
                sampleInputElement.addContent(sampleInputFiles);

                Element sampleInputSuffix = new Element(SAMPLE_SUFFIX);
                sampleInputSuffix.addContent(sampleInput.getSampleSuffix());
                sampleInputElement.addContent(sampleInputSuffix);

                Element sampleInputType = new Element(SAMPLE_TYPE);
                sampleInputType.addContent(sampleInput.getSampleType().getDisplayName());
                sampleInputElement.addContent(sampleInputType);

                csUnitElement.addContent(sampleInputElement);
            }

            chipSeqExperiment.addContent(csUnitElement);
        }

        Element replicatesFlag = new Element(REPLICATES_FLAG);
        replicatesFlag.addContent(experiment.isReplicatesFlag() ? "1" : "0");
        chipSeqExperiment.addContent(replicatesFlag);

        configurationFile.getRootElement().addContent(chipSeqExperiment);
    }

    Element chromSize = new Element(CHROMSIZE);
    chromSize.addContent(this.getChromSize().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(chromSize);

    if (!this.getPeakAnalysisType().equals(peakAnalysisType_DV)) {
        Element peakAnalysis = new Element(PEAKANALYSIS);
        peakAnalysis.addContent(this.getPeakAnalysisType().getDisplayName());
        configurationFile.getRootElement().addContent(peakAnalysis);
    }

    if (this.getCcatConfigFile() != ccatConfigFile_DV) {
        Element ccaConfigFile = new Element(CCAT_CONFIG_FILE);
        ccaConfigFile.addContent(this.getCcatConfigFile().getFile().getAbsolutePath());
        configurationFile.getRootElement().addContent(ccaConfigFile);
    }

    if (!this.getMacsExtraArgs().equals(macsExtraArgs_DV)) {
        Element macsExtraArgs = new Element(MACS_EXTRAARGS);
        macsExtraArgs.addContent(this.getMacsExtraArgs());
        configurationFile.getRootElement().addContent(macsExtraArgs);
    }

    if (!this.getFastqc().equals(fastqc_DV)) {
        Element fastqc = new Element(FASTQC);
        fastqc.addContent(this.getFastqc().toString());
        configurationFile.getRootElement().addContent(fastqc);
    }

    if (this.getAnnotFile() != annotFile_DV) {
        Element annotFile = new Element(ANNOTFILE);
        annotFile.addContent(this.getAnnotFile().getFile().getAbsolutePath());
        configurationFile.getRootElement().addContent(annotFile);
    }

    if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) {
        Element queueProject = new Element(QUEUESGEPROJECT);
        queueProject.addContent(this.getQueueSGEProject().toString());
        configurationFile.getRootElement().addContent(queueProject);
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    xmlOutput.setFormat(Format.getPrettyFormat());
    xmlOutput.output(configurationFile, new FileWriter(output));
}

From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.CopyNumberVariationExperiment.java

License:Open Source License

public void generateXMLConfigurationFile(File output) throws IOException {
    Document configurationFile = new Document();
    Element configData = new Element(CONFIG_DATA);
    configurationFile.setRootElement(configData);
    configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_CNV);

    Element genRef = new Element(GENREF);
    genRef.addContent(this.getGenRefPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(genRef);

    Element dbSnpAnnot = new Element(DBSNPANNOT);
    dbSnpAnnot.addContent(this.getDbSnpAnnotPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dbSnpAnnot);

    Element indelAnnot = new Element(INDELANNOT);
    indelAnnot.addContent(this.getIndelAnnotPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(indelAnnot);

    Element intervals = new Element(INTERVALS);
    intervals.addContent(this.getIntervalsPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(intervals);

    if (this.getKnownIndels().size() > 0) {
        for (KnownIndels kI : this.getKnownIndels()) {
            Element knownIndels = new Element(KNOWNINDELS);
            knownIndels.addContent(kI.getFile().getFile().getAbsolutePath());
            configurationFile.getRootElement().addContent(knownIndels);
        }/*w ww.j a  v a2  s  . c o  m*/
    }

    Element plattform = new Element(PLATTFORM);
    plattform.addContent(this.getPlattform().getDisplayName());
    configurationFile.getRootElement().addContent(plattform);

    if (!this.getCheckCasava().equals(checkCasava_DV)) {
        Element checkCasava = new Element(CHECKCASAVA);
        checkCasava.addContent(this.getCheckCasava().toString());
        configurationFile.getRootElement().addContent(checkCasava);
    }

    Element dirOutBase = new Element(DIROUTBASE);
    dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dirOutBase);

    Element projectId = new Element(PROJECTID);
    projectId.addContent(this.getProjectId());
    configurationFile.getRootElement().addContent(projectId);

    if (!this.getUserName().equals(userName_DV)) {
        Element userName = new Element(USERNAME);
        userName.addContent(this.getUserName());
        configurationFile.getRootElement().addContent(userName);
    }

    Element dataInDirpreProcess = new Element(INDIRPREPROCESS);
    dataInDirpreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dataInDirpreProcess);

    for (Sample s : this.getSamples()) {
        Element sample = new Element(SAMPLE);

        Element sampleName = new Element(SAMPLE_NAME);
        sampleName.addContent(s.getSampleName());
        sample.addContent(sampleName);

        Element sampleFiles = new Element(SAMPLE_FILES);
        sampleFiles.addContent(s.getSampleFiles());
        sample.addContent(sampleFiles);

        Element sampleSuffix = new Element(SAMPLE_SUFFIX);
        sampleSuffix.addContent(s.getSampleSuffix());
        sample.addContent(sampleSuffix);

        Element sampleType = new Element(SAMPLE_TYPE);
        sampleType.addContent(s.getSampleType().getDisplayName());
        sample.addContent(sampleType);

        configurationFile.getRootElement().addContent(sample);
    }

    if (!this.getFastqc().equals(fastqc_DV)) {
        Element fastqc = new Element(FASTQC);
        fastqc.addContent(this.getFastqc().toString());
        configurationFile.getRootElement().addContent(fastqc);
    }

    if (!this.getExtraContra().equals(extraContra_DV)) {
        Element extraContra = new Element(EXTRACONTRA);
        extraContra.addContent(this.getExtraContra().toString());
        configurationFile.getRootElement().addContent(extraContra);
    }

    if (this.getBaseline() != baseline_DV) {
        Element baseline = new Element(BASELINE);
        baseline.addContent(this.getBaseline().getFile().getAbsolutePath());
        configurationFile.getRootElement().addContent(baseline);
    }

    if (!this.getmDFlag().equals(mDFlag_DV)) {
        Element mDFlag = new Element(MDFLAG);
        mDFlag.addContent(this.getmDFlag().toString());
        configurationFile.getRootElement().addContent(mDFlag);
    }

    if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) {
        Element queueSGEProject = new Element(QUEUESGEPROJECT);
        queueSGEProject.addContent(this.getQueueSGEProject().toString());
        configurationFile.getRootElement().addContent(queueSGEProject);
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    xmlOutput.setFormat(Format.getPrettyFormat());
    xmlOutput.output(configurationFile, new FileWriter(output));
}

From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.MethylationExperiment.java

License:Open Source License

public void generateXMLConfigurationFile(File output) throws IOException {
    Document configurationFile = new Document();
    Element configData = new Element(CONFIG_DATA);
    configurationFile.setRootElement(configData);
    configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_METHYLATION);

    Element referencePath = new Element(REFERENCEPATH);
    referencePath.addContent(this.getReferencePath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(referencePath);

    Element readsPath = new Element(READSPATH);
    readsPath.addContent(this.getReadsPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(readsPath);

    Element projectCompletePath = new Element(PROJECT_COMPLETE_PATH);
    projectCompletePath.addContent(this.getProjectCompletePath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(projectCompletePath);

    Element plattform = new Element(PLATTFORM);
    plattform.addContent(this.getPlattform().getDisplayName());
    configurationFile.getRootElement().addContent(plattform);

    Element methylType = new Element(METHYLTYPE);
    methylType.addContent(this.getMethylType().toString());
    configurationFile.getRootElement().addContent(methylType);

    for (MethylationSample ms : this.getSamples()) {
        Element sample1 = new Element(SAMPLE1);
        sample1.addContent(ms.getSample1().getFile().getName());
        configurationFile.getRootElement().addContent(sample1);
    }//ww  w.  ja  va 2s. c om

    for (MethylationSample ms : this.getSamples()) {
        if (ms.getSample2() != null) {
            Element sample2 = new Element(SAMPLE2);
            sample2.addContent(ms.getSample2().getFile().getName());
            configurationFile.getRootElement().addContent(sample2);
        }
    }

    if (!this.getSeedLength().equals(seedLength_DV)) {
        Element seedLength = new Element(SEED_LENGTH);
        seedLength.addContent(this.getSeedLength().toString());
        configurationFile.getRootElement().addContent(seedLength);
    }

    if (!this.getNumMis().equals(numMis_DV)) {
        Element numMiss = new Element(NUM_MIS);
        numMiss.addContent(this.getNumMis().toString());
        configurationFile.getRootElement().addContent(numMiss);
    }

    if (this.getIntervalsPath() != intervalsPath_DV) {
        Element intervalsPath = new Element(INTERVALS);
        intervalsPath.addContent(this.getIntervalsPath().getFile().getAbsolutePath());
        configurationFile.getRootElement().addContent(intervalsPath);
    }

    if (!this.getContextType().equals(contextType_DV)) {
        Element contextType = new Element(CONTEXT);
        contextType.addContent(this.getContextType().toString());
        configurationFile.getRootElement().addContent(contextType);
    }

    if (!this.getTrimTagLength().equals(trimTagLength_DV)) {
        Element trimTagLength = new Element(TRIMTAGLENGTH);
        trimTagLength.addContent(this.getTrimTagLength());
        configurationFile.getRootElement().addContent(trimTagLength);
    }

    if (!this.getMinQual().equals(minQual_DV)) {
        Element minQual = new Element(MINQUAL);
        minQual.addContent(this.getMinQual().toString());
        configurationFile.getRootElement().addContent(minQual);
    }

    if (!this.getFastqc().equals(fastqc_DV)) {
        Element fastqc = new Element(FASTQC);
        fastqc.addContent(this.getFastqc().toString());
        configurationFile.getRootElement().addContent(fastqc);
    }

    if (!this.getDepthFilter().equals(depthFilter_DV)) {
        Element depthFilter = new Element(DEPTHFILTER);
        depthFilter.addContent(this.getDepthFilter().toString());
        configurationFile.getRootElement().addContent(depthFilter);
    }

    if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) {
        Element queueProject = new Element(QUEUESGEPROJECT);
        queueProject.addContent(this.getQueueSGEProject().toString());
        configurationFile.getRootElement().addContent(queueProject);
    }

    if (!this.getMultiExec().equals(multiExec_DV)) {
        Element multiExec = new Element(MULTIEXEC);
        multiExec.addContent(this.getMultiExec().toString());
        configurationFile.getRootElement().addContent(multiExec);
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    xmlOutput.setFormat(Format.getPrettyFormat());
    xmlOutput.output(configurationFile, new FileWriter(output));
}

From source file:es.uvigo.ei.sing.rubioseq.gui.view.models.experiments.SingleNucleotideVariantExperiment.java

License:Open Source License

public void generateXMLConfigurationFile(File output) throws IOException {
    Document configurationFile = new Document();
    Element configData = new Element(CONFIG_DATA);
    configurationFile.setRootElement(configData);
    configData.setAttribute(ExperimentUtils.BRANCH, ExperimentUtils.BRANCH_SNV);

    Element genRef = new Element(GENREF);
    genRef.addContent(this.getGenRefPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(genRef);

    Element dbSnpAnnot = new Element(DBSNPANNOT);
    dbSnpAnnot.addContent(this.getDbSnpAnnotPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dbSnpAnnot);

    Element genomes1000Annot = new Element(GENOMES1000ANNOT);
    genomes1000Annot.addContent(this.getGenomes1000AnnotPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(genomes1000Annot);

    Element indelAnnot = new Element(INDELANNOT);
    indelAnnot.addContent(this.getIndelAnnotPath().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(indelAnnot);

    if (this.getIntervalsPath() != getIntervalsPath_DV()) {
        Element intervals = new Element(INTERVALS);
        intervals.addContent(this.getIntervalsPath().getFile().getAbsolutePath());
        configurationFile.getRootElement().addContent(intervals);
    }//from  w w w  . j  a  va2s .  c o m

    if (this.getKnownIndels().size() > 0) {
        for (KnownIndels kI : this.getKnownIndels()) {
            Element knownIndels = new Element(KNOWNINDELS);
            knownIndels.addContent(kI.getFile().getFile().getAbsolutePath());
            configurationFile.getRootElement().addContent(knownIndels);
        }
    }

    Element plattform = new Element(PLATTFORM);
    plattform.addContent(this.getPlattform().getDisplayName());
    configurationFile.getRootElement().addContent(plattform);

    if (!this.getCheckCasava().equals(checkCasava_DV)) {
        Element checkCasava = new Element(CHECKCASAVA);
        checkCasava.addContent(this.getCheckCasava().toString());
        configurationFile.getRootElement().addContent(checkCasava);
    }

    Element dirOutBase = new Element(DIROUTBASE);
    dirOutBase.addContent(this.getDirOutBase().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dirOutBase);

    Element projectId = new Element(PROJECTID);
    projectId.addContent(this.getProjectId());
    configurationFile.getRootElement().addContent(projectId);

    if (!this.getUserName().equals(userName_DV)) {
        Element userName = new Element(USERNAME);
        userName.addContent(this.getUserName());
        configurationFile.getRootElement().addContent(userName);
    }

    Element dataInDirpreProcess = new Element(INDIRPREPROCESS);
    dataInDirpreProcess.addContent(this.getDataInDirpreProcess().getFile().getAbsolutePath());
    configurationFile.getRootElement().addContent(dataInDirpreProcess);

    for (Sample s : this.getSamples()) {
        Element sample = new Element(SAMPLE);

        Element sampleName = new Element(SAMPLE_NAME);
        sampleName.addContent(s.getSampleName());
        sample.addContent(sampleName);

        Element sampleFiles = new Element(SAMPLE_FILES);
        sampleFiles.addContent(s.getSampleFiles());
        sample.addContent(sampleFiles);

        Element sampleSuffix = new Element(SAMPLE_SUFFIX);
        sampleSuffix.addContent(s.getSampleSuffix());
        sample.addContent(sampleSuffix);

        Element sampleType = new Element(SAMPLE_TYPE);
        sampleType.addContent(s.getSampleType().getDisplayName());
        sample.addContent(sampleType);

        configurationFile.getRootElement().addContent(sample);
    }

    if (!this.getCallingType().equals(callingType_DV)) {
        Element callingType = new Element(CALLYING_TYPE);
        callingType.addContent(this.getCallingType().toString());
        configurationFile.getRootElement().addContent(callingType);
    }

    if (!this.getgATKoutputMode().equals(gATKoutputMode_DV)) {
        Element gATKoutputModeoutputMode = new Element(GATKOUTPUTMODE);
        gATKoutputModeoutputMode.addContent(this.getgATKoutputMode().toString());
        configurationFile.getRootElement().addContent(gATKoutputModeoutputMode);
    }

    if (!this.getRsFilter().equals(rsFilter_DV)) {
        Element rsFilter = new Element(RSFILTER);
        rsFilter.addContent(this.getRsFilter().toString());
        configurationFile.getRootElement().addContent(rsFilter);
    }

    if (!this.getrUbioSeqMode().equals(rUbioSeqMode_DV)) {
        Element rUbioSeq_Mode = new Element(RUBIOSEQMODE);
        rUbioSeq_Mode.addContent(this.getrUbioSeqMode().toString());
        configurationFile.getRootElement().addContent(rUbioSeq_Mode);
    }

    if (!this.getFastqc().equals(fastqc_DV)) {
        Element fastqc = new Element(FASTQC);
        fastqc.addContent(this.getFastqc().toString());
        configurationFile.getRootElement().addContent(fastqc);
    }

    if (!this.getvEPFlag().equals(vEPFlag_DV)) {
        Element vEPFlag = new Element(VEPFLAG);
        vEPFlag.addContent(this.getvEPFlag().toString());
        configurationFile.getRootElement().addContent(vEPFlag);
    }

    if (!this.gettCFlag().equals(tCFlag_DV)) {
        Element tCFlag = new Element(TCFLAG);
        tCFlag.addContent(this.gettCFlag().toString());
        configurationFile.getRootElement().addContent(tCFlag);
    }

    if (!this.getmDFlag().equals(mDFlag_DV)) {
        Element mDFlag = new Element(MDFLAG);
        mDFlag.addContent(this.getmDFlag().toString());
        configurationFile.getRootElement().addContent(mDFlag);
    }

    if (!this.getStandCallConf().equals(standCallConf_DV)) {
        Element standCallConf = new Element(STANDCALLCONF);
        standCallConf.addContent(this.getStandCallConf().toString());
        configurationFile.getRootElement().addContent(standCallConf);
    }

    if (!this.getStandEmitConf().equals(standEmitConf_DV)) {
        Element standEmitConf = new Element(STANDEMITCONF);
        standEmitConf.addContent(this.getStandEmitConf().toString());
        configurationFile.getRootElement().addContent(standEmitConf);
    }

    if (!this.getQueueSGEProject().equals(queueSGEProject_DV)) {
        Element queueSGEProject = new Element(QUEUESGEPROJECT);
        queueSGEProject.addContent(this.getQueueSGEProject().toString());
        configurationFile.getRootElement().addContent(queueSGEProject);
    }

    if (this.getChoiceVqrsHardFilters().equals(VQRSHardFiltersChoice.VQRS)
            && this.getvQSRblockMills() != VQSRblockMills_DV && this.getvQSRblockHapMAp() != VQSRblockHapMAp_DV
            && this.getvQSRblockThousandG() != VQSRblockThousandG_DV) {

        Element vQSR_block = new Element(VQSRBLOCK);

        Element mills = new Element(MILLS);
        mills.addContent(this.getvQSRblockMills().getFile().getAbsolutePath());
        vQSR_block.addContent(mills);

        Element hapmap = new Element(HAPMAP);
        hapmap.addContent(this.getvQSRblockHapMAp().getFile().getAbsolutePath());
        vQSR_block.addContent(hapmap);

        Element thousandg = new Element(THOUSANDG);
        thousandg.addContent(this.getvQSRblockThousandG().getFile().getAbsolutePath());
        vQSR_block.addContent(thousandg);

        configurationFile.getRootElement().addContent(vQSR_block);
    }

    if (this.getChoiceVqrsHardFilters().equals(VQRSHardFiltersChoice.HARDFILTERS)
            && (!this.getminQual().equals(minQual_DV) || !this.getdPmin().equals(DPmin_DV)
                    || this.getHardFilters().size() > 0)) {

        Element hardFiltersBlock = new Element(HFILTERS);

        if (!this.getdPmin().equals(DPmin_DV)) {
            Element dpMin = new Element(DPMIN);
            dpMin.addContent(this.getdPmin().toString());
            hardFiltersBlock.addContent(dpMin);
        }

        if (!this.getminQual().equals(minQual_DV)) {
            Element minQual = new Element(MINQUAL);
            minQual.addContent(this.getminQual().toString());
            hardFiltersBlock.addContent(minQual);
        }

        for (HardFilter hF : this.getHardFilters()) {
            Element name = hF.getType().equals(HardFilter.HFilterType.SNP) ? new Element(HFILTER_NAME_SNP)
                    : new Element(HFILTER_NAME_INDEL);
            name.addContent(hF.getName());
            Element rule = hF.getType().equals(HardFilter.HFilterType.SNP) ? new Element(HFILTER_RULE_SNP)
                    : new Element(HFILTER_RULE_INDEL);
            rule.addContent(hF.getRule());
            hardFiltersBlock.addContent(name);
            hardFiltersBlock.addContent(rule);
        }

        configurationFile.getRootElement().addContent(hardFiltersBlock);
    }

    XMLOutputter xmlOutput = new XMLOutputter();
    xmlOutput.setFormat(Format.getPrettyFormat());
    xmlOutput.output(configurationFile, new FileWriter(output));
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Builds the hocr document, extracting the header from the old hocr document.
 * @param the old hocrDocument//from  w  w  w  .  j a v  a 2 s .co  m
 * @return the new ohocrDocument
 */
public Document build(Document hocrDocument) {
    Element root = hocrDocument.getRootElement();
    xmlns = root.getNamespace();
    Element bodyEl = root.getChildren().get(1);
    Element ocrPageEl = bodyEl.getChildren().get(0).detach();
    String pageId = ocrPageEl.getAttributeValue("id");
    ocrPageEl = new Element("div", xmlns);
    ocrPageEl.setAttribute("class", "ocr_page");
    ocrPageEl.setAttribute("id", pageId);
    for (OcrLine ocrLine : ocrPage.getOcrLines()) {
        ocrPageEl.addContent(makeOcrLineEl(ocrLine));
        ocrPageEl.addContent(new Element("br", xmlns));
    }
    bodyEl.addContent(ocrPageEl);
    return hocrDocument;
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Makes the line.//from w  w w . ja  v  a 2  s .co m
 * @param ocrLine
 * @return the related element.
 */
private Element makeOcrLineEl(OcrLine ocrLine) {
    Element ocrLineEl = new Element("span", xmlns);
    ocrLineEl.setAttribute("class", "ocr_line");
    ocrLineEl.setAttribute("title", ocrLine.getScan().getCoords().getBbox());
    for (OcrWord ocrWord : ocrLine.getOcrWords()) {
        ocrLineEl.addContent(makeOcrWordEl(ocrWord));
    }
    return ocrLineEl;
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Makes the token.// ww w .  j a va2s .co m
 * @param ocrWord
 * @return the related element.
 */
private Element makeOcrWordEl(OcrWord ocrWord) {
    Element ocrWordEl = new Element("span", xmlns);
    String wordId = ocrWord.getId();
    ocrWordEl.setAttribute("id", wordId);
    ocrWordEl.setAttribute("class", "ocr_word");
    ocrWordEl.setAttribute("title", ocrWord.getScan().getCoords().getBbox());
    Element alternativeEl = new Element("span", xmlns);
    alternativeEl.setAttribute("class", "alternatives");
    Element alternativeInsertionEl = new Element("ins", xmlns);
    alternativeInsertionEl.setAttribute("class", "alt");
    alternativeInsertionEl.setAttribute("title", ocrWord.getInsertion().getNlp());
    alternativeInsertionEl.setText(ocrWord.getInsertion().getText());
    alternativeEl.addContent(alternativeInsertionEl);
    for (Deletion alternativeDeletion : ocrWord.getDeletions()) {
        alternativeEl.addContent(makeAlternativeDeletionEl(alternativeDeletion));
    }
    ocrWordEl.addContent(alternativeEl);
    return ocrWordEl;
}

From source file:eu.himeros.cophi.ocr.proofreader.controller.pojo.HocrDocumentBuilder.java

License:Open Source License

/**
 * Makes the alternative deletion.//w w w.j  a va2s . c  o  m
 * @param alternativeDeletion
 * @return an alternative deletion.
 */
private Element makeAlternativeDeletionEl(Deletion alternativeDeletion) {
    Element alternativeDeletionEl = new Element("del", xmlns);
    //alternativeDeletionEl.setAttribute("class", "alt");
    alternativeDeletionEl.setAttribute("title", alternativeDeletion.getNlp());
    alternativeDeletionEl.setText(alternativeDeletion.getText());
    return alternativeDeletionEl;
}

From source file:eu.himeros.digitaledition.AlignedQuotationParser.java

License:Open Source License

private Element appendToAnchor(Element root) throws Exception {
    Element anchorRoot = new Element("text");
    List<Element> words = root.getChildren();
    Element currAnchor = new Element("w");
    currAnchor.setAttribute("id", "0");
    anchorRoot.addContent(currAnchor);//from  w  w  w . j  a va 2 s . c  o m
    Element currNode;
    for (Element word : words) {
        currNode = word.clone();
        if ("1".equals(word.getAttributeValue("occ"))) {
            currAnchor = currNode;
            anchorRoot.addContent(currAnchor);
        } else {
            currAnchor.addContent(currNode);
        }
    }
    return anchorRoot;
}