Changeset 6012


Ignore:
Timestamp:
Sep 28, 2020, 8:31:09 AM (12 months ago)
Author:
Nicklas Nordborg
Message:

Fixes #1268: Remove temporary code used for running prepDE.py for existing StringTie? raw bioassays

Location:
extensions/net.sf.basedb.reggie/branches/4.27-stable
Files:
4 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/resources/index.js

    r6004 r6012  
    211211      Doc.show('more-boxes-are-needed', 'inline-block');
    212212    }
    213    
    214     if (counts['stringtie-without-prepde']) Doc.show('prepde-wizard', 'list-item');
    215213   
    216214    index.displayCounterAge();
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/resources/index.jsp

    r6004 r6012  
    838838                  title="Number of rawbioassays without a SCAN-B report PDF">∙</span>
    839839             
    840               <li id="prepde-wizard" style="display: none;"><span class="require-permission" data-role="Administrator" data-link="analysis/prepde.jsp?ID=<%=ID%>"
    841                 >Run prepDE.py</span>
    842                 <span class="counter" data-counter="stringtie-without-prepde"
    843                   title="Number of StringTie rawbioassays that is missing prepDE data">∙</span>
    844              
    845840              </ul>
    846841            </dd>
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/autoconfirm/AutoConfirmService.java

    r6006 r6012  
    306306      numItems += confirmRawOnlyVariantCalling(dc, manager, "variants-raw.vcf.gz");
    307307     
    308       // Temporary prepDE for existing StringTie items
    309       numItems += confirmPrepDE(dc, manager, "gene_count.csv");
    310      
    311308      // Commit now so that all items are reverted to manual flow just in case
    312309      // Actual auto-confirm and starting of next step is done later
     
    421418  }
    422419
    423   /**
    424     This will check if there are any '*.csv' AnyToAny links from a RawBioAssay (StringTie)
    425     to a JOB with ERROR status. If so, the link is removed to allowed it to be picked up for
    426     re-processing.
    427     @since 4.27.4
    428   */
    429   private int confirmPrepDE(DbControl dc, AutoConfirmManager manager, String csvName)
    430   {
    431     ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
    432     query.setIncludes(dc.getSessionControl().getActiveProjectId() != 0 ? Reggie.INCLUDE_IN_CURRENT_PROJECT : Include.ALL);
    433  
    434     // StringTie only
    435     Rawdatatype.STRINGTIE.addFilter(dc, query);
    436    
    437     // Must have '*.csv' linking to a JOB item
    438     query.restrict(AnyToAnyRestriction.exists(csvName, Item.JOB));
    439  
    440     int numItems = 0;
    441     Iterator<RawBioAssay> it = query.iterate(dc);
    442     while (it.hasNext())
    443     {
    444       numItems++;
    445       RawBioAssay stringTie = it.next();
    446       AutoConfirmer<?> ac = new PrepDEAutoConfirmer(stringTie, csvName);
    447       manager.checkRulesAndAdd(dc, ac);
    448     }
    449     return numItems;
    450   }
    451420
    452421  /**
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/counter/CounterService.java

    r6004 r6012  
    13851385    // ---
    13861386   
    1387     // StringTie raw bioassays without prepDE results
    1388     query = RawBioAssay.getQuery();
    1389     query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
    1390     Rawdatatype.STRINGTIE.addFilter(dc, query);
    1391     Pipeline.RNASEQ_HISAT_STRINGTIE.addFilter(dc, query);
    1392     // Must have a ANALYSIS_RESULT=Successful annotation
    1393     query.join(Annotations.leftJoin(null, Annotationtype.ANALYSIS_RESULT.load(dc), "ar"));
    1394     query.restrict(Restrictions.eq(Hql.alias("ar"), Expressions.string(Rawbioassay.FEATURE_EXTRACTION_SUCCESSFUL)));
    1395     // Must not have 'gene_count.csv' already
    1396     query.restrict(AnyToAnyRestriction.missing("gene_count.csv", null));
    1397     query.setCacheResult(true);
    1398     json.put("stringtie-without-prepde", query.count(dc));
    1399     // ---
    1400    
    14011387    // All Cufflinks raw bioassays with a gene report pdf
    14021388    query = RawBioAssay.getQuery();
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/dao/Subtype.java

    r6005 r6012  
    347347  public static final Subtype SSP_JOB = new Subtype("Single Sample Predictor", null, null, null, Item.JOB, false);
    348348
    349   /**
    350     The definition of the prepDE job.
    351     @since 4.27.4
    352   */
    353   public static final Subtype PREPDE_JOB = new Subtype("prepDE.py", null, null, null, Item.JOB, false);
    354 
    355  
    356349  /**
    357350    The definition of the "Sequencer" hardware subtype. Should already exist in BASE.
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/grid/JobCompletionHandlerFactory.java

    r6005 r6012  
    9999          action = new StringTieJobCreator.StringTieJobCompletionHandler();
    100100        }
    101         else if (jobType.equals(Subtype.PREPDE_JOB.get(dc)))
    102         {
    103           action = new PrepDEJobCreator.PrepDEJobCompletionHandler();
    104         }
    105101        else if (jobType.equals(Subtype.MBAF_JOB.get(dc)))
    106102        {
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/servlet/InstallServlet.java

    r6005 r6012  
    342342        jsonChecks.add(checkSubtype(dc, Subtype.VARIANT_STATISTICS_JOB, null, createIfMissing));
    343343        jsonChecks.add(checkSubtype(dc, Subtype.SSP_JOB, null, createIfMissing));
    344         jsonChecks.add(checkSubtype(dc, Subtype.PREPDE_JOB, null, createIfMissing));
    345344        jsonChecks.add(checkSubtype(dc, Subtype.REPORT_SOFTWARE, null, createIfMissing));
    346345        jsonChecks.add(checkSubtype(dc, Subtype.REPORT_JOB, null, createIfMissing));
  • extensions/net.sf.basedb.reggie/branches/4.27-stable/src/net/sf/basedb/reggie/servlet/StringTieServlet.java

    r6006 r6012  
    33import java.io.IOException;
    44import java.util.ArrayList;
    5 import java.util.Collections;
    65import java.util.List;
    76
     
    2827import net.sf.basedb.core.RawBioAssay;
    2928import net.sf.basedb.core.SessionControl;
    30 import net.sf.basedb.core.SimpleProgressReporter;
    3129import net.sf.basedb.core.Software;
    3230import net.sf.basedb.core.Trashcan;
     
    5048import net.sf.basedb.reggie.dao.Datafiletype;
    5149import net.sf.basedb.reggie.dao.Library;
    52 import net.sf.basedb.reggie.dao.Pipeline;
    5350import net.sf.basedb.reggie.dao.Rawbioassay;
    5451import net.sf.basedb.reggie.dao.Rawdatatype;
     
    5653import net.sf.basedb.reggie.dao.Rna;
    5754import net.sf.basedb.reggie.dao.Subtype;
    58 import net.sf.basedb.reggie.grid.PrepDEJobCreator;
    5955import net.sf.basedb.reggie.grid.ScriptUtil;
    6056import net.sf.basedb.reggie.grid.StringTieJobCreator;
    61 import net.sf.basedb.reggie.query.AnyToAnyRestriction;
    6257import net.sf.basedb.util.Values;
    6358import net.sf.basedb.util.error.ThrowableUtil;
     
    226221        json.put("rawBioAssays", jsonRawBioAssays);
    227222      }
    228       else if ("CountStringTieWithoutPrepDE".equals(cmd))
    229       {
    230         dc = sc.newDbControl();
    231        
    232         ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
    233         query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
    234         Rawdatatype.STRINGTIE.addFilter(dc, query);
    235         Pipeline.RNASEQ_HISAT_STRINGTIE.addFilter(dc, query);
    236         // Must have a ANALYSIS_RESULT=Successful annotation
    237         query.join(Annotations.leftJoin(null, Annotationtype.ANALYSIS_RESULT.load(dc), "ar"));
    238         query.restrict(Restrictions.eq(Hql.alias("ar"), Expressions.string(Rawbioassay.FEATURE_EXTRACTION_SUCCESSFUL)));
    239         // Must not have 'gene_count.csv' already
    240         query.restrict(AnyToAnyRestriction.missing("gene_count.csv", null));
    241         json.put("countRawBioAssays", query.count(dc));
    242       }
    243223     
    244224    }
     
    482462        }
    483463      }
    484       else if ("RunPrepDE".equals(cmd))
    485       {
    486         dc = sc.newDbControl();
    487 
    488         ReggieRole.checkPermission(dc, "'" + cmd + "' wizard", ReggieRole.SECONDARY_ANALYSIS, ReggieRole.ADMINISTRATOR);
    489 
    490         SimpleProgressReporter progress = new SimpleProgressReporter(null);
    491         sc.setSessionSetting("prepde-progress", progress);
    492         progress.display(1, "Loading StringTie raw bioassays...");
    493 
    494         JSONObject jsonReq = JsonUtil.parseRequest(req);
    495         String clusterId = (String)jsonReq.get("cluster");
    496         boolean debug = Boolean.TRUE.equals(jsonReq.get("debug"));
    497         Number priority = (Number)jsonReq.get("priority");
    498         OpenGridCluster cluster = OpenGridService.getInstance().getClusterById(dc, clusterId);
    499         if (cluster == null)
    500         {
    501           throw new ItemNotFoundException("OpenGridCluster[" + clusterId + "]");
    502         }
    503        
    504         PrepDEJobCreator prepDE = new PrepDEJobCreator();
    505         prepDE.setDebug(debug);
    506         prepDE.setPriority(priority == null ? null : priority.intValue());
    507 
    508         ItemQuery<RawBioAssay> query = RawBioAssay.getQuery();
    509         query.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
    510         Rawdatatype.STRINGTIE.addFilter(dc, query);
    511         Pipeline.RNASEQ_HISAT_STRINGTIE.addFilter(dc, query);
    512         // Must have a ANALYSIS_RESULT=Successful annotation
    513         query.join(Annotations.leftJoin(null, Annotationtype.ANALYSIS_RESULT.load(dc), "ar"));
    514         query.restrict(Restrictions.eq(Hql.alias("ar"), Expressions.string(Rawbioassay.FEATURE_EXTRACTION_SUCCESSFUL)));
    515         // Must not have 'gene_count.csv' already
    516         query.restrict(AnyToAnyRestriction.missing("gene_count.csv", null));
    517         query.order(Orders.asc(Hql.property("name"))); // Predicatable sort order is important since we loading 500 at a time
    518         query.order(Orders.asc(Hql.property("id")));
    519         query.setMaxResults(500);
    520        
    521         int totalCount = (int)query.count(dc);
    522         dc.close();
    523        
    524         // We create jobs with max 500 raw bioassays in each job
    525         // Each batch uses a separate transaction to minimize problems in case something goes wrong
    526         int currentCount = 0;
    527         try
    528         {
    529           while (true)
    530           {
    531             dc = sc.newDbControl();
    532             List<Rawbioassay> stringTie = Rawbioassay.toList(query.list(dc));
    533             if (stringTie.size() == 0) break;
    534            
    535             currentCount += stringTie.size();
    536             progress.display(5+(90*currentCount) / totalCount, "Submitting " + currentCount + " of " + totalCount + " items...");
    537            
    538             // For debugging
    539             // stringTie = stringTie.subList(0, 2);
    540            
    541             JobDefinition jobDef = prepDE.createPrepDEJob(dc, cluster, stringTie);
    542             Job job = ScriptUtil.submitJobs(dc, cluster, Collections.singletonList(jobDef)).get(0);
    543             dc.commit();
    544            
    545             if (job.getStatus() == Job.Status.ERROR)
    546             {
    547               jsonMessages.add("[Error]Job submission failed: " + job.getStatusMessage());
    548               break;
    549             }
    550             else
    551             {
    552               jsonMessages.add("Submitted prepDE.py (" + stringTie.size() + " rawbioassays) job to " + cluster.getConnectionInfo().getName() + " with id " + job.getExternalId());
    553             }
    554             // NOTE! query.setFirstResult() is not needed since the previous 500 will get a temporary "gene_count.csv" link
    555             // query.setFirstResult(query.getMaxResults()+query.getFirstResult());
    556           }
    557 
    558         }
    559         catch (RuntimeException ex)
    560         {
    561           jsonMessages.add("[Error]Job submission failed: " + ex.getMessage());
    562         }
    563         finally
    564         {
    565           dc.close();
    566         }
    567 
    568       }
    569464
    570465      json.put("messages", jsonMessages);
Note: See TracChangeset for help on using the changeset viewer.