andim / pyrepseq

Python library for immune repertoire analysis
MIT License
15 stars 4 forks source link

Refactor nearest neighbor module #15

Closed andim closed 10 months ago

andim commented 10 months ago

A couple of refactoring suggestions:

heartnetkung commented 10 months ago

I've completed all the tasks. I'm sorry that I mistakenly pushed to the main branch.

  1. To help declutter the namespace it would be useful to make the helper functions in the nearest neighbor module private.
  2. The code in util.py which is currenlty only used in the nearest neighbor module should be merged into this module.
    • I've moved all functions as you requested except for ensure_numpy() which is also used by James.
    • This function prevents common bugs of inputting pandas series and python list in place of a numpy list, so I anticipate that it can be used in other functions as well.
    • However, if you want me to remove it I can do that as well.
  3. The file name should be shortened to nn.
    • done
  4. The module should be imported to the main namespace.
    • done
andim commented 10 months ago

Great! Thank you very much for turning this around so quickly. Adding an underscore to make the functions internal is exactly what I had in mind.