Skip to content

Commit

Permalink
script: postprocess count alleles outside regions as intermissions for
Browse files Browse the repository at this point in the history
  • Loading branch information
Katherine Eaton committed Nov 8, 2022
1 parent c11770c commit 1085ce0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sc2rf/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,24 @@ def main(
alleles_by_parent[clade] = []
alleles_by_parent[clade].append(allele)

# Add in alleles that were not assigned to any region
for allele in alleles_split:
allele_nuc = allele.split("|")[2]
# Skip missing data
if allele_nuc == "N":
continue

allele_coord = int(allele.split("|")[0])
allele_in_region = False
for start_coord in regions_filter:
end_coord = regions_filter[start_coord]["end"]
if allele_coord >= start_coord and allele_coord <= end_coord:
allele_in_region = True

# Alleles not assigned to any region are counted as intermissions
if not allele_in_region:
intermission_alleles.append(allele)

# Identify the "minor" parent (least number of alleles)
# minor_parent = None
minor_num_alleles = len(alleles_split)
Expand Down

0 comments on commit 1085ce0

Please sign in to comment.