private CountFields constructFields()

in src/main/java/com/epam/fonda/tools/impl/Count.java [104:140]


    private CountFields constructFields(Configuration configuration, TemplateEngine templateEngine) {
        checkValues(configuration);
        CountFields countFields = new CountFields();
        countFields.jarPath = PipelineUtils.getExecutionPath(configuration);
        countFields.cellRanger = configuration.getGlobalConfig().getToolConfig().getCellranger();
        countFields.rScript = configuration.getGlobalConfig().getToolConfig().getRScript();
        countFields.sampleName = sample.getName();
        countFields.transcriptome = configuration.getGlobalConfig().getDatabaseConfig().getTranscriptome();
        countFields.libraries = createLibraryCsvFile(configuration, templateEngine);
        final String featureRef = configuration.getGlobalConfig().getDatabaseConfig().getFeatureRef();
        countFields.featureRef = removeFeatureRefFlag(featureRef) ? NA : featureRef;
        countFields.countOutdir = format("%s/%s", configuration.getCommonOutdir().getRootOutdir(), "count");
        PipelineUtils.createDir(countFields.countOutdir);
        countFields.genomeBuild = configuration.getGlobalConfig().getDatabaseConfig().getGenomeBuild();
        countFields.expectedCells = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerExpectedCells();
        countFields.forcedCells = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerForcedCells();
        countFields.nosecondary = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerNosecondary();
        countFields.chemistry = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerChemistry();
        countFields.r1Length = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerR1Length();
        countFields.r2Length = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerR2Length();
        countFields.lanes = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerLanes();
        countFields.indices = configuration.getGlobalConfig().getCellrangerConfig().getCellrangerIndices();
        String samplePath = format("%s/%s", countFields.countOutdir, countFields.sampleName);
        countFields.bam = format("%s/%s/possorted_genome_bam.bam", samplePath, CELLRANGER_OUTPUT_FOLDER);
        countFields.matrixInfo = format("%s/%s/filtered_feature_bc_matrix", samplePath,
                CELLRANGER_OUTPUT_FOLDER);
        countFields.numThreads = configuration.getGlobalConfig().getQueueParameters().getNumThreads();
        String countTargetPanel = configuration.getGlobalConfig().getDatabaseConfig().getCellrangerCountTargetPanel();
        countFields.targetPanel = StringUtils.isBlank(countTargetPanel) || NA.equals(countTargetPanel)
                ? null
                : countTargetPanel;
        String maxMem = configuration.getGlobalConfig().getQueueParameters().getMaxMem();
        countFields.maxMemInGb = StringUtils.isBlank(maxMem)
                ? null
                : maxMem.replaceAll("\\D+", StringUtils.EMPTY);
        return countFields;
    }