Class Utils
java.lang.Object
fr.ens.biologie.genomique.eoulsan.modules.mapping.hadoop.hadoopbamcli.Utils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureSampling(org.apache.hadoop.fs.Path workDir, String outName, org.apache.hadoop.conf.Configuration conf) Configure sampling.static voidcorrectSAMRecordForMerging(htsjdk.samtools.SAMRecord r, org.apache.hadoop.conf.Configuration conf) Changes the given SAMRecord as appropriate for being placed in a file whose header is getSAMHeaderMerger(conf).getMergedHeader().static StringgetArgv0()static org.apache.hadoop.fs.PathgetMergeableWorkFile(org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.apache.hadoop.mapreduce.TaskAttemptContext ctx, String extension) Returns a name that mergeInto() will recognize as a file to be merged.static htsjdk.samtools.SamFileHeaderMergergetSAMHeaderMerger(org.apache.hadoop.conf.Configuration conf) Computes the merger of the SAM headers in the files listed in HEADERMERGER_INPUTS_PROPERTY.static StringGet stringency option helpstatic voidmergeInto(OutputStream out, org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.apache.hadoop.conf.Configuration conf, String commandName) Merges the files in the given directory that have names given by getMergeableWorkFile() into out.static voidmergeSAMInto(org.apache.hadoop.fs.Path out, org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.seqdoop.hadoop_bam.SAMFormat format, org.apache.hadoop.conf.Configuration conf, String commandName) Merges the files in the given directory that have names given by getMergeableWorkFile() into out in the given SAMFormat, using getSAMHeaderMerger().getMergedHeader() as the header.static voidprintWrapped(PrintStream out, String str) Print wrapped.static voidprintWrapped(PrintStream out, String str, int indent) Print wrapped.static voidprintWrapped(PrintStream out, String str, int indent, int wrapAt) Print wrapped.static voidsetArgv0Class(Class<?> cl) Set the arg0 class.static voidsetHeaderMergerSortOrder(org.apache.hadoop.conf.Configuration conf, htsjdk.samtools.SAMFileHeader.SortOrder order) Set Header merger order.
-
Field Details
-
WORK_FILENAME_PROPERTY
- See Also:
-
HEADERMERGER_INPUTS_PROPERTY
- See Also:
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
printWrapped
Print wrapped.- Parameters:
out- print streamstr- string to write
-
printWrapped
Print wrapped.- Parameters:
out- print streamstr- string to writeindent- indentation
-
printWrapped
Print wrapped.- Parameters:
out- print streamstr- string to writeindent- indentationwrapAt- position to wrap
-
getArgv0
-
setArgv0Class
Set the arg0 class.- Parameters:
cl- the class to set
-
configureSampling
public static void configureSampling(org.apache.hadoop.fs.Path workDir, String outName, org.apache.hadoop.conf.Configuration conf) throws IOException Configure sampling.- Parameters:
workDir- work directoryoutName- output nameconf- Hadoop configuration- Throws:
IOException- if an error occurs while configuring the sampling
-
getMergeableWorkFile
public static org.apache.hadoop.fs.Path getMergeableWorkFile(org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.apache.hadoop.mapreduce.TaskAttemptContext ctx, String extension) Returns a name that mergeInto() will recognize as a file to be merged.The filename is the value of WORK_FILENAME_PROPERTY surrounded by basePrefix and basePostfix, followed by the part number and with the given extension.
- Parameters:
directory- the directorybasePrefix- base prefixbasePostfix- base postfixctx- task contextextension- the extension- Returns:
- a Path
-
mergeInto
public static void mergeInto(OutputStream out, org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.apache.hadoop.conf.Configuration conf, String commandName) throws IOException Merges the files in the given directory that have names given by getMergeableWorkFile() into out.Outputs progress reports if commandName is non-null.
- Parameters:
out- out streamdirectory- directorybasePrefix- base prefixbasePostfix- base postfixconf- Hadoop configurationcommandName- command name- Throws:
IOException- if an error occurs while merging
-
setHeaderMergerSortOrder
public static void setHeaderMergerSortOrder(org.apache.hadoop.conf.Configuration conf, htsjdk.samtools.SAMFileHeader.SortOrder order) Set Header merger order.- Parameters:
conf- Hadoop configurationorder- order to use
-
getSAMHeaderMerger
public static htsjdk.samtools.SamFileHeaderMerger getSAMHeaderMerger(org.apache.hadoop.conf.Configuration conf) throws IOException Computes the merger of the SAM headers in the files listed in HEADERMERGER_INPUTS_PROPERTY. The sort order of the result is set according to the last call to setHeaderMergerSortOrder, or otherwise to "unsorted".The result is cached locally to prevent it from being recomputed too often.
- Parameters:
conf- Hadoop configuration- Returns:
- a SamFileHeaderMerger object
- Throws:
IOException- if an error occurs while getting the header
-
correctSAMRecordForMerging
public static void correctSAMRecordForMerging(htsjdk.samtools.SAMRecord r, org.apache.hadoop.conf.Configuration conf) throws IOException Changes the given SAMRecord as appropriate for being placed in a file whose header is getSAMHeaderMerger(conf).getMergedHeader().- Parameters:
r- SAM recordconf- Hadoop configuration- Throws:
IOException- if an error occurs
-
mergeSAMInto
public static void mergeSAMInto(org.apache.hadoop.fs.Path out, org.apache.hadoop.fs.Path directory, String basePrefix, String basePostfix, org.seqdoop.hadoop_bam.SAMFormat format, org.apache.hadoop.conf.Configuration conf, String commandName) throws IOException Merges the files in the given directory that have names given by getMergeableWorkFile() into out in the given SAMFormat, using getSAMHeaderMerger().getMergedHeader() as the header.Outputs progress reports if commandName is non-null.
- Parameters:
out- out streamdirectory- directorybasePrefix- base prefixbasePostfix- base postfixformat- SAM formatconf- Hadoop configurationcommandName- command name- Throws:
IOException- if an error occurs while merging
-
getStringencyOptHelp
Get stringency option help- Returns:
- a string with the help
-