Skip to content

Commit

Permalink
Fix ignoring intact sequences in table_precursor and landscapes_plots
Browse files Browse the repository at this point in the history
  • Loading branch information
Donaim committed Jul 29, 2024
1 parent 9454ade commit 87aaffb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 4 additions & 3 deletions gene_splicer/landscapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,15 @@ def generate_proviral_landscape_csv_1_cont(blastn_reader: csv.DictReader,
ref_end = new_end
is_inverted = 'yes'

verdict = verdicts.get(qseqid)
verdict = verdicts[qseqid]
is_defective = verdict != 'Intact'
landscape_entry = {'ref_start': ref_start,
'ref_end': ref_end,
'samp_name': sample_name,
'run_name': run_name,
'is_inverted': is_inverted,
'is_defective': verdict is not None,
'defect': verdict or 'Intact',
'is_defective': is_defective,
'defect': verdict,
}

landscape_writer.writerow(landscape_entry)
Expand Down
10 changes: 8 additions & 2 deletions gene_splicer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,21 @@ def iterate_hivintact_verdicts_1(directory: Path, intact: Set[str] = set()) -> I
intact = set()

def get_verdict(SEQID: str, all_errors) -> Tuple[str, str]:
ordered = sorted(all_errors, key=HIVINTACT_ERRORS_TABLE.index)
verdict = ordered[0]
if all_errors:
ordered = sorted(all_errors, key=HIVINTACT_ERRORS_TABLE.index)
verdict = ordered[0]
else:
verdict = "Intact"

return (SEQID, verdict)

with open(os.path.join(directory, 'holistic.csv'), 'r') as f:
reader = csv.DictReader(f)
for row in reader:
if row["intact"] == "True":
intact.add(row["qseqid"])
SEQID = row["qseqid"]
yield get_verdict(SEQID, all_errors=[])

with open(os.path.join(directory, 'defects.csv'), 'r') as f:
reader = csv.DictReader(f)
Expand Down

0 comments on commit 87aaffb

Please sign in to comment.