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

New Resfinder v4.5.0 #86

Merged
merged 2 commits into from
May 20, 2024
Merged
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
29 changes: 22 additions & 7 deletions hAMRonization/ResFinderIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,29 @@ def parse(self, handle):
reader = csv.DictReader(handle, delimiter="\t")
for result in reader:
result["_gene_name"] = result["Resistance gene"]
_start, _stop = result["Position in contig"].split("..")
if _start > _stop:
_strand = "-"
# Removes fields that have NA and NA..NA this is typical in the 4.5.0 resfinder when the --inputfastq is implimented
for field, value in result.items():
if value == "NA":
result[field] = None
if value == "NA..NA":
result[field] = None
# If result["Position in contig"] == None then make _start, _stop and _strand = None
if result["Position in contig"] != None:
_start, _stop = result["Position in contig"].split("..")
if _start > _stop :
_strand = "-"
else:
_strand = "+"

result["_start"] = _start
result["_stop"] = _stop
result["_strand"] = _strand
else:
_strand = "+"
result["_start"] = _start
result["_stop"] = _stop
result["_strand"] = _strand
_strand = None
result["_start"] = None
result["_stop"] = None
result["_strand"] = None

_reference_gene_length = result["Alignment Length/Gene Length"].split("/")[
0
]
Expand Down
Loading