Changeset 4979


Ignore:
Timestamp:
Sep 24, 2018, 11:38:50 AM (3 years ago)
Author:
Nicklas Nordborg
Message:

References #1054: Even more functionality in the Flagged alignment wizard

When a RNA is selected for DoNotUse we should also find the corresponding DNA and FlowThrough. This is done by looking for the other items that have the same Lysate parent and same Qiacube date and run number.

File:
1 edited

Legend:

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

    r4977 r4979  
    3838import net.sf.basedb.core.SimpleProgressReporter;
    3939import net.sf.basedb.core.Subtypable;
     40import net.sf.basedb.core.Type;
    4041import net.sf.basedb.core.query.Annotations;
    4142import net.sf.basedb.core.query.Expressions;
     
    506507        ItemList flaggedAlignments = BiomaterialList.FLAGGED_ALIGNMENT.get(dc);
    507508       
     509        ItemQuery<Extract> dnaFtQuery = Extract.getQuery();
     510        dnaFtQuery.setIncludes(Reggie.INCLUDE_IN_CURRENT_PROJECT);
     511        // We find ALL child items to a specific Lysate with the same Qiacube date and run number
     512        dnaFtQuery.join(Hql.innerJoin("parent", "lys"));
     513        dnaFtQuery.join(Annotations.innerJoin(Annotationtype.QIACUBE_DATE.load(dc), "qcDate"));
     514        dnaFtQuery.join(Annotations.innerJoin(Annotationtype.QIACUBE_RUN_NO.load(dc), "qcRun"));
     515        dnaFtQuery.restrict(Restrictions.eq(Hql.alias("lys"), Hql.entityParameter("lysate", Item.EXTRACT)));
     516        dnaFtQuery.restrict(Restrictions.eq(Hql.alias("qcDate"), Expressions.parameter("qcDate", Type.DATE)));
     517        dnaFtQuery.restrict(Restrictions.eq(Hql.alias("qcRun"), Expressions.parameter("qcRun", Type.INT)));
     518       
    508519        GenoTypeChecker checker = new GenoTypeChecker();
    509520        checker.preloadVcfForFlaggedAlignments(dc);
     
    547558          // Load all downstream items (by matching the name)
    548559          List<BasicItem> allChildItems = getAllChildItems(dc, rootItem);
     560          if ("RNA".equals(doNotUse))
     561          {
     562            Extract rna = (Extract)rootItem;
     563            Extract lysate = (Extract)rna.getParent();
     564            Date qcDate = (Date)Annotationtype.QIACUBE_DATE.getAnnotationValue(dc, rna);
     565            Integer qcRun = (Integer)Annotationtype.QIACUBE_RUN_NO.getAnnotationValue(dc, rna);
     566            // Also include DNA and FlowThrough from the same Qiacube run
     567            if (lysate != null && qcDate != null && qcRun != null)
     568            {
     569              dnaFtQuery.setEntityParameter("lysate", lysate);
     570              dnaFtQuery.setParameter("qcDate", qcDate, Type.DATE);
     571              dnaFtQuery.setParameter("qcRun", qcRun, Type.INT);
     572              for (Extract e : dnaFtQuery.list(dc))
     573              {
     574                if (!e.equals(rootItem)) // The query return all children for the lysate but we do not need to process the RNA twice
     575                {
     576                  List<BasicItem> dnaFtItems = getAllChildItems(dc, e);
     577                  allChildItems.addAll(dnaFtItems);
     578                  jsonDebug.add("[Debug]Added " + dnaFtItems.size() + " items related to " + e);
     579                }
     580              }
     581            }
     582          }
    549583         
    550584          for (BasicItem basicItem : allChildItems)
Note: See TracChangeset for help on using the changeset viewer.