Main Content

inputNames

Get names of unconnected block inputs from pipeline

Since R2023a

Description

example

names = inputNames(pipeline) returns the input port names for all the blocks in the pipeline that are not connected.

example

names = inputNames(pipeline,IncludeOptional=tf) specifies whether to include the names of optional input ports.

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"

Import the Pipeline and block objects needed for the example.

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

Create a pipeline.

P = Pipeline;

Create a Bowtie2Build block to build index files for the reference genome.

bowtie2build = Bowtie2Build;

Create a Bowtie2 block to map the read sequences to the reference sequence.

bowtie2 = Bowtie2;

Add the blocks to the pipeline.

addBlock(P,[bowtie2build,bowtie2],["bowtie2build","bowtie2"]);

Get the list of names of all the required input ports from every block in the pipeline that are needed to be set or connected. IndexBaseName is an input port of both bowtie2build and bowtie2 block. Reads1File is the input port of the bowtie2 block and ReferenceFASTAFile is the input of bowtie2build block.

portnames = inputNames(P)
portnames = 1×3 string
    "IndexBaseName"    "Reads1Files"    "ReferenceFASTAFiles"

Some blocks have optional input ports. To see the names of these ports, set IncludeOptional=true. For instance, the Bowtie2 block has an optional input port (Reads2Files) that accepts files for the second mate reads when you have paired-end read data.

allportnames = inputNames(P,IncludeOptional=true)
allportnames = 1×4 string
    "IndexBaseName"    "Reads1Files"    "Reads2Files"    "ReferenceFASTAFiles"

Create an input structure to set the input port values of the bowtie2 and bowtie2build blocks. Specifically, set IndexBaseName to "Dmel_chr4" which is the base name for the reference index files for the Drosophila genome. Set Reads1Files to "SRR6008575_10k_1.fq" and Reads2Files to "SRR6008575_10k_2.fq". Set ReferenceFASTAFile to "Dmel_chr4.fa". These read files are already provided with the toolbox.

inputStruct.IndexBaseName = "Dmel_chr4";
inputStruct.Reads1Files   = "SRR6008575_10k_1.fq";
inputStruct.Reads2Files   = "SRR6008575_10k_2.fq";
inputStruct.ReferenceFASTAFiles = "Dmel_chr4.fa";

Optionally, you can compile and check if the input structure is set up correctly. Note that this compilation also happens automatically when you run the pipeline.

compile(P,inputStruct);

Run the pipeline using the structure as an input.

run(P,inputStruct);

Get the bowtie2 block result after the pipeline finishes running.

wait(P);
mappedFile = results(P,bowtie2)
mappedFile = struct with fields:
    SAMFile: [1×1 bioinfo.pipeline.datatype.File]

The Bowtie2 block generates a SAM file that contains the mapped results. To see the location of the file, use unwrap.

unwrap(mappedFile.SAMFile)

Input Arguments

collapse all

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

Flag to include optional input port names, specified as a numeric or logical 1 (true) or 0 (false). An optional inport port is an input port (bioinfo.pipeline.Input) with its Required property set to false.

Output Arguments

collapse all

Names of unconnected block inputs, returned as a string scalar or string vector. You can use these names as fields of the input structure in the run call run(pipeline,inputStruct).

Version History

Introduced in R2023a