def msiAVUs2BisqueTags(avuXml, bisqueTags, rei): avuXml = avuXml.parseForStr() print "msiAVUs2BisqueTags: avuXml:\n", avuXml indoc = libxml2.parseDoc(avuXml) outdoc = AVUs2BisqueTagsStyle.applyStylesheet(indoc, None) print "msiAVUs2BisqueTags: outdoc:\n", outdoc outdoc = str(outdoc) print "msiAVUs2BisqueTags: outdoc:\n", outdoc irods.fillStrInMsParam(bisqueTags, outdoc)
def msiIsReadyHcsColl(inStr, resStr, rei): res = '' coll = inStr.parseForStr() print "msiIsReadyHcsColl: " + coll # irods connection conn = rei.getRsComm() # select statement i1 = inxIvalPair_t() i1.addInxIval(COL_D_CREATE_TIME, 0) # sort results i1.addInxIval(COL_D_CREATE_TIME, ORDER_BY_DESC) # condition statement i2 = inxValPair_t() i2.addInxVal(COL_COLL_NAME, " like '" + coll + "%'") # create query genQueryInp = genQueryInp_t() genQueryInp.setSelectInp(i1) genQueryInp.setSqlCondInp(i2) genQueryInp.setMaxRows(2) genQueryInp.setContinueInx(0) # execute query print 'msiIsReadyHcsColl: before query' genQueryOut, status = rsGenQuery(conn, genQueryInp) if status !=0: res += "msiIsReadyLeicaColl: ERROR " + str(status) + '\n' if status == CAT_NO_ROWS_FOUND: res += "msiIsReadyLeicaColl: ERROR " + str(status) + '\n' # read the times for sqlRes in genQueryOut.getSqlResult(): for time in sqlRes.getValues(): res += "time " + str(time) + '\n' res += "ready tai not\n" genQueryOut.free() print 'msiIsReadyHcsColl: after query' res = 'test msiIsReadyHcsColl ' + str(coll) + '\n' res = 'READY, query done\n' print res irods.fillStrInMsParam(resStr, res) print 'msiIsReadyHcsColl: exiting'
def msiXSLTransform(inxml, xsl, outxml, rei): inxml = inxml.parseForStr() xsl = xsl.parseForStr() print 'msiXSLTransform: inxml', inxml print 'msiXSLTransform: xsl', xsl doc = libxml2.parseDoc(inxml) styledoc = libxml2.parseDoc(xsl) style = libxslt.parseStylesheetDoc(styledoc) result = style.applyStylesheet(doc, None) result = str(result) print 'msiXSLTransform: result', result irods.fillStrInMsParam(outxml, result)
def msiAVUs2BisqueTags_OLD(path, tagsOut, rei): # tags = '\'' tags = '<resource>' conn = rei.getRsComm() f = iRodsOpen(rei.getRsComm(), path.parseForStr(), 'w') avus = f.getUserMetadata() f.close() print 'msiAVUs2BisqueTags', avus for avu in avus: (a, v, u) = avu #tag = '<tag name="%s" value="%s"/>' % (a, v) tag = '<tag name=\"%s\" value=\"%s\"/>' % (a, v) tags += tag tags += '</resource>' print 'msiAVUs2BisqueTags', tags irods.fillStrInMsParam(tagsOut, str(tags))
def msiIsReadyHcsColl0(inStr, resStr, rei): inStr = inStr.parseForStr() res = 'test msiIsReadyHcsColl0 ' + str(inStr) + '\n' print res irods.fillStrInMsParam(resStr, res)
def msiLeica2FlatDir(inputColl, outputColl, resStr, rei): res = '' inputColl = inputColl.parseForStr() outputColl = outputColl.parseForStr() print 'msiLeica2FlatDir: ', inputColl, outputColl # irods connection conn = rei.getRsComm() # get directory handles c = irodsCollection(conn) res += c.getCollName() + '\n' # experiment experiment = findBasename(inputColl) plateCode = createPlateCode(experiment) c.openCollection(outputColl) c.createCollection(experiment + '_flatdir') outputColl += '/' + experiment + '_flatdir/' c.openCollection(inputColl) res += c.getCollName() + '\n' # plate c.openCollection('slide--S00') wells = c.getSubCollections() for w in wells: # well c.openCollection(w) res += 'WELL ' + c.getCollName() + '\n' wellCode = createWellCode(w) fields = c.getSubCollections() (xmax, ymax) = findFieldIndexRange(fields) for f in fields: c.openCollection(f) res += 'FIELD ' + c.getCollName() + '\n' fieldCode = createFieldCode(xmax, ymax, f) for dataObj in c.getObjects(): image = dataObj[0] resc = dataObj[1] print image stackName = plateCode + '_'+ wellCode + 'f' + fieldCode + '.tif' print stackName f = c.open(image, 'r', resc) f.addUserMetadata('leica.experiment', experiment) f.addUserMetadata('leica2flatdir.collection', outputColl) f.addUserMetadata('leica2flatdir.plateId', plateCode) f.addUserMetadata('leica2flatdir.stackName', stackName) f.addUserMetadata('leica2flatdir.dataObject', outputColl + stackName) f.close() res += image + ' '+ stackName + '\n' c.upCollection() res += '\n' c.upCollection() irods.fillStrInMsParam(resStr, str(res))
def msiBase64Encode(inStr, outStr, rei): input = inStr.parseForStr() output = base64.encodestring(input).strip() irods.fillStrInMsParam(outStr, str(output))
def msiUrlEncode(inParam, inValue, outStr, rei): param = inParam.parseForStr() value = inValue.parseForStr() output = urllib.urlencode( { param: value }) irods.fillStrInMsParam(outStr, str(output))
def msiGetMatrixScreenerField(image, resStr, rei): res = '' image = image.parseForStr() res += createFieldIndex(image) print 'msiGetMatrixScreenerField', res irods.fillStrInMsParam(resStr, str(res))
def msiGetMatrixScreenerWell(image, resStr, rei): res = '' image = image.parseForStr() res += createWellCode(image) print 'msiGetMatrixScreenerWell', res irods.fillStrInMsParam(resStr, str(res))
def msiGetMatrixScreenerExperiment(image, resStr, rei): res = '' image = image.parseForStr() res += createExperiment(image) print 'msiGetMatrixScreenerExperiment', res irods.fillStrInMsParam(resStr, str(res))
def testH2(inStr, resStr, rei): inStr = inStr.parseForStr() res = 'testH2 kukkuu ' + str(inStr) + '\n' print res irods.fillStrInMsParam(resStr, res)
def testH1(resStr, rei): irods.fillStrInMsParam(resStr, 'testH1 kukkuu')