<commit_before>package cz.siret.prank.score.results

import cz.siret.prank.domain.Prediction
import cz.siret.prank.score.prediction.PrankPocket
import cz.siret.prank.utils.CSV

import static cz.siret.prank.utils.PerfUtils.formatDouble

/**
 * Summary of predicted pockets for one protein.
 */
class PredictionSummary {

    private Prediction prediction

    PredictionSummary(Prediction prediction) {
        this.prediction = prediction
    }

    CSV toCSV() {
        StringBuilder sb = new StringBuilder()

        sb << "name, rank, score, sas_points, surf_atoms, center_x, center_y, center_z, residue_ids, surf_atom_ids   " << '\n'

        for (pp in prediction.reorderedPockets) {

            PrankPocket p = (PrankPocket) pp

            String fmtScore = formatDouble(p.newScore)

            def x = formatDouble(p.centroid.x)
            def y = formatDouble(p.centroid.y)
            def z = formatDouble(p.centroid.z)

            def surfAtomIds = p.surfaceAtoms*.PDBserial.join(" ")

            Set resIds = new TreeSet(p.surfaceAtoms.distinctGroups.collect { it.residueNumber.toString() })
            String strResIds = resIds.join(" ")

            sb << "$p.name,$p.newRank,$fmtScore,${p.sasPoints.count},$p.surfaceAtoms.count,$x,$y,$z,$strResIds,$surfAtomIds\n"
        }

        return new CSV(sb.toString())
    }

    String toTable() {
        return toCSV().tabulated(10,10,10,10,10)
    }

}<commit_msg>full residue ids in predictions.csv<commit_after>package cz.siret.prank.score.results

import cz.siret.prank.domain.Prediction
import cz.siret.prank.score.prediction.PrankPocket
import cz.siret.prank.utils.CSV
import groovy.transform.CompileStatic

import static cz.siret.prank.utils.PerfUtils.formatDouble

/**
 * Summary of predicted pockets for one protein.
 */
@CompileStatic
class PredictionSummary {

    private Prediction prediction

    PredictionSummary(Prediction prediction) {
        this.prediction = prediction
    }

    CSV toCSV() {
        StringBuilder sb = new StringBuilder()

        sb << "name, rank, score, sas_points, surf_atoms, center_x, center_y, center_z, residue_ids, surf_atom_ids   " << '\n'

        for (pp in prediction.reorderedPockets) {

            PrankPocket p = (PrankPocket) pp

            String fmtScore = formatDouble(p.newScore)

            def x = formatDouble(p.centroid.x)
            def y = formatDouble(p.centroid.y)
            def z = formatDouble(p.centroid.z)

            def surfAtomIds = (p.surfaceAtoms*.PDBserial).toSorted().join(" ")

            Set resIds = new TreeSet(p.surfaceAtoms.distinctGroups.collect { it.residueNumber.printFull() })
            String strResIds = resIds.join(" ")

            sb << "$p.name,$p.newRank,$fmtScore,${p.sasPoints.count},$p.surfaceAtoms.count,$x,$y,$z,$strResIds,$surfAtomIds\n"
        }

        return new CSV(sb.toString())
    }

    String toTable() {
        return toCSV().tabulated(10,10,10,10,10)
    }

}
{'fraction_non_alphanumeric': 0.11734866418667568, 'fraction_numerical': 0.006763611768684477, 'mean_word_length': 2.8217054263565893, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4556374', 'n_tokens_mistral': 996, 'n_tokens_neox': 938, 'n_words': 177}