Difference between revisions of "Scripts"

From mn.ibv.aqua
Jump to: navigation, search
(R scripts)
 
(3 intermediate revisions by the same user not shown)
Line 8: Line 8:
  
 
==== Comet assay ====
 
==== Comet assay ====
Some helpful commands to read in all comet assay files simultaneously. Remember to convert the protected <code>.xls</code> files to <code>.csv</code> files, e.g. using LibreOffice<ref>https://www.libreoffice.org/</ref>.  
+
Some helpful commands to read in all comet assay files simultaneously. The protected <code>.xls</code> files need to be converted to <code>.csv</code> files, e.g. using LibreOffice<ref>https://www.libreoffice.org/</ref>.  
 
* In R, navigate to the folder containing your <code>.csv</code> files using the <code>setwd()</code> command.
 
* In R, navigate to the folder containing your <code>.csv</code> files using the <code>setwd()</code> command.
* Read in the tail intensity of the <code>.csv</code> files using the following command: <code>pre.data <- data.frame(sapply(list.files(pattern = "*.csv"), FUN = function(x) { read.csv(x, sep = ";", dec = ",")$Tail.Intensity }))</code>, but remember that you may have to adjust the separator and decimal characters.  
+
* Read in the tail intensity of the <code>.csv</code> files using the following command: <code>pre.data <- data.frame(sapply(list.files(pattern = "*.csv"), FUN = function(x) { read.csv(x, sep = ";", dec = ",")$Tail.Intensity }))</code>, but keep in mind that you may have to adjust the separator and decimal characters.  
* Calculate the median values of the 50 comets scored per sample: <code>pre.data <- sapply(pre.data, FUN = "median")</code>.
+
* Convert the data to a column-based data frame using the median values of the 50 comets scored per sample: <code>data <- data.frame(Tail.Intensity = stack(sapply(pre.data, FUN = "median"))[ , 1])</code>.
* Convert the data to a column-based data frame: <code>data <- data.frame(Tail.Intensity = stack(pre.data)[ , 1]</code>.
 
 
* Remember to add the necessary columns, describing e.g. concentration, locations, or treatments before further analysis.  
 
* Remember to add the necessary columns, describing e.g. concentration, locations, or treatments before further analysis.  
  
Line 23: Line 22:
  
 
== ImageJ==
 
== ImageJ==
 +
 +
== References ==

Latest revision as of 12:56, 17 October 2016

Here you will find a collection of scripts and code snippets used in R, Python and other programming languages.


R scripts

Ecotoxicology

Comet assay

Some helpful commands to read in all comet assay files simultaneously. The protected .xls files need to be converted to .csv files, e.g. using LibreOffice[1].

  • In R, navigate to the folder containing your .csv files using the setwd() command.
  • Read in the tail intensity of the .csv files using the following command: pre.data <- data.frame(sapply(list.files(pattern = "*.csv"), FUN = function(x) { read.csv(x, sep = ";", dec = ",")$Tail.Intensity })), but keep in mind that you may have to adjust the separator and decimal characters.
  • Convert the data to a column-based data frame using the median values of the 50 comets scored per sample: data <- data.frame(Tail.Intensity = stack(sapply(pre.data, FUN = "median"))[ , 1]).
  • Remember to add the necessary columns, describing e.g. concentration, locations, or treatments before further analysis.

Python

Linear filming robot. This script allows to film up to 10 bottles. It will move from bottle to bottle and film each of the bottles for a specified number of seconds (HERE variable name).


Arduino

ImageJ

References

  1. https://www.libreoffice.org/