biodavidjm / artMS

Analytical R Tools for Mass Spectrometry
GNU General Public License v3.0
14 stars 7 forks source link

dont_check_names used for data.frame and data.table evidence_file #152

Open bpolacco opened 4 years ago

bpolacco commented 4 years ago

I discovered a problem in .artms_checkIfFile that was using dont_check_names the opposite that the name implies (beware double negative). The only function to use this argument that I found (grep dont_check_names ./R/*) was protein2SiteConversion which was also using it opposite of the name, so no effective bug in usage. However, there was a bug when a data.table or data.frame was passed in to protein2SiteConversion as the evidence file: no check.names argument was passed to data.frame() or data.table() so that names were always checked. The function protein2SiteConversion uses names with spaces, e.g. "Leading proteins", so check.names should be FALSE in calls to read.delim(), data.table(), data.frame().

My changes are 1) check_names = !dont_check_names in arguments to read.delim, data.table, data.frame 2) dont_check_names = TRUE inside protein2SiteConversion 3) cleaning up redundant code in if(dont_check_names) statement

bpolacco commented 4 years ago

I'd support changing the argument dont_check_names to check_names in the function .checkIfFile for easier to understand code, but that is potentially a mess if its called places I didn't find, so I didn't use that as my fix.

bpolacco commented 4 years ago

wait on this, I broke something else, it seems.

Its all good now with my second commit.