#description: Inverse log ratios in a data set into a child data set #Import some handy Java classes from java.lang import String from java.lang import Math #set replacement value for 0.0 entries replVal = -200 #get dimensions of dataset n=data.getDataLength() m=data.getDataWidth() #clone the dataset that we will modify a = data.clone() #Set some fields Icon og Navn a.setIcon("data") a.setFile("Jython script calculated inversed log ratios") #calculate the new data set dat = data.getData() newdata = [] for i in range(n): newline = [] for j in range(m): if dat[i][j] == 0.0: new_log_ratio = replVal else: new_log_ratio = 0 - dat[i][j] newline=newline + [ new_log_ratio ] newdata = newdata + [newline] #insert the cloned dataset object into the project tree of JE a.removeFromParent() main.addNode(a,data) a.unLink(0) #insert the new data into the cloned dataset object a.setData(newdata) #Update id fields and headers colInfos = a.getColInfos(); newcolumnID = [] for j in range(m): newColumn =["inv "+colInfos[j][0]] newcolumnID=newcolumnID+[newColumn] a.setColInfos(newcolumnID) a.setColInfoHeaders( ["New identifiers"] )