Ejemplo n.º 1
0
 public static void main(String[] argv) {
   TableSchema table = MedSavantDatabase.GeneSetTableSchema;
   SelectQuery query =
       MedSavantDatabase.GeneSetTableSchema.where(GENOME, "hg19", TYPE, "RefSeq")
           .groupBy(CHROM)
           .groupBy(NAME)
           .select(NAME, CHROM, "MIN(start)", "MAX(end)", "MIN(codingStart)", "MAX(codingEnd)");
   BinaryCondition dumbChrsCondition1 =
       BinaryConditionMS.notlike(
           table.getDBColumn(MedSavantDatabase.GeneSetColumns.CHROM), "%\\_%");
   query.addCondition(dumbChrsCondition1);
   BinaryCondition dumbChrsCondition2 =
       BinaryConditionMS.notlike(
           table.getDBColumn(MedSavantDatabase.GeneSetColumns.CHROM), "%\\-%");
   query.addCondition(dumbChrsCondition2);
   System.out.println(query.toString());
 }
Ejemplo n.º 2
0
  @Override
  public Gene[] getGenes(String sessID, GeneSet geneSet)
      throws SQLException, SessionExpiredException {

    TableSchema table = MedSavantDatabase.GeneSetTableSchema;
    SelectQuery query =
        MedSavantDatabase.GeneSetTableSchema.where(
                GENOME, geneSet.getReference(), TYPE, geneSet.getType())
            .groupBy(CHROM)
            .groupBy(NAME)
            .select(NAME, CHROM, "MIN(start)", "MAX(end)", "MIN(codingStart)", "MAX(codingEnd)");
    BinaryCondition dumbChrsCondition =
        BinaryConditionMS.notlike(
            table.getDBColumn(MedSavantDatabase.GeneSetColumns.CHROM), "%\\_%");
    query.addCondition(dumbChrsCondition);
    BinaryCondition dumbNameCondition =
        BinaryConditionMS.notlike(table.getDBColumn(MedSavantDatabase.GeneSetColumns.NAME), "%-%");
    query.addCondition(dumbNameCondition);

    System.out.println(query.toString());

    LOG.info(query);
    ResultSet rs = ConnectionController.executeQuery(sessID, query.toString());

    Gene[] result = new Gene[geneSet.getSize()];
    int i = 0;
    while (rs.next()) {
      Gene g =
          new Gene(
              rs.getString(1),
              rs.getString(2),
              rs.getInt(3),
              rs.getInt(4),
              rs.getInt(5),
              rs.getInt(6),
              null);
      result[i++] = g;
    }
    if (i != result.length) {
      LOG.info("There were " + result.length + " genes, but only " + i + " were loaded.");
    }
    result = Arrays.copyOf(result, i);

    return result;
  }
Ejemplo n.º 3
0
  public void removeAnnotationLogEntry(String sid, int updateId)
      throws SQLException, SessionExpiredException {

    TableSchema table = MedSavantDatabase.VariantpendingupdateTableSchema;
    DeleteQuery query = new DeleteQuery(table.getTable());
    query.addCondition(
        BinaryConditionMS.equalTo(
            table.getDBColumn(VariantPendingUpdateTableSchema.COLUMNNAME_OF_UPLOAD_ID), updateId));

    ConnectionController.executeUpdate(sid, query.toString());
  }
Ejemplo n.º 4
0
  public void setAnnotationLogStatus(String sid, int updateId, Status status)
      throws SQLException, SessionExpiredException {

    TableSchema table = MedSavantDatabase.VariantpendingupdateTableSchema;
    UpdateQuery query = new UpdateQuery(table.getTable());
    query.addSetClause(
        table.getDBColumn(VariantPendingUpdateTableSchema.COLUMNNAME_OF_STATUS),
        AnnotationLog.statusToInt(status));
    query.addCondition(
        BinaryConditionMS.equalTo(
            table.getDBColumn(VariantPendingUpdateTableSchema.COLUMNNAME_OF_UPLOAD_ID), updateId));

    ConnectionController.executeUpdate(sid, query.toString());
  }