Ejemplo n.º 1
1
  private void filterChange(final BamView bamView, final JComboBox flagCheck[]) {
    int nflags = SAMRecordFlagPredicate.FLAGS.length;
    int flagCombined = 0;
    Vector<SAMRecordPredicate> predicates = new Vector<SAMRecordPredicate>();

    for (int j = 0; j < nflags; j++) {
      String opt = (String) flagCheck[j].getSelectedItem();
      if (opt.equals("HIDE")) flagCombined = flagCombined | SAMRecordFlagPredicate.FLAGS[j];
      else if (opt.equals("SHOW"))
        predicates.add(new SAMRecordFlagPredicate(SAMRecordFlagPredicate.FLAGS[j], false));
    }

    if (flagCombined == 0 && predicates.size() == 0) bamView.setSamRecordFlagPredicate(null);
    else {
      final SAMRecordPredicate predicate;
      if (predicates.size() == 0) predicate = new SAMRecordFlagPredicate(flagCombined);
      else if (flagCombined == 0) {
        predicate =
            new SAMRecordFlagConjunctionPredicate(predicates, SAMRecordFlagConjunctionPredicate.OR);
      } else {
        SAMRecordFlagPredicate p1 = new SAMRecordFlagPredicate(flagCombined);
        SAMRecordFlagConjunctionPredicate p2 =
            new SAMRecordFlagConjunctionPredicate(predicates, SAMRecordFlagConjunctionPredicate.OR);

        predicate =
            new SAMRecordFlagConjunctionPredicate(p1, p2, SAMRecordFlagConjunctionPredicate.OR);
      }
      bamView.setSamRecordFlagPredicate(predicate);
    }
    bamView.repaint();
  }
Ejemplo n.º 2
0
 private void setQualityCutOff(final JTextField cutOff, final BamView bamView) {
   String cutOffStr = cutOff.getText().trim();
   if (cutOffStr.equals("")) bamView.setSamRecordMapQPredicate(null);
   else {
     try {
       SAMRecordMapQPredicate predicate = new SAMRecordMapQPredicate(Integer.parseInt(cutOffStr));
       bamView.setSamRecordMapQPredicate(predicate);
     } catch (NumberFormatException nfe) {
       bamView.setSamRecordMapQPredicate(null);
     }
   }
   bamView.repaint();
 }