Skip to content

Instantly share code, notes, and snippets.

@jpshanno
Created July 20, 2018 02:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save jpshanno/bc92209583cc9dc60fe47c26bd78b9b3 to your computer and use it in GitHub Desktop.
Plate Reader Ingest Demo
##BLOCKS= 8
Note:
~End
Plate: Plate#1 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
22.20 0.0675 0.067 0.0701 0.256 0.3226 0.3276 0.0654 0.0646 0.0668 0.0644 0.0655 0.0705
0.0771 0.0665 0.0739 0.0578 0.0724 0.061 0.0749 0.0703 0.0672 0.0739 0.0843 0.0808
0.0878 0.0824 0.0853 0.0564 0.0637 0.0609 0.066 0.0594 0.0639 0.0624 0.0704 0.0671
0.0815 0.0684 0.0739 0.0604 0.0729 0.06 0.0682 0.0601 0.0651 0.0608 0.0688 0.0626
0.1321 0.1215 0.1385 0.0586 0.0687 0.0625 0.0656 0.0585 0.0645 0.0576 0.0699 0.0633
0.1813 0.1796 0.1888 0.0622 0.0626 0.0635 0.0629 0.0576 0.0616 0.057 0.0664 0.062
0.27 0.2692 0.2758 0.0591 0.0706 0.0647 0.0722 0.0624 0.0682 0.0644 0.069 0.0673
0.4654 0.4494 0.5092 0.0577 0.0654 0.0665 0.0653 0.0643 0.0637 0.0646 0.0696 0.0728
~End
Plate: Plate#2 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
26.60 0.0735 0.086 0.0709 0.0643 0.0645 0.0638 0.1344 0.1293 0.1306 0.0629 0.0652 0.0611
0.0851 0.0741 0.0835 0.0745 0.0821 0.0759 0.0647 0.0615 0.0654 0.0618 0.0723 0.0606
0.0894 0.0912 0.0887 0.0609 0.0625 0.0601 0.0612 0.0614 0.0631 0.0605 0.063 0.0587
0.0919 0.0822 0.0926 0.0647 0.0699 0.0654 0.0694 0.0739 0.0684 0.0631 0.0648 0.0594
0.1318 0.1272 0.1318 0.0641 0.0702 0.0624 0.0638 0.0622 0.0632 0.0626 0.0623 0.0576
0.1808 0.1817 0.1837 0.0667 0.0687 0.0641 0.0822 0.0804 0.0819 0.0653 0.0669 0.0645
0.2836 0.2777 0.285 0.0651 0.0728 0.066 0.0756 0.0688 0.0708 0.0672 0.0712 0.0653
0.5644 0.5765 0.57 0.0721 0.0694 0.0686 0.0869 0.0863 0.08 0.07 0.0714 0.0687
~End
Plate: Plate#3 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
23.00 0.0677 0.0673 0.0655 0.0694 0.0672 0.0654 0.1095 0.1098 0.113 0.0694 0.0686 0.0701
0.0789 0.0658 0.0727 0.0724 0.0816 0.0715 0.1174 0.1126 0.118 0.1852 0.1967 0.1878
0.0961 0.0858 0.0786 0.0646 0.0852 0.0692 0.0715 0.0695 0.0767 0.0709 0.064 0.0649
0.0801 0.0729 0.08 0.0705 0.076 0.069 0.0819 0.0775 0.0873 0.1907 0.1816 0.1819
0.132 0.1205 0.1232 0.0782 0.081 0.0751 0.1562 0.1564 0.1641 0.0597 0.0743 0.0597
0.1846 0.174 0.1701 0.0668 0.0743 0.0658 0.077 0.0604 0.0689 0.0614 0.0635 0.0615
0.2939 0.2757 0.2703 0.0674 0.0983 0.0686 0.0803 0.0694 0.0844 0.0716 0.0718 0.0694
0.5075 0.5496 0.537 0.1566 0.1504 0.149 0.0972 0.097 0.0973 0.1226 0.1184 0.1158
~End
Plate: Plate#4 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
26.60 0.0735 0.086 0.0709 0.0643 0.0645 0.0638 0.1344 0.1293 0.1306 0.0629 0.0652 0.0611
0.0851 0.0741 0.0835 0.0745 0.0821 0.0759 0.0647 0.0615 0.0654 0.0618 0.0723 0.0606
0.0894 0.0912 0.0887 0.0609 0.0625 0.0601 0.0612 0.0614 0.0631 0.0605 0.063 0.0587
0.0919 0.0822 0.0926 0.0647 0.0699 0.0654 0.0694 0.0739 0.0684 0.0631 0.0648 0.0594
0.1318 0.1272 0.1318 0.0641 0.0702 0.0624 0.0638 0.0622 0.0632 0.0626 0.0623 0.0576
0.1808 0.1817 0.1837 0.0667 0.0687 0.0641 0.0822 0.0804 0.0819 0.0653 0.0669 0.0645
0.2836 0.2777 0.285 0.0651 0.0728 0.066 0.0756 0.0688 0.0708 0.0672 0.0712 0.0653
0.5644 0.5765 0.57 0.0721 0.0694 0.0686 0.0869 0.0863 0.08 0.07 0.0714 0.0687
~End
Plate: Plate#5 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
27.60 0.0735 0.0781 0.0736 0.0644 0.0649 0.0655 0.0672 0.0683 0.0691 0.0677 0.0643 0.0659
0.1025 0.0937 0.0912 0.0629 0.0677 0.0618 0.0692 0.0625 0.0624 0.064 0.0622 0.0621
0.1042 0.0999 0.0986 0.0615 0.064 0.0599 0.0659 0.0579 0.066 0.0646 0.0612 0.063
0.0945 0.0882 0.091 0.0639 0.0692 0.0635 0.0682 0.0587 0.0651 0.0624 0.0655 0.0607
0.0394 0.1454 0.1485 0.0597 0.0589 0.0581 0.0634 0.0578 0.0646 0.0597 0.0614 0.0597
0.2188 0.2187 0.2197 0.0593 0.0658 0.0594 0.0663 0.0566 0.0644 0.062 0.0655 0.0613
0.0429 0.2594 0.2623 0.0607 0.0593 0.0594 0.0651 0.0583 0.0645 0.0591 0.07 0.0603
0.0444 0.5456 0.5409 0.0688 0.0735 0.0695 0.0712 0.0696 0.0691 0.0691 0.0636 0.0644
~End
Plate: Plate#6 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
27.70 0.0741 0.0695 0.0727 0.0624 0.0626 0.0634 0.0658 0.0656 0.0645 0.0645 0.0636 0.0633
0.0835 0.0923 0.0956 0.0664 0.0734 0.0664 0.0634 0.0611 0.0643 0.0609 0.0662 0.0628
0.0933 0.0933 0.0987 0.3647 0.3493 0.3611 0.0663 0.0633 0.0659 0.0981 0.103 0.0997
0.0901 0.083 0.09 0.0682 0.0778 0.0684 0.0691 0.0609 0.0693 0.0827 0.0944 0.0822
0.1279 0.1255 0.1385 0.062 0.069 0.0609 0.0653 0.0652 0.0621 0.0597 0.065 0.0598
0.1625 0.1647 0.1666 0.0598 0.0605 0.0589 0.0604 0.0574 0.0606 0.0663 0.0674 0.0596
0.2095 0.2192 0.2238 0.0619 0.0634 0.0597 0.0624 0.0575 0.0621 0.0602 0.0647 0.0607
0.5125 0.5198 0.5353 0.0677 0.0664 0.0669 0.0593 0.0591 0.0626 0.0624 0.0662 0.0676
~End
Plate: Plate#7 1.3 PlateFormat Endpoint Absorbance Raw FALSE 1 1 610 1 12 96 1 8 None
Temperature(�C) 1 2 3 4 5 6 7 8 9 10 11 12
27.70 0.0741 0.0695 0.0727 0.0624 0.0626 0.0634 0.0658 0.0656 0.0645 0.0645 0.0636 0.0633
0.0835 0.0923 0.0956 0.0664 0.0734 0.0664 0.0634 0.0611 0.0643 0.0609 0.0662 0.0628
0.0933 0.0933 0.0987 0.3647 0.3493 0.3611 0.0663 0.0633 0.0659 0.0981 0.103 0.0997
0.0901 0.083 0.09 0.0682 0.0778 0.0684 0.0691 0.0609 0.0693 0.0827 0.0944 0.0822
0.1279 0.1255 0.1385 0.062 0.069 0.0609 0.0653 0.0652 0.0621 0.0597 0.065 0.0598
0.1625 0.1647 0.1666 0.0598 0.0605 0.0589 0.0604 0.0574 0.0606 0.0663 0.0674 0.0596
0.2095 0.2192 0.2238 0.0619 0.0634 0.0597 0.0624 0.0575 0.0621 0.0602 0.0647 0.0607
0.5125 0.5198 0.5353 0.0677 0.0664 0.0669 0.0593 0.0591 0.0626 0.0624 0.0662 0.0676
~End
Original Filename: Ammonium_2018-06-07.pda Date Last Saved: 6/21/2018
Copyright � 2004 Molecular Devices. All rights reserved.
ingest_spectramax2 <- function(input.source) {
# input.source <-
# "../Raw/Plate_Reader/ammonium/Ammonium_2018-06-19.txt"
raw_text <-
scan(input.source,
what = character())
exported_format <-
unique(grep("PlateFormat|TimeFormat",
raw_text,
value = TRUE))
if(length(exported_format) > 1){
stop("The input.source ",
input.source,
" contains plates exported in Plate and Time format. Please provide a file with only one export format.")
}
if(!match(exported_format, c("PlateFormat", "TimeFormat"))){
stop("The input.source ",
input.source,
" was not exported in plate or time format.")
}
# Plate Format ------------------------------------------------------------
## Check that the export source is 'Raw'
file_note <-
if(grep("~End", raw_text)[1] - grep("Note:", raw_text) != 1){
raw_text[grep("Note:", raw_text):grep("~End", raw_text)[1]]
} else {
message("No note present in the header of ",
input.source)
}
plate_end_locations <-
grep("^~End$",
raw_text)[-1] - 1
plate_name_locations <-
grep("Plate:",
raw_text) + 1
plate_header_ends <-
grep("Temperature",
raw_text)
header_data <-
do.call("rbind",
lapply(seq_len(length(plate_name_locations)),
function(x){
plate_name <- plate_name_locations[x]
header_end <- plate_header_ends[x]
data.frame(input_source = basename(input.source),
plate_name = raw_text[plate_name],
software_version = raw_text[(header_end - 15)],
read_method = raw_text[(header_end - 13)],
read_type = raw_text[(header_end - 12)],
data_type = raw_text[(header_end - 11)],
header_info_6 = raw_text[(header_end - 10)],
header_info_7 = raw_text[(header_end - 9)],
header_info_8 = raw_text[(header_end - 8)],
wavelength_nm = raw_text[(header_end - 7)],
header_info_10 = raw_text[(header_end - 6)],
header_info_11 = raw_text[(header_end - 5)],
plate_type = raw_text[(header_end - 4)],
header_info_13 = raw_text[(header_end - 3)],
header_info_14 = raw_text[(header_end - 2)],
header_info_15 = raw_text[(header_end - 1)],
stringsAsFactors = FALSE)
}))
# Use plate_type in place of 95 for number of wells
data <-
do.call("rbind",
lapply(seq_len(length(plate_name_locations)),
function(x){
plate_name <- raw_text[plate_name_locations[x]]
plate_end <- plate_end_locations[x]
data.frame(input_source = basename(input.source),
plate_name = plate_name,
well = paste0(rep(LETTERS[1:8], each = 12), 1:12),
read_type = unique(header_data[header_data$plate_name == plate_name, "read_type"]),
value = as.numeric(raw_text[(plate_end - (as.numeric(unique(header_data[header_data$plate_name == plate_name, "plate_type"])) - 1)):plate_end]),
stringsAsFactors = FALSE)
}))
return(data)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment