We help IT Professionals succeed at work.

Unable to run job: Script length does not match declared length.


I've written a shell script which involves submitting information to a queue using qsub.

If I run the script, i'm currently receiving the message:

"Unable to run job: Script length does not match declared length."

I'm unsure as to what this actually means and how I'd go about rectifying the situation.

If anybody could possibly help me out with this I'd very much appreciate it.



#Shell script to use genome database files (generated from formatdb) and BLAST them against a database of antibodies

#define BLAST pathway


#create variable $database. Go through the /Genome directory, pick out any file containing ".psq"

	for 	database in $(find ~/Genomes -name "*.psq")

#once finding a file, trim off the ".psq" from the end


#remove all parent directories associated with the file, only giving the current file name

#create variable $antibodydb. Find it in ~/DatabaseTesting

	for 	antibodydb in $(find ~/DatabaseTesting -name "*ABDatabase.psq")

#once finding the file, trim off .psq


#remove all parent directories associated with the file, only giving the current file name


#test with echo to make sure variables are correctly formatted

echo "$database"
echo "$antibodydb"

#command line 

#    echo "Processing $database"
#    blastall -p blastp -m 8 -d $antibodydb -i $database
qsub -N StephenJob1 $BLASTALL -p blastp -m 9 -d $antibodydb -i $database -o $database.txt


Open in new window

Watch Question

First thing I would do to troubleshoot this script is that I would put an echo in the line
echo qsub -N StephenJob1 $BLASTALL -p blastp -m 9 -d $antibodydb -i $database -o $database.txt

to see if the script is calling this command the way you would expect it to act, because otherwise it is not a very reable script.
Kamaraj SubramanianApplication Support Analyst

-N name
Declares a name for the job. The name specified may be up to and including 15 characters in length. It must consist of printable, non white space characters with the first character alphabetic.

What is $BLASTALL ?

Is that should attach with Stephenjob1 ?

try with -b ( for binary )

-p priority
Defines the priority of the job. The priority argument must be a integer between -1024 and +1023 inclusive. The default is no priority which is equivalent to a priority of zero.

why you submitting blastp  for -p ?

if it is user then, you need to use -P ( upper case )


Ok, the first thing I've done is to echo the command line:

qsub -N StephenJob1 /usr/bin/blastall -p blastp -m 9 -d MyositisABDatabase -i HepatitisBgenome -o HepatitisBgenome.txt

the command line uses a program called 'blastall'. blastall has various options which have been fulfilled, such as the type of blast required (-p), the output format (-m), the name of the database being inputted (-d), the file to query against - input (-i), and also the output file name (-o).

The script uses "MyositisABDatabase" and tests it against various genomes, i.e. in the example above "HepatitisBgenome". It should then save these results to HepatitisBgenome.txt in the format suggested (in this case -m 9)

I've attached a full list of the options associated with blastall below:



blastall 2.2.24   arguments:

  -p  Program Name [String]
  -d  Database [String]
    default = nr
  -i  Query File [File In]
    default = stdin
  -e  Expectation value (E) [Real]
    default = 10.0
  -m  alignment view options:
0 = pairwise,
1 = query-anchored showing identities,
2 = query-anchored no identities,
3 = flat query-anchored, show identities,
4 = flat query-anchored, no identities,
5 = query-anchored no identities and blunt ends,
6 = flat query-anchored, no identities and blunt ends,
7 = XML Blast output,
8 = tabular,
9 tabular with comment lines
10 ASN, text
11 ASN, binary [Integer]
    default = 0
    range from 0 to 11
  -o  BLAST report Output File [File Out]  Optional
    default = stdout
  -F  Filter query sequence (DUST with blastn, SEG with others) [String]
    default = T
  -G  Cost to open a gap (-1 invokes default behavior) [Integer]
    default = -1
  -E  Cost to extend a gap (-1 invokes default behavior) [Integer]
    default = -1
  -X  X dropoff value for gapped alignment (in bits) (zero invokes default behav                                                                             ior)
      blastn 30, megablast 20, tblastx 0, all others 15 [Integer]
    default = 0
  -I  Show GI's in deflines [T/F]
    default = F
  -q  Penalty for a nucleotide mismatch (blastn only) [Integer]
    default = -3
  -r  Reward for a nucleotide match (blastn only) [Integer]
    default = 1
  -v  Number of database sequences to show one-line descriptions for (V) [Intege                                                                             r]
    default = 500
  -b  Number of database sequence to show alignments for (B) [Integer]
    default = 250
  -f  Threshold for extending hits, default if zero
      blastp 11, blastn 0, blastx 12, tblastn 13
      tblastx 13, megablast 0 [Real]
    default = 0
  -g  Perform gapped alignment (not available with tblastx) [T/F]
    default = T
  -Q  Query Genetic code to use [Integer]
    default = 1
  -D  DB Genetic code (for tblast[nx] only) [Integer]
    default = 1
  -a  Number of processors to use [Integer]
    default = 1
  -O  SeqAlign file [File Out]  Optional
  -J  Believe the query defline [T/F]
    default = F
  -M  Matrix [String]
    default = BLOSUM62
  -W  Word size, default if zero (blastn 11, megablast 28, all others 3) [Intege                                                                             r]
    default = 0
  -z  Effective length of the database (use zero for the real size) [Real]
    default = 0
  -K  Number of best hits from a region to keep. Off by default.
If used a value of 100 is recommended.  Very high values of -v or -b is also sug                                                                             gested [Integer]
    default = 0
  -P  0 for multiple hit, 1 for single hit (does not apply to blastn) [Integer]
    default = 0
  -Y  Effective length of the search space (use zero for the real size) [Real]
    default = 0
  -S  Query strands to search against database (for blast[nx], and tblastx)
       3 is both, 1 is top, 2 is bottom [Integer]
    default = 3
  -T  Produce HTML output [T/F]
    default = F
  -l  Restrict search of database to list of GI's [String]  Optional
  -U  Use lower case filtering of FASTA sequence [T/F]  Optional
  -y  X dropoff value for ungapped extensions in bits (0.0 invokes default behav                                                                             ior)
      blastn 20, megablast 10, all others 7 [Real]
    default = 0.0
  -Z  X dropoff value for final gapped alignment in bits (0.0 invokes default be                                                                             havior)
      blastn/megablast 100, tblastx 0, all others 25 [Integer]
    default = 0
  -R  PSI-TBLASTN checkpoint file [File In]  Optional
  -n  MegaBlast search [T/F]
    default = F
  -L  Location on query sequence [String]  Optional
  -A  Multiple Hits window size, default if zero (blastn/megablast 0, all others                                                                              40 [Integer]
    default = 0
  -w  Frame shift penalty (OOF algorithm for blastx) [Integer]
    default = 0
  -t  Length of the largest intron allowed in a translated nucleotide sequence w                                                                             hen linking multiple distinct alignments. (0 invokes default behavior; a negativ                                                                             e value disables linking.) [Integer]
    default = 0
  -B  Number of concatenated queries, for blastn and tblastn [Integer]  Optional
    default = 0
  -V  Force use of the legacy BLAST engine [T/F]  Optional
    default = F
  -C  Use composition-based score adjustments for blastp or tblastn:
      As first character:
      D or d: default (equivalent to T)
      0 or F or f: no composition-based statistics
      2 or T or t: Composition-based score adjustments as in Bioinformatics 21:9                                                                             02-911,
      1: Composition-based statistics as in NAR 29:2994-3005, 2001
          2005, conditioned on sequence properties
      3: Composition-based score adjustment as in Bioinformatics 21:902-911,
          2005, unconditionally
      For programs other than tblastn, must either be absent or be D, F or 0.
           As second character, if first character is equivalent to 1, 2, or 3:
      U or u: unified p-value combining alignment p-value and compositional p-va                                                                             lue in round 1 only
    default = D
  -s  Compute locally optimal Smith-Waterman alignments (This option is only
      available for gapped tblastn.) [T/F]
    default = F

Open in new window

Kamaraj SubramanianApplication Support Analyst



hi itkamaraj,

I tried -v in the following command line:

qsub -v -N StephenJob1 $BLASTALL -p blastp -m 9 -d $antibodydb -i $database -o $database.txt

but received the following message:

"Unable to read script file because of error: error opening StephenJob1: No such file or directory"

StephenJob1 being the job name when submitting.



Kamaraj SubramanianApplication Support Analyst

you need to specifiy like this

qsub -v param1=val,param2=val,... $BLASTALL....etc...

Hi again itka.

I think I've sorted it. I've been told that it's because I am using qsub to run a binary (pre-compiled) programme rather than a script. I was suggested to try adding  '-b y '  into the qsub command

 e.g. qsub -b y -N StephenJob1

and it seems to have worked.

It seems to have been submitted to the queue, although i'm not sure the command which shows me the current queue and where my jobs are etc?




Found out the answer elsewhere
Kamaraj SubramanianApplication Support Analyst

hmm.. i asked you to try with -b option in my first post

try with -b ( for binary )