aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2022-08-12 14:18:22 +0000
committerzsloan2022-12-21 13:04:07 -0600
commit18cb113450b8ef17d1d1ca81062e05ce27657c00 (patch)
tree880031a6fb1ac6aab36463036b7d2793baeccefe
parent6bdbab327ac9a26517ef81a105c0ba5a8b0c360d (diff)
downloadgenenetwork2-18cb113450b8ef17d1d1ca81062e05ce27657c00.tar.gz
Change homology logic to include lines that start/end outside of the
given mb range This is to avoid a situation where a user zooms in and a bar should encompass the whole area but isn't displayed (because its start/end don't both fall within the given Mb range) This commit also renames mm10/hg38 to ref/query to be more generic
-rw-r--r--wqflask/wqflask/interval_analyst/GeneUtil.py21
1 files changed, 13 insertions, 8 deletions
diff --git a/wqflask/wqflask/interval_analyst/GeneUtil.py b/wqflask/wqflask/interval_analyst/GeneUtil.py
index 5b28f458..a3fe1269 100644
--- a/wqflask/wqflask/interval_analyst/GeneUtil.py
+++ b/wqflask/wqflask/interval_analyst/GeneUtil.py
@@ -9,16 +9,21 @@ def load_homology(chr_name, start_mb, end_mb, source_file):
for line in h_file:
line_items = line.split()
this_dict = {
- "mm10_chr": line_items[2][3:],
- "mm10_start": float(line_items[5])/1000000,
- "mm10_end": float(line_items[6])/1000000,
- "hg38_chr": line_items[7][3:],
- "hg38_strand": line_items[9],
- "hg38_start": float(line_items[10])/1000000,
- "hg38_end": float(line_items[11])/1000000
+ "ref_chr": line_items[2][3:],
+ "ref_strand": line_items[4],
+ "ref_start": float(line_items[5])/1000000,
+ "ref_end": float(line_items[6])/1000000,
+ "query_chr": line_items[7][3:],
+ "query_strand": line_items[9],
+ "query_start": float(line_items[10])/1000000,
+ "query_end": float(line_items[11])/1000000
}
- if str(this_dict["mm10_chr"]) == str(chr_name) and this_dict["mm10_start"]>= start_mb and this_dict["mm10_end"] <= end_mb:
+ if str(this_dict["ref_chr"]) == str(chr_name) and
+ ((this_dict["ref_start"]>= start_mb and this_dict["ref_end"] <= end_mb) or
+ (this_dict["ref_start"] < start_mb and this_dict["ref_end"] <= end_mb) or
+ (this_dict["ref_start"] >= start_mb and this_dict["ref_end"] > end_mb) or
+ (this_dict["ref_start"] < start_mb and this_dict["ref_end"] > end_mb)):
homology_list.append(this_dict)
return homology_list