univieCUBE / gepard

Genome Pair Rapid Dotter
http://cube.univie.ac.at/gepard
MIT License
61 stars 16 forks source link

Output dot matrix? #9

Closed songbowang125 closed 2 years ago

songbowang125 commented 2 years ago

Hi, I am using gepard and want to ask whether Gepard could output the dot matrix (rather than png or jpg files). Since I want to perform some downstream analysis of Gepard results and the dot matrix will be much helpful.

Thanks

songbowang125 commented 2 years ago

I modified the source code a little and successfully outputed the dot matrix. Thanks

JulleeeK commented 2 years ago

Dear songbowang125,

Would it be possible that you share that code? Then maybe we could permanently implement that feature into gepard.

Best, Julius

plnspineda commented 2 years ago

Hello, I would like to have the dot plot matrix output as well, can you share the code? Thank you!

songbowang125 commented 2 years ago

I just made simple modifications of the source code. In line ~311 of file CommandLine.java, an object dm of DotMatrix is created, therefore, I just used a for-loop to output the matrix (dm.getDotMatrix()) to file.

float[][] dotmatrix = dm.getDotMatrix();
String out_file = arguments.getValue("outfile");
File f = new File(out_file);
FileOutputStream fop = new FileOutputStream(f);
OutputStreamWriter writer = new OutputStreamWriter(fop, "UTF-8");

for (int j = 0; j < dm.getHeight(); j++){
    for (int i = 0; i < dm.getWidth(); i++){
        writer.append(dotmatrix[i][j]+"\t");
    }
    writer.append("\n");

}