proc MBF_writetable(table table in "The table to save in file", string filename filename in "The filename" //bool add_datatypes="false" in "Add header line showing data types" ) [hidden] data output "Saves a table in a text file. The column names are ouptut in the first row. Will append tables to existing file." //adapted from writetable() function { //check to see if file's already there set(h1="") set(keys=table.columns) eval(readfile(filename)) if(warningcode==2050) foreach(keys) typeinfo(table[i]) if(typeinfo.elemclass == "memblock") delete(table[i]) else() set(h1=h1 & unquote|text(i,"name") & "\t") end() end() set(h1 = h1 & "\n") end() output(errorcode,"error code") write(table, "0) set(sourcedata.sublayout=sourcedata.field) end() //count channels TableFilter("Field==1", table=sourcedata) set(nCh=sourcedata.Channel.max) //set fov variable to be the max sublayout ID set(fov=sourcedata.Field.max) set(nImages=sourcedata.@rowcount/fov) set (directoryStop=at(wellIndex, sourcedata.sourcefilename[0], -1)) //get directory name by cropping full filename where wellindex starts set (dir=substr (sourcedata.sourcefilename[0], 0, directoryStop-1)) set(lastBackSlash=at("/",sourcedata.sourcefilename[0],-2)) set(exptFolder=substr(sourcedata.sourcefilename[0], 0, lastBackSlash)) set (firstSlash=at("/", sourcedata.sourcefilename[0], 1)) set (secondSlash=at("/", sourcedata.sourcefilename[0], 2)) set (barcode=sourcedata.Barcode[0]) eval(readfile(filename=dir&"\\platemap.txt")) if(warningcode!=2050) readtable(filename=dir&"\\platemap.txt", fileformat="ascii", columns="firstrow", separators="\t") tablefilter("wellindex=="&wellindex, table=table) foreach(0..table.@columncount-1, "c") output(table.[c][0], table.@columns[c]) end() // Insert_At(table, barcode, "barcode", table.columncount) Insert_At(table, sourcedata.sourcefilename[0], "Path", 1) Insert_At(table, sourcedata.Barcode[0], "Barcode", 1) set(platemap_tab=table) end() output(Row, "Row") output(column, "Column") output(sourcedata.sourcefilename[0], "Path") output(barcode, "Barcode") } Proc MBF_addTableToObjects( objectlist objects=objects inout "Objects to add to table", table table =table in "table to add to objects" ) "adds table to objects" { if(objects.count==table.@rowcount) foreach(0..table.@columncount-1, "c") //set(newVecName = table.columns[c]) //set(newVec =_["table."&newVecName]) //set(_["objects."&table.@columns[c]]=newVec) set(_["objects."&table.@columns[c]]=_["table."&table.columns[c]]) end() else() warning("Table and objects have different number of entries") end() } Proc MBF_CombineTables( table table_first =table in "table to add to front of table table", table table_second = table_new in "table to recive new table", table table = table out "the combined table" ) "adds table to the front of another table" { if(table_first.@columncount==0) set(table=table_second) return() end() //pad out table_first if not the right number of rows if(table_first.@rowcount