Main Content

bioinfo.pipeline.block.SamSort

Bioinformatics pipeline block to sort SAM files

Since R2023a

  • samsort block icon

Description

A SamSort block enables you to sort alignment records from SAM files by the reference sequence name first, and then by position within the reference.

Creation

Description

fcBlock = bioinfo.pipeline.block.SamSort creates a SamSort block.

example

fcBlock = bioinfo.pipeline.block.SamSort(outFileName) specifies the output file name.

Input Arguments

expand all

Name of the output file, specified as a string or character vector. The file extension must be .sam.

Data Types: char | string

Properties

expand all

Function to handle errors from the run method of the block, specified as a function handle. The handle specifies the function to call if the run method encounters an error within a pipeline. For the pipeline to continue after a block fails, ErrorHandler must return a structure that is compatible with the output ports of the block. The error handling function is called with the following two inputs:

  • Structure with these fields:

    FieldDescription
    identifierIdentifier of the error that occurred
    messageText of the error message
    indexLinear index indicating which block process failed in the parallel run. By default, the index is 1 because there is only one run per block. For details on how block inputs can be split across different dimensions for multiple run calls, see Bioinformatics Pipeline SplitDimension.

  • Input structure passed to the run method when it fails

Data Types: function_handle

This property is read-only.

Input ports of the block, specified as a structure. The field names of the structure are the names of the block input ports, and the field values are bioinfo.pipeline.Input objects. These objects describe the input port behaviors. The input port names are the expected field names of the input structure that you pass to the block run method.

The SamSort block Inputs structure has the following field:

Data Types: struct

This property is read-only.

Output ports of the block, specified as a structure. The field names of the structure are the names of the block output ports, and the field values are bioinfo.pipeline.Output objects. These objects describe the output port behaviors. The field names of the output structure returned by the block run method are the same as the output port names.

The SamSort block Outputs structure has the following field:

  • SortedSAMFile — Output file name. By default, it has the same base name as the input SAM file but with the extension .sorted.sam.

    Tip

    To see the actual location of these files, first get the results of the block. Then use the unwrap method as shown in this example.

Data Types: struct

Output file name, specified as a string. If it is empty, the output file will have the same base name as the input file with the extension .sorted.sam.

Data Types: string

Object Functions

compilePerform block-specific additional checks and validations
copyCopy array of handle objects
emptyInputsCreate input structure for use with run method
evalEvaluate block object
runRun block object

Examples

collapse all

Sort a sample SAM file using a SamSort block.

import bioinfo.pipeline.block.*
import bioinfo.pipeline.Pipeline

FC = FileChooser(which("Myco_1_1.sam"));
SS = SamSort;
P = Pipeline;

addBlock(P,[FC,SS]);
connect(P,FC,SS,["Files","SAMFile"]);

run(P);
R = results(P,SS)
R = 

  struct with fields:

    SortedSAMFile: [1×1 bioinfo.pipeline.datatypes.File]

Call unwrap on SortedSAMFile to see the location of the output file.

unwrap(R.SortedSAMFile)
ans = 

    "C:\PipelineResults\SamSort_1\1\Myco_1_1.sorted.sam"

Version History

Introduced in R2023a