Class DesignUtils


  • public final class DesignUtils
    extends Object
    Utils methods for Design.
    Since:
    1.0
    Author:
    Laurent Jourdren, Xavier Bauquet
    • Method Detail

      • showDesign

        public static void showDesign​(Design design)
        Show a design
        Parameters:
        design - Design to show
      • getAllSamplesMetadataKeys

        public static List<String> getAllSamplesMetadataKeys​(Design design)
        Get all the sample metadata keys of the samples of a design.
        Parameters:
        design - the design
        Returns:
        a list with the sample metadata keys of the samples of a design
      • getExperimentSampleAllMetadataKeys

        public static List<String> getExperimentSampleAllMetadataKeys​(Experiment experiment)
        Get all the experiment metadata keys of the samples of a design.
        Parameters:
        experiment - the experiment
        Returns:
        a list with the experiment metadata keys of the samples of a design
      • checkSamples

        public static boolean checkSamples​(Design design)
        Check if there are duplicate samples in the design.
        Parameters:
        design - Design to test
        Returns:
        if there are no duplicate
      • checkGenomes

        public static boolean checkGenomes​(Design design)
        Check if there is more than one genome in the design
        Parameters:
        design - Design to test
        Returns:
        true if there is more than one genome in the genome
      • checkAnnotations

        public static boolean checkAnnotations​(Design design)
        Check if there is more than one annotation in the design
        Parameters:
        design - Design to test
        Returns:
        true if there is more than one annotation in the genome
      • readAndCheckDesign

        public static Design readAndCheckDesign​(InputStream is)
                                         throws EoulsanException
        Read and Check design
        Parameters:
        is - InputStream for the design
        Returns:
        a Design object
        Throws:
        EoulsanException - if an error occurs while reading the design
      • obfuscate

        public static void obfuscate​(Design design,
                                     boolean removeReplicateInformation)
        Remove optional description fields and obfuscate condition field.
        Parameters:
        design - design object to obfuscate
        removeReplicateInformation - if replicate information must be removed
      • replaceLocalPathBySymlinks

        public static void replaceLocalPathBySymlinks​(Design design,
                                                      DataFile symlinksDir)
                                               throws IOException
        Replace the local paths in the design by paths to symbolic links in a directory.
        Parameters:
        design - Design object to modify
        symlinksDir - path to the directory where create symbolic links
        Throws:
        IOException - if an error occurs while creating symbolic links of if a path the design file does not exists
      • getCondition

        public static String getCondition​(Experiment experiment,
                                          Sample sample)
        Get the Condition metadata value for an experimentSample. First look in
        Parameters:
        experiment - the experiment
        sample - the sample
        Returns:
        the Condition value
      • getCondition

        public static String getCondition​(ExperimentSample experimentSample)
        Get the Condition metadata value for an experimentSample. First look in
        Parameters:
        experimentSample - the experiment sample
        Returns:
        the Condition value
      • getRepTechGroup

        public static String getRepTechGroup​(Experiment experiment,
                                             Sample sample)
        Get the RepTechGroup metadata value for an experimentSample. First look in
        Parameters:
        experiment - the experiment
        sample - the sample
        Returns:
        the Condition value
      • getRepTechGroup

        public static String getRepTechGroup​(ExperimentSample experimentSample)
        Get the Condition metadata value for an experimentSample. First look in
        Parameters:
        experimentSample - the experiment sample
        Returns:
        the Condition value
      • getMetadata

        public static String getMetadata​(Experiment experiment,
                                         Sample sample,
                                         String key)
        Get a metadata value for an experiment and a sample. First look in
        Parameters:
        experiment - the experiment
        sample - the sample
        key - the metadata key to get
        Returns:
        the Condition value
      • getMetadata

        public static String getMetadata​(ExperimentSample experimentSample,
                                         String key)
        Get a metadata value for an experimentSample. First look in
        Parameters:
        experimentSample - the experiment sample
        key - the metadata key to get
        Returns:
        the Condition value
      • isSkipped

        public static boolean isSkipped​(Experiment experiment)
        Test if an experiement is skipped.
        Parameters:
        experiment - the experiment
        Returns:
        true if the experiment must be skipped
      • containsReferenceField

        public static boolean containsReferenceField​(Experiment experiment)
        Test if an experiment contains reference fields
        Returns:
        true if an experiment contains reference fields
      • getReference

        public static String getReference​(Experiment experiment,
                                          Sample sample)
        Get the reference of a sample.
        Parameters:
        experiment - the experiment
        sample - the sample
        Returns:
        the reference of a sample
      • getReference

        public static String getReference​(ExperimentSample experimentSample)
        Get the reference of a sample.
        Parameters:
        experimentSample - the experiment sample
        Returns:
        the reference of a sample
      • referenceValueToInt

        public static int referenceValueToInt​(String value,
                                              String experiementReference)
        Convert a reference value to an integer.
        Parameters:
        value - the reference value
        Returns:
        an integer
      • getModelColumns

        public static Set<String> getModelColumns​(Experiment experiment)
        Get the column names used in DESeq2 model.
        Parameters:
        experiment - the experiment
        Returns:
        a set with the column names