Run block object
For most cases, use the
run method of a block instead of
eval because the
run method performs
additional error checks and ensures that the block inputs and outputs are satisfied and
method accepts and returns a scalar structure, which is a requirement to run the block
as part of a pipeline. In addition, when you run a pipeline, it calls the
run method of each block.
Run Bioinformatics Block
Create a SamSort block.
SSBlock = bioinfo.pipeline.block.SamSort;
emptyInputs method of the block creates an input structure with the field name equivalent to the name of the input port of the block. The
run method of a block requires such a structure.
inputStruct = emptyInputs(SSBlock)
inputStruct = struct with fields: SAMFile: 
Set the value of the
SAMFile field to a sample SAM file.
inputStruct.SAMFile = which("ex1.sam");
run method of the block with the input structure. The output structure contains the field name that is the same as the output port name of the block and its value is the block output (which is a sorted SAM file).
outStruct = run(SSBlock,inputStruct)
outStruct = struct with fields: SortedSAMFile: [1×1 bioinfo.pipeline.datatype.File]
unwrap to check the location of the generated sorted SAM file.
outStruct — Block output
Block output, returned as a structure. The field names of the structure are the names of the output ports of the block, and the field values are the output values of the block.
Introduced in R2023a