- You can install **Google Scholar [[https://chrome.google.com/webstore/detail/google-scholar-button/ldipcbpaocekfooobnbcddclnhejkcpn?hl=en|Button]]**add-on for an easier way of searching Google Scholar. You select the paper title and then click on the little blue icon on the top right corner. For any paper which you want to cite on the lab wiki, find it on Google Scholar, click on "More>Cite" and copy the MLA format. Also, use [[https://gsuite.google.com/marketplace/app/paperpile/894076725911|Paperpile]] for easy citation in Google doc, and Math [[https://gsuite.google.com/marketplace/app/math_equations/825973477142|Equations]] for writing and manipulating equations on Google presentations. | - You can install **Google Scholar [[https://chrome.google.com/webstore/detail/google-scholar-button/ldipcbpaocekfooobnbcddclnhejkcpn?hl=en|Button]]**add-on for an easier way of searching Google Scholar. You select the paper title and then click on the little blue icon on the top right corner. For any paper which you want to cite on the lab wiki, find it on Google Scholar, click on "More>Cite" and copy the MLA format. Also, use [[https://gsuite.google.com/marketplace/app/paperpile/894076725911|Paperpile]] for easy citation in Google doc, and Math [[https://gsuite.google.com/marketplace/app/math_equations/825973477142|Equations]] for writing and manipulating equations on Google presentations. |
- **Code style** in Oncinfo lab: We follow Hadley Wickhams’s R Style [[http://adv-r.had.co.nz/Style.html|Guide]] unless another convention is mentioned below. The goal is to include as much code as possible on 1 page so that it is easier to skim while keeping the overall structure such as proper indentation. Use [[https://contributions.bioconductor.org/r-code.html?q=inde#indentation|2 spaces]] (not tabs) for indentation. Like writing English texts, organize each script in small paragraphs and avoid extra white lines. Give each paragraph a short title in a comment. \\ When writing R code, use "''x <- 5''" for assigning a value to a variable. Do NOT use "''x = 5''" or "''x<-5''". We use**[[https://en.wikipedia.org/wiki/Camel_case|camelCase]]**in R, so do NOT use underscore, '_', and dot, '.', in variable or function names. E.g., instead of "''inverse_of''", use "''inverseOf''" as a variable name or function name so that you can select it by 1 click. Almost all functions must return a list so that extending them will be easy. Use "''##''" for comments NOT a single "''#''". Boolean flags and variable names start with and as [[https://en.wikipedia.org/wiki/Auxiliary_verb|auxiliary]] verb like ''do'', ''is'', or ''has'', e.g., ''doPlot'', ''isSingle'', ''hasMeta'', etc. Write the name of the loaded object in a comment in front of ''load()''. \\ Avoid long lines of code. Most lines should be < 90 characters, and all lines must be <100 characters . Thus, do NOT include space when using ''='' in function calls. Good example: ''average <- mean(feet[ ,"real"]/12+inches, na.rm=TRUE) ## Spaces only around "<-" and after ","''. The space in "''[ ,''" is OK, which refers to all rows. It is better to place a space before the parenthesis after "''if (''", "''for (''", and alike, but do NOT use space between a function name and ''"("'' e.g., write ''plot(Data)''. When the line is long, it usually means you need to extract some of it and define a new variable right above that line. \\ Data structures in R can be ordered from simple to complex as follows: number , vector, matrix, and list. Always use the simplest possible data structure, e.g., do not use a list when you can use a matrix and do not use a matrix with one column when you can use a named vector. The reson is that R has more tools for simpler data structures, e.g., ''sum'' and ''paste'' work on vectors, but not lists. To __add or modify__ a new element to a list use double square brackets like {{:wiki:public:screen_shot_2021-05-25_at_9.00.51_pm.png?linkonly|this}} , not "''$''". You can use "''$''" to __access__ elements of a list like ''A1 <- list1$matrixA'' (with some [[https://oncinfo.org/mohsens_lab_notebook#section20240211|caveates]]), but NOT to access a column of a data frame. Do not use [[https://www.datacamp.com/tutorial/pipe-r-tutorial|pipes]] in R (i.e., ''%>%'' and ''|>'') due to its [[https://stackoverflow.com/questions/38880352/should-i-avoid-programming-packages-with-pipe-operators|drawbacks]] outlined by Hadley [[https://r4ds.had.co.nz/pipes.html#when-not-to-use-the-pipe|Wickham]]. | - **Code style** in Oncinfo lab: We follow Hadley Wickhams’s R Style [[http://adv-r.had.co.nz/Style.html|Guide]] unless another convention is mentioned below. The goal is to include as much code as possible on 1 page so that it is easier to skim while keeping the overall structure such as proper indentation. Use [[https://contributions.bioconductor.org/r-code.html?q=inde#indentation|2 spaces]] (not tabs) for indentation. Like writing English texts, organize each script in small paragraphs and avoid extra white lines. Give each paragraph a short title in a comment. \\ When writing R code, use "''x <- 5''" for assigning a value to a variable. Do NOT use "''x = 5''" or "''x<-5''". We use**[[https://en.wikipedia.org/wiki/Camel_case|camelCase]]**in R, so do NOT use underscore, '_', and dot, '.', in variable or function names. E.g., instead of "''inverse_of''", use "''inverseOf''" as a variable name or function name so that you can select it by 1 click. Almost all functions must return a list so that extending them will be easy. Use "''##''" for comments NOT a single "''#''". Boolean flags and variable names start with and as [[https://en.wikipedia.org/wiki/Auxiliary_verb|auxiliary]] verb like ''do'', ''is'', or ''has'', e.g., ''doPlot'', ''isSingle'', ''hasMeta'', etc. Write the name of the loaded object in a comment in front of ''load()''. \\ Avoid long lines of code. Most lines should be < 90 characters, and all lines must be <100 characters . Thus, do NOT include space when using ''='' in function calls. Good example: ''average <- mean(feet[ ,"real"]/12+inches, na.rm=TRUE) ## Spaces only around "<-" and after ","''. The space in "''[ ,''" is OK, which refers to all rows. It is better to place a space before the parenthesis after "''if (''", "''for (''", and alike, but do NOT use space between a function name and ''"("'' e.g., write ''plot(Data)''. Write the FULL name of arguments when calling a function and do NOT reply on their order, which may change in the future. \\ When the line is long, it usually means you need to extract some of it and define a new variable right above that line. \\ Data structures in R can be ordered from simple to complex as follows: number , vector, matrix, and list. Always use the simplest possible data structure, e.g., do not use a list when you can use a matrix and do not use a matrix with one column when you can use a named vector. The reson is that R has more tools for simpler data structures, e.g., ''sum'' and ''paste'' work on vectors, but not lists. To __add or modify__ a new element to a list use double square brackets like {{:wiki:public:screen_shot_2021-05-25_at_9.00.51_pm.png?linkonly|this}} , not "''$''". You can use "''$''" to __access__ elements of a list like ''A1 <- list1$matrixA'' (with some [[https://oncinfo.org/mohsens_lab_notebook#section20240211|caveates]]), but NOT to access a column of a data frame. Do not use [[https://www.datacamp.com/tutorial/pipe-r-tutorial|pipes]] in R (i.e., ''%>%'' and ''|>'') due to its [[https://stackoverflow.com/questions/38880352/should-i-avoid-programming-packages-with-pipe-operators|drawbacks]] outlined by Hadley [[https://r4ds.had.co.nz/pipes.html#when-not-to-use-the-pipe|Wickham]]. |