Skip to content

Commit

Permalink
a few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rpetit3 committed Aug 5, 2024
1 parent dfb58a3 commit 3148f3c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@

# Changelog

## v0.3.1 rpetit3/camlhmp "Maybe a cat?" 2024/08/05

### `Fixed`

- `camlhmp-blast-alleles` not having a default value for targets

## v0.3.0 rpetit3/camlhmp "More bunnies and fewer baby birds" 2024/08/05

### `Added`
Expand Down
18 changes: 9 additions & 9 deletions camlhmp/parsers/blast.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ def get_blast_allele_hits(
})

final_allele_hits = {}
for target in targets:
final_allele_hits[target] = {
"id": "-",
"qcovs": 0,
"pident": 0,
"bitscore": 0,
"comment": "No hits met thresholds",
}

for target in target_results:
if len(target_results[target]["known"]):
# exact matches to known alleles were found
Expand All @@ -75,15 +84,6 @@ def get_blast_allele_hits(
# multiple hits, only report highest score
final_allele_hits[target] = sorted(target_results[target]["novel"], key=lambda x: x["bitscore"], reverse=True)[0]
final_allele_hits[target]["comment"] = "No exact matches to known alleles"
else:
# no hits
final_allele_hits[target] = {
"id": "-",
"qcovs": 0,
"pident": 0,
"bitscore": 0,
"comment": "No hits met thresholds",
}

# Debugging information
logging.debug("camlhmp.engines.blast.get_blast_allele_hits")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "camlhmp"
version = "0.3.0"
version = "0.3.1"
description = "Classification through yAML Heuristic Mapping Protocol"
authors = [
"Robert A. Petit III <[email protected]>",
Expand Down
7 changes: 4 additions & 3 deletions tests/data/blast/alleles/spn-pbptype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ metadata:
engine:
type: blast # The type of tool used to generate the data
tool: tblastn # The tool used to generate the data

# targets provides a list of sequence targets (primers, genes, proteins, etc...)
targets: ["1A", "2A", "2X"]
targets: ["1A", "2B", "2X"]
# types includes the final typing designations based on targets and aliases
types:
- name: "1A" # name of the profile
targets: ["1A"] # list of targets that are part of the profile
- name: "2A"
targets: ["2A"]
- name: "2B"
targets: ["2B"]
- name: "2X"
targets: ["2X"]

0 comments on commit 3148f3c

Please sign in to comment.