Changeset 2556


Ignore:
Timestamp:
Aug 5, 2014, 3:58:08 PM (9 years ago)
Author:
Nicklas Nordborg
Message:

References #614: Improve error handling when executing jobs on the cluster

Running samtools index ... which was the last part from the tophat script. Created a new statistics script, alignment_statistics.sh which replaces the statistics_tophat.sh. The new scripts works on a single folder given as an argument to the script instead of using a file with paths to BAM files.

Since this script only uses 'samtools' no redirection wrapper is not needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/servlet/MaskAlignServlet.java

    r2555 r2556  
    380380          script.cmd("cp ${ScriptDir}/stdwrap.sh .");
    381381          script.cmd("cp ${ScriptDir}/picard .");
    382           script.cmd("cp ${ScriptDir}/statistics_tophat.sh .");
     382          script.cmd("cp ${ScriptDir}/alignment_statistics.sh .");
    383383          script.cmd("cp ${ScriptDir}/sync_resultfiles.sh .");
    384384          script.newLine();
     
    432432          script.newLine();
    433433
    434           script.progress(60, "Running picard MarkDuplicates");
     434          script.progress(70, "Running picard MarkDuplicates");
    435435          String picardCmd = "./picard MarkDuplicates";
    436436          picardCmd += " INPUT=fastq.masked.tophat/accepted_hits.bam";
     
    441441          script.cmd(picardCmd);
    442442          script.cmd("mv fastq.masked.tophat/accepted_hits.bam.tmp_picard fastq.masked.tophat/accepted_hits.bam");
    443 
    444           // TODO - other scripts from tophat_single.sh script
    445 
    446           script.comment("Run alignment analysis");
    447           script.progress(80, "Running alignment analysis");
    448           script.cmd("find fastq.masked.tophat -name \"accepted_hits.bam\" > accepted.list");
    449           // TODO duplicate.sh and other scripts have hardocded paths to other scripts and folders
    450           script.comment("./duplicate.sh < accepted.list >& duplicate.out");
    451           script.bkgr("./statistics_tophat.sh < accepted.list >& statistics_tophat.out");
     443          script.newLine();
     444         
     445          script.progress(80, "Creating BAM index");
     446          script.cmd("samtools index fastq.masked.tophat/accepted_hits.bam");
     447          script.newLine();
     448
     449          script.progress(90, "Culculating alignment statistics");
     450          script.cmd("./alignment_statistics.sh fastq.masked.tophat > " + jobFolder + "/alignment_statistics.out");
    452451          script.newLine();
    453452         
     
    456455          script.newLine();
    457456         
    458           script.progress(90, "Copying result files");
    459           script.comment("Copy filter information back to job folder for importing into BASE");
    460           script.cmd("cp fastq.masked.tophat/*_tophatstats.out " + jobFolder + "/tophatstats.out");
    461           script.newLine();
     457          script.progress(90, "Copying result files to project archive");
    462458          script.comment("Sync result files to project archive");
    463459          script.cmd("echo " + merged.getName() + " > sync.list");
     
    630626    {
    631627      CmdResult masked = cluster.executeCmd(ssh, "cat " + cluster.getJobFolder() + "/" + jobStatus.getJobName() + "/masked.out", 2);
    632       CmdResult tophat = cluster.executeCmd("cat " + cluster.getJobFolder() + "/" + jobStatus.getJobName() + "/tophatstats.out" , 2);
    633       if (masked.getExitStatus() == 0 && tophat.getExitStatus() == 0)
    634       {
    635         long[] reads = parseMaskedAndAlignedOut(sc, job, masked.getStdout(), tophat.getStdout());
     628      CmdResult statistics = cluster.executeCmd("cat " + cluster.getJobFolder() + "/" + jobStatus.getJobName() + "/alignment_statistics.out" , 2);
     629      if (masked.getExitStatus() == 0 && statistics.getExitStatus() == 0)
     630      {
     631        long[] reads = parseMaskedAndAlignedOut(sc, job, masked.getStdout(), statistics.getStdout());
    636632        // 0 = number of reads after filter, 1 = number of reads after align
    637633        return Values.formatNumber(reads[0]/1000000f, 1) + "M reads after mask; "  + Values.formatNumber(reads[1]/1000000f, 1) + "M reads after alignment";
     
    639635      else
    640636      {
    641         job.setDescription(masked.getStderr() + "\n" + tophat.getStderr());
     637        job.setDescription(masked.getStderr() + "\n" + statistics.getStderr());
    642638      }
    643639      return null;
Note: See TracChangeset for help on using the changeset viewer.