Skip to content

Commit

Permalink
Revert to previous AGM script
Browse files Browse the repository at this point in the history
  • Loading branch information
markquintontulloch committed Jan 6, 2025
1 parent c320f4b commit b6983be
Showing 1 changed file with 2 additions and 68 deletions.
70 changes: 2 additions & 68 deletions scripts/AGR/curation_db_submissions/make_agr_agm_json.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Const::Fast;

my ($help, $debug, $test, $verbose, $store, $wormbase);
my ($outfile, $acedbpath, $ws_version, $out_fh, $association_outfile);
my ($outfile, $acedbpath, $ws_version, $out_fh);

const my $LINKML_SCHEMA => 'v2.8.1';

Expand All @@ -18,7 +18,6 @@
"store:s" => \$store,
"database:s" => \$acedbpath,
"outfile:s" => \$outfile,
"assoc:s" => \$association_outfile,
"wsversion=s" => \$ws_version
);

Expand All @@ -38,10 +37,9 @@
my $it = $db->fetch_many(-query => $query);

$outfile = "./wormbase.agms.${ws_version}.${LINKML_SCHEMA}.json" unless defined $outfile;
$association_outfile = "./wormbase.agm_associations.${ws_version}.${LINKML_SCHEMA}.json" unless defined $association_outfile;

my @agms;
my @agm_components;


while (my $obj = $it->next) {
unless ($obj->Species) {
Expand Down Expand Up @@ -75,31 +73,6 @@
data_provider_dto => $data_provider_dto_json
};
push @agms, $strain;

if ($obj->Variation) {
my @component_variations = $obj->at('Contains.Variation');
for my $cv (@component_variations) {
my $cv_json = {
agm_subject_identifier => "WB:$obj",
zygosity_curie => "GENO:0000137",
allele_identifier => "WB:" . $cv->name,
relation_name => "contains"
};
push @agm_components, $cv_json;
}
}
if ($obj->Transgene) {
my @component_transgenes = $obj->at('Contains.Transgene');
for my $ct (@component_transgenes) {
my $ct_json = {
agm_subject_identifier => "WB:$obj",
zygosity_curie => "GENO:0000137",
allele_identifier => "WB:" . $ct->name,
relation_name => "contains"
};
push @agm_components, $ct_json;
}
}
}


Expand Down Expand Up @@ -139,57 +112,18 @@
data_provider_dto => $data_provider_dto_json
};
push @agms, $genotype;

if ($obj->Variation) {
my @component_variations = $obj->at('Genotype_component.Variation');
for my $cv (@component_variations) {
my $cv_json = {
agm_subject_identifier => "WB:$obj",
zygosity_curie => "GENO:0000137",
allele_identifier => "WB:" . $cv->name,
relation_name => "contains"
};
push @agm_components, $cv_json;
}
}
if ($obj->Transgene) {
my @component_transgenes = $obj->at('Genotype_component.Transgene');
for my $ct (@component_transgenes) {
my $ct_json = {
agm_subject_identifier => "WB:$obj",
zygosity_curie => "GENO:0000137",
allele_identifier => "WB:" . $ct->name,
relation_name => "contains"
};
push @agm_components, $ct_json;
}
}
}

my $data = {
linkml_version => $LINKML_SCHEMA,
alliance_member_release_version => $ws_version,
agm_ingest_set => \@agms,
};

my $assoc_data = {
linkml_version => $LINKML_SCHEMA,
alliance_member_release_version => $ws_version,
agm_allele_association_ingest_set => \@agm_components
}

my $json_obj = JSON->new;
my $string = $json_obj->allow_nonref->canonical->pretty->encode($data);
my $out_fh;
open $out_fh, ">$outfile" or die "Could not open $outfile for writing\n";

print $out_fh $string;

my $assoc_json_obj = JSON->new;
my $assoc_string = $assoc_json_obj->allow_nonref->canonical->pretty->encode($assoc_data);
my $assoc_out_fh;
open $assoc_out_fh, ">$association_outfile" or die "Could not open $association_outfile for writing\n";

print $assoc_out_fh $assoc_string;
$db->close;

0 comments on commit b6983be

Please sign in to comment.