Skip to content

Commit

Permalink
Adding a check for the mode
Browse files Browse the repository at this point in the history
  • Loading branch information
olaaustine committed Mar 4, 2024
1 parent 047fc6c commit 144bafb
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions neXtProt.pm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ limitations under the License.
Of notice, multiple values can be returned for the same label. In this case, the values will
be separeted by '|' for tab and txt format, and '&' for VCF format.
N/B: This plugin requires a connection to the Database and API, can not be used in offline mode.
The plugin can then be run as default:
./vep -i variations.vcf --plugin neXtProt
Expand Down Expand Up @@ -123,6 +125,10 @@ sub new {

my $param_hash = $self->params_to_hash();

if (defined($self->{config}->{offline})) {
die "Plugin can not work in offline mode \n";
}

if(defined($param_hash->{max_set}) && defined($param_hash->{return_values})) {
die "ERROR: Can't use max_set and return_values simultaneously!\n";
}
Expand Down Expand Up @@ -198,12 +204,15 @@ sub run {
my $translation_id = $tva->transcript->translation->stable_id;

my $tl = $tva->transcript->translation;

my @uniprot = @{$tl->get_all_DBLinks('Uniprot_isoform')};


return {} unless defined($peptide_start) && scalar @uniprot > 0;

my $isoform_id = $uniprot[0]->display_id;


my $query = $self->get_sparql_query($peptide_start,$isoform_id);

# run SPARQL query
Expand All @@ -212,7 +221,6 @@ sub run {
$query_output = `curl -X POST -H "Accept:application/sparql-results+json" --data-urlencode "query=$query" https://sparql.nextprot.org/ 2> /dev/null`;
};
warn $@ if $@;

my $output = decode_json ($query_output);

my %result_hash;
Expand Down

0 comments on commit 144bafb

Please sign in to comment.