diff --git a/src/NCBIBlast.jl b/src/NCBIBlast.jl index 361214d..0b7dcfc 100644 --- a/src/NCBIBlast.jl +++ b/src/NCBIBlast.jl @@ -4,18 +4,22 @@ export blastn, blastp, blastx, tblastn, + tblastx, makeblastdb using CondaPkg -function add_cli_kwargs!(cmd, kwargs) +function add_cli_kwargs!(cmd::Vector{String}, kwargs) for (key,val) in pairs(kwargs) if val isa Bool val && push!(cmd, string("-", key)) - elseif val isa AbstractVector - append!(cmd, [string("-", key), string.(val)...]) else - append!(cmd, [string("-", key), string(val)]) + push!(cmd, string("-", key)) + if val isa AbstractVector + append!(cmd, map(string, val)) + else + push!(cmd, string(val)) + end end end @@ -261,6 +265,59 @@ function tblastn(stdin = nothing; stdout=stdout, kwargs...) end end +""" + tblastx([input]; stdout, kwargs...) + +Run `tblastx` with passed kwargs. +Use `arg=true` to pass flags +(eg `lcase_masking=true` will pass `-lcase_masking`). + +Optionally, provide an input that will be provided +as `stdin` (a file string, or `IO` type). + +To print results to somewhere other than `stdout`, +use eg `stdout="results.txt"`. + +```julia +julia> tblastx(; h=true) +USAGE + tblastx [-h] [-help] [-import_search_strategy filename] + [-export_search_strategy filename] [-db database_name] + [-dbsize num_letters] [-gilist filename] [-seqidlist filename] + [-negative_gilist filename] [-negative_seqidlist filename] + [-taxids taxids] [-negative_taxids taxids] [-taxidlist filename] + [-negative_taxidlist filename] [-no_taxid_expansion] + [-entrez_query entrez_query] [-db_soft_mask filtering_algorithm] + [-db_hard_mask filtering_algorithm] [-subject subject_input_file] + [-subject_loc range] [-query input_file] [-out output_file] + [-evalue evalue] [-word_size int_value] [-qcov_hsp_perc float_value] + [-max_hsps int_value] [-xdrop_ungap float_value] [-searchsp int_value] + [-sum_stats bool_value] [-max_intron_length length] [-seg SEG_options] + [-soft_masking soft_masking] [-matrix matrix_name] + [-threshold float_value] [-culling_limit int_value] + [-best_hit_overhang float_value] [-best_hit_score_edge float_value] + [-subject_besthit] [-window_size int_value] [-lcase_masking] + [-query_loc range] [-strand strand] [-parse_deflines] + [-query_gencode int_value] [-db_gencode int_value] [-outfmt format] + [-show_gis] [-num_descriptions int_value] [-num_alignments int_value] + [-line_length line_length] [-html] [-sorthits sort_hits] + [-sorthsps sort_hsps] [-max_target_seqs num_sequences] + [-num_threads int_value] [-remote] [-version] + +DESCRIPTION + Translated Query-Translated Subject BLAST 2.16.0+ + +Use '-help' to print detailed descriptions of command line arguments +``` +""" +function tblastx(stdin = nothing; stdout=stdout, kwargs...) + cmd = ["tblastx"] + add_cli_kwargs!(cmd, kwargs) + CondaPkg.withenv() do + run(pipeline(Cmd(cmd); stdout, stdin)) + end +end + """ makeblastdb(; kwargs...)