简体   繁体   English

如何将置信度值整合到DNA色谱图图像中?

[英]How to integrate confidence values into DNA chromatogram images?

I'm using biojava to create a chromatogram. 我正在使用biojava创建色谱图。

The chromatogram is an image. 色谱图是图像。 Each basecall is held within a rectange. 每个基本调用都保存在矩形中。

To get x coordinate (left side): gfx.getCallboxBounds(int i).getX(); 要获取x坐标(左侧):gfx.getCallboxBounds(int i).getX();

To get width: gfx.getCallboxBounds(int i).getX() 要获取宽度:gfx.getCallboxBounds(int i).getX()

where the integer i represents the rectangle in the arrangement of rectangles that build the chromatogram. 其中,整数i代表构成色谱图的矩形排列中的矩形。

To get the confidence value of a given base: 要获得给定基数的置信度值:

(I create an array called confidence) confidence[i - 1]; (我创建一个称为置信度的数组)confidence [i-1];

where i is, again, the base in question. 我又在哪里,有关基地。

Confidence values are reported between 1 and 70. The height of the image is 240 pixels. 置信度值报告在1到70之间。图像的高度为240像素。

I want to print 2 pixel thick, gray lines at relatives heights along the sequence, for the width of each basecall. 我想在每个序列的宽度上沿序列的相对高度打印2像素粗的灰线。

For instance, if the quality of basecall (Rectangle) 60 is 40 and its width is 20, a gray line will be drawn at 137 pixels (40 / 70 * 240) for its width. 例如,如果基通话(矩形)60的质量为40,其宽度为20,则将以137像素(40/70 * 240)的宽度绘制一条灰线。

Here is the method that draws the trace: 这是绘制跟踪的方法:

    ChromatogramFactory chromFactory = new ChromatogramFactory();

    Chromatogram chrom = ChromatogramFactory.create(abi);

    ChromatogramGraphic gfx = new ChromatogramGraphic(chrom);

    BufferedImage bi = new BufferedImage(
            gfx.getWidth(),
            gfx.getHeight(),
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = bi.createGraphics();
    g2.setBackground(Color.white);
    g2.clearRect(0, 0, bi.getWidth(), bi.getHeight());
    if (g2.getClip() == null) {
        g2.setClip(new Rectangle(0, 0, bi.getWidth(), bi.getHeight()));
    }
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    gfx.drawTo(g2);

    g2.draw(new java.awt.Rectangle(-10, -10, 5, 5));

EDIT: Also, the sequence length is the same as the number of rectangles. 编辑:而且,序列长度与矩形数相同。 Each letter in the sequence represents a basecall, as does each rectangle. 序列中的每个字母都代表一个碱基调用,每个矩形也是如此。

Using the code below, I was able to add lines at relative locations to give the confidence values: 使用下面的代码,我能够在相对位置添加行以给出置信度值:

    int leftBound = 0;
    int rightBound = 0;
    double confVal = 0;
    double heightDouble = 0;
    int height = 0;

    g2.setColor(Color.LIGHT_GRAY);

    for (int i = 0; i < gfx.getCallboxCount(); i++) {
        leftBound = (int) gfx.getCallboxBounds(i).getX();
        rightBound = (int) ((int) leftBound + gfx.getCallboxBounds(i).getWidth());
        confVal = confidence[i] * 2.67;
        heightDouble = 200 - confVal;
        height = (int) heightDouble;
        g2.drawLine(leftBound, height, rightBound, height);
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM