#!/usr/bin/env python3

#-------------------------------------------------------------------------------------------------------
# author: António Sousa
# written: 25/04/2021
# updated: 25/04/2021
#
# programs: kraken2 (version 2.1.1)
#
# TODO: 
#-------------------------------------------------------------------------------------------------------

# import modules
from tax_assign import *
import argparse
import subprocess
import os
import sys
import re
import datetime

# Define arguments
parser = argparse.ArgumentParser(description='Map nanopore reads against a reference database!')
parser.add_argument('-i', action="store", dest="input", type=str, \
    help='fasta/fastq(.gz) comma-separated file directories')
parser.add_argument('-t', action="store", dest="threads", type=str, \
    help='no. of threads [default -t 1]')
parser.add_argument('-db', action="store", dest="database", type=str, \
    help='database name directory')
parser.add_argument('-db_down', action="store", dest="database_download", type=str, \
    help="database name to download. One of: silva, greengenes, rdp.\n\
        It ignores if the directory given in '-db' already exists.")
parser.add_argument('-s', action="store", dest="samples", type=str, \
    help="samples name separated by comma in the same order given in '-i'")
parser.add_argument('-r', action='store_true', dest="report", default=False, \
    help="build kraken2 report")
parser.add_argument('-o', action="store", dest="output", type=str, default = "./", \
    help='output directory name')
args = parser.parse_args()
args_dic = {"input": "-i", "threads": "-t", "database": "-db", "database_download": "-db_down",  
            "samples": "-s", "report": "-r", "output": "-o"}

# Database build with kraken
if args.database_download is not None: 
    #cmd_log("tax_assign-py", "kraken2-build", "--version", args, args_dic)
    build_kraken2_db(db_dir = args.database, db_name = args.database_download, threads = args.threads)

# Map reads with kraken2
cmd_log("tax_assign-py", "kraken2", "--version", args, args_dic)
map_reads_with_kraken2(fastq = args.input, db_dir = args.database, out_dir = args.output, \
    samples = args.samples, report = args.report, threads = args.threads)

3ad80d48c9cdba926fe4ab3f4a1ee1fce938bf9d
<mask token>

<mask token>
parser.add_argument('-i', action='store', dest='input', type=str, help=
    'fasta/fastq(.gz) comma-separated file directories')
parser.add_argument('-t', action='store', dest='threads', type=str, help=
    'no. of threads [default -t 1]')
parser.add_argument('-db', action='store', dest='database', type=str, help=
    'database name directory')
parser.add_argument('-db_down', action='store', dest='database_download',
    type=str, help=
    """database name to download. One of: silva, greengenes, rdp.
        It ignores if the directory given in '-db' already exists."""
    )
parser.add_argument('-s', action='store', dest='samples', type=str, help=
    "samples name separated by comma in the same order given in '-i'")
parser.add_argument('-r', action='store_true', dest='report', default=False,
    help='build kraken2 report')
parser.add_argument('-o', action='store', dest='output', type=str, default=
    './', help='output directory name')
<mask token>
if args.database_download is not None:
    build_kraken2_db(db_dir=args.database, db_name=args.database_download,
        threads=args.threads)
cmd_log('tax_assign-py', 'kraken2', '--version', args, args_dic)
map_reads_with_kraken2(fastq=args.input, db_dir=args.database, out_dir=args
    .output, samples=args.samples, report=args.report, threads=args.threads)

<mask token>
parser = argparse.ArgumentParser(description=
    'Map nanopore reads against a reference database!')
parser.add_argument('-i', action='store', dest='input', type=str, help=
    'fasta/fastq(.gz) comma-separated file directories')
parser.add_argument('-t', action='store', dest='threads', type=str, help=
    'no. of threads [default -t 1]')
parser.add_argument('-db', action='store', dest='database', type=str, help=
    'database name directory')
parser.add_argument('-db_down', action='store', dest='database_download',
    type=str, help=
    """database name to download. One of: silva, greengenes, rdp.
        It ignores if the directory given in '-db' already exists."""
    )
parser.add_argument('-s', action='store', dest='samples', type=str, help=
    "samples name separated by comma in the same order given in '-i'")
parser.add_argument('-r', action='store_true', dest='report', default=False,
    help='build kraken2 report')
parser.add_argument('-o', action='store', dest='output', type=str, default=
    './', help='output directory name')
args = parser.parse_args()
args_dic = {'input': '-i', 'threads': '-t', 'database': '-db',
    'database_download': '-db_down', 'samples': '-s', 'report': '-r',
    'output': '-o'}
if args.database_download is not None:
    build_kraken2_db(db_dir=args.database, db_name=args.database_download,
        threads=args.threads)
cmd_log('tax_assign-py', 'kraken2', '--version', args, args_dic)
map_reads_with_kraken2(fastq=args.input, db_dir=args.database, out_dir=args
    .output, samples=args.samples, report=args.report, threads=args.threads)

from tax_assign import *
import argparse
import subprocess
import os
import sys
import re
import datetime
parser = argparse.ArgumentParser(description=
    'Map nanopore reads against a reference database!')
parser.add_argument('-i', action='store', dest='input', type=str, help=
    'fasta/fastq(.gz) comma-separated file directories')
parser.add_argument('-t', action='store', dest='threads', type=str, help=
    'no. of threads [default -t 1]')
parser.add_argument('-db', action='store', dest='database', type=str, help=
    'database name directory')
parser.add_argument('-db_down', action='store', dest='database_download',
    type=str, help=
    """database name to download. One of: silva, greengenes, rdp.
        It ignores if the directory given in '-db' already exists."""
    )
parser.add_argument('-s', action='store', dest='samples', type=str, help=
    "samples name separated by comma in the same order given in '-i'")
parser.add_argument('-r', action='store_true', dest='report', default=False,
    help='build kraken2 report')
parser.add_argument('-o', action='store', dest='output', type=str, default=
    './', help='output directory name')
args = parser.parse_args()
args_dic = {'input': '-i', 'threads': '-t', 'database': '-db',
    'database_download': '-db_down', 'samples': '-s', 'report': '-r',
    'output': '-o'}
if args.database_download is not None:
    build_kraken2_db(db_dir=args.database, db_name=args.database_download,
        threads=args.threads)
cmd_log('tax_assign-py', 'kraken2', '--version', args, args_dic)
map_reads_with_kraken2(fastq=args.input, db_dir=args.database, out_dir=args
    .output, samples=args.samples, report=args.report, threads=args.threads)

#!/usr/bin/env python3

#-------------------------------------------------------------------------------------------------------
# author: António Sousa
# written: 25/04/2021
# updated: 25/04/2021
#
# programs: kraken2 (version 2.1.1)
#
# TODO: 
#-------------------------------------------------------------------------------------------------------

# import modules
from tax_assign import *
import argparse
import subprocess
import os
import sys
import re
import datetime

# Define arguments
parser = argparse.ArgumentParser(description='Map nanopore reads against a reference database!')
parser.add_argument('-i', action="store", dest="input", type=str, \
    help='fasta/fastq(.gz) comma-separated file directories')
parser.add_argument('-t', action="store", dest="threads", type=str, \
    help='no. of threads [default -t 1]')
parser.add_argument('-db', action="store", dest="database", type=str, \
    help='database name directory')
parser.add_argument('-db_down', action="store", dest="database_download", type=str, \
    help="database name to download. One of: silva, greengenes, rdp.\n\
        It ignores if the directory given in '-db' already exists.")
parser.add_argument('-s', action="store", dest="samples", type=str, \
    help="samples name separated by comma in the same order given in '-i'")
parser.add_argument('-r', action='store_true', dest="report", default=False, \
    help="build kraken2 report")
parser.add_argument('-o', action="store", dest="output", type=str, default = "./", \
    help='output directory name')
args = parser.parse_args()
args_dic = {"input": "-i", "threads": "-t", "database": "-db", "database_download": "-db_down",  
            "samples": "-s", "report": "-r", "output": "-o"}

# Database build with kraken
if args.database_download is not None: 
    #cmd_log("tax_assign-py", "kraken2-build", "--version", args, args_dic)
    build_kraken2_db(db_dir = args.database, db_name = args.database_download, threads = args.threads)

# Map reads with kraken2
cmd_log("tax_assign-py", "kraken2", "--version", args, args_dic)
map_reads_with_kraken2(fastq = args.input, db_dir = args.database, out_dir = args.output, \
    samples = args.samples, report = args.report, threads = args.threads)
