-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/WGS-TB/MentaLiST
- Loading branch information
Showing
12 changed files
with
1,861 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
{% set name = "MentaLiST" %} | ||
{% set version = "0.1.3" %} | ||
|
||
package: | ||
name: mentalist | ||
version: 0.1.3 | ||
name: {{ name|lower }} | ||
version: {{ version }} | ||
|
||
source: | ||
git_url: https://github.com/WGS-TB/MentaLiST.git | ||
git_rev: v0.1.3 | ||
folder: MentaLiST | ||
fn: {{ name|lower }}-{{ version }}.tar.gz | ||
url: https://github.com/WGS-TB/MentaLiST/archive/v{{ version }}.tar.gz | ||
|
||
build: | ||
number: 0 | ||
skip: True # [osx] | ||
|
||
requirements: | ||
build: | ||
- julia 0.5.2 | ||
- hdf5 | ||
- mpfr | ||
run: | ||
- julia 0.5.2 | ||
- hdf5 | ||
- mpfr | ||
|
||
build: | ||
number: 0 | ||
test: | ||
commands: | ||
- mentalist -h | ||
|
||
about: | ||
home: https://github.com/WGS-TB/MentaLiST | ||
summary: The MLST pipeline developed by the PathOGiST research group. | ||
license: MIT | ||
license_file: LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
#!/usr/bin/env julia | ||
|
||
using Suppressor | ||
@suppress_err begin | ||
using Lumberjack | ||
using ArgParse | ||
end | ||
|
||
function parse_commandline() | ||
s = ArgParseSettings() | ||
@add_arg_table s begin | ||
"call" | ||
help = "MLST caller, given a sample and a k-mer database." | ||
action = :command | ||
"build_db" | ||
help = "Build a MLST k-mer database, given a list of FASTA files." | ||
action = :command | ||
"list_pubmlst" | ||
help = "List all available MLST schemes from www.pubmlst.org. " | ||
action = :command | ||
"download_pubmlst" | ||
help = "Dowload a MLST scheme from pubmlst and build a MLST k-mer database." | ||
action = :command | ||
"list_cgmlst" | ||
help = "List all available cgMLST schemes from www.cgmlst.org." | ||
action = :command | ||
"download_cgmlst" | ||
help = "Dowload a MLST scheme from cgmlst.org and build a MLST k-mer database." | ||
action = :command | ||
|
||
end | ||
# Calling MLST options: | ||
@add_arg_table s["call"] begin | ||
"-o" | ||
help = "Output file with MLST call" | ||
arg_type = String | ||
required = true | ||
"-s" | ||
help = "Sample name" | ||
arg_type = String | ||
required = true | ||
"--db" | ||
help = "Kmer database" | ||
required = true | ||
arg_type = String | ||
"files" | ||
nargs = '*' | ||
help = "FastQ input files" | ||
required = true | ||
arg_type = String | ||
end | ||
# Build DB from FASTA, options: | ||
@add_arg_table s["build_db"] begin | ||
"--db" | ||
help = "Output file (kmer database)" | ||
arg_type = String | ||
required = true | ||
"-k" | ||
help = "Kmer size" | ||
required = true | ||
arg_type = Int8 | ||
"-f", "--fasta_files" | ||
nargs = '+' | ||
arg_type = String | ||
help = "Fasta files with the MLST scheme" | ||
required = true | ||
"-p", "--profile" | ||
arg_type = String | ||
help = "Profile file for known genotypes." | ||
"-c", "--disable_compression" | ||
help = "Disables the default compression of the database, that stores only the most informative kmers. Not recommended unless for debugging." | ||
action = :store_true | ||
end | ||
@add_arg_table s["list_pubmlst"] begin | ||
"-p", "--prefix" | ||
help = "Only list schemes that starts with this prefix." | ||
arg_type = String | ||
end | ||
|
||
@add_arg_table s["list_cgmlst"] begin | ||
"-p", "--prefix" | ||
help = "Only list schemes that start with this prefix." | ||
arg_type = String | ||
end | ||
|
||
@add_arg_table s["download_pubmlst"] begin | ||
"-o", "--output" | ||
help = "Output folder for the scheme files." | ||
arg_type = String | ||
required = true | ||
"-s", "--scheme" | ||
help = "Species name or ID of the scheme." | ||
arg_type = String | ||
required = true | ||
"-k" | ||
help = "K-mer size" | ||
required = true | ||
arg_type = Int8 | ||
"--db" | ||
help = "Output file for the kmer database." | ||
arg_type = String | ||
required = true | ||
"-c", "--disable_compression" | ||
help = "Disables the default compression of the database, that stores only the most informative kmers. Not recommended unless for debugging." | ||
action = :store_true | ||
end | ||
|
||
@add_arg_table s["download_cgmlst"] begin | ||
"-o", "--output" | ||
help = "Output folder for the scheme files." | ||
arg_type = String | ||
required = true | ||
"-s", "--scheme" | ||
help = "Species name or ID of the scheme" | ||
arg_type = String | ||
required = true | ||
"-k" | ||
help = "K-mer size" | ||
required = true | ||
arg_type = Int8 | ||
"--db" | ||
help = "Output file for the kmer database." | ||
arg_type = String | ||
required = true | ||
"-c", "--disable_compression" | ||
help = "Disables the default compression of the database, that stores only the most informative kmers. Not recommended unless for debugging." | ||
action = :store_true | ||
end | ||
|
||
return parse_args(s) | ||
end | ||
|
||
|
||
#### Main COMMAND functions: | ||
function call_mlst(args) | ||
include("build_db_functions.jl") | ||
# check if the files exist: | ||
check_files([args["db"];args["files"]]) | ||
info("Opening kmer database ... ") | ||
kmer_db, loci, loci2alleles, k, profile = open_db(args["db"]) | ||
info("Opening fastq file(s) ... ") | ||
votes, loci_votes = count_kmers_and_vote(DNAKmer{k}, args["files"], kmer_db, loci2alleles) | ||
info("Writing output ...") | ||
write_calls(votes, loci_votes, loci, loci2alleles, args["s"], args["o"], profile) | ||
info("Done.") | ||
end | ||
|
||
function list_pubmlst(args) | ||
include("mlst_download_functions.jl") | ||
list_pubmlst_schema(args["prefix"]) | ||
end | ||
|
||
function download_pubmlst(args) | ||
include("mlst_download_functions.jl") | ||
loci_files, profile_file = download_pubmlst_scheme(args["scheme"], args["output"]) | ||
info("Building the k-mer database ...") | ||
args["fasta_files"] = loci_files | ||
args["profile"] = profile_file | ||
build_db(args) | ||
end | ||
|
||
function list_cgmlst(args) | ||
include("mlst_download_functions.jl") | ||
list_cgmlst_schema(args["prefix"]) | ||
end | ||
|
||
function download_cgmlst(args) | ||
include("mlst_download_functions.jl") | ||
loci_files = download_cgmlst_scheme(args["scheme"], args["output"]) | ||
info("Building the k-mer database ...") | ||
args["fasta_files"] = loci_files | ||
args["profile"] = nothing | ||
build_db(args) | ||
end | ||
|
||
function build_db(args) | ||
include("build_db_functions.jl") | ||
check_files(args["fasta_files"]) | ||
k::Int8 = args["k"] | ||
info("Opening FASTA files ... ") | ||
results, loci = kmer_class_for_each_locus(k, args["fasta_files"], !args["disable_compression"]) | ||
# Combine results: | ||
info("Combining results for each locus ...") | ||
kmer_classification = combine_loci_classification(k, results, loci) | ||
|
||
info("Saving DB ...") | ||
save_db(k, kmer_classification, loci, args["db"], args["profile"]) | ||
info("Done!") | ||
end | ||
|
||
##### Main function: just calls the appropriate commands, with arguments: | ||
function main() | ||
args = parse_commandline() | ||
# determine command: | ||
if args["%COMMAND%"] == "call" | ||
call_mlst(args["call"]) | ||
elseif args["%COMMAND%"] == "build_db" | ||
build_db(args["build_db"]) | ||
elseif args["%COMMAND%"] == "list_pubmlst" | ||
list_pubmlst(args["list_pubmlst"]) | ||
elseif args["%COMMAND%"] == "download_pubmlst" | ||
download_pubmlst(args["download_pubmlst"]) | ||
elseif args["%COMMAND%"] == "list_cgmlst" | ||
list_cgmlst(args["list_cgmlst"]) | ||
elseif args["%COMMAND%"] == "download_cgmlst" | ||
download_cgmlst(args["download_cgmlst"]) | ||
end | ||
end | ||
|
||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.