Main Content

deleteResults

Delete block results from pipeline

Since R2023a

Description

example

deleteResults(pipeline) deletes all computed results and metadata of pipeline, a bioinfo.pipeline.Pipeline object. By default, the function does not delete the generated directories and output files. Set IncludeFiles name-value argument to true to delete the folders and files also.

example

deleteResults(pipeline,blocks) deletes the results of the specified blocks only.

example

deleteResults(___,IncludeFiles=tf), for any syntax, specifies whether to also delete the generated directories and files of the blocks in the pipeline.

Examples

collapse all

Import the pipeline and block objects needed for the example.

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

Create a pipeline.

P = Pipeline;

Create FileChooser and SamSort blocks.

FCB = FileChooser(which("ex1.sam"));
SSB = SamSort;

Add blocks to the pipeline. You can pass in the names of the blocks ("myFileChooser" and "mySamSorter") and connect them.

addBlock(P,[FCB, SSB],["myFileChooser","mySamSorter"]);
connect(P, FCB, SSB, ["Files","SAMFile"]);

Run the pipeline.

run(P,ResultsDirectory="C:\Examples\")

Check the results. During the pipeline run, the pipeline created a folder for each block with the same name as the block name. In this case, the pipeline created myFileChooser and mySamSorter folders in the above results directory C:\Examples. Each block results folder can contain 1 to N number of folders determined by the number of times a block processes in a given run. In this case, each block is processed just one time and the block results folder contains a subfolder named "1" that has the block results.

Set Expanded to true to expand the table variable values which are cell arrays.

tbl = processTable(P,Expanded=true)
tbl=2×5 table
         Block          Status            RunStart                 RunEnd              RunErrors    
    _______________    _________    ____________________    ____________________    ________________

    "myFileChooser"    Completed    26-Jul-2023 09:02:06    26-Jul-2023 09:02:06    {0×0 MException}
    "mySamSorter"      Completed    26-Jul-2023 09:02:06    26-Jul-2023 09:02:06    {0×0 MException}

Check the result of the SamSort block. It indicates the output of the block is a sorted SAM file.

r = results(P,SSB)
r = struct with fields:
    SortedSAMFile: [1×1 bioinfo.pipeline.datatype.File]

Check the full file path of the sorted file.

unwrap(r.SortedSAMFile)
ans = 
"C:\Examples\mySamSorter\1\ex1.sorted.sam"

Delete the SamSort block result from the pipeline. After deletion, the SAM file output value is now incomplete.

deleteResults(P,SSB)
r = results(P,SSB)
r = 
  Incomplete pipeline result.

However, the generated directory (mySamSorter) and actual SAM file still exists in that directory. To delete them also from your computer completely, use IncludeFiles name-value argument.

deleteResults(P,SSB,IncludeFiles=true)

Input Arguments

collapse all

Bioinformatics pipeline, specified as a bioinfo.pipeline.Pipeline object.

Input blocks, specified as a bioinfo.pipeline.Block object, vector of block objects, character vector, string scalar, string vector, or cell array of character vectors representing block names.

Flag to delete generated block results folders and contents inside those folders, specified as a numeric or logical 1 (true) or 0 (false).

Data Types: logical

Version History

Introduced in R2023a