Skip to content
Snippets Groups Projects
Commit bdc27dcf authored by kohleman's avatar kohleman
Browse files

bugfix: check which lane is being processed

SVN: 33555
parent c0fd088e
No related branches found
No related tags found
No related merge requests found
...@@ -389,6 +389,58 @@ def getFlowCellMetaData (transaction,flowCellId): ...@@ -389,6 +389,58 @@ def getFlowCellMetaData (transaction,flowCellId):
fcPropertyTypes.sort() fcPropertyTypes.sort()
return fcPropertiesDict, fcPropertyTypes return fcPropertiesDict, fcPropertyTypes
def getIndexesofDataSetsofSample(transaction, sample, DATA_SET_TYPE):
index1List = []
index2List = []
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sample));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
dataSetSc = SearchCriteria()
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.TYPE, DATA_SET_TYPE))
dataSetSc.addSubCriteria(SearchSubCriteria.createSampleCriteria(sc))
foundDataSets = search_service.searchForDataSets(dataSetSc)
for ds in foundDataSets:
index1List.append(ds.getPropertyValue('BARCODE'))
index2List.append(ds.getPropertyValue('INDEX2'))
return index1List, index2List
def searchDataSetsofSample(transaction, sample, index1, index2, DATA_SET_TYPE):
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sample));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
dataSetSc = SearchCriteria()
# set the Search Criteria to an OR condition, default is AND
#dataSetSc.setOperator(SearchCriteria.SearchOperator.MATCH_ANY_CLAUSES)
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.TYPE, DATA_SET_TYPE))
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createPropertyMatch("BARCODE", index1 ))
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createPropertyMatch("INDEX2", index2))
dataSetSc.addSubCriteria(SearchSubCriteria.createSampleCriteria(sc))
foundDataSets = search_service.searchForDataSets(dataSetSc)
print "foundDataSets.size() "+ str(foundDataSets.size())
for ds in foundDataSets:
print "Index1 for found Data Set" + ds.getDataSetCode() + " " + ds.getPropertyValue('BARCODE')
print "Index2 for found Data Set" + ds.getDataSetCode() + " " + ds.getPropertyValue('INDEX2')
return foundDataSets
def sampleSearch(transaction, code=''):
sc = SearchCriteria()
numberOfLanes = 0
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, code));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
if foundSample.size() > 0:
# Search for contained samples
sampleSc = SearchCriteria()
sampleSc.addSubCriteria(SearchSubCriteria.createSampleContainerCriteria(sc))
foundContainedSamples = search_service.searchForSamples(sampleSc)
numberOfLanes = foundContainedSamples.size()
return foundSample, foundContainedSamples, numberOfLanes
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
...@@ -403,7 +455,7 @@ def process(transaction): ...@@ -403,7 +455,7 @@ def process(transaction):
UNDETERMINED='UNDETERMINED' UNDETERMINED='UNDETERMINED'
incomingPath = transaction.getIncoming().getPath() incomingPath = transaction.getIncoming().getPath()
name = transaction.getIncoming().getName().split('-')[0] name, laneNumber = transaction.getIncoming().getName().split('-')
print('\n'+time.ctime()) print('\n'+time.ctime())
...@@ -420,7 +472,7 @@ def process(transaction): ...@@ -420,7 +472,7 @@ def process(transaction):
sa = sample() sa = sample()
sampleDict = {} sampleDict = {}
print ("Length Sample List: " + str(len(sampleList))) print ("Length List samples x tiles x surface: " + str(len(sampleList)))
# key = sample name, value = sample() # key = sample name, value = sample()
for element in range(0, len(sampleList)): for element in range(0, len(sampleList)):
...@@ -448,66 +500,7 @@ def process(transaction): ...@@ -448,66 +500,7 @@ def process(transaction):
for mye in stat: for mye in stat:
mye.rawPercentageReadsPerLane = relRawReadsDict[mye.sampleName] mye.rawPercentageReadsPerLane = relRawReadsDict[mye.sampleName]
def sampleSearch(Code=''): flowcell, lanes, numberOfLanes = sampleSearch(transaction, name)
sc = SearchCriteria()
numberOfLanes = 0
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, Code));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
if foundSample.size() > 0:
# Search for contained samples
sampleSc = SearchCriteria()
sampleSc.addSubCriteria(SearchSubCriteria.createSampleContainerCriteria(sc))
foundContainedSamples = search_service.searchForSamples(sampleSc)
numberOfLanes = foundContainedSamples.size()
return foundSample, foundContainedSamples, numberOfLanes
#--------------------------------------------------------------------------------------------------------------------------------------
def searchDataSetsofSample(sample, index1, index2, DATA_SET_TYPE):
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sample));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
dataSetSc = SearchCriteria()
# set the Search Criteria to an OR condition, default is AND
#dataSetSc.setOperator(SearchCriteria.SearchOperator.MATCH_ANY_CLAUSES)
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.TYPE, DATA_SET_TYPE))
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createPropertyMatch("BARCODE", index1 ))
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createPropertyMatch("INDEX2", index2))
dataSetSc.addSubCriteria(SearchSubCriteria.createSampleCriteria(sc))
foundDataSets = search_service.searchForDataSets(dataSetSc)
print "foundDataSets.size() "+ str(foundDataSets.size())
for ds in foundDataSets:
print "Index1 for found Data Set" + ds.getDataSetCode() + " " + ds.getPropertyValue('BARCODE')
print "Index2 for found Data Set" + ds.getDataSetCode() + " " + ds.getPropertyValue('INDEX2')
return foundDataSets
#--------------------------------------------------------------------------------------------------------------------------------------
def getIndexesofDataSetsofSample(sample, DATA_SET_TYPE):
index1List = []
index2List = []
sc = SearchCriteria()
sc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.CODE, sample));
search_service = transaction.getSearchService()
foundSample = search_service.searchForSamples(sc)
dataSetSc = SearchCriteria()
dataSetSc.addMatchClause(SearchCriteria.MatchClause.createAttributeMatch(SearchCriteria.MatchClauseAttribute.TYPE, DATA_SET_TYPE))
dataSetSc.addSubCriteria(SearchSubCriteria.createSampleCriteria(sc))
foundDataSets = search_service.searchForDataSets(dataSetSc)
for ds in foundDataSets:
index1List.append(ds.getPropertyValue('BARCODE'))
index2List.append(ds.getPropertyValue('INDEX2'))
return index1List, index2List
#--------------------------------------------------------------------------------------------------------------------------------------
flowcell, lanes, numberOfLanes = sampleSearch(name)
index1Length = fcPropertiesDict['INDEXREAD'] index1Length = fcPropertiesDict['INDEXREAD']
index2Length = fcPropertiesDict['INDEXREAD2'] index2Length = fcPropertiesDict['INDEXREAD2']
...@@ -515,9 +508,16 @@ def process(transaction): ...@@ -515,9 +508,16 @@ def process(transaction):
full_lane_statistics = lane_statistics() full_lane_statistics = lane_statistics()
complete_lane_statistic = full_lane_statistics.caluclate_complete_lane_statistic(stat) complete_lane_statistic = full_lane_statistics.caluclate_complete_lane_statistic(stat)
print(complete_lane_statistic.pfYieldSum)
# TODO Can we assume that this is always the same lanes, so we take the first one? # TODO Can we assume that this is always the same lanes, so we take the first one?
lane = lanes[0] lane = lanes[0]
mutable_lane = transaction.getSampleForUpdate(lane.getSampleIdentifier())
for lane in lanes:
if laneNumber == lane.getSampleIdentifier().split(":")[-1]:
mutable_lane = transaction.getSampleForUpdate(lane.getSampleIdentifier())
print("Setting Complete Lanes Statistics For: " + lane.getSampleIdentifier())
break
mutable_lane.setPropertyValue("YIELD_MBASES", str(complete_lane_statistic.pfYieldSum)) mutable_lane.setPropertyValue("YIELD_MBASES", str(complete_lane_statistic.pfYieldSum))
mutable_lane.setPropertyValue('RAW_YIELD_MBASES', str(complete_lane_statistic.rawYieldSum)) mutable_lane.setPropertyValue('RAW_YIELD_MBASES', str(complete_lane_statistic.rawYieldSum))
mutable_lane.setPropertyValue('PERCENTAGE_PASSED_FILTERING',str(complete_lane_statistic.pfPercentage)) mutable_lane.setPropertyValue('PERCENTAGE_PASSED_FILTERING',str(complete_lane_statistic.pfPercentage))
...@@ -534,7 +534,7 @@ def process(transaction): ...@@ -534,7 +534,7 @@ def process(transaction):
print '\n' print '\n'
print mystat print mystat
index1List, index2List = getIndexesofDataSetsofSample(laneCode, FASTQ_DATA_SET_TYPE) index1List, index2List = getIndexesofDataSetsofSample(transaction, laneCode, FASTQ_DATA_SET_TYPE)
print "Searching for "+ searchIndex1 + " in " + str(index1List) print "Searching for "+ searchIndex1 + " in " + str(index1List)
print "Searching for "+ searchIndex2 + " in " + str(index2List) print "Searching for "+ searchIndex2 + " in " + str(index2List)
...@@ -576,7 +576,7 @@ def process(transaction): ...@@ -576,7 +576,7 @@ def process(transaction):
print "searchIndex2 " + str(searchIndex2) print "searchIndex2 " + str(searchIndex2)
# Search for a data set with those two indices # Search for a data set with those two indices
DataSet = searchDataSetsofSample(laneCode, searchIndex1, searchIndex2, FASTQ_DATA_SET_TYPE) DataSet = searchDataSetsofSample(transaction, laneCode, searchIndex1, searchIndex2, FASTQ_DATA_SET_TYPE)
try: try:
assert DataSet.size() == 1 assert DataSet.size() == 1
except AssertionError: except AssertionError:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment