-pod2usage(' -sequence argument not provided') unless $infile;
-die "-db $db_entry not recognised" unless exists $database->{$db_entry};
-$output = $infile . ".res" unless $output;
-$ncpu = 1 if ( 1 > $ncpu or 8 < $ncpu );
+pod2usage(' ERROR! Input file with a sequence should be provided with -sequence/-in') unless $infile;
+pod2usage(' ERROR! Unknown database at ' . $db_path . '. Use -dbpath and -dbname for configuring the database' ) unless exists $database->{$db_entry};
+pod2usage(' ERROR! UNIREF database doesn\'t exist. Use -dbpath and -dbname for configuring the database') unless -f $database->{$db_entry}{database};
+
+if ( defined $prefix ) {
+ unless (defined $outfile) {
+ $outfile = $prefix. ".res.fasta";
+ }
+} else {
+ if (defined $outfile) {
+ print "WARNING! file prefix is not defined. Jpred will use $outfile.tmp as the prefix\n";
+ $prefix = $outfile . ".tmp";
+ } else {
+ print "WARNING! file prefix is not defined. Jpred will use $infile.res as the prefix\n";
+ $prefix = $infile . ".res";
+ $outfile = $prefix. ".jnet";
+ }
+}