-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add number of homologs to summary table
- Loading branch information
1 parent
f26df83
commit a05af5a
Showing
4 changed files
with
63 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,34 @@ | ||
def get_liftover_summary(): | ||
pass | ||
from ..lift_over.util import * | ||
from ..general_util import * | ||
|
||
from collections import defaultdict | ||
|
||
|
||
def get_liftover_summary(genomic_interval, implicated_genes): | ||
all_genes = get_all_genes(other_ref_genomes.keys(), | ||
genomic_interval).values.tolist() | ||
|
||
NB_IDX = 1 | ||
NB_PREFIX = 'LOC_Os' | ||
|
||
gene_to_homologs_map = defaultdict(set) | ||
for row in all_genes: | ||
if row[NB_IDX].startswith(NB_PREFIX): | ||
# Subtract 2 (i.e., subtract OGI) | ||
for gene in row: | ||
if gene != NULL_PLACEHOLDER: | ||
gene_to_homologs_map[row[NB_IDX]].add(gene) | ||
|
||
print(gene_to_homologs_map) | ||
gene_to_count = [] | ||
for gene, homologs in gene_to_homologs_map.items(): | ||
# Subtract 2 to remove OGI and Nipponbare | ||
gene_to_count.append([gene, len(homologs) - 2]) | ||
|
||
gene_to_count_df = pd.DataFrame( | ||
gene_to_count, columns=['Gene', '# Homologs']) | ||
return gene_to_count_df | ||
|
||
|
||
def make_summary_table(genomic_interval, implicated_genes): | ||
return get_liftover_summary(genomic_interval, implicated_genes) |