Skip to content

Commit

Permalink
Fix missing feature_relationship loading complexes
Browse files Browse the repository at this point in the history
We were only storing one feature_relationship per complex when loading
pombe_to_complex_id_mapping.tsv

Refs #1166
  • Loading branch information
kimrutherford committed May 3, 2024
1 parent fdcbfde commit ec6cdaf
Showing 1 changed file with 30 additions and 19 deletions.
49 changes: 30 additions & 19 deletions lib/PomBase/Import/GenericFeaturePub.pm
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ sub load {
my $organism = $self->organism();

my %seen_feature_pubs = ();
my %seen_features = ();

my $tsv = Text::CSV->new({ sep_char => "\t", allow_loose_quotes => 1 });

Expand Down Expand Up @@ -197,37 +198,47 @@ sub load {

my $feature_uniquename = $columns_ref->[$self->feature_uniquename_column()];

my $reference_value = $columns_ref->[$reference_column];

my $seen_feature_pubs_key = "$feature_uniquename--$reference_value";
if ($seen_feature_pubs{$seen_feature_pubs_key}) {
next;
if (defined $seen_features{$feature_uniquename}) {
$feature = $seen_features{$feature_uniquename};
} else {
$seen_feature_pubs{$seen_feature_pubs_key} = 1;
if ($create_feature_with_type) {
my $type_name = $create_feature_with_type;
$feature = $self->store_feature($feature_uniquename, undef, [],
$type_name, $organism);

} else {
try {
$feature = $self->find_chado_feature($feature_uniquename);
}
catch {
warn "line $.: failed to find feature: $_";
};

if (!defined $feature) {
next;
}
}

$seen_features{$feature_uniquename} = $feature;
}

if ($create_feature_with_type) {
my $type_name = $create_feature_with_type;
$feature = $self->store_feature($feature_uniquename, undef, [],
$type_name, $organism);

my $subject_feature_uniquename = $columns_ref->[$subject_feature_column];

my $subject_feature =
$self->find_chado_feature($subject_feature_uniquename);

$self->store_feature_rel($subject_feature, $feature,
$relationship_type_cvterm);
}

my $reference_value = $columns_ref->[$reference_column];

my $seen_feature_pubs_key = "$feature_uniquename--$reference_value";
if ($seen_feature_pubs{$seen_feature_pubs_key}) {
next;
} else {
try {
$feature = $self->find_chado_feature($feature_uniquename);
} catch {
warn "line $.: failed to find feature: $_";
};

if (!defined $feature) {
next;
}
$seen_feature_pubs{$seen_feature_pubs_key} = 1;
}

my $reference = $self->find_or_create_pub($reference_value);
Expand Down

0 comments on commit ec6cdaf

Please sign in to comment.