connect
Syntax
Description
connect(
connects an output port of the pipeline
,sourceBlock
,targetBlock
,portsToConnect
)sourceBlock
to an input port of the
targetBlock
. portsToConnect
specifies the output
and input ports.
also returns the complete list of connections mappedPorts
= connect(pipeline
,sourceBlock
,targetBlock
,portsToConnect
)mappedPorts
between the
source block and target block after connecting two blocks as specified by
portsToConnect
.
Examples
Connect Blocks in Bioinformatics Pipeline
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
pipeline
— Bioinformatics pipeline
bioinfo.pipeline.Pipeline
object
Bioinformatics pipeline, specified as a bioinfo.pipeline.Pipeline
object.
sourceBlock
— Block in pipeline
bioinfo.pipeline.Block
object | character vector | string scalar
Block in the pipeline to connect from, specified as a bioinfo.pipeline.Block
object or character vector or string scalar that
represents the block name.
targetBlock
— Block in pipeline
bioinfo.pipeline.Block
object | character vector | string scalar
Block in the pipeline to connect to, specified as a bioinfo.pipeline.Block
object or character vector or string scalar that
represents the block name.
portsToConnect
— Output port name and input port name
N-by-2 string array
Output port name of the source block and an input port name of the target block to connect, specified an N-by-2 string array, where N is the number of connections between two blocks.
For example, if you are connecting the source block that has two output ports,
"output1
" and "output2
", to the target block
that has two input ports, "input1
" and "input2
",
specify portsToConnect
as a 2-by-2 string array:
["output1","input1";"output2","input2"]
. The next figure is a
graphical representation of such connections.
Tip
To get the names of the input or output ports of a block, check the
Inputs
and Outputs
properties of the
block. Each property is returned as a structure, where each field name represents the
corresponding port name that you can use to connect the blocks.
Data Types: string
Output Arguments
mappedPorts
— Connections between source and target blocks
N-by-2 string array
Connections between source and target blocks, returned as an N-by-2 string array. N is the total number of connections between two blocks.
Version History
Introduced in R2023a
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)