Skip to content
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
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ jobs:

- name: Run tests
run: pytest tests/ -v

- name: Lint
run: pylint assemblytics/ --fail-under=9.0
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ This runs `python3 -m build --wheel` and copies the result into `public/`. If yo
To re-run the pipeline on each input and diff its variant calls against the matching example output:

```bash
pip3 uninstall assemblytics # remove whatever's installed
pip3 install -e . # install editable from current directory

# E. coli (uses a smaller unique anchor length since it's a small genome)
assemblytics -d input_examples/ecoli.delta.gz -o /tmp/assemblytics_test/ecoli -l 1000
diff <(tail -n +2 /tmp/assemblytics_test/ecoli/assemblytics_structural_variants.bed | sort) \
Expand Down
6 changes: 3 additions & 3 deletions assemblytics/dot_prep.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def index_for_dot(reference_lengths, fields_by_query, output_prefix, max_overvie

# orientation:
flip = sum_reverse > sum_forward
flip_by_query[query_name] = "-" if (flip == True) else "+"
flip_by_query[query_name] = "-" if flip else "+"


for tag in ordered_tags:
Expand All @@ -103,7 +103,7 @@ def index_for_dot(reference_lengths, fields_by_query, output_prefix, max_overvie

for fields in lines:
if fields[8] == tag:
if flip == True:
if flip:
fields[2] = int(fields[5]) - int(fields[2])
fields[3] = int(fields[5]) - int(fields[3])

Expand Down Expand Up @@ -138,7 +138,7 @@ def index_for_dot(reference_lengths, fields_by_query, output_prefix, max_overvie
f_out_index.write("#query\n")
f_out_index.write("query,query_length,orientation,bytePosition_unique,bytePosition_repetitive,bytePosition_end,unique_matching_refs,matching_refs\n")
# relative_ref_position_by_query is sorted by rel_pos
for query,rel_pos in relative_ref_position_by_query:
for query,_ in relative_ref_position_by_query:
f_out_index.write("%s,%d,%s,%d,%d,%d,%s,%s\n" % (query, query_lengths[query], flip_by_query[query], query_byte_positions[(query,"unique")], query_byte_positions[(query,"repetitive")] - query_byte_positions[(query,"unique")], query_byte_positions[(query,"end")] - query_byte_positions[(query,"repetitive")], "~".join(unique_references_by_query[query]), "~".join(all_references_by_query[query])))

f_out_index.write("#overview\n")
Expand Down
1 change: 0 additions & 1 deletion assemblytics/dotplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os

def run(output_dir):
Expand Down
1 change: 0 additions & 1 deletion assemblytics/nchart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import os

def bp_format(num):
Expand Down
13 changes: 5 additions & 8 deletions assemblytics/uniq_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ def run(args):
try:
f = gzip.open(filename, 'rt')
header1 = f.readline().strip()
# Detected gzipped delta file.
except:
except Exception: # noqa: BLE001 — fallback for uncompressed delta
f = open(filename, 'r')
header1 = f.readline().strip()
# Detected uncompressed delta file.

# Skip the second line
f.readline()
Expand Down Expand Up @@ -97,11 +95,9 @@ def run(args):
try:
f = gzip.open(filename, 'rt')
header1 = f.readline()
# Detected gzipped delta file.
except:
except Exception: # noqa: BLE001 — fallback for uncompressed delta
f = open(filename, 'r')
header1 = f.readline()
# Detected uncompressed delta file.

fout.write(header1)
fout.write(f.readline())
Expand All @@ -112,6 +108,7 @@ def run(args):
list_of_alignments_to_keep = []
alignment_counter = {}
keep_printing = False
query = ""

# For coords:
current_query_name = ""
Expand Down Expand Up @@ -152,7 +149,7 @@ def run(args):
for index in list_of_alignments_to_keep:
if line.strip() == header_lines_by_query[query][index]:
header_needed = True
if header_needed == True:
if header_needed:
fout.write(line) # if we have any alignments under this header, print the header
alignment_counter[query] = alignment_counter.get(query,0)

Expand Down Expand Up @@ -204,7 +201,7 @@ def run(args):
)
alignment_counter[query] = alignment_counter[query] + 1

elif keep_printing == True:
elif keep_printing:
fout.write(line)

fcoords_out_tab.close()
Expand Down
30 changes: 29 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,38 @@ Repository = "https://github.com/MariaNattestad/assemblytics"
assemblytics = "assemblytics.cli:main"

[project.optional-dependencies]
dev = ["pytest"]
dev = ["pytest", "pylint"]

[tool.setuptools]
packages = ["assemblytics"]

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.pylint.format]
max-line-length = 250

[tool.pylint."messages control"]
disable = [
"missing-module-docstring",
"missing-function-docstring",
"missing-class-docstring",
"trailing-whitespace",
"wrong-import-order",
"wrong-import-position",
"import-outside-toplevel",
"too-many-locals",
"too-many-branches",
"too-many-statements",
"too-many-positional-arguments",
"too-many-arguments",
"consider-using-f-string",
"consider-using-with",
"consider-using-dict-items",
"unspecified-encoding",
"duplicate-code",
"bad-indentation",
"redefined-outer-name",
"chained-comparison",
"broad-exception-caught",
]
Loading