diff --git a/INNUca.py b/INNUca.py index 3352d99..37c5fb2 100755 --- a/INNUca.py +++ b/INNUca.py @@ -257,7 +257,7 @@ def run_INNUca(sampleName, outdir, fastq_files, args, script_path, scheme): # Run SPAdes if not args.skipSPAdes: - run_successfully, pass_qc, time_taken, failing, contigs = spades.runSpades(sampleName, outdir, threads, fastq_files, args.spadesNotUseCareful, args.spadesMaxMemory, args.spadesMinCoverageAssembly, args.spadesMinContigsLength, genomeSize, args.spadesKmers, maximumReadsLength, args.spadesSaveReport, args.spadesDefaultKmers, args.spadesMinCoverageContigs) + run_successfully, pass_qc, time_taken, failing, contigs = spades.runSpades(sampleName, outdir, threads, fastq_files, args.spadesNotUseCareful, args.spadesMaxMemory, args.spadesMinCoverageAssembly, args.spadesMinContigsLength, genomeSize, args.spadesKmers, maximumReadsLength, args.spadesDefaultKmers, args.spadesMinCoverageContigs) runs['SPAdes'] = [run_successfully, pass_qc, time_taken, failing] if run_successfully: diff --git a/README.md b/README.md index 507cc13..48a0631 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,8 @@ Usage [--spadesNotUseCareful] [--spadesMinContigsLength N] [--spadesKmers 55 77 | --spadesDefaultKmers] [--spadesMaxMemory N] [--spadesMinCoverageAssembly 10] - [--spadesMinCoverageContigs N] [--spadesSaveReport] - [--pilonKeepFiles] [--pilonKeepSPAdesAssembly] + [--spadesMinCoverageContigs N] [--pilonKeepFiles] + [--pilonKeepSPAdesAssembly] INNUca - Reads Control and Assembly @@ -152,8 +152,6 @@ Usage Minimum contigs coverage. After assembly only keep contigs with reported coverage equal or above this value (default: 5) - --spadesSaveReport Tells INNUca to store the number of contigs and - assembled nucleotides for each sample SPAdes k-mers options (one of the following): --spadesKmers 55,77 Manually sets SPAdes k-mers lengths (all values must be odd, less than 128) (default: 55, 77, 99, 113, diff --git a/modules/spades.py b/modules/spades.py index 3592c4c..76db841 100644 --- a/modules/spades.py +++ b/modules/spades.py @@ -71,7 +71,7 @@ def define_kmers(kmers, maximumReadsLength): # Run SPAdes procedure @spades_timer -def runSpades(sampleName, outdir, threads, fastq_files, notUseCareful, maxMemory, minCoverageAssembly, minContigsLength, estimatedGenomeSizeMb, kmers, maximumReadsLength, saveReport, defaultKmers, minCoverageContigs): +def runSpades(sampleName, outdir, threads, fastq_files, notUseCareful, maxMemory, minCoverageAssembly, minContigsLength, estimatedGenomeSizeMb, kmers, maximumReadsLength, defaultKmers, minCoverageContigs): pass_qc = False failing = {} failing['sample'] = False @@ -110,11 +110,10 @@ def runSpades(sampleName, outdir, threads, fastq_files, notUseCareful, maxMemory if number_contigs == 0: run_successfully = False - if saveReport: - report_file = os.path.join(outdir, 'spades_report.txt') - with open(report_file, 'wt') as writer: - writer.write('#contigs' + '\n' + str(number_contigs) + '\n' + '#bp' + '\n' + str(number_bases) + '\n') - writer.flush() + report_file = os.path.join(outdir, 'spades_report.txt') + with open(report_file, 'wt') as writer: + writer.write('#contigs' + '\n' + str(number_contigs) + '\n' + '#bp' + '\n' + str(number_bases) + '\n') + writer.flush() if failing['sample'] is False: if number_bases >= estimatedGenomeSizeMb * 1000000 * 0.8 and number_bases <= estimatedGenomeSizeMb * 1000000 * 1.5: diff --git a/modules/trimmomatic.py b/modules/trimmomatic.py index fcd95ea..ee1a773 100644 --- a/modules/trimmomatic.py +++ b/modules/trimmomatic.py @@ -8,7 +8,7 @@ def trimmomatic(sampleName, trimmomatic_folder, threads, adaptersFasta, script_p fastq = sorted(fastq_files)[0] # Run Trimmomatic - command = ['trimmomatic-0.36.jar', 'PE', '-threads', str(threads), '-basein', fastq, '-baseout', os.path.join(trimmomatic_folder, str(sampleName + '.fastq.gz')), '', '', '', str('SLIDINGWINDOW:' + slidingWindow), str('LEADING:' + str(leading)), str('TRAILING:' + str(trailing)), str('MINLEN:' + str(minLength)), 'TOPHRED33'] + command = ['trimmomatic-0.36.jar', 'PE', '-threads', str(threads), '-basein', fastq, '-baseout', os.path.join(trimmomatic_folder, str(sampleName + '.fastq.gz')), '', '', '', str('SLIDINGWINDOW:' + slidingWindow), str('LEADING:' + str(leading)), str('TRAILING:' + str(trailing)), str('MINLEN:' + str(minLength)), 'TOPHRED33', ''] if not doNotTrimCrops: if maxReadsLength is not None: @@ -47,11 +47,11 @@ def trimmomatic(sampleName, trimmomatic_folder, threads, adaptersFasta, script_p if not run_successfully: print 'Trimmomatic fail! Trying run with Phred+33 enconding defined...' - command.append('-phred33') + command[16] = '-phred33' run_successfully, stdout, stderr = utils.runCommandPopenCommunicate(command, False, None) if not run_successfully: print 'Trimmomatic fail again! Trying run with Phred+64 enconding defined...' - command[18] = '-phred64' + command[16] = '-phred64' run_successfully, stdout, stderr = utils.runCommandPopenCommunicate(command, False, None) return run_successfully diff --git a/modules/utils.py b/modules/utils.py index 3d3b6a7..e2bcccf 100644 --- a/modules/utils.py +++ b/modules/utils.py @@ -53,7 +53,6 @@ def parseArguments(version): spades_options.add_argument('--spadesMaxMemory', type=int, metavar='N', help='The maximum amount of RAM Gb for SPAdes to use', required=False, default=25) spades_options.add_argument('--spadesMinCoverageAssembly', type=spades_cov_cutoff, metavar='10', help='The minimum number of reads to consider an edge in the de Bruijn graph (or path I am not sure). Can also be auto or off', required=False, default='off') spades_options.add_argument('--spadesMinCoverageContigs', type=int, metavar='N', help='Minimum contigs coverage. After assembly only keep contigs with reported coverage equal or above this value', required=False, default=5) - spades_options.add_argument('--spadesSaveReport', action='store_true', help='Tells INNUca to store the number of contigs and assembled nucleotides for each sample') spades_kmers_options = parser.add_mutually_exclusive_group() spades_kmers_options.add_argument('--spadesKmers', nargs='+', type=int, metavar='55 77', help='Manually sets SPAdes k-mers lengths (all values must be odd, lower than 128)', required=False, default=[55, 77, 99, 113, 127])