Class Normalization

  • Direct Known Subclasses:
    DiffAna

    public class Normalization
    extends Object
    This class create and launch an R script to compute normalisation of expression data
    Since:
    1.2
    Author:
    Vivien Deshaies
    • Constructor Detail

      • Normalization

        public Normalization​(RExecutor executor,
                             Design design)
                      throws EoulsanException
        Public constructor.
        Parameters:
        executor - executor to use to execute the normalization
        design - The design object
        Throws:
        EoulsanException - if an error occurs if connection to RServe server cannot be established
    • Method Detail

      • runRExecutor

        protected void runRExecutor​(TaskContext context,
                                    Data data)
                             throws EoulsanException
        Execute Rnw script.
        Parameters:
        context - Step context
        data - data to process
        Throws:
        EoulsanException - if an error occurs while executing the script
      • isTechnicalReplicates

        protected boolean isTechnicalReplicates​(List<String> rRepTechGroup)
        Test if there is Technical replicates into rRepTechGroup field.
        Parameters:
        rRepTechGroup - list of the technical replicate group
      • readStaticScript

        protected String readStaticScript​(String staticFile)
                                   throws EoulsanException
        Read a static part of the generated script.
        Parameters:
        staticFile - the name of a file containing a part of the script
        Returns:
        A String with the static part of the script
        Throws:
        EoulsanException - if an error occurs while reading the script
      • generateScript

        protected String generateScript​(Experiment experiment,
                                        TaskContext context)
                                 throws EoulsanException
        Generate the R script.
        Parameters:
        experiment - the experiment
        context - step context
        Returns:
        String rScript R script to execute
        Throws:
        EoulsanException - if an error occurs while generate the R script
      • generateRnwpreamble

        protected StringBuilder generateRnwpreamble​(List<Sample> experimentSamplesList,
                                                    String title,
                                                    String filePrefix)
        Write Rnw preamble.
        Parameters:
        experimentSamplesList - sample experiment list
        title - title of the document
        filePrefix - Sweave file prefix
        Returns:
        a StringBuilder with Rnw preamble
      • generateSampleNamePart

        protected void generateSampleNamePart​(List<String> rSampleNames,
                                              StringBuilder sb)
        Add sampleNames vector to R script.
        Parameters:
        rSampleNames - sample names
        sb - StringBuilder where write the part of the script
      • generateSampleIdsPart

        protected void generateSampleIdsPart​(List<Integer> rSampleIds,
                                             StringBuilder sb)
        Add SampleIds vector to R script.
        Parameters:
        rSampleIds - samples identifiers
        sb - StringBuilder where write the part of the script
      • generateExpressionFileNamesPart

        protected void generateExpressionFileNamesPart​(StringBuilder sb)
        Add expression file name vector to R script.
        Parameters:
        sb - StringBuilder where write the part of the script
      • generateRepTechGroupPart

        protected void generateRepTechGroupPart​(List<String> rRepTechGroup,
                                                StringBuilder sb)
        Write the section of the script that handle technical replicate groups.
        Parameters:
        rRepTechGroup - list of technical replicate groups
        sb - StringBuilder where write the part of the script
      • generateConditionPart

        protected void generateConditionPart​(List<String> rCondNames,
                                             StringBuilder sb)
        Add condition vector to R script.
        Parameters:
        rCondNames - condition names
        sb - StringBuilder where write the part of the script
      • checkRepTechGroupCoherence

        protected void checkRepTechGroupCoherence​(List<String> rRepTechGroup,
                                                  List<String> rCondNames)
                                           throws EoulsanException
        Check if there is a problem in the repTechGroup coherence.
        Parameters:
        rRepTechGroup - technical replicate group
        rCondNames - condition names
        Throws:
        EoulsanException - if an error if found in the design file
      • escapeUnderScore

        protected String escapeUnderScore​(String s)
        Escape underscore for LaTeX title.
        Parameters:
        s - string to escape
        Returns:
        s with escaped underscore
      • replaceRtgNA

        protected void replaceRtgNA​(List<String> rRepTechGroup,
                                    List<String> rSampleNames)
        Replace na values in RepTechGroup list to avoid pooling error.
        Parameters:
        rRepTechGroup - list of technical replicate groups
        rSampleNames - sample names