From d59da63245d26b3f9ee8842c06c5a628f09e35db Mon Sep 17 00:00:00 2001 From: Matthias De Smet Date: Wed, 31 Mar 2021 16:22:55 +0200 Subject: [PATCH 1/4] add reference for cram support --- wisecondorX/convert_tools.py | 6 +++++- wisecondorX/main.py | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wisecondorX/convert_tools.py b/wisecondorX/convert_tools.py index 41966d6..f4d0e8a 100644 --- a/wisecondorX/convert_tools.py +++ b/wisecondorX/convert_tools.py @@ -24,7 +24,11 @@ def convert_reads(args): elif args.infile.endswith(".bam"): reads_file = pysam.AlignmentFile(args.infile, 'rb') elif args.infile.endswith(".cram"): - reads_file = pysam.AlignmentFile(args.infile, 'rc') + if args.reference is not None: + reads_file = pysam.AlignmentFile(args.infile, 'rc', reference_filename=args.reference) + else: + logging.error("Cram support requires a reference file, please use the --reference argument") + sys.exit(1) else: logging.error( "Unsupported input file type. Make sure your input filename has a correct extension (sam/bam/cram)") diff --git a/wisecondorX/main.py b/wisecondorX/main.py index 01183a0..da59666 100755 --- a/wisecondorX/main.py +++ b/wisecondorX/main.py @@ -276,10 +276,13 @@ def main(): formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser_convert.add_argument('infile', type=str, - help='.bam input file for conversion') + help='aligned reads input for conversion') parser_convert.add_argument('outfile', type=str, help='Output .npz file') + parser_convert.add_argument('-r', '--reference', + type=str, + help='Fasta reference to be used during cram conversion') parser_convert.add_argument('--binsize', type=float, default=5e3, From d872d56134a60223e05818957d86dd269448dbb9 Mon Sep 17 00:00:00 2001 From: Matthias De Smet Date: Wed, 31 Mar 2021 16:33:48 +0200 Subject: [PATCH 2/4] cleanup --- wisecondorX/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wisecondorX/main.py b/wisecondorX/main.py index da59666..4c2e99a 100755 --- a/wisecondorX/main.py +++ b/wisecondorX/main.py @@ -264,7 +264,7 @@ def output_gender(args): def main(): warnings.filterwarnings('ignore') - parser = argparse.ArgumentParser(description='wisecondorX') + parser = argparse.ArgumentParser(description='WisecondorX') parser.add_argument('--loglevel', type=str, default='INFO', @@ -272,7 +272,7 @@ def main(): subparsers = parser.add_subparsers() parser_convert = subparsers.add_parser('convert', - description='Convert and filter a .bam file to a .npz', + description='Convert and filter a aligned reads to .npz', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser_convert.add_argument('infile', type=str, From 91ac8799aa1a5ca771849c98b431d6c9c834568d Mon Sep 17 00:00:00 2001 From: Matthias De Smet Date: Wed, 31 Mar 2021 16:40:26 +0200 Subject: [PATCH 3/4] update readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b9201db..c7d874a 100755 --- a/README.md +++ b/README.md @@ -65,6 +65,7 @@ WisecondorX convert input.sam/bam/cram output.npz [--optional arguments]
Optional argument

| Function :--- | :--- +`--reference x` | Fasta reference to be used with cram inputs `--binsize x` | Size per bin in bp; the reference bin size should be a multiple of this value. Note that this parameter does not impact the resolution, yet it can be used to optimize processing speed (default: x=5e3) `--normdup` | Use this flag to avoid duplicate removal From b520919b8a9cf855aecc4a9da89e0c06846422dd Mon Sep 17 00:00:00 2001 From: Matthias De Smet Date: Wed, 31 Mar 2021 16:44:21 +0200 Subject: [PATCH 4/4] bump version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 85650dd..a63f195 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #! /usr/bin/env python from setuptools import setup, find_packages -version = '1.2.2' +version = '1.2.3' dl_version = 'master' if 'dev' in version else '{}'.format(version) setup(