Skip to content

Commit

Permalink
Merge branch 'dev' into 'master'
Browse files Browse the repository at this point in the history
rls v1.0.1

See merge request research/medaka!407
  • Loading branch information
mwykes committed May 6, 2020
2 parents 0903328 + 9956ae5 commit e345f3b
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
v1.0.1
-------
Minor fixes release, resolving issues introduced in v1.0.0.

* Fix default model for SNP calling.
* Fix issue causing medaka_consensus to crash.


v1.0.0
-------
Models, features and fixes release
Expand Down
2 changes: 1 addition & 1 deletion medaka/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os
import subprocess

__version__ = '1.0.0'
__version__ = '1.0.1'


def check_minimap2_version():
Expand Down
15 changes: 9 additions & 6 deletions medaka/medaka.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ def _log_level():
def _model_arg():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter, add_help=False)
parser.add_argument('--model', action=ResolveModel, default=medaka.options.default_models['consensus'],
help='Model definition, default is equivalent to {}.'.format(medaka.options.default_models['consensus']))
parser.add_argument('--model', action=ResolveModel,
default=medaka.options.default_models['consensus'],
help='Model to use.')
parser.add_argument('--allow_cudnn', dest='allow_cudnn', default=True, action='store_true', help=argparse.SUPPRESS)
parser.add_argument('--disable_cudnn', dest='allow_cudnn', default=False, action='store_false',
help='Disable use of cuDNN model layers.')
Expand Down Expand Up @@ -200,9 +201,9 @@ def is_rle_encoder(model_name):

def get_alignment_params(args):
if is_rle_encoder(args.model):
align_params = alignment_params['rle']
align_params = medaka.options.alignment_params['rle']
else:
align_params = alignment_params['non-rle']
align_params = medaka.options.alignment_params['non-rle']

print(align_params)

Expand Down Expand Up @@ -389,10 +390,9 @@ def main():
# Consensus from features input
cfparser = subparsers.add_parser('consensus_from_features',
help='Run inference from a trained model on existing features.',
parents=[_log_level()],
parents=[_log_level(), _model_arg()],
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
cfparser.add_argument('features', nargs='+', help='Pregenerated features (from medaka features).')
cfparser.add_argument('--model', action=ResolveModel, default=medaka.options.default_models['consensus'], help='Model definition.')

# Compression of fasta/q to quality-RLE fastq
rleparser = subparsers.add_parser('fastrle',
Expand Down Expand Up @@ -637,4 +637,7 @@ def main():
if RG is not None:
msg = "Reads will be filtered to only those with RG tag: {}"
logger.info(msg.format(RG))
# if model is default, resolve to file, save mess in help text
if hasattr(args, 'model'):
args.model = medaka.models.resolve_model(args.model)
args.func(args)
1 change: 0 additions & 1 deletion medaka/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ def resolve_model(model):
pathlib.Path(d).mkdir(parents=True, exist_ok=True)
with open(fp, 'wb') as fh:
fh.write(data)
print("returning ", fp)
return fp
except Exception: # we might not have write access
pass
Expand Down
2 changes: 1 addition & 1 deletion medaka/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
allowed_models = sorted(current_models + archived_models)
default_models = {
'consensus': 'r941_min_high_g351',
'snp': 'r941_min_high_g351',
'snp': 'r941_prom_snp_g322',
'variant': 'r941_prom_variant_g322'}

alignment_params = {
Expand Down
8 changes: 5 additions & 3 deletions scripts/medaka_variant
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env bash
set -eo pipefail

myInvocation="CL=\"$(printf %q "$BASH_SOURCE")$((($#)) && printf ' %q' "$@")\""
printf -v args ' %q' $@
src=${BASH_SOURCE}
INVOCATION=$([ $# -ne 0 ] && echo $src $args || echo $src)

medaka_version=$(medaka --version)
modeldata=()
Expand Down Expand Up @@ -388,8 +390,8 @@ else
${REF} ${UNFILTERED}

# Add invocation of this script to VCF header
INVOCATION_DATE="##${myInvocation}; $(date)"
sed -i "/^#CHROM.*/i $INVOCATION_DATE" ${UNFILTERED}
INVOCATION_DATE="##CL=${INVOCATION}; $(date)"
sed -i "/^#CHROM.*/i ${INVOCATION_DATE}" ${UNFILTERED}

if $FILTER_FLAG; then
# Filter resulting vcf
Expand Down

0 comments on commit e345f3b

Please sign in to comment.