Main Content

disconnect

Remove connection between ports in a pipeline

Since R2023a

Description

disconnect(pipeline,sourceBlock,targetBlock) removes all connections between sourceBlock and targetBlock in the pipeline.

example

portMaps = disconnect(pipeline,sourceBlock,targetBlock,portsToDisconnect) removes the specified connections, portsToDisconnect, between sourceBlock and targetBlock. portMaps is the list of remaining connections between the blocks after disconnecting the specified ports.

example

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 two FileChooser blocks and a Bowtie2 block. The files represent pair-end read data for the Drosophila genome. These read files are already provided with the toolbox.

reads1 = FileChooser(which("SRR6008575_10k_1.fq"));
reads2 = FileChooser(which("SRR6008575_10k_2.fq"));
bowtie2Block = Bowtie2;

Add the blocks. Define the block names as "reads1","reads2", and "bowtie2" and add them in the same call.

addBlock(P,[reads1,reads2,bowtie2Block],["reads1","reads2","bowtie2"]);

Check the names of the output and input ports of the blocks to connect.

reads1.Outputs
ans = struct with fields:
    Files: [1×1 bioinfo.pipeline.Output]

reads2.Outputs
ans = struct with fields:
    Files: [1×1 bioinfo.pipeline.Output]

bowtie2Block.Inputs
ans = struct with fields:
    IndexBaseName: [1×1 bioinfo.pipeline.Input]
      Reads1Files: [1×1 bioinfo.pipeline.Input]
      Reads2Files: [1×1 bioinfo.pipeline.Input]

The Bowtie2 block has two required and one optional inputs. Set the value of the first required input IndexBaseName to "Dmel_chr4", which is the base name for the reference index files, which are provided with the toolbox, for the Drosophila genome.

bowtie2Block.Inputs.IndexBaseName.Value = "Dmel_chr4";

Because you are providing the pair-end (paired) read data, connect Reads1Files to the Files output of the reads1 block, which contains the first mate reads "SRR6008575_10k_1.fq" and connect Reads2Files to the reads2 block that contains the second mate reads "SRR6008575_10k_2.fq". The Reads2Files input is optional and is not needed if you have the single-end (unpaired) read data.

connect(P,reads1,bowtie2Block,["Files","Reads1Files"]);
connect(P,reads2,bowtie2Block,["Files","Reads2Files"]);

Run the pipeline.

run(P);

The Bowtie2 block generates a SAM file as the output.

mappedReads = results(P,bowtie2Block)
mappedReads = struct with fields:
    SAMFile: [1×1 bioinfo.pipeline.datatype.File]

Suppose you want to provide a single end read data to the bowtie2Block. You can update the reads1 block to read in such a single end read file and disconnect the Reads2File optional input of bowtie2Block. The disconnect function returns an empty string array, which means that there are no more connection between two blocks.

reads1.Files = which("SRR005164_1_50.fastq");
disconnect(P,reads2,bowtie2Block,["Files","Reads2Files"])
ans = 

  0×2 empty string array

Alternatively, you can use portMap to check if there are any connections between two blocks.

portMap(P,reads2,bowtie2Block)
ans = 

  0×2 empty string array

You can then run the pipeline again.

run(P);
mappedReads = results(P,bowtie2Block)
mappedReads = struct with fields:
    SAMFile: [1×1 bioinfo.pipeline.datatype.File]

Input Arguments

collapse all

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

Source block, specified as a bioinfo.pipeline.Block object or character vector or string scalar representing a block name.

Target block, specified as a bioinfo.pipeline.Block object or character vector or string scalar representing a block name.

Output Arguments

collapse all

Remaining connections between the source and target blocks, returned as an N-by-2 string array, where N is the total number of connections. The string array lists the names of output ports (of the source blocks) and input ports (of the target blocks) that are still connected.

Version History

Introduced in R2023a