@@ -62,10 +62,9 @@ sub is_pop {
62
62
for my $single_allele_genotype_annotation ($single_allele_genotype -> annotations()) {
63
63
64
64
my $term_ontid = $single_allele_genotype_annotation -> data()-> {term_ontid };
65
- my $res = $lookup -> lookup_by_id(id => $term_ontid ,
66
- include_subset_ids => 1);
67
- if (grep { $_ eq ' is_a(FYPO:0002057)' } @{$res -> {subset_ids }}
68
- ) {
65
+ my $res = $lookup -> lookup_by_id(id => $term_ontid , include_subset_ids => 1);
66
+
67
+ if (grep { $_ eq ' is_a(FYPO:0002057)' } @{$res -> {subset_ids }}) {
69
68
return $single_allele_genotype ;
70
69
}
71
70
}
@@ -76,6 +75,28 @@ sub is_pop {
76
75
return undef ;
77
76
};
78
77
78
+
79
+ sub make_key
80
+ {
81
+ my $evidence = shift ;
82
+ my $genotype_annotation = shift ;
83
+ my $allele_1_genotype = shift ;
84
+ my $allele_2_genotype = shift ;
85
+
86
+ my $data = $genotype_annotation -> annotation-> data();
87
+
88
+ my $annotation_key =
89
+ join (' ---' ,
90
+ $genotype_annotation -> genotype-> display_name($config ),
91
+ $genotype_annotation -> annotation-> type(),
92
+ $data -> {term_ontid });
93
+
94
+ return join (' :-:' ,$evidence ,
95
+ $annotation_key ,
96
+ $allele_1_genotype -> display_name($config ),
97
+ $allele_2_genotype -> display_name($config ));
98
+ }
99
+
79
100
sub make_interaction {
80
101
my ($curs_schema , $interaction_type ,
81
102
$double_mutant_genotype_annotation , $allele_1_genotype ,
@@ -84,16 +105,16 @@ sub make_interaction {
84
105
my %create_args = (
85
106
interaction_type => $interaction_type ,
86
107
primary_genotype_annotation_id =>
87
- $double_mutant_genotype_annotation -> genotype_annotation_id(),
108
+ $double_mutant_genotype_annotation -> genotype_annotation_id(),
88
109
genotype_a_id => $allele_1_genotype -> genotype_id(),
89
110
genotype_b_id => $allele_2_genotype -> genotype_id(),
90
111
);
91
112
92
- print " created interaction\n " ;
93
-
94
113
$curs_schema -> create_with_type(' GenotypeInteraction' , \%create_args );
95
114
}
96
115
116
+ my %created_interactions = ();
117
+
97
118
my $proc = sub {
98
119
my $curs = shift ;
99
120
my $curs_schema = shift ;
@@ -124,6 +145,16 @@ sub make_interaction {
124
145
my $allele_2_genotype = is_pop($allele_2 );
125
146
next unless defined $allele_2_genotype ;
126
147
148
+ my $seen_key = make_key(' Synthetic Growth Defect' ,
149
+ $genotype_annotation , $allele_1_genotype ,
150
+ $allele_2_genotype );
151
+
152
+ if ($created_interactions {$seen_key }) {
153
+ next ;
154
+ } else {
155
+ $created_interactions {$seen_key } = 1;
156
+ }
157
+
127
158
print $curs -> curs_key(), " \n " ;
128
159
make_interaction($curs_schema , ' Synthetic Growth Defect' ,
129
160
$genotype_annotation , $allele_1_genotype ,
0 commit comments