Skip to content
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

Add option to not trim terminal N bases #10

Merged
merged 2 commits into from
Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ positional arguments:
optional arguments:
-h, --help show this help message and exit
--csv_N Include Ns in sample variant CSVs
--no_trim_terminal_N Don't trim Ns from sequence terminus. Default behaviour is to trim Ns and gaps BEFORE analysis
--no_gzip_json Don't gzip typing JSON files
--output_unclassified
Retain unclassified samples in summary CSV
Expand Down
8 changes: 7 additions & 1 deletion aln2type/aln2type.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ def write_sample_variant_csv(name, variants, sample_csv_outdir, csv_N=False):
def remove_terminal_gapns(seq):
return re.sub(r'(N|-)*$', '', seq)

def remove_terminal_gaps(seq):
return re.sub(r'-*$', '', seq)

def go(args):

refseq = get_ref_seq(args.msa, args.ref_name)
Expand All @@ -592,7 +595,10 @@ def go(args):
if name == args.ref_name:
continue
else:
variants = update_variants(remove_terminal_gapns(seq.upper()), refseq)
if args.no_trim_terminal_N:
variants = update_variants(remove_terminal_gaps(seq.upper()), refseq)
else:
variants = update_variants(remove_terminal_gapns(seq.upper()), refseq)

print(name)
if variants:
Expand Down
1 change: 1 addition & 0 deletions aln2type/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--csv_N", action='store_true', required=False, help="Include Ns in sample variant CSVs")
parser.add_argument("--no_trim_terminal_N", action='store_true', required=False, help="Don't trim Ns from sequence terminus. Default behaviour is to trim Ns and gaps BEFORE analysis")
parser.add_argument("--no_gzip_json", action='store_true', required=False, help="Don't gzip typing JSON files")
parser.add_argument("--output_unclassified", action='store_true', required=False, help="Retain unclassified samples in summary CSV")
parser.add_argument("--no_call_deletion", action='store_true', required=False, help="Allow deleted positions to be treated as no-calls not ref")
Expand Down
2 changes: 1 addition & 1 deletion aln2type/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.2"
__version__ = "0.0.3"