-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.0.1 #8
Open
miguelpmachado
wants to merge
1
commit into
master
Choose a base branch
from
python3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
v1.0.1 #8
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '1.0' | ||
__version__ = '1.0.1' |
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 |
---|---|---|
|
@@ -7,9 +7,9 @@ | |
Illumina reads | ||
<https://github.com/B-UMMI/patho_typing/> | ||
|
||
Copyright (C) 2018 Miguel Machado <[email protected]> | ||
Copyright (C) 2019 Miguel Machado <[email protected]> | ||
|
||
Last modified: October 15, 2018 | ||
Last modified: January 10, 2019 | ||
|
||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
|
@@ -144,13 +144,13 @@ def indexSequenceBowtie2(referenceFile, threads): | |
return run_successfully | ||
|
||
|
||
def run_bowtie(fastq_files, referenceFile, threads, outdir, conserved_True, numMapLoc): | ||
def run_bowtie(fastq_files, referenceFile, threads, outdir, numMapLoc, bowtie_algorithm): | ||
sam_file = os.path.join(outdir, str('alignment.sam')) | ||
|
||
run_successfully = indexSequenceBowtie2(referenceFile, threads) | ||
if run_successfully: | ||
command = ['bowtie2', '-k', str(numMapLoc), '-q', '', '--threads', str(threads), '-x', referenceFile, '', | ||
'--no-unal', '-S', sam_file] | ||
command = ['bowtie2', '-k', str(numMapLoc), '-q', bowtie_algorithm, '--threads', str(threads), '-x', | ||
referenceFile, '', '--no-unal', '-S', sam_file] | ||
|
||
if len(fastq_files) == 1: | ||
command[9] = '-U ' + fastq_files[0] | ||
|
@@ -159,11 +159,6 @@ def run_bowtie(fastq_files, referenceFile, threads, outdir, conserved_True, numM | |
else: | ||
return False, None | ||
|
||
if conserved_True: | ||
command[4] = '--sensitive' | ||
else: | ||
command[4] = '--very-sensitive-local' | ||
|
||
run_successfully, stdout, stderr = utils.runCommandPopenCommunicate(command, False, None, True) | ||
|
||
if not run_successfully: | ||
|
@@ -189,9 +184,9 @@ def indexAlignment(alignment_file): | |
return run_successfully | ||
|
||
|
||
def mapping_reads(fastq_files, referenceFile, threads, outdir, conserved_True, numMapLoc): | ||
def mapping_reads(fastq_files, referenceFile, threads, outdir, numMapLoc, bowtie_algorithm): | ||
print('\n' + 'Mapping the reads' + '\n') | ||
run_successfully, sam_file = run_bowtie(fastq_files, referenceFile, threads, outdir, conserved_True, numMapLoc) | ||
run_successfully, sam_file = run_bowtie(fastq_files, referenceFile, threads, outdir, numMapLoc, bowtie_algorithm) | ||
bam_file = None | ||
if run_successfully: | ||
run_successfully, bam_file = sortAlignment(sam_file, str(os.path.splitext(sam_file)[0] + '.bam'), False, | ||
|
@@ -331,6 +326,16 @@ def main(): | |
help='Minimum typing gene average coverage depth of present positions to' | ||
' consider a gene to be present (default is 1/3 of average sample' | ||
' coverage or 15x)', required=False) | ||
parser_optional_general.add_argument('--bowtieAlgo', type=str, metavar='"--very-sensitive-local"', | ||
help='Bowtie2 alignment mode. It can be an end-to-end alignment' | ||
' (unclipped alignment) or local alignment (soft clipped' | ||
' alignment). Also, can choose between fast or sensitive' | ||
' alignments. Please check Bowtie2 manual for extra information:' | ||
' http://bowtie-bio.sourceforge.net/bowtie2/index.shtml .' | ||
' This option should be provided between quotes and starting with' | ||
' an empty space (like --bowtieAlgo " --very-fast") or using equal' | ||
' sign (like --bowtieAlgo="--very-fast")', | ||
required=False, default=['--very-sensitive-local']) | ||
parser_optional_general.add_argument('--doNotRemoveConsensus', action='store_true', | ||
help='Do not remove ReMatCh consensus sequences') | ||
parser_optional_general.add_argument('--debug', action='store_true', | ||
|
@@ -366,7 +371,8 @@ def main(): | |
|
||
confirm_genes_fasta_rules(typing_headers, typing_rules) | ||
|
||
run_successfully, bam_file = mapping_reads(args.fastq, reference_file, args.threads, args.outdir, False, 1) | ||
run_successfully, bam_file = mapping_reads(args.fastq, reference_file, args.threads, args.outdir, 1, | ||
args.bowtieAlgo) | ||
if run_successfully: | ||
rematch_dir = os.path.join(args.outdir, 'rematch', '') | ||
if not os.path.isdir(rematch_dir): | ||
|
@@ -401,8 +407,8 @@ def main(): | |
sample_data_general['number_genes_multiple_alleles'] is not None: | ||
if args.minGeneDepth is None: | ||
args.minGeneDepth = sample_data_general['mean_sample_coverage'] / 3 if \ | ||
sample_data_general['mean_sample_coverage'] / 3 > 15 else \ | ||
15 | ||
sample_data_general['mean_sample_coverage'] / 3 > 15 else \ | ||
15 | ||
|
||
exit_info = [] | ||
if sample_data_general['mean_sample_coverage'] < config['minimum_read_coverage']: | ||
|
@@ -476,9 +482,8 @@ def main(): | |
args.debug, args.doNotRemoveConsensus) | ||
if run_successfully and data_by_gene is not None: | ||
if args.minGeneDepth is None: | ||
args.minGeneDepth = sample_data_general['mean_sample_coverage'] / 3 if \ | ||
sample_data_general['mean_sample_coverage'] / 3 > 15 else \ | ||
15 | ||
args.minGeneDepth = sample_data_general['mean_sample_coverage'] / 3 \ | ||
if sample_data_general['mean_sample_coverage'] / 3 > 15 else 15 | ||
|
||
_, _, _ = typing.typing(data_by_gene, typing_rules, config['minimum_gene_coverage'], | ||
config['minimum_gene_identity'], args.minGeneDepth, args.outdir) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You state that the option should be provided between quotes and starting with an empty space, but the default value isn't like this. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default only displays the default value that will be used