Skip to content

Commit

Permalink
addressing #63
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangrengang committed Dec 25, 2024
1 parent 36793dd commit 0072927
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion TEsorter/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,10 @@ def identify_rexdb(self, genes, clades):
('LTR', 'Bel-Pao'): ['GAG', 'PROT', 'RT', 'RH', 'INT'],
}
clade_count = Counter(clades)
counts = list(clade_count.values())
max_clade = max(clade_count, key=lambda x: clade_count[x])
order, superfamily = self._parse_rexdb(max_clade)
if len(clade_count) == 1 or clade_count[max_clade] > 1:
if len(clade_count) == 1 or (clade_count[max_clade] > 1 and counts[0] > counts[1]):
max_clade = max_clade.split('/')[-1]
elif len(clade_count) > 1:
max_clade = 'mixture'
Expand Down
7 changes: 5 additions & 2 deletions scripts/LTR_tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ format_id <- function(x1, x2, x3, x4) {
x1 = sapply(x1, split_id)
x1 = gsub('\\W+', '_', x1)
x = paste(x1, x2, x3, x4, sep='_')
x = gsub('\\W+', '_', x)
return(x)
}

Expand All @@ -35,8 +36,10 @@ if (branch_color == 'Clade') {
labels = map[which(map$Clade==clade), ]
clade = paste(labels$Superfamily, labels$Clade, sep='/')[1]
labels = format_id(labels$X.TE, labels$Order, labels$Superfamily, labels$Clade)
if (! any(labels %in% tree$tip.label)) {next}
# print(clade)
if (! any(labels %in% tree$tip.label)) {
#print(labels);
next}
#print(clade)
grp[[clade]] = labels
}
clades = sort(names(grp))
Expand Down

0 comments on commit 0072927

Please sign in to comment.