From fdfd4dd6f240df133d458d172a6da1b5ddabcc72 Mon Sep 17 00:00:00 2001 From: Emmanuel Mongin <mongin@sanger.ac.uk> Date: Sat, 14 Jun 2003 10:30:48 +0000 Subject: [PATCH] more checks --- misc-scripts/protein_match/get_Xmapping.pl | 13 ++ misc-scripts/protein_match/mapping_conf.pl | 4 + misc-scripts/protein_match/maps2db.pl | 15 ++ misc-scripts/protein_match/pmatch.pl | 13 +- .../protein_match/prepare_proteome.pl | 170 +++++++++++++++++- 5 files changed, 213 insertions(+), 2 deletions(-) diff --git a/misc-scripts/protein_match/get_Xmapping.pl b/misc-scripts/protein_match/get_Xmapping.pl index 00a5f2388b..7bccda5040 100644 --- a/misc-scripts/protein_match/get_Xmapping.pl +++ b/misc-scripts/protein_match/get_Xmapping.pl @@ -47,6 +47,18 @@ my $zeb_dblink = $conf{'zeb_dblink'}; my $briggsae_peptides = $conf{'briggsae_hybrid'}; +my $help; + + +&GetOptions( + 'help' => \$help, + ); + +if ($help) { + print STDERR $conf{'help'}."\n"; + exit(); +} + #Check that the configuration file has been well filled in for each different organism #Beginning of check @@ -640,3 +652,4 @@ HELP exit(); } + diff --git a/misc-scripts/protein_match/mapping_conf.pl b/misc-scripts/protein_match/mapping_conf.pl index f4579c7009..b35e34f6a6 100644 --- a/misc-scripts/protein_match/mapping_conf.pl +++ b/misc-scripts/protein_match/mapping_conf.pl @@ -221,6 +221,10 @@ package main; ################## 'check' => '', #obslete option? + + +#Help related stuff. Put the location of the latest help file + 'help' => 'For an extensive help please check out ensembl-doc and have a look at protein_mapping.txt', ); diff --git a/misc-scripts/protein_match/maps2db.pl b/misc-scripts/protein_match/maps2db.pl index 563428af7a..67793bba77 100644 --- a/misc-scripts/protein_match/maps2db.pl +++ b/misc-scripts/protein_match/maps2db.pl @@ -32,6 +32,17 @@ my $port = $conf{'port'}; my $organism = $conf{'organism'}; my $query_pep = $conf{'query'}; my $refseq_pred = $conf{'refseq_pred_gnp'}; +my $help; + + +&GetOptions( + 'help' => \$help, + ); + +if ($help) { + print STDERR $conf{'help'}."\n"; + exit(); +} #Organism specific options #Drosophila @@ -53,6 +64,10 @@ my %embl2sp; my %errorflag; my %ref_map_pred; +my $help = $conf{'help'}; + +print STDERR "$help\n"; + #Checks my %check; diff --git a/misc-scripts/protein_match/pmatch.pl b/misc-scripts/protein_match/pmatch.pl index 6f92b024fb..4d6759ec4f 100644 --- a/misc-scripts/protein_match/pmatch.pl +++ b/misc-scripts/protein_match/pmatch.pl @@ -11,7 +11,7 @@ use strict; -use Getopt::Std; +use Getopt::Long; #use vars qw($opt_q $opt_t $opt_l $opt_o $t_thr $q_thr $opt_w $opt_s $opt_c $opt_d); BEGIN { @@ -39,6 +39,17 @@ my $t_thr = $conf{'target_idt'}; my $q_thr = $conf{'query_idt'}; my $pmatch_bin = $conf{'pmatch'}; my ($opt_w,$opt_l,$opt_d); +my $help; + + +&GetOptions( + 'help' => \$help, + ); + +if ($help) { + print STDERR $conf{'help'}."\n"; + exit(); +} #Check if the configuration file is correct my %check; diff --git a/misc-scripts/protein_match/prepare_proteome.pl b/misc-scripts/protein_match/prepare_proteome.pl index afa8997a8c..0661f84953 100755 --- a/misc-scripts/protein_match/prepare_proteome.pl +++ b/misc-scripts/protein_match/prepare_proteome.pl @@ -1,6 +1,6 @@ #!/usr/local/bin/perl -w use strict; - +use Getopt::Long; =head1 NAME prepare_proteome.pl @@ -49,8 +49,11 @@ BEGIN { require "mapping_conf.pl"; } + +#Global var my %conf = %::mapping_conf; +my $org_list = $conf{'organism_list'}; my $refseq = $conf{'refseq_fa'}; my $sptr = $conf{'sptr_fa'}; my $protfile = $conf{'pmatch_input_fa'}; @@ -58,6 +61,148 @@ my $pmatch = $conf{'pmatch'}; my $organism = $conf{'organism'}; my $refseq_pred = $conf{'refseq_pred_fa'}; my $sub_genes = $conf{'submitted_genes'}; +my $help; + + +&GetOptions( + 'help' => \$help, + ); + +if ($help) { + print STDERR $conf{'help'}."\n"; + exit(); +} + + +#Check that the configuration file has been well filled in for each different organism +#Beginning of check + +my %check; +my $seenorg = 0; + +#Check if the organism is correct +foreach my $or (@{$org_list}) { + if ($or eq $organism) { + $seenorg = 1; + } +} + +if ($seenorg == 0) { + print STDERR "Either the organism name you are using ($organism) is not define or is not allowed\n"; + print STDERR "Here is a list of authorised organisms:\n"; + foreach my $or (@{$org_list}) { + print STDERR "$or\n"; + } + + exit(); +} + + +#Organism specific checks +if($organism eq "human") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'refseq_gnp'} = $conf{'refseq_gnp'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + +if ($organism eq "mouse") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'refseq_gnp'} = $conf{'refseq_gnp'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + +if ($organism eq "elegans") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + +if ($organism eq "anopheles") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'submitted_genes'} = $conf{'submitted_genes'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } +} + +if ($organism eq "drosophila") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'refseq_gnp'} = $conf{'refseq_gnp'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + +if ($organism eq "rat") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'refseq_gnp'} = $conf{'refseq_gnp'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + +if ($organism eq "zebrafish") { + $check{'sptr_swiss'} = $conf{'sptr_swiss'}; + $check{'pmatch_input_fa'} = $conf{'pmatch_input_fa'}; + $check {'pmatch'} = $conf{'pmatch'}; + + foreach my $k (keys %check) { + print STDERR $check{$k}."\n"; + if ($check{$k} !~ /(\S+)/) { + usage(); + } + } + +} + + +#End of checks + print STDERR "Prepare proteome using following files: SPTR ($sptr)\nREFSEQ ($refseq)\nPROTFILE ($protfile)\n"; @@ -286,3 +431,26 @@ sub test_protfile { unlink $tmpfile; } + + +sub usage { + + print STDERR <<HELP + +Usage: get_Xmapping.pl +One of the element of the configuration file has not been properly loaded +for the organism $organism +Please fill in properly your configuration file + +Here is your set up: +HELP +; + + foreach my $k (keys %check) { + print STDERR "$k:\t$check{$k}\n"; + } + + + + exit(); +} -- GitLab