IgBLAST
A Julia package for running IgBLAST (v1.22.0) on immunoglobulin (Ig) and T cell receptor (TCR) sequences.
prepare builds BLAST databases, then runs your do block with an IgBLASTSession. The temporary databases are deleted when the block returns — the same resource pattern as mktempdir / open.
Installation
using Pkg
Pkg.add("IgBLAST")Quick start
Binaries install automatically on first using IgBLAST.
using IgBLAST
dbs = VDJGermlines("V.fasta", "D.fasta", "J.fasta")
params = Dict("organism" => "human", "domain_system" => "imgt")
prepare(IgBLASTn, dbs; additional_params=params) do ig
ig("query.fasta", "output.tsv")
end
# Gzip query and/or output (autodetected)
prepare(IgBLASTn, dbs; additional_params=params) do ig
ig("query.fasta.gz", "output.tsv.gz")
end
# Custom auxiliary file
prepare(IgBLASTn, dbs; aux="human_gl.aux", additional_params=params) do ig
ig("query.fasta", "output.tsv")
endTiming the IgBLAST command
makeblastdb runs before the do block. For uncompressed files, command is NCBI IgBLAST writing a plain file:
seconds = prepare(IgBLASTn, dbs; additional_params=params, num_threads=8) do ig
@elapsed run(command(ig, "query.fasta", "output.tsv"))
endDo not use .gz paths here — gzip is Julia-side and would be included in the clock.
IgBLASTp
Only the V germline is used:
prepare(IgBLASTp, VGermlines("V_nucleotide.fasta");
additional_params=Dict("organism" => "human")) do ig
ig("query_protein.fasta", "output.tsv")
endAPI
IgBLAST.IgBLASTIgBLAST.noauxiliaryIgBLAST.AbstractAuxiliaryIgBLAST.AbstractAuxiliaryCapabilityIgBLAST.AbstractFileEncodingIgBLAST.AbstractGermlinesIgBLAST.AbstractIgBLASTIgBLAST.AbstractMoleculeIgBLAST.AbstractPreparedDBIgBLAST.AuxiliaryFileIgBLAST.GzipEncodingIgBLAST.IgBLASTSessionIgBLAST.IgBLASTSessionIgBLAST.IgBLASTnIgBLAST.IgBLASTpIgBLAST.NoAuxiliaryIgBLAST.PlainEncodingIgBLAST.VDJGermlinesIgBLAST.VGermlinesIgBLAST.append_paramIgBLAST.append_paramsIgBLAST.apply_auxiliaryIgBLAST.artifact_rootIgBLAST.artifact_toml_pathIgBLAST.auxiliary_capabilityIgBLAST.bin_dirIgBLAST.blastdb_typeIgBLAST.build_commandIgBLAST.commandIgBLAST.default_outfmtIgBLAST.ensure_parent_directoryIgBLAST.executableIgBLAST.executable_pathIgBLAST.file_encodingIgBLAST.finalize_outputIgBLAST.germlines_forIgBLAST.igblast_prefixIgBLAST.igblastn_artifact_pathIgBLAST.install_igblastIgBLAST.is_igblast_installedIgBLAST.makeblastdb_pathIgBLAST.moleculeIgBLAST.native_executableIgBLAST.normalize_auxiliaryIgBLAST.open_sessionIgBLAST.prepareIgBLAST.prepare_databasesIgBLAST.prepare_dbIgBLAST.set_igdata!IgBLAST.source_fastaIgBLAST.stage_queryIgBLAST.supports_auxiliaryIgBLAST.verify_igblast_installationIgBLAST.with_session
IgBLAST.IgBLAST — Module
IgBLASTA Julia package for running IgBLAST analyses on immunoglobulin (Ig) and T cell receptor (TCR) sequences.
Prepare BLAST databases once with prepare, then run IgBLAST inside the do block. Temporary databases are deleted when the block returns.
Exports
install_igblast,is_igblast_installedprepare,command,IgBLASTSessionAbstractIgBLAST,IgBLASTn,IgBLASTpAbstractAuxiliary,NoAuxiliary,noauxiliary,AuxiliaryFileAbstractGermlines,VGermlines,VDJGermlines,germlines_for
Examples
using IgBLAST
dbs = VDJGermlines("V.fasta", "D.fasta", "J.fasta")
params = Dict("organism" => "human", "domain_system" => "imgt")
prepare(IgBLASTn, dbs; additional_params=params) do ig
ig("query.fasta", "out.tsv")
end
# Time only igblastn (plain files; databases already prepared)
t = prepare(IgBLASTn, dbs; additional_params=params) do ig
@elapsed run(command(ig, "query.fasta", "out.tsv"))
endIgBLAST.noauxiliary — Constant
noauxiliarySingleton NoAuxiliary instance.
IgBLAST.AbstractAuxiliary — Type
AbstractAuxiliaryOptional IgBLAST auxiliary (J-gene) annotation data. Defaults to NoAuxiliary; pass AuxiliaryFile only when needed.
IgBLAST.AbstractAuxiliaryCapability — Type
AbstractAuxiliaryCapabilityWhether an IgBLAST variant accepts -auxiliary_data.
IgBLAST.AbstractFileEncoding — Type
AbstractFileEncodingCompression encoding inferred from a path (e.g. .gz).
IgBLAST.AbstractGermlines — Type
AbstractGermlinesAbstract germline FASTA collection used by an IgBLAST variant.
IgBLAST.AbstractIgBLAST — Type
AbstractIgBLASTAbstract supertype for IgBLAST program variants.
IgBLAST.AbstractMolecule — Type
AbstractMoleculeMolecule kind used when preparing BLAST databases.
IgBLAST.AbstractPreparedDB — Type
AbstractPreparedDBPrepared BLAST database prefixes produced for a specific IgBLAST variant.
IgBLAST.AuxiliaryFile — Type
AuxiliaryFile{P}Path to a custom IgBLAST auxiliary data file.
IgBLAST.GzipEncoding — Type
GzipEncodingGzip-compressed file encoding, used when a path ends in .gz.
IgBLAST.IgBLASTSession — Type
IgBLASTSession{T,DBs,A,E,N,O,D,W}Prepared IgBLAST databases and run settings for variant T.
Created only inside prepare; BLAST databases live for the do block and are deleted when it returns. Call the session on a query/output path, or command to get the raw igblastn/igblastp Cmd.
IgBLAST.IgBLASTSession — Method
(session::IgBLASTSession)(query, output)Run IgBLAST. Gzip query/output (.gz) is staged around the command; plain paths are passed through to IgBLAST unchanged.
IgBLAST.IgBLASTn — Type
IgBLASTnNucleotide IgBLAST (igblastn).
IgBLAST.IgBLASTp — Type
IgBLASTpProtein IgBLAST (igblastp).
IgBLAST.NoAuxiliary — Type
NoAuxiliarySentinel meaning no auxiliary file is supplied.
IgBLAST.PlainEncoding — Type
PlainEncodingUncompressed file encoding (default when the path does not end in .gz).
IgBLAST.VDJGermlines — Type
VDJGermlines{V,D,J}V, D, and J germline FASTA paths (used by IgBLASTn).
IgBLAST.VGermlines — Type
VGermlines{V}V-only germline FASTA (used by IgBLASTp).
IgBLAST.append_param — Method
append_param(cmd, key, value)Append one IgBLAST CLI argument. An empty value is a flag (-key). Emptiness is string content, not a type, so it cannot be dispatched.
IgBLAST.append_params — Method
append_params(cmd, params)Append additional IgBLAST CLI parameters.
IgBLAST.apply_auxiliary — Method
apply_auxiliary(cmd, aux)Attach -auxiliary_data when a custom auxiliary file is present.
IgBLAST.artifact_root — Method
artifact_root()Return the installed IgBLAST artifact root directory.
IgBLAST.artifact_toml_path — Method
artifact_toml_path()Path to the package Artifacts.toml.
IgBLAST.auxiliary_capability — Method
auxiliary_capability(::Type{<:AbstractIgBLAST})Auxiliary-data capability trait for the variant.
IgBLAST.bin_dir — Method
bin_dir()Return the directory containing IgBLAST binaries.
IgBLAST.blastdb_type — Method
blastdb_type(molecule) -> Stringmakeblastdb -dbtype for this molecule kind.
IgBLAST.build_command — Method
build_command(exe, query, dbs, aux, output, num_threads, outfmt, params)Build an IgBLAST Cmd, dispatching on the prepared database kind.
IgBLAST.command — Method
command(session, query, output) -> CmdBuild the IgBLAST command for uncompressed query and output paths.
This is the timing surface: run(command(ig, query, output)) is NCBI IgBLAST writing a plain file, with no gzip, progress monitor, or extra copies.
IgBLAST.default_outfmt — Method
default_outfmt(::Type{<:AbstractIgBLAST})Default -outfmt for the variant.
IgBLAST.ensure_parent_directory — Method
ensure_parent_directory(path)Create the parent directory of path when it is non-empty and missing.
IgBLAST.executable — Method
executable(::Type{<:AbstractIgBLAST})Return the IgBLAST executable basename for the given variant.
IgBLAST.executable_path — Method
executable_path(::Type{T}) where T <: AbstractIgBLASTAbsolute path to the IgBLAST executable for variant T.
IgBLAST.file_encoding — Method
file_encoding(path) -> AbstractFileEncodingReify the filename suffix as an encoding type (*.gz → GzipEncoding). Callers then dispatch on that type.
IgBLAST.finalize_output — Method
finalize_output(igblast_path, user_output, ::GzipEncoding)Compress IgBLAST's plain output into the user-requested gzip path.
IgBLAST.germlines_for — Method
germlines_for(::Type{IgBLASTn}, v, d, j)
germlines_for(::Type{IgBLASTp}, v)Build the germline collection appropriate for the IgBLAST variant.
IgBLAST.igblast_prefix — Method
igblast_prefix()Return the ncbi-igblast-VERSION directory inside the artifact.
IgBLAST.igblastn_artifact_path — Method
igblastn_artifact_path(sha; artifact_path_fn=artifact_path)Absolute path to igblastn inside an installed artifact identified by sha.
IgBLAST.install_igblast — Method
install_igblast(; kwargs...)Install the IgBLAST binary artifact declared in Artifacts.toml via ensure_artifact_installed, then verify igblastn is present.
Keyword hooks (for testing):
already_installedartifact_tomlensure_fnartifact_hash_fnartifact_path_fn
IgBLAST.is_igblast_installed — Method
is_igblast_installed()Return true if the IgBLAST artifact is present and contains igblastn.
IgBLAST.makeblastdb_path — Method
makeblastdb_path()Absolute path to makeblastdb.
IgBLAST.molecule — Method
molecule(::Type{<:AbstractIgBLAST})Molecule kind required by germline databases for this variant.
IgBLAST.native_executable — Method
native_executable(name, suffix)Append .exe on Windows; otherwise return name unchanged.
IgBLAST.normalize_auxiliary — Method
normalize_auxiliary(aux) -> AbstractAuxiliaryNormalize a path or auxiliary value to AbstractAuxiliary.
IgBLAST.open_session — Method
open_session(f, ::Type{T}, germlines, aux, num_threads, outfmt, params)Prepare databases and call f(session). aux is a concrete AbstractAuxiliary so the session type is known at compile time.
IgBLAST.prepare — Method
prepare(f, ::Type{T}, germlines; kwargs...)Prepare BLAST databases, call f(session), then delete the temporary databases. Use do-block syntax:
prepare(IgBLASTn, VDJGermlines(v, d, j); additional_params=Dict("organism"=>"human")) do ig
ig("query.fasta", "out.tsv")
endReturns the value of f. Setup (makeblastdb) is outside the session body, so @elapsed ig(query, output) or @elapsed run(command(ig, query, output)) times only IgBLAST.
IgBLASTn requires VDJGermlines; IgBLASTp requires VGermlines.
Keywords
aux:NoAuxiliary(default),AuxiliaryFile, or a path stringnum_threads: IgBLAST-num_threads(defaultThreads.nthreads())outfmt: IgBLAST-outfmt(default 19 for IgBLASTn, 7 for IgBLASTp)additional_params: extra CLI flags (Dict; empty value = flag)
IgBLAST.prepare_databases — Method
prepare_databases(makeblastdb, germlines, temp_dir, molecule)Prepare BLAST databases for a germline collection.
IgBLAST.prepare_db — Method
prepare_db(makeblastdb, db_file, db_type, temp_dir, molecule)Build a BLAST database in temp_dir. Returns the database prefix.
IgBLAST.set_igdata! — Method
set_igdata!()Set ENV["IGDATA"] to the IgBLAST data directory.
IgBLAST.source_fasta — Method
source_fasta(db_file, temp_dir, db_type, molecule)FASTA path to feed makeblastdb, dispatching on molecule kind. Nucleotide germlines are used in place; protein germlines are translated.
IgBLAST.stage_query — Method
stage_query(input_file, output_file, ::GzipEncoding)Decompress a gzip FASTA into output_file for IgBLAST.
IgBLAST.supports_auxiliary — Method
supports_auxiliary(::Type{<:AbstractIgBLAST}) -> BoolWhether this variant accepts -auxiliary_data.
IgBLAST.verify_igblast_installation — Method
verify_igblast_installation(sha; artifact_path_fn=artifact_path)Ensure igblastn exists under artifact sha, otherwise throw.
IgBLAST.with_session — Method
with_session(f, ::Type{T}, germlines; kwargs...)Normalize keywords, then open_session.