andersen-lab / Freyja

Depth-weighted De-Mixing
BSD 2-Clause "Simplified" License
102 stars 29 forks source link

Potential bug in sorting code for covariants function #181

Closed JHarrisonEcoEvo closed 1 year ago

JHarrisonEcoEvo commented 1 year ago

Hi, I was checking out the code for the covariants function and found this passage, starting at line 685:

if sort_by.lower() == 'count':
    df = df.sort_values('Count', ascending=False)
elif sort_by.lower() == 'freq':
    df = df.sort_values('Count', ascending=False)

Just checking to see if this should specify different sorting criteria. Perhaps I am missing something elsewhere in the code, but this looked like maybe a typo, since the statement following the conditional is the same. Cheers

dylanpilz commented 1 year ago

Hey @JHarrisonEcoEvo,

Nice catch, I seem to have missed this since plot-covariants sorts by frequency by default, but covariants should obviously sort the values correctly by the user-defined parameter. Will put out a fix soon.

-Dylan