genome-rcast / karkinos

Tumor genotyper, that detects SNV, absolute CNV and Tumor contents
Apache License 2.0
10 stars 2 forks source link

RenameSuggestion #33

Open AnonymousAccount4SE opened 1 year ago

AnonymousAccount4SE commented 1 year ago

Renaming Suggestion of Method Names to Make Them More Descriptive


Description

We have developed a tool (NameSpotter) for identifying non-descriptive method names, and using this tool we find several non-descriptive method names in your repository:

/* Non-descriptive Method Name in src/main/java/jp/ac/utokyo/rcast/karkinos/exec/TumorGenotyper.java */
    protected boolean fileExsistanceCheck(List<String> files) {
        for (String s : files) {
            File f = new File(s);
            if (!f.exists()) {
                System.out.println("file does not exsist " + s);
                return false;
            }
        }
        return true;
    }

We considered "fileExsistanceCheck" as non-descriptive because it contains a typo (i.e., Exsistance should be Existence).

/* Non-descriptive Method Name in src/main/java/jp/ac/utokyo/rcast/karkinos/filter/SupportReadsCheck.java */
    private float getAdjuatedLogt(char genomeR, char alt, List<BaseandQData> pileuplist, double tumorratio,
            double copynumber, double normalAF) {
        return OddRatioCalculator.getAdjuatedLogt(genomeR, alt, pileuplist, tumorratio, copynumber, normalAF);
    }
/* Non-descriptive Method Name in src/main/java/jp/ac/utokyo/rcast/karkinos/utils/OddRatioCalculator.java */
    public static float getAdjuatedLogt(char genomeR, char alt,
            List<BaseandQData> pileuplist, double tumorratio, double copynumber,double normalAF) {
        //int copynumbern = getRound(copynumber);

        List<BaseandQData> pileuplistToCheck = getTocheckList(genomeR, alt,
                pileuplist, tumorratio, copynumber,normalAF);

        double reflikehood = 0;
        double altlikehood = 0;
        for (BaseandQData data : pileuplistToCheck) {
            double qual0 = (int) data.getQual() & 0xFF;
            qual0 = qual0 * 0.1;
            double pNomatch = (1 / Math.pow(10, qual0));
            double pmathch = 1 - pNomatch;

            if (equalChar(data.getBase(), genomeR)) {
                reflikehood = reflikehood + pmathch;
                altlikehood = altlikehood + (pNomatch / (double) 3);
            } else {
                reflikehood = reflikehood + (pNomatch / (double) 3);
                altlikehood = altlikehood + pmathch;
            }
        }
        double d = altlikehood / reflikehood;
        return (float) (Math.log10(d));
    }

We considered "getAdjuatedLogt" as non-descriptive because it contains a typo (i.e., Adjuated should be Adjusted).

We have corrected them and commited a pull request.

Do you agree with the judgment?