Main Content

portMap

Show connected ports between two blocks

Since R2023a

Description

portnames = portMap(pipeline,sourceBlock,targetBlock) returns the names of connected ports between sourceBlock and targetBlock in the pipeline.

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.

qcpipeline = Pipeline;

Select an input FASTQ file using a FileChooser block.

fastqfile = FileChooser(which("SRR005164_1_50.fastq"));

Create a SeqFilter block.

sequencefilter = SeqFilter;

Add blocks to the pipeline. Optionally, you can specify the block names.

addBlock(qcpipeline,[fastqfile,sequencefilter],["FF","SF"]);

Connect the output of the first block to the input of the second block. To do so, you need to first check the input and output port names of the corresponding blocks.

View the Outputs (port of the first block) and Inputs (port of the second block).

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

sequencefilter.Inputs
ans = struct with fields:
    FASTQFiles: [1×1 bioinfo.pipeline.Input]

Connect the Files output port of the fastqfile block to the FASTQFiles port of sequencefilter block. The output is a 1-by-2 string array, indicating the names of two ports that are now connected. You can use either the block objects themselves or the block names that you have defined previously. The next command uses the block names to identify and connect these two blocks.

connectedports = connect(qcpipeline,"FF","SF",["Files","FASTQFiles"])
connectedports = 1×2 string
    "Files"    "FASTQFiles"

You can also query the names of connected ports using portMap.

portnames = portMap(qcpipeline,"FF","SF")
portnames = 1×2 string
    "Files"    "FASTQFiles"

Input Arguments

collapse all

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

Block in the pipeline, specified as a scalar bioinfo.pipeline.Block object or a character vector or string scalar that represents a block name.

Block in the pipeline, specified as a bioinfo.pipeline.Block object or a character vector or string scalar that represents a block name.

Output Arguments

collapse all

Connected port names, specified as an N-by-2 string array, where N is the number of connections. Each row of portnames is a connection. For instance, for the nth connection, portnames(n,1) is the name of an output port of a source block and portnames(n,2) is the name of the input port of a target block.

Version History

Introduced in R2023a