[med-svn] [Git][med-team/igdiscover][upstream] New upstream version 0.12.3
Andreas Tille
gitlab at salsa.debian.org
Fri Oct 2 13:48:20 BST 2020
Andreas Tille pushed to branch upstream at Debian Med / igdiscover
Commits:
11f77113 by Andreas Tille at 2020-10-02T14:31:20+02:00
New upstream version 0.12.3
- - - - -
5 changed files:
- src/igdiscover/Snakefile
- src/igdiscover/cli/clonoquery.py
- src/igdiscover/cli/clonotypes.py
- tests/test_commands.py
- tests/utils.py
Changes:
=====================================
src/igdiscover/Snakefile
=====================================
@@ -330,7 +330,12 @@ else:
input: fastaq='reads/3-forward-primer-trimmed.{ext}.gz'
resources: time=1
run:
- relative_symlink(input.fastaq, output.fastaq, force=True)
+ if config.forward_primers:
+ # The target is marked as temp().
+ # To avoid a dangling symlink, use a hardlink.
+ os.link(input.fastaq, output.fastaq)
+ else:
+ relative_symlink(input.fastaq, output.fastaq, force=True)
rule trimmed_fasta_stats:
=====================================
src/igdiscover/cli/clonoquery.py
=====================================
@@ -30,7 +30,6 @@ def add_arguments(parser):
arg = parser.add_argument
arg('--minimum-count', '-c', metavar='N', default=1, type=int,
help='Discard all rows with count less than N. Default: %(default)s')
- arg('--v-shm-threshold', default=5, type=float, help='V SHM threshold for _mindiffrate computations')
arg('--cdr3-core', default=None,
type=slice_arg, metavar='START:END',
help='START:END defines the non-junction region of CDR3 '
@@ -93,7 +92,7 @@ def collect(querytable, reftable, mismatches, cdr3_core_slice, cdr3_column):
yield ([query_row], reftable.head(0))
continue
- similar_group = vjlen_group.iloc[list(indices), :]
+ similar_group = vjlen_group.iloc[list(indices), :].copy()
yield (query_rows, similar_group)
# Yield result tuples for all the queries that have not been found
@@ -138,13 +137,11 @@ def main(args):
else:
summary_file = None
- # Print header
+ # Header
print(*reftable.columns, sep='\t')
- # Do the actual work
for query_rows, result_table in collect(querytable, reftable, args.mismatches,
args.cdr3_core, cdr3_column):
- result_table = augment_group(result_table, v_shm_threshold=args.v_shm_threshold)
assert len(query_rows) >= 1
if summary_file:
for query_row in query_rows:
=====================================
src/igdiscover/cli/clonotypes.py
=====================================
@@ -234,9 +234,8 @@ def augment_group(table, v_shm_threshold=5, suffix='_mindiffrate'):
for column in columns:
root_seq = root[column]
- table[column + suffix] = [
+ table[column + suffix] = table[column].apply(lambda s:
round(edit_distance(root_seq, s, maxdiff=int(0.2 * len(root_seq))) / len(root_seq) * 100., 1)
- for s in table[column]
- ]
+ )
return table
=====================================
tests/test_commands.py
=====================================
@@ -1,12 +1,14 @@
import os
import sys
-import pytest
import contextlib
import shutil
+from pathlib import Path
+from xopen import xopen
+import pytest
from igdiscover.__main__ import main
-from .utils import datapath, resultpath, files_equal
+from .utils import datapath, resultpath, files_equal, convert_fastq_to_fasta
from igdiscover.cli.init import run_init
from igdiscover.cli.config import print_configuration, modify_configuration
from igdiscover.cli.run import run_snakemake
@@ -154,6 +156,27 @@ def test_primers(pipeline_dir):
run_snakemake(dryrun=True)
+# TODO slow
+def test_only_forward_primer(pipeline_dir):
+ # issue #107 (broken symlink)
+ with chdir(pipeline_dir):
+ modify_configuration(settings=[("forward_primers", "['CGTGA']")])
+ # Create some dummy files so we don’t need to run irrelevant steps of the pipeline
+ r = Path("reads")
+ r.mkdir()
+ with xopen(r / "2-merged.fastq.gz", "w") as f:
+ pass
+ s = Path("stats")
+ s.mkdir()
+ with open(s / "merging-successful", "w") as f:
+ pass
+ with open(s / "reads.json", "w") as f:
+ f.write('{"total": 0}')
+ with open(s / "trimmed.json", "w") as f:
+ f.write('{"trimmed": 0}')
+ run_snakemake(targets=["reads/sequences.fasta.gz"])
+
+
def test_flash(pipeline_dir):
# Test using FLASH and parsing its log output
with chdir(pipeline_dir):
@@ -218,11 +241,3 @@ def test_fasta_input(has_filtered_tab, tmp_path):
with chdir(directory):
modify_configuration([("barcode_length_3prime", "21")])
run_snakemake(targets=["stats/reads.json"])
-
-
-def convert_fastq_to_fasta(fastq, fasta):
- import dnaio
- with dnaio.open(fastq) as inf:
- with dnaio.open(fasta, mode="w") as outf:
- for record in inf:
- outf.write(record)
=====================================
tests/utils.py
=====================================
@@ -4,6 +4,8 @@ import subprocess
from contextlib import contextmanager
from io import StringIO
+import dnaio
+
@contextmanager
def capture_stdout():
@@ -25,3 +27,9 @@ def resultpath(path):
def files_equal(path1, path2):
return subprocess.call(['diff', '-u', path1, path2]) == 0
+
+def convert_fastq_to_fasta(fastq, fasta):
+ with dnaio.open(fastq) as inf:
+ with dnaio.open(fasta, mode="w") as outf:
+ for record in inf:
+ outf.write(record)
View it on GitLab: https://salsa.debian.org/med-team/igdiscover/-/commit/11f77113b8b9318c00567647d641057588b8e501
--
View it on GitLab: https://salsa.debian.org/med-team/igdiscover/-/commit/11f77113b8b9318c00567647d641057588b8e501
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201002/fbaf3dbb/attachment-0001.html>
More information about the debian-med-commit
mailing list