コード例 #1
0
  public static void main(String[] argv) throws Exception {
    DriverManager.load(
        "org/ensembl/conf/current_driver.conf:org/ensembl/conf/kaka_mysql_server.conf");
    Controller c = new Controller();
    EnsJSequence seq =
        new EnsJSequence("Dummy", c, new AssemblyLocation("22", 20000000, 20100000, 0), "current");

    SequenceAdaptor sa = (SequenceAdaptor) DriverManager.get("current").getAdaptor("sequence");

    seq.getCacher().setMinChunkSize(100);
    System.out.println("Have sequence. Dumping regions");

    String processedSeq = seq.getResidues(1, 10);
    String rawSeq = sa.fetch(new AssemblyLocation("22", 20000000, 20000009, 0)).getString();
    String diff =
        (rawSeq.equals(processedSeq))
            ? "SAME"
            : "protected = " + processedSeq + "\nraw = " + rawSeq;
    System.out.println("Sequence first 10 = " + diff);

    processedSeq = seq.getResidues(100, 110);
    rawSeq = sa.fetch(new AssemblyLocation("22", 20000099, 20000109, 0)).getString();
    diff =
        (rawSeq.equals(processedSeq))
            ? "SAME"
            : "protected = " + processedSeq + "\nraw = " + rawSeq;
    System.out.println("Sequence 100-110 = " + diff);

    processedSeq = seq.getResidues(10000, 11010);
    rawSeq = sa.fetch(new AssemblyLocation("22", 20009999, 20011009, 0)).getString();
    diff =
        (rawSeq.equals(processedSeq))
            ? "SAME"
            : "protected = " + processedSeq + "\nraw = " + rawSeq;
    System.out.println("Sequence 10000-11010 = " + diff);

    processedSeq = seq.getResidues(1, 12010);
    rawSeq = sa.fetch(new AssemblyLocation("22", 20000000, 20012009, 0)).getString();
    diff =
        (rawSeq.equals(processedSeq))
            ? "SAME"
            : "protected = " + processedSeq + "\nraw = " + rawSeq;
    System.out.println("Sequence 1-12010 = " + diff);

    processedSeq = seq.getResidues(12010, 1);
    rawSeq = sa.fetch(new AssemblyLocation("22", 20000000, 20012009, -1)).getString();
    diff =
        (rawSeq.equals(processedSeq))
            ? "SAME"
            : "protected = " + processedSeq + "\nraw = " + rawSeq;
    System.out.println("Sequence 12010-1 = " + diff);
  }
コード例 #2
0
  /* Note: low and high are relative coordinates */
  protected String getResiduesFromSourceImpl(int start, int end) {

    try {

      logger.debug(
          "getting sequence "
              + start
              + " to "
              + end
              + " from "
              + driverPath
              + " for seq obj "
              + this);
      SequenceAdaptor sa = (SequenceAdaptor) DriverManager.get(driverPath).getAdaptor("sequence");
      LinearLocation loc = derivedLocation(start, end);
      org.ensembl19.datamodel.Sequence seq = sa.fetch(loc);
      String s = seq.getString();
      logger.debug("s=" + start + "\te=" + end);
      logger.debug("EnsJSequence retrieved: " + s.length() + "\t" + s + "\t" + loc);

      return s;

    } catch (Exception e) {
      logger.error("Failed getting sequence residues", e);
      return null;
    }
  }