elsasserlab / labcode

Utils to perform frequent data analyses in the lab.
GNU General Public License v3.0
0 stars 1 forks source link

Add files via upload #9

Closed shaorray closed 4 years ago

shaorray commented 4 years ago

Three functions often use in gene count table normalization, quantile normalization is very common in ChIP sample, size factor and median ratio are for RNA expression.

cnluzon commented 4 years ago

Hi @shaorray ! Thanks for contributing to the repo! :) I have realised that in documenting the package I have not written or linked any style guide, as I was not sure how much contribution I would get. But since you are including code, it is important that we agree on certain style, so all the code within the package looks the same and we don't confuse users (and ourselves).

I am aware that for R there is no global agreement on coding standards, but tidyverse coding standard seems to be one of the most widely accepted ones, and it's the one I am following.

So I will make some comments on your pull request according to this, mostly. I will also include this info in the README.

shaorray commented 4 years ago

Ok, I replaced the function name, and camel naming style can leave for methods.

I don't know how to compile the package to include the new file, roxygen2 doesn't add the new namespace to the package.

cnluzon commented 4 years ago

In general you should have the same style everywhere in your code, and even if it feels as nitpicking, it helps in the long run, and also cooperating with others. These are just common good programming practices.

Almost every respectable coding project that involves more than one person (and sometimes even those) has a style guide that developers follow. Some of the initial decisions are a matter of taste, but the code gains in quality and readability just by being consistent, it is definitely a bad practice to have mixed naming conventions within the same code.

You can also use styler to format code, it seems to be working nicely.

About the compiling: If you are using R studio and open the R project attached to the package: It is my understanding that R studio will update the NAMESPACE file when you document or devtools::build(), I think. You should see some line that says Writing NAMESPACE in the process, and then if you look at the file you should see in there lines that contain export(your_function). But do not edit this by hand, it should be generated by Roxygen2.

At this moment if vignettes are built it takes a bit long because there is some bw file that is processed. I'm working in including a small toy dataset that does not stall the build.

cnluzon commented 4 years ago

I have cloned your branch and it did work for me. So what I did:

Then you should be able to run it.

To build, you can call devtools::build() or Command + Shift + B. devtools::check() is also good to see if everything is ok: http://r-pkgs.had.co.nz/check.html