Esempio n. 1
0
    @Override
    public String process(File page, Map<String, String> query) {
      JSONObject jo = new JSONObject();
      jo.put("cr", "not found");

      if (graphs.containsKey(query.get("graphName")) && query.containsKey("sk")) {
        jo.put("cr", query.get("sk") + " not found");

        CortexGraph cg = graphs.get(query.get("graphName"));

        CortexKmer ck = new CortexKmer(query.get("sk"));

        CortexRecord cr = cg.findRecord(ck);
        if (cr != null) {
          String text = cr.toString();
          if (ck.isFlipped()) {
            String info = query.get("sk");

            for (int coverage : cr.getCoverages()) {
              info += " " + coverage;
            }

            for (String edge : cr.getEdgeAsStrings()) {
              info += " " + SequenceUtils.reverseComplement(edge);
            }

            text = info;
          }

          String sampleName = cg.getColor(0).getSampleName();
          if (LINKS != null && !LINKS.isEmpty()) {
            for (CortexLinksMap link : LINKS) {
              if (sampleName.equals(link.getCortexLinks().getColor(0).getSampleName())) {
                if (link.containsKey(ck)) {
                  CortexLinksRecord clr = link.get(ck);
                  int cov = 0;
                  for (CortexJunctionsRecord cjr : clr.getJunctions()) {
                    cov += cjr.getCoverage(0);
                  }

                  text += " (" + cov + " links)";
                }
              }
            }
          }

          jo.put("cr", text);
        }
      }

      return jo.toString();
    }
Esempio n. 2
0
 public CtxVertex(String kmer, int pos, VertexType vt, CortexRecord cr) {
   this.kmer = kmer;
   this.pos = pos + kmer.length() - 1;
   this.vertexType = vt;
   this.missingFromGraph = (cr == null);
   this.cov = (cr == null) ? 0 : cr.getCoverage(0);
 }