Class FileNaming
- java.lang.Object
 - 
- fr.ens.biologie.genomique.eoulsan.core.FileNaming
 
 
- 
- Direct Known Subclasses:
 WorkflowFileNaming
public class FileNaming extends Object
This class contains methods to create workflow data file names.- Since:
 - 2.0
 - Author:
 - Laurent Jourdren
 
 
- 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedFileNaming()Private constructor. 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringcompatibilityFilename()Return the filename using Eoulsan 1.x naming.static booleandataEquals(DataFile file1, DataFile file2)Test if two files are related to the same data.static booleandataEquals(File file1, File file2)Test if two files are related to the same data.static booleandataEquals(String filename1, String filename2)Test if two filenames are related to the same data.StringfileMiddle()Return the middle string of the filename.static StringfileMiddle(String dataName, int fileIndex, int part)Create the middle of a filename.Stringfilename()Return the filename.static Stringfilename(String stepId, String portName, DataFormat format, String dataName, int fileIndex, int part, fr.ens.biologie.genomique.kenetre.io.CompressionType compression)Create the filename from several parameters.StringfilePrefix()Return the file prefix.static StringfilePrefix(String stepId, String portName, DataFormat format)Create the prefix of a filename.static StringfilePrefix(String stepId, String portName, String formatPrefix)Create the prefix of a filename.StringfileSuffix()Return the file suffix.static StringfileSuffix(DataFormat format, fr.ens.biologie.genomique.kenetre.io.CompressionType compression)Create the suffix of a file.static StringfileSuffix(String extension, String compression)Create the suffix of a file.fr.ens.biologie.genomique.kenetre.io.CompressionTypegetCompression()Get the compression.StringgetDataName()Get the data name.intgetFileIndex()Get the file index.DataFormatgetFormat()Get the format.intgetPart()Get the file part.StringgetPortName()Get the port name.intgetSampleNumber()Get the sample number related to the data.StringgetStepId()Get Step Id.Stringglob()Get a glob for the filename.static booleanisDataNameValid(String dataName)Test if a data name is valid.static booleanisFilenameValid(DataFile file)Test if a filename is valid.static booleanisFilenameValid(File file)Test if a filename is valid.static booleanisFilenameValid(String filename)Test if a filename is valid.static booleanisFormatPrefixValid(String formatPrefix)Test if a format prefix id is valid.static booleanisPortNameValid(String portName)Test if a port name is valid.static booleanisStepIdValid(String stepId)Test if a step id is valid.static FileNamingparse(DataFile file)Create a FileNaming object from a DataFile object.static FileNamingparse(File file)Create a FileNaming object from a File object.static FileNamingparse(String filename)Create a FileNaming object from a filename.protected voidset(Data data)Set several field of the object from a Data object.voidsetCompression(fr.ens.biologie.genomique.kenetre.io.CompressionType compression)Set the compressionvoidsetDataName(String dataName)Set the data name.voidsetFileIndex(int fileIndex)Set the file index.voidsetFormat(DataFormat format)Set the format.voidsetPart(int part)Set the part number.voidsetPortName(String portName)Set the port name.voidsetSampleNumber(int sampleNumber)Set the sample number related to the data.voidsetStepId(String stepId)Set the step id. 
 - 
 
- 
- 
Method Detail
- 
getStepId
public String getStepId()
Get Step Id.- Returns:
 - the step Id
 
 
- 
getPortName
public String getPortName()
Get the port name.- Returns:
 - the port name
 
 
- 
getDataName
public String getDataName()
Get the data name.- Returns:
 - the data name
 
 
- 
getSampleNumber
public int getSampleNumber()
Get the sample number related to the data. This value is only use when generate compatible filenames.- Returns:
 - the number of the sample related to the file or -1 if not known
 
 
- 
getFormat
public DataFormat getFormat()
Get the format.- Returns:
 - the format
 
 
- 
getFileIndex
public int getFileIndex()
Get the file index.- Returns:
 - the file index
 
 
- 
getPart
public int getPart()
Get the file part.- Returns:
 - the file part
 
 
- 
getCompression
public fr.ens.biologie.genomique.kenetre.io.CompressionType getCompression()
Get the compression.- Returns:
 - the compression
 
 
- 
setStepId
public void setStepId(String stepId)
Set the step id.- Parameters:
 stepId- the step id
 
- 
setPortName
public void setPortName(String portName)
Set the port name.- Parameters:
 portName- the port name
 
- 
setDataName
public void setDataName(String dataName)
Set the data name.- Parameters:
 dataName- the data name
 
- 
setSampleNumber
public void setSampleNumber(int sampleNumber)
Set the sample number related to the data. This value is only use when generate compatible filenames.- Parameters:
 sampleNumber- the number of the sample related to the file or -1 if not known
 
- 
setFormat
public void setFormat(DataFormat format)
Set the format.- Parameters:
 format- the format
 
- 
setFileIndex
public void setFileIndex(int fileIndex)
Set the file index.- Parameters:
 fileIndex- the file index
 
- 
setPart
public void setPart(int part)
Set the part number.- Parameters:
 part- the part number
 
- 
setCompression
public void setCompression(fr.ens.biologie.genomique.kenetre.io.CompressionType compression)
Set the compression- Parameters:
 compression- the compression type
 
- 
set
protected void set(Data data)
Set several field of the object from a Data object.- Parameters:
 data- the data object
 
- 
filePrefix
public String filePrefix()
Return the file prefix.- Returns:
 - a string with the file prefix
 
 
- 
fileSuffix
public String fileSuffix()
Return the file suffix.- Returns:
 - q string with the file suffix
 
 
- 
fileMiddle
public String fileMiddle()
Return the middle string of the filename.- Returns:
 - a string with the middle string of the filename
 
 
- 
filename
public String filename()
Return the filename.- Returns:
 - a string with the filename
 
 
- 
glob
public String glob()
Get a glob for the filename.- Returns:
 - a glob in a string
 
 
- 
compatibilityFilename
public String compatibilityFilename()
Return the filename using Eoulsan 1.x naming.- Returns:
 - a string with the filename using Eoulsan 1.x naming
 
 
- 
filePrefix
public static String filePrefix(String stepId, String portName, DataFormat format)
Create the prefix of a filename.- Parameters:
 stepId- step idportName- port nameformat- format of the file- Returns:
 - a String with the prefix of the file
 
 
- 
filePrefix
public static String filePrefix(String stepId, String portName, String formatPrefix)
Create the prefix of a filename.- Parameters:
 stepId- step idportName- port nameformatPrefix- format prefix of the file- Returns:
 - a String with the prefix of the file
 
 
- 
fileMiddle
public static String fileMiddle(String dataName, int fileIndex, int part)
Create the middle of a filename.- Parameters:
 dataName- data namefileIndex- file indexpart- file part- Returns:
 - a String with the suffix of a file
 
 
- 
fileSuffix
public static String fileSuffix(DataFormat format, fr.ens.biologie.genomique.kenetre.io.CompressionType compression)
Create the suffix of a file.- Parameters:
 format- format of the filecompression- file compression- Returns:
 - a String with the suffix of a file
 
 
- 
fileSuffix
public static String fileSuffix(String extension, String compression)
Create the suffix of a file.- Parameters:
 extension- file extensioncompression- file compression- Returns:
 - a String with the suffix of a file
 
 
- 
filename
public static String filename(String stepId, String portName, DataFormat format, String dataName, int fileIndex, int part, fr.ens.biologie.genomique.kenetre.io.CompressionType compression)
Create the filename from several parameters.- Parameters:
 stepId- the step idportName- the port nameformat- the formatdataName- the data namefileIndex- the file indexpart- the partcompression- the compression type- Returns:
 - a string with the filename
 
 
- 
parse
public static FileNaming parse(File file)
Create a FileNaming object from a File object.- Parameters:
 file- the file- Returns:
 - a new FileNaming object
 
 
- 
parse
public static FileNaming parse(DataFile file)
Create a FileNaming object from a DataFile object.- Parameters:
 file- the file- Returns:
 - a new FileNaming object
 
 
- 
parse
public static FileNaming parse(String filename)
Create a FileNaming object from a filename.- Parameters:
 filename- the filename- Returns:
 - a new FileNaming object
 
 
- 
isStepIdValid
public static boolean isStepIdValid(String stepId)
Test if a step id is valid.- Parameters:
 stepId- the step id to check- Returns:
 - true if the step id is valid
 
 
- 
isFormatPrefixValid
public static boolean isFormatPrefixValid(String formatPrefix)
Test if a format prefix id is valid.- Parameters:
 formatPrefix- the format prefix to check- Returns:
 - true if the format prefix is valid
 
 
- 
isPortNameValid
public static boolean isPortNameValid(String portName)
Test if a port name is valid.- Parameters:
 portName- port name to check- Returns:
 - true if the port name is valid
 
 
- 
isDataNameValid
public static boolean isDataNameValid(String dataName)
Test if a data name is valid.- Parameters:
 dataName- data name to check- Returns:
 - true if the data name is valid
 
 
- 
isFilenameValid
public static boolean isFilenameValid(DataFile file)
Test if a filename is valid.- Parameters:
 file- the file to test.- Returns:
 - true if the filename is valid
 
 
- 
isFilenameValid
public static boolean isFilenameValid(File file)
Test if a filename is valid.- Parameters:
 file- the file to test.- Returns:
 - true if the filename is valid
 
 
- 
isFilenameValid
public static boolean isFilenameValid(String filename)
Test if a filename is valid.- Parameters:
 filename- the file to test.- Returns:
 - true if the filename is valid
 
 
- 
dataEquals
public static boolean dataEquals(File file1, File file2)
Test if two files are related to the same data.- Parameters:
 file1- the first filefile2- the second file- Returns:
 - true if the two files are related to the same data
 
 
- 
dataEquals
public static boolean dataEquals(DataFile file1, DataFile file2)
Test if two files are related to the same data.- Parameters:
 file1- the first filefile2- the second file- Returns:
 - true if the two files are related to the same data
 
 
 - 
 
 -