Skip to content

Commit

Permalink
Merge pull request #86 from DanyMatute/master
Browse files Browse the repository at this point in the history
New Resfinder v4.5.0
  • Loading branch information
fmaguire authored May 20, 2024
2 parents c54390e + bc2b370 commit 5852116
Showing 1 changed file with 22 additions and 7 deletions.
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

0 comments on commit 5852116

Please sign in to comment.