compile
Description
compile(
compiles the pipeline using a structure pipeline
,inputStruct
)inputStruct
as an input.
Examples
Compile Bioinformatics Pipeline
Checks for errors and warnings before running a pipeline.
Import the pipeline and block objects needed for the example.
import bioinfo.pipeline.Pipeline import bioinfo.pipeline.block.*
Create a pipeline.
P = Pipeline;
Add some blocks to the pipeline.
FCB = FileChooser(which("ex1.sam"));
SSB = SamSort;
addBlock(P,[FCB, SSB]);
Compile the pipeline.
compile(P)
Error using bioinfo.pipeline.Pipeline/compile Pipeline compilation failed with the following reason. Caused by: Block 'SamSort_1' has one or more required ports that are not connected or passed in as the pipeline inputs.
The error is due to the blocks being not connected. Connect the blocks and recompile to ensure that there is no more error, and the pipeline is ready to run.
connect(P,FCB,SSB,["Files","SAMFile"]); compile(P)
Run Bioinformatics Pipeline Using Input Structure
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
pipeline
— Bioinformatics pipeline
bioinfo.pipeline.Pipeline
object
Bioinformatics pipeline, specified as a bioinfo.pipeline.Pipeline
object.
inputStruct
— Input structure to satisfy input ports
structure
Input structure to satisfy unconnected input ports, specified as a structure.
The field names of inputStruct
must match the names of unconnected ports in the pipeline.
Tip
Use inputNames
to get the list of names for all unconnected input ports and use them as field names in inputStruct
.
Data Types: struct
More About
Satisfy Input Ports
All required input ports of every block in a pipeline must be satisfied before you can run the pipeline.
To satisfy an input port, you must do one of the following:
Connect to another port.
Set the value of the input port, that is,
myBlock.Inputs.PropertyName.Value
. For example, consider aBamSort
block. To specify the name of a BAM file as the block input value, set the value asbamsortBlock.Inputs.BAMFile.Value = "ex1.bam"
.Pass in an input structure by calling
run(pipeline,inputStruct)
, where inputStruct has the field name equivalent to the input port name and the field value as the input port value.
Version History
Introduced in R2023a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)