addBlock
Description
addBlock(
adds a block or vector of blocks lib
,inBlocks
,blockNames
)inBlocks
to the block library
lib
with the names blockNames
.
Examples
Create and Save Bioinformatics Pipeline Blocks in Block Libraries
Import the pipeline, block, and library objects needed for the example.
import bioinfo.pipeline.library.* import bioinfo.pipeline.block.* import bioinfo.pipeline.Pipeline
Create a pipeline.
P = Pipeline;
Create a FileChooser
block for a FASTQ file, that is provided with the toolbox, and add to the pipeline.
fastqfile = FileChooser(which("SRR005164_1_50.fastq"));
addBlock(P,fastqfile);
Create a block library directly from the pipeline.
mylib = Library(P,Name="mylib")
mylib = Library with properties: Name: "mylib" Description: "" BlockNames: "FileChooser_1" Blocks: [1x1 bioinfo.pipeline.block.FileChooser]
Add a block to the library.
sequencefilter = SeqFilter(Method="MinLength"); addBlock(mylib,sequencefilter,"MinLengthSeqFilter");
Remove a block from the library.
removeBlock(mylib,"MinLengthSeqFilter");
Add a library to the list of available libraries.
addLibrary(mylib);
You can also save a library as a MAT-file and share with others. saveLibrary
creates the corresponding MAT-file in the current folder. The MAT-file has the same base name as the library being saved. You may set Overwrite=true
to overwrite any existing library with the same name. For instance, the following call creates mylib.mat
in the current folder.
saveLibrary(mylib,Overwrite=true);
Instead of saving the file in the current directory, you can also specify an alternative location to save the file.
saveLibrary(mylib,"C:\Examples\BlockLibraries\");
Load the library from the MAT-file.
mylib2 = loadLibrary("mylib.mat");
Create a new SeqFilter
block that filters sequences using their average base qualities instead. Add the block to mylib2 and rename the library.
mqseqfilter = SeqFilter(Method="MeanQuality"); addBlock(mylib,mqseqfilter,"MeanQuality"); mylib2.Name = "mylib2"
mylib2 = Library with properties: Name: "mylib2" Description: "" BlockNames: "FileChooser_1" Blocks: [1x1 bioinfo.pipeline.block.FileChooser]
Add mylib2 to the list of available libraries.
addLibrary(mylib2,Overwrite=true);
Get a list of all the available libraries.
availableLibs = getLibrary
availableLibs=1×2 Library array with properties:
Name
Description
BlockNames
Blocks
Remove the library mylib
from the list.
removeLibrary("mylib");
availableLibs = getLibrary
availableLibs = Library with properties: Name: "mylib2" Description: "" BlockNames: "FileChooser_1" Blocks: [1x1 bioinfo.pipeline.block.FileChooser]
Input Arguments
lib
— Block library
bioinfo.pipeline.library.Library
Block library, specified as a bioinfo.pipeline.library.Library
object.
inBlocks
— Input blocks
bioinfo.pipeline.Block
object | vector of block objects
Input blocks, specified as a bioinfo.pipeline.Block
object or vector of such objects.
blockNames
— Names of input blocks
character vector | string scalar | string vector | cell array of character vectors
Names of input blocks, specified as a character vector, string scalar, string vector, or cell array of character vectors.
If inBlocks
is a single block, blockNames
must be a character vector or string scalar. Otherwise, blockNames
must be a string vector or cell array of character vectors with the same number of
elements as inBlocks
. The block names must be valid variable names
and must be unique within a library.
Data Types: char
| string
| cell
Version History
Introduced in R2023b
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 (한국어)