Skip to content

Commit

Permalink
Add --assigned-by flag for modication import
Browse files Browse the repository at this point in the history
  • Loading branch information
kimrutherford committed Sep 19, 2024
1 parent c7935ac commit 9ca3545
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/PomBase/Import/Modification.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ has verbose => (is => 'ro');
has options => (is => 'ro', isa => 'ArrayRef');
has organism_taxonid => (is => 'rw', init_arg => undef);
has organism => (is => 'rw', init_arg => undef);
has assigned_by => (is => 'rw', init_arg => undef);
has extension_processor => (is => 'ro', init_arg => undef, lazy => 1,
builder => '_build_extension_processor');

Expand All @@ -81,6 +82,15 @@ sub _build_extension_processor {
sub BUILD {
my $self = shift;

my $assigned_by = undef;

my @opt_config = ("assigned-by=s" => \$assigned_by);

if (!GetOptionsFromArray($self->options(), @opt_config)) {
croak "option parsing failed";
}

$self->assigned_by($assigned_by);
}

sub load {
Expand All @@ -89,6 +99,8 @@ sub load {

my $file_name = $self->file_name_of_fh($fh);

my $assigned_by = $self->assigned_by();

my $chado = $self->chado();

my $tsv = Text::CSV->new({ sep_char => "\t" });
Expand Down Expand Up @@ -186,6 +198,10 @@ sub load {
$self->add_feature_cvtermprop($feature_cvterm, 'date', $date);
}

if (defined $assigned_by) {
$self->add_feature_cvtermprop($feature_cvterm, 'assigned_by', $assigned_by);
}

if (defined $extension) {
try {
$self->extension_processor()->process_one_annotation($feature_cvterm, $extension);
Expand Down

0 comments on commit 9ca3545

Please sign in to comment.