コード例 #1
0
ファイル: Zzz.java プロジェクト: DBHi-BiC/snpEff
  @Override
  public boolean run() {
    for (Gene g : config.getSnpEffectPredictor().getGenome().getGenes()) {
      //			System.out.println(g.getGeneName());
      for (Transcript tr : g) {
        if (!tr.isProteinCoding()) continue;
        if (tr.introns().size() < 2) continue;

        // System.out.println("\t" + tr.getId());
        for (Intron i : tr.introns()) {
          int pos = i.getStart() + (int) (Math.random() * (i.size() - 2)) + 1;

          String line =
              i.getChromosomeName()
                  + "\t"
                  + pos
                  + "\t.\tA\tT\t.\t.\tAC=1;GENE="
                  + g.getGeneName()
                  + ";TR="
                  + tr.getId()
                  + ";INTRON="
                  + i.getRank();
          System.out.println(line);
          sb.append(line + "\n");
        }
      }
    }

    Gpr.toFile(Gpr.HOME + "/introns_test.vcf", sb);

    return true;
  }
コード例 #2
0
  /**
   * Add into to a hash
   *
   * @param hits
   * @param marker
   * @param hit2add
   * @param showGeneDetails
   * @param compareTemplate
   */
  void regionsAddHit(
      HashSet<String> hits,
      Marker hit2add,
      Marker marker,
      boolean showGeneDetails,
      boolean compareTemplate) {
    String hitStr = hit2add.getClass().getSimpleName();

    if (compareTemplate) {
      Gene gene = (Gene) hit2add.findParent(Gene.class);
      if (gene != null)
        hitStr +=
            (hit2add.isStrandPlus() == marker.isStrandPlus())
                ? "_TEMPLATE_STRAND"
                : "_NON_TEMPLATE_STRAND";
    }

    if (showGeneDetails && (hit2add instanceof Gene)) {
      Gene gene = (Gene) hit2add;
      hitStr +=
          "["
              + gene.getBioType()
              + ", "
              + gene.getGeneName()
              + ", "
              + (gene.isProteinCoding() ? "protein" : "not-protein")
              + "]";
    }

    hits.add(hitStr); // Add marker name to the list
  }
コード例 #3
0
ファイル: VariantEffect.java プロジェクト: Tmacme/SnpEff
  public String toString(boolean useSeqOntology, boolean useHgvs) {
    // Get data to show
    String geneId = "", geneName = "", bioType = "", transcriptId = "", exonId = "", customId = "";
    int exonRank = -1;

    if (marker != null) {
      // Gene Id, name and biotype
      Gene gene = getGene();
      Transcript tr = getTranscript();

      // CDS size info
      if (gene != null) {
        geneId = gene.getId();
        geneName = gene.getGeneName();
        bioType = getBiotype();
      }

      // Update trId
      if (tr != null) transcriptId = tr.getId();

      // Exon rank information
      Exon exon = getExon();
      if (exon != null) {
        exonId = exon.getId();
        exonRank = exon.getRank();
      }

      // Regulation
      if (isRegulation()) bioType = ((Regulation) marker).getCellType();
    }

    // Add seqChage's ID
    if (!variant.getId().isEmpty()) customId += variant.getId();

    // Add custom markers
    if ((marker != null) && (marker instanceof Custom))
      customId += (customId.isEmpty() ? "" : ";") + marker.getId();

    // CDS length
    int cdsSize = getCdsLength();

    String errWarn = error + (error.isEmpty() ? "" : "|") + warning;

    String aaChange = "";
    if (useHgvs) aaChange = getHgvs();
    else aaChange = ((aaRef.length() + aaAlt.length()) > 0 ? aaRef + "/" + aaAlt : "");

    return errWarn //
        + "\t"
        + geneId //
        + "\t"
        + geneName //
        + "\t"
        + bioType //
        + "\t"
        + transcriptId //
        + "\t"
        + exonId //
        + "\t"
        + (exonRank >= 0 ? exonRank : "") //
        + "\t"
        + effect(false, false, false, useSeqOntology) //
        + "\t"
        + aaChange //
        + "\t"
        + ((codonsRef.length() + codonsAlt.length()) > 0 ? codonsRef + "/" + codonsAlt : "") //
        + "\t"
        + (codonNum >= 0 ? (codonNum + 1) : "") //
        + "\t"
        + (codonDegeneracy >= 0 ? codonDegeneracy + "" : "") //
        + "\t"
        + (cdsSize >= 0 ? cdsSize : "") //
        + "\t"
        + (codonsAroundOld.length() > 0 ? codonsAroundOld + " / " + codonsAroundNew : "") //
        + "\t"
        + (aasAroundOld.length() > 0 ? aasAroundOld + " / " + aasAroundNew : "") //
        + "\t"
        + customId //
    ;
  }