Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
include subtype positions to orfs.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Sep 18, 2023
1 parent 355d219 commit d3678f7
Show file tree
Hide file tree
Showing 7 changed files with 2,082 additions and 1,042 deletions.
16 changes: 11 additions & 5 deletions intact/intact.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class CandidateORF:
name: str
start: int
end: int
subtype_start: int
subtype_end: int
orientation: str
distance: float
protein: str
Expand All @@ -90,9 +92,11 @@ class CandidateORF:
@dataclass
class FoundORF:
name: str
orientation: str
start: int
end: int
subtype_start: int
subtype_end: int
orientation: str
distance: str
protein: str
aminoacids: str
Expand Down Expand Up @@ -568,8 +572,8 @@ def find_candidate_positions(e, q_start, q_end):
closest_start = min(n, (closest_start_a * 3) + frame)
closest_end = min(n + 1, (closest_end_a * 3) + 3 + frame)
got_protein = get_biggest_protein(has_start_codon(e), got_aminoacids)
yield CandidateORF(e.name, closest_start, closest_end, "forward",
dist, got_protein, got_aminoacids)
yield CandidateORF(e.name, closest_start, closest_end, e.start, e.end,
"forward", dist, got_protein, got_aminoacids)

def find_real_correspondence(e):
q_start = coordinates_mapping[e.start]
Expand Down Expand Up @@ -730,7 +734,7 @@ def __enter__(self, *args):
self.errors = {}
elif self.fmt == "csv":
self.orfs_writer = csv.writer(self.orfs_file)
self.orfs_header = ['seqid'] + [field.name for field in dataclasses.fields(CandidateORF)]
self.orfs_header = ['seqid'] + [field.name for field in dataclasses.fields(FoundORF)]
self.orfs_writer.writerow(self.orfs_header)
self.holistic_writer = csv.writer(self.holistic_file)
self.holistic_header = ['seqid'] + [field.name for field in dataclasses.fields(HolisticInfo)]
Expand Down Expand Up @@ -900,9 +904,11 @@ def intact( working_dir,

hxb2_found_orfs = [FoundORF(
o.name,
o.orientation,
o.start,
o.end,
o.subtype_start,
o.subtype_end,
o.orientation,
o.distance,
str(o.protein),
str(o.aminoacids),
Expand Down
904 changes: 452 additions & 452 deletions tests/expected-results-large-csv/orfs.csv

Large diffs are not rendered by default.

1,804 changes: 1,353 additions & 451 deletions tests/expected-results-large/orfs.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions tests/expected-results-single-csv/orfs.csv

Large diffs are not rendered by default.

44 changes: 33 additions & 11 deletions tests/expected-results-single/orfs.json

Large diffs are not rendered by default.

112 changes: 56 additions & 56 deletions tests/expected-results-small-csv/orfs.csv

Large diffs are not rendered by default.

220 changes: 165 additions & 55 deletions tests/expected-results-small/orfs.json

Large diffs are not rendered by default.

0 comments on commit d3678f7

Please sign in to comment.