@@ -20,7 +20,7 @@ class RnaSqliteStore(object):
20
20
def __init__ (self , sqliteFileName ):
21
21
self ._dbConn = sqlite3 .connect (sqliteFileName )
22
22
self ._cursor = self ._dbConn .cursor ()
23
- self ._batchSize = 100
23
+ self ._batchSize = 2000
24
24
self ._rnaValueList = []
25
25
self ._expressionValueList = []
26
26
@@ -109,16 +109,20 @@ def setUnits(self, units):
109
109
elif units == "tpm" :
110
110
self ._units = 2
111
111
112
- def writeExpression (self , rnaQuantificationId , quantfilename ):
112
+ def writeExpression (self , rnaQuantificationId , quantfilename ,
113
+ featureSetNames = None ):
113
114
"""
114
115
Reads the quantification results file and adds entries to the
115
116
specified database.
116
117
"""
117
118
isNormalized = self ._isNormalized
118
119
units = self ._units
119
120
featureSets = None
120
- if self ._dataset :
121
- featureSets = self ._dataset .getFeatureSets ()
121
+ if self ._dataset and featureSetNames :
122
+ featureSets = []
123
+ for annotationName in featureSetNames .split ("," ):
124
+ featureSets .append (
125
+ self ._dataset .getFeatureSetByName (annotationName ))
122
126
with open (quantfilename , "r" ) as quantFile :
123
127
quantificationReader = csv .DictReader (quantFile , delimiter = b"\t " )
124
128
for expression in quantificationReader :
@@ -246,9 +250,10 @@ def writeRnaseqTable(rnaDB, analysisIds, description, annotationId,
246
250
rnaDB .batchaddRNAQuantification ()
247
251
248
252
249
- def writeExpressionTable (writer , data ):
253
+ def writeExpressionTable (writer , data , featureSetNames = None ):
250
254
for rnaQuantId , quantfilename in data :
251
- writer .writeExpression (rnaQuantId , quantfilename )
255
+ writer .writeExpression (
256
+ rnaQuantId , quantfilename , featureSetNames = featureSetNames )
252
257
253
258
254
259
def rnaseq2ga (quantificationFilename , sqlFilename , localName , rnaType ,
@@ -291,4 +296,6 @@ def rnaseq2ga(quantificationFilename, sqlFilename, localName, rnaType,
291
296
featureSetIds ,
292
297
readGroupId = readGroupIds , programs = programs ,
293
298
bioSampleId = bioSampleId )
294
- writeExpressionTable (writer , [(localName , quantificationFilename )])
299
+ writeExpressionTable (
300
+ writer , [(localName , quantificationFilename )],
301
+ featureSetNames = featureSetNames )
0 commit comments