wtsi-hgi / Automated-Enhancer-Gene-SCRAMBLEr

A tool to help automate the Genome Scramble project
MIT License
0 stars 1 forks source link

Rename 'pr' Variables #5

Closed KMace closed 1 year ago

KMace commented 1 year ago

https://github.com/wtsi-hgi/Automated-Enhancer-Gene-SCRAMBLEr/blob/5da1fbc6d244dbede92c624d6d2bc0d420354147/find_metrics.py#L66

Not sure what 'pr' means in the variable names?

For example, you know what pyranges does and what it returns, so line 67 genes_pr = pr.PyRanges(gene_data) makes sense to you. But it does not to me; if the variable(s) was named differently it should hopefully make more sense!

Ronnie-Crawford commented 1 year ago

Not sure about this one, the data structure is a pyranges, similar to a pandas dataframe but with a more specific layout, as far as I can tell from their documentation their convention seems to be to name the pyranges "pr", similar to how data frames are often "df", so the suffix is just letting you know its the same data in a different structure

KMace commented 1 year ago

If a variable is just called df then that is quite conventional (although still not ideal as per https://www.freecodecamp.org/news/clean-coding-for-beginners/), but if you have a line that reads gene_expression_df = pd.readcsv(), which is analogous to your code, then that is unnecessary; you don’t need to include pr in a variable if you invoke the pr misnomer within the very same line.

Ronnie-Crawford commented 1 year ago

Renamed to "_search" data frame since that's their use