#! /usr/bin/env python """ Script for uploading FACS data for the YeastLab. FACS data are organized in one main folder which contains a folder with the username. Inside this folder there are folders and subfolders that correspond to different FACS experiments. Inside the username folder there is a file called data_structure.ois which contains the structure of the FACS experiments. This script creates a sample in openBIS for each FACS experiment and uploads the corresponding data in one dataset connected to the samples. The space where the sample should go is detected from the username. The project and experiment are detected from the name of the folders given by the user. The FACS experiment should be named by the users as PROJECT-EXPERIMENT-SAMPLE. The script also automatically assign teh FREEFORM_TABLE_STATE property, which creates tables in the ELN UI. If there are plates in the directories (these are directories named "96 Wells") it creates 96-well plates table (8x12); if there are .fcs files it creates a table with one row and as many columns as there are .fcs files. Multiple tables for one sample can be created. """ import os, glob, re, csv, time, shutil from java.io import File from ch.systemsx.cisd.openbis.dss.etl.dto.api.v1 import SimpleImageDataConfig, ImageMetadata, Location from ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto import Geometry from ch.systemsx.cisd.openbis.dss.etl.dto.api.v1 import SimpleImageContainerDataConfig, ChannelColor from loci.formats import ImageReader from time import * from datetime import * print "##############################################################" def process(transaction): incoming = transaction.getIncoming() projectNameList=[] experimentNameList=[] sampleNameList=[] directoryToImportList=[] userNameList=[] # read the data_structure.ois file to get the structure of the FACS experiment. The name of the FACS experiment contains project, experiment, sample info for openBIS. def getProjExpSample(incoming): for userName in os.listdir(incoming): if not userName.startswith('.'): dataStructure = incoming + "/" + userName + "/data_structure.ois" f = open(dataStructure) lines=f.readlines() for line in lines: path = re.split("/", line) directoryToImport= incoming +"/"+ "/".join(path[:-1]) projectName = re.split("-",path[-1])[0] if len(re.split("-",path[-1])) == 3: #in some cases the user specifies the sample name in the file name experimentName = re.split("-",path[-1])[1] sampleNameFile = re.split("-",path[-1])[2] sampleName = re.split("_properties.oix", sampleNameFile)[0] elif len(re.split("-",path[-1]))==2: #in some cases the sample name is not in the file name, and it will be generated by openBIS experimentNameProp = re.split("-",path[-1])[1] experimentName = re.split("_properties.oix", experimentNameProp)[0] sampleName = "na" projectNameList.append(projectName) experimentNameList.append(experimentName) sampleNameList.append(sampleName) directoryToImportList.append(directoryToImport) userNameList.append(userName) return userNameList, projectNameList, experimentNameList, sampleNameList, directoryToImportList getProjExpSample(incoming.getPath()) #get the space according to the user for user in set (userNameList): if user == "pontia": space = "AARON" elif user == "ottozd": space = "DIANA" elif user == "elfstrok": space = "KRISTINA" elif user == "rgnuegge": space = "ROBERT" #get or create the project for proj in set(projectNameList): project = transaction.getProject("/" + space + "/" + proj) if not project: project = transaction.createNewProject("/" + space + "/" + proj) #get or create the experiment for exp in set(experimentNameList): experiment = transaction.getExperiment("/" + space + "/" + proj + "/" + exp) if not experiment: experiment = transaction.createNewExperiment("/" + space + "/" + proj + "/" + exp, "ANALYSIS") #create te samples, upload the datasets for the sample, create the tables for the ELN UI for sample, directory in zip(sampleNameList,directoryToImportList): table =[] all_subdir_list=[] fcs_file_plate_list=[] for all_subdir in os.listdir(directory): if not all_subdir.startswith('.'): (all_subdir_name, all_subdir_ext) = os.path.splitext(all_subdir) if not (all_subdir_ext): plate_content = directory + "/" + all_subdir_name A1 = str(glob.glob(os.path.join(plate_content, "*A01.fcs"))) if not A1: A1 = '' (A1_content, A1_ext)= os.path.splitext(os.path.basename(A1)) A2 = str(glob.glob(os.path.join(plate_content, "*A02.fcs"))) if not A2: A2 = '' (A2_content, A2_ext)= os.path.splitext(os.path.basename(A2)) A3 = str(glob.glob(os.path.join(plate_content, "*A03.fcs"))) if not A3: A3 = '' (A3_content, A3_ext)= os.path.splitext(os.path.basename(A3)) A4 = str(glob.glob(os.path.join(plate_content, "*A04.fcs"))) if not A4: A4 = '' (A4_content, A4_ext)= os.path.splitext(os.path.basename(A4)) A5 = str(glob.glob(os.path.join(plate_content, "*A05.fcs"))) if not A5: A5 = '' (A5_content, A5_ext)= os.path.splitext(os.path.basename(A5)) A6 = str(glob.glob(os.path.join(plate_content, "*A06.fcs"))) if not A6: A6 = '' (A6_content, A6_ext)= os.path.splitext(os.path.basename(A6)) A7 = str(glob.glob(os.path.join(plate_content, "*A07.fcs"))) if not A7: A7 = '' (A7_content, A7_ext)= os.path.splitext(os.path.basename(A7)) A8 = str(glob.glob(os.path.join(plate_content, "*A08.fcs"))) if not A8: A8 = '' (A8_content, A8_ext)= os.path.splitext(os.path.basename(A8)) A9 = str(glob.glob(os.path.join(plate_content, "*A09.fcs"))) if not A9: A9 = '' (A9_content, A9_ext)= os.path.splitext(os.path.basename(A9)) A10 = str(glob.glob(os.path.join(plate_content, "*A10.fcs"))) if not A10: A10 = '' (A10_content, A10_ext)= os.path.splitext(os.path.basename(A10)) A11 = str(glob.glob(os.path.join(plate_content, "*A11.fcs"))) if not A11: A11 = '' (A11_content, A11_ext)= os.path.splitext(os.path.basename(A11)) A12 = str(glob.glob(os.path.join(plate_content, "*A12.fcs"))) if not A12: A12 = '' (A12_content, A12_ext)= os.path.splitext(os.path.basename(A12)) B1 = str(glob.glob(os.path.join(plate_content, "*B01.fcs"))) if not B1: B1 = '' (B1_content, B1_ext)= os.path.splitext(os.path.basename(B1)) B2 = str(glob.glob(os.path.join(plate_content, "*B02.fcs"))) if not B2: B2 = '' (B2_content, B2_ext)= os.path.splitext(os.path.basename(B2)) B3 = str(glob.glob(os.path.join(plate_content, "*B03.fcs"))) if not B3: B3 = '' (B3_content, B3_ext)= os.path.splitext(os.path.basename(B3)) B4 = str(glob.glob(os.path.join(plate_content, "*B04.fcs"))) if not B4: B4 = '' (B4_content, B4_ext)= os.path.splitext(os.path.basename(B4)) B5 = str(glob.glob(os.path.join(plate_content, "*B05.fcs"))) if not B5: B5 = '' (B5_content, B5_ext)= os.path.splitext(os.path.basename(B5)) B6 = str(glob.glob(os.path.join(plate_content, "*B06.fcs"))) if not B6: B6 = '' (B6_content, B6_ext)= os.path.splitext(os.path.basename(B6)) B7 = str(glob.glob(os.path.join(plate_content, "*B07.fcs"))) if not B7: B7 = '' (B7_content, B7_ext)= os.path.splitext(os.path.basename(B7)) B8 = str(glob.glob(os.path.join(plate_content, "*B08.fcs"))) if not B8: B8 = '' (B8_content, B8_ext)= os.path.splitext(os.path.basename(B8)) B9 = str(glob.glob(os.path.join(plate_content, "*B09.fcs"))) if not B9: B9 = '' (B9_content, B9_ext)= os.path.splitext(os.path.basename(B9)) B10 = str(glob.glob(os.path.join(plate_content, "*B10.fcs"))) if not B10: B10 = '' (B10_content, B10_ext)= os.path.splitext(os.path.basename(B10)) B11 = str(glob.glob(os.path.join(plate_content, "*B11.fcs"))) if not B11: B11 = '' (B11_content, B11_ext)= os.path.splitext(os.path.basename(B11)) B12 = str(glob.glob(os.path.join(plate_content, "*B12.fcs"))) if not B12: B12 = '' (B12_content, B12_ext)= os.path.splitext(os.path.basename(B12)) C1 = str(glob.glob(os.path.join(plate_content, "*C01.fcs"))) if not C1: C1 = '' (C1_content, C1_ext)= os.path.splitext(os.path.basename(C1)) C2 = str(glob.glob(os.path.join(plate_content, "*C02.fcs"))) if not C2: C2 = '' (C2_content, C2_ext)= os.path.splitext(os.path.basename(C2)) C3 = str(glob.glob(os.path.join(plate_content, "*C03.fcs"))) if not C3: C3 = '' (C3_content, C3_ext)= os.path.splitext(os.path.basename(C3)) C4 = str(glob.glob(os.path.join(plate_content, "*C04.fcs"))) if not C4: C4 = '' (C4_content, C4_ext)= os.path.splitext(os.path.basename(C4)) C5 = str(glob.glob(os.path.join(plate_content, "*C05.fcs"))) if not C5: C5 = '' (C5_content, C5_ext)= os.path.splitext(os.path.basename(C5)) C6 = str(glob.glob(os.path.join(plate_content, "*C06.fcs"))) if not C6: C6 = '' (C6_content, C6_ext)= os.path.splitext(os.path.basename(C6)) C7 = str(glob.glob(os.path.join(plate_content, "*C07.fcs"))) if not C7: C7 = '' (C7_content, C7_ext)= os.path.splitext(os.path.basename(C7)) C8 = str(glob.glob(os.path.join(plate_content, "*C08.fcs"))) if not C8: C8 = '' (C8_content, C8_ext)= os.path.splitext(os.path.basename(C8)) C9 = str(glob.glob(os.path.join(plate_content, "*C09.fcs"))) if not C9: C9 = '' (C9_content, C9_ext)= os.path.splitext(os.path.basename(C9)) C10 = str(glob.glob(os.path.join(plate_content, "*C10.fcs"))) if not C10: C10 = '' (C10_content, C10_ext)= os.path.splitext(os.path.basename(C10)) C11 = str(glob.glob(os.path.join(plate_content, "*C11.fcs"))) if not C11: C11 = '' (C11_content, C11_ext)= os.path.splitext(os.path.basename(C11)) C12 = str(glob.glob(os.path.join(plate_content, "*C12.fcs"))) if not C12: C12 = '' (C12_content, C12_ext)= os.path.splitext(os.path.basename(C12)) D1 = str(glob.glob(os.path.join(plate_content, "*D01.fcs"))) if not D1: D1 = '' (D1_content, D1_ext)= os.path.splitext(os.path.basename(D1)) D2 = str(glob.glob(os.path.join(plate_content, "*D02.fcs"))) if not D2: D2 = '' (D2_content, D2_ext)= os.path.splitext(os.path.basename(D2)) D3 = str(glob.glob(os.path.join(plate_content, "*D03.fcs"))) if not D3: D3 = '' (D3_content, D3_ext)= os.path.splitext(os.path.basename(D3)) D4 = str(glob.glob(os.path.join(plate_content, "*D04.fcs"))) if not D4: D4 = '' (D4_content, D4_ext)= os.path.splitext(os.path.basename(D4)) D5 = str(glob.glob(os.path.join(plate_content, "*D05.fcs"))) if not D5: D5 = '' (D5_content, D5_ext)= os.path.splitext(os.path.basename(D5)) D6 = str(glob.glob(os.path.join(plate_content, "*D06.fcs"))) if not D6: D6 = '' (D6_content, D6_ext)= os.path.splitext(os.path.basename(D6)) D7 = str(glob.glob(os.path.join(plate_content, "*D07.fcs"))) if not D7: D7 = '' (D7_content, D7_ext)= os.path.splitext(os.path.basename(D7)) D8 = str(glob.glob(os.path.join(plate_content, "*D08.fcs"))) if not D8: D8 = '' (D8_content, D8_ext)= os.path.splitext(os.path.basename(D8)) D9 = str(glob.glob(os.path.join(plate_content, "*D09.fcs"))) if not D9: D9 = '' (D9_content, D9_ext)= os.path.splitext(os.path.basename(D9)) D10 = str(glob.glob(os.path.join(plate_content, "*D10.fcs"))) if not D10: D10 = '' (D10_content, D10_ext)= os.path.splitext(os.path.basename(D10)) D11 = str(glob.glob(os.path.join(plate_content, "*D11.fcs"))) if not D11: D11 = '' (D11_content, D11_ext)= os.path.splitext(os.path.basename(D11)) D12 = str(glob.glob(os.path.join(plate_content, "*D12.fcs"))) if not D12: D12 = '' (D12_content, D12_ext)= os.path.splitext(os.path.basename(D12)) E1 = str(glob.glob(os.path.join(plate_content, "*E01.fcs"))) if not E1: E1 = '' (E1_content, E1_ext)= os.path.splitext(os.path.basename(E1)) E2 = str(glob.glob(os.path.join(plate_content, "*E02.fcs"))) if not E2: E2 = '' (E2_content, E2_ext)= os.path.splitext(os.path.basename(E2)) E3 = str(glob.glob(os.path.join(plate_content, "*E03.fcs"))) if not E3: E3 = '' (E3_content, E3_ext)= os.path.splitext(os.path.basename(E3)) E4 = str(glob.glob(os.path.join(plate_content, "*E04.fcs"))) if not E4: E4 = '' (E4_content, E4_ext)= os.path.splitext(os.path.basename(E4)) E5 = str(glob.glob(os.path.join(plate_content, "*E05.fcs"))) if not E5: E5 = '' (E5_content, E5_ext)= os.path.splitext(os.path.basename(E5)) E6 = str(glob.glob(os.path.join(plate_content, "*E06.fcs"))) if not E6: E6 = '' (E6_content, E6_ext)= os.path.splitext(os.path.basename(E6)) E7 = str(glob.glob(os.path.join(plate_content, "*E07.fcs"))) if not E7: E7 = '' (E7_content, E7_ext)= os.path.splitext(os.path.basename(E7)) E8 = str(glob.glob(os.path.join(plate_content, "*E08.fcs"))) if not E8: E8 = '' (E8_content, E8_ext)= os.path.splitext(os.path.basename(E8)) E9 = str(glob.glob(os.path.join(plate_content, "*E09.fcs"))) if not E9: E9 = '' (E9_content, E9_ext)= os.path.splitext(os.path.basename(E9)) E10 = str(glob.glob(os.path.join(plate_content, "*E10.fcs"))) if not E10: E10 = '' (E10_content, E10_ext)= os.path.splitext(os.path.basename(E10)) E11 = str(glob.glob(os.path.join(plate_content, "*E11.fcs"))) if not E11: E11 = '' (E11_content, E11_ext)= os.path.splitext(os.path.basename(E11)) E12 = str(glob.glob(os.path.join(plate_content, "*E12.fcs"))) if not E12: E12 = '' (E12_content, E12_ext)= os.path.splitext(os.path.basename(E12)) F1 = str(glob.glob(os.path.join(plate_content, "*F01.fcs"))) if not F1: F1 = '' (F1_content, F1_ext)= os.path.splitext(os.path.basename(F1)) F2 = str(glob.glob(os.path.join(plate_content, "*F02.fcs"))) if not F2: F2 = '' (F2_content, F2_ext)= os.path.splitext(os.path.basename(F2)) F3 = str(glob.glob(os.path.join(plate_content, "*F03.fcs"))) if not F3: F3 = '' (F3_content, F3_ext)= os.path.splitext(os.path.basename(F3)) F4 = str(glob.glob(os.path.join(plate_content, "*F04.fcs"))) if not F4: F4 = '' (F4_content, F4_ext)= os.path.splitext(os.path.basename(F4)) F5 = str(glob.glob(os.path.join(plate_content, "*F05.fcs"))) if not F5: F5 = '' (F5_content, F5_ext)= os.path.splitext(os.path.basename(F5)) F6 = str(glob.glob(os.path.join(plate_content, "*F06.fcs"))) if not F6: F6 = '' (F6_content, F6_ext)= os.path.splitext(os.path.basename(F6)) F7 = str(glob.glob(os.path.join(plate_content, "*F07.fcs"))) if not F7: F7 = '' (F7_content, F7_ext)= os.path.splitext(os.path.basename(F7)) F8 = str(glob.glob(os.path.join(plate_content, "*F08.fcs"))) if not F8: F8 = '' (F8_content, F8_ext)= os.path.splitext(os.path.basename(F8)) F9 = str(glob.glob(os.path.join(plate_content, "*F09.fcs"))) if not F9: F9 = '' (F9_content, F9_ext)= os.path.splitext(os.path.basename(F9)) F10 = str(glob.glob(os.path.join(plate_content, "*F10.fcs"))) if not F10: F10 = '' (F10_content, F10_ext)= os.path.splitext(os.path.basename(F10)) F11 = str(glob.glob(os.path.join(plate_content, "*F11.fcs"))) if not F11: F11 = '' (F11_content, F11_ext)= os.path.splitext(os.path.basename(F11)) F12 = str(glob.glob(os.path.join(plate_content, "*F12.fcs"))) if not F12: F12 = '' (F12_content, F12_ext)= os.path.splitext(os.path.basename(F12)) G1 = str(glob.glob(os.path.join(plate_content, "*G01.fcs"))) if not G1: G1 = '' (G1_content, G1_ext)= os.path.splitext(os.path.basename(G1)) G2 = str(glob.glob(os.path.join(plate_content, "*G02.fcs"))) if not G2: G2 = '' (G2_content, G2_ext)= os.path.splitext(os.path.basename(G2)) G3 = str(glob.glob(os.path.join(plate_content, "*G03.fcs"))) if not G3: G3 = '' (G3_content, G3_ext)= os.path.splitext(os.path.basename(G3)) G4 = str(glob.glob(os.path.join(plate_content, "*G04.fcs"))) if not G4: G4 = '' (G4_content, G4_ext)= os.path.splitext(os.path.basename(G4)) G5 = str(glob.glob(os.path.join(plate_content, "*G05.fcs"))) if not G5: G5 = '' (G5_content, G5_ext)= os.path.splitext(os.path.basename(G5)) G6 = str(glob.glob(os.path.join(plate_content, "*G06.fcs"))) if not G6: G6 = '' (G6_content, G6_ext)= os.path.splitext(os.path.basename(G6)) G7 = str(glob.glob(os.path.join(plate_content, "*G07.fcs"))) if not G7: G7 = '' (G7_content, G7_ext)= os.path.splitext(os.path.basename(G7)) G8 = str(glob.glob(os.path.join(plate_content, "*G08.fcs"))) if not G8: G8 = '' (G8_content, G8_ext)= os.path.splitext(os.path.basename(G8)) G9 = str(glob.glob(os.path.join(plate_content, "*G09.fcs"))) if not G9: G9 = '' (G9_content, G9_ext)= os.path.splitext(os.path.basename(G9)) G10 = str(glob.glob(os.path.join(plate_content, "*G10.fcs"))) if not G10: G10 = '' (G10_content, G10_ext)= os.path.splitext(os.path.basename(G10)) G11 = str(glob.glob(os.path.join(plate_content, "*G11.fcs"))) if not G11: G11 = '' (G11_content, G11_ext)= os.path.splitext(os.path.basename(G11)) G12 = str(glob.glob(os.path.join(plate_content, "*G12.fcs"))) if not G12: G12 = '' (G12_content, G12_ext)= os.path.splitext(os.path.basename(G12)) H1 = str(glob.glob(os.path.join(plate_content, "*H01.fcs"))) if not H1: H1 = '' (H1_content, H1_ext)= os.path.splitext(os.path.basename(H1)) H2 = str(glob.glob(os.path.join(plate_content, "*H02.fcs"))) if not H2: H2 = '' (H2_content, H2_ext)= os.path.splitext(os.path.basename(H2)) H3 = str(glob.glob(os.path.join(plate_content, "*H03.fcs"))) if not H3: H3 = '' (H3_content, H3_ext)= os.path.splitext(os.path.basename(H3)) H4 = str(glob.glob(os.path.join(plate_content, "*H04.fcs"))) if not H4: H4 = '' (H4_content, H4_ext)= os.path.splitext(os.path.basename(H4)) H5 = str(glob.glob(os.path.join(plate_content, "*H05.fcs"))) if not H5: H5 = '' (H5_content, H5_ext)= os.path.splitext(os.path.basename(H5)) H6 = str(glob.glob(os.path.join(plate_content, "*H06.fcs"))) if not H6: H6 = '' (H6_content, H6_ext)= os.path.splitext(os.path.basename(H6)) H7 = str(glob.glob(os.path.join(plate_content, "*H07.fcs"))) if not H7: H7 = '' (H7_content, H7_ext)= os.path.splitext(os.path.basename(H7)) H8 = str(glob.glob(os.path.join(plate_content, "*H08.fcs"))) if not H8: H8 = '' (H8_content, H8_ext)= os.path.splitext(os.path.basename(H8)) H9 = str(glob.glob(os.path.join(plate_content, "*H09.fcs"))) if not H9: H9 = '' (H9_content, H9_ext)= os.path.splitext(os.path.basename(H9)) H10 = str(glob.glob(os.path.join(plate_content, "*H10.fcs"))) if not H10: H10 = '' (H10_content, H10_ext)= os.path.splitext(os.path.basename(H10)) H11 = str(glob.glob(os.path.join(plate_content, "*H11.fcs"))) if not H11: H11 = '' (H11_content, H11_ext)= os.path.splitext(os.path.basename(H11)) H12 = str(glob.glob(os.path.join(plate_content, "*H12.fcs"))) if not H12: H12 = '' (H12_content, H12_ext)= os.path.splitext(os.path.basename(H12)) t = "{\"name\":\"\",\"modelDetailed\":[[""\"" + A1_content + "\" ," "\"" + A2_content + "\"," "\"" + A3_content + "\"," "\"" + A4_content + "\"," "\"" + A5_content + "\"," "\"" + A6_content + "\"," "\"" + A7_content + "\"," "\"" + A8_content + "\"," "\"" + A9_content + "\"," "\"" + A10_content + "\"," "\"" + A11_content + "\"," "\"" + A12_content + "\"""],[""\"" + B1_content + "\" ," "\"" + B2_content + "\"," "\"" + B3_content + "\"," "\"" + B4_content + "\"," "\"" + B5_content + "\"," "\"" + B6_content + "\"," "\"" + B7_content + "\"," "\"" + B8_content + "\"," "\"" + B9_content + "\"," "\"" + B10_content + "\"," "\"" + B11_content + "\"," "\"" + B12_content + "\"""],[""\"" + C1_content + "\" ," "\"" + C2_content + "\"," "\"" + C3_content + "\"," "\"" + C4_content + "\"," "\"" + C5_content + "\"," "\"" + C6_content + "\"," "\"" + C7_content + "\"," "\"" + C8_content + "\"," "\"" + C9_content + "\"," "\"" + C10_content + "\"," "\"" + C11_content + "\"," "\"" + C12_content + "\"""],[""\"" + D1_content + "\" ," "\"" + D2_content + "\"," "\"" + D3_content + "\"," "\"" + D4_content + "\"," "\"" + D5_content + "\"," "\"" + D6_content + "\"," "\"" + D7_content + "\"," "\"" + D8_content + "\"," "\"" + D9_content + "\"," "\"" + D10_content + "\"," "\"" + D11_content + "\"," "\"" + D12_content + "\"""],[""\"" + E1_content + "\" ," "\"" + E2_content + "\"," "\"" + E3_content + "\"," "\"" + E4_content + "\"," "\"" + E5_content + "\"," "\"" + E6_content + "\"," "\"" + E7_content + "\"," "\"" + E8_content + "\"," "\"" + E9_content + "\"," "\"" + E10_content + "\"," "\"" + E11_content + "\"," "\"" + E12_content + "\"""],[""\"" + F1_content + "\" ," "\"" + F2_content + "\"," "\"" + F3_content + "\"," "\"" + F4_content + "\"," "\"" + F5_content + "\"," "\"" + F6_content + "\"," "\"" + F7_content + "\"," "\"" + F8_content + "\"," "\"" + F9_content + "\"," "\"" + F10_content + "\"," "\"" + F11_content + "\"," "\"" + F12_content + "\"""],[""\"" + G1_content + "\" ," "\"" + G2_content + "\"," "\"" + G3_content + "\"," "\"" + G4_content + "\"," "\"" + G5_content + "\"," "\"" + G6_content + "\"," "\"" + G7_content + "\"," "\"" + G8_content + "\"," "\"" + G9_content + "\"," "\"" + G10_content + "\"," "\"" + G11_content + "\"," "\"" + G12_content + "\"""],[""\"" + H1_content + "\" ," "\"" + H2_content + "\"," "\"" + H3_content + "\"," "\"" + H4_content + "\"," "\"" + H5_content + "\"," "\"" + H6_content + "\"," "\"" + H7_content + "\"," "\"" + H8_content + "\"," "\"" + H9_content + "\"," "\"" + H10_content + "\"," "\"" + H11_content + "\"," "\"" + H12_content + "\"""]],\"modelMini\":{\"rows\":[null,null,null,null,null,null,null,null],\"columns\":[null,null,null,null,null,null,null,null,null,null,null,null]}}" table.append(t) elif all_subdir_ext == ".fcs": all_subdir_list.append(all_subdir_name) s = "[\"" + "\",\"".join(str(x) for x in all_subdir_list) + "\"]" #write the filename in each column of teh table t = "{\"name\":\"\",\"modelDetailed\":[" + s + "],\"modelMini\":{\"rows\":[\"\"],\"columns\":" + s + "}}" #for single samples (not in plates) create a table with only one row and as many columns as samples. table.append(t) freeform_table = "[" +','.join(map(str,table)) +"]" print "FREFORM", freeform_table if sample == "na": sampleNew = transaction.createNewSampleWithGeneratedCode(space, "RESULT") sampleNew.setExperiment(experiment) sampleNew.setPropertyValue("FREEFORM_TABLE_STATE", freeform_table) else: sampleNew = transaction.createNewSample("/" + space + "/" + sample, "RESULT" ) sampleNew.setExperiment(experiment) sampleNew.setPropertyValue("FREEFORM_TABLE_STATE", freeform_table) dataSet = transaction.createNewDataSet() dataSet.setDataSetType("FACS_DATA_RAW") dataSet.setSample(sampleNew) transaction.moveFile(directory, dataSet)