Skip to content

Commit 20a570d

Browse files
committed
Ensure that sample_id and experiment_id are passed when extracting batch info
1 parent 0226f3c commit 20a570d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

rnaseq_pipeline/sources/geo.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ def run(self):
103103
raise RuntimeError('{} GEO record is not linked to SRA.'.format(self.gsm))
104104
platform, srx_url = samples_info[self.gsm]
105105
srx = parse_qs(urlparse(srx_url).query)['term'][0]
106-
yield DownloadSraExperiment(srx, metadata=self.metadata)
106+
yield DownloadSraExperiment(srx, metadata=dict(**self.metadata, sample_id=self.sample_id))
107107

108-
class DownloadGeoSeriesMetadata(RerunnableTaskMixin, luigi.Task):
108+
class DownloadGeoSeriesMetadata(TaskWithMetadataMixin, RerunnableTaskMixin, luigi.Task):
109109
"""
110110
Download a GEO Series metadata containg information about related GEO
111111
Samples.
@@ -138,7 +138,7 @@ def run(self):
138138
gsms = collect_geo_samples(self.input().path)
139139
if not gsms:
140140
raise ValueError('{} has no related GEO samples with RNA-Seq data.'.format(self.gse))
141-
yield [DownloadGeoSample(gsm) for gsm in gsms]
141+
yield [DownloadGeoSample(gsm, metadata=self.metadata) for gsm in gsms]
142142

143143
@requires(DownloadGeoSeriesMetadata, DownloadGeoSeries)
144144
class ExtractGeoSeriesBatchInfo(luigi.Task):

rnaseq_pipeline/sources/sra.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def run(self):
157157
# on the number of mates per spot
158158
is_paired = (self.sample_id in sra_cfg.paired_read_experiments) or (run.spots_with_mates > 0) or (run.LibraryLayout == 'PAIRED')
159159

160-
yield DumpSraRun(run.Run, self.srx, paired_reads=is_paired, metadata=self.metadata)
160+
yield DumpSraRun(run.Run, self.srx, paired_reads=is_paired, metadata=dict(**self.metadata, sample_id=self.sample_id))
161161

162162
class DownloadSraProjectRunInfo(TaskWithMetadataMixin, RerunnableTaskMixin, luigi.Task):
163163
"""

rnaseq_pipeline/tasks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -376,9 +376,9 @@ def requires(self):
376376
# TODO: Have a generic strategy for extracting batch info that would
377377
# work for all sources
378378
if self.external_database == 'GEO':
379-
return ExtractGeoSeriesBatchInfo(self.accession)
379+
return ExtractGeoSeriesBatchInfo(self.accession, metadata=dict(experiment_id=self.experiment_id))
380380
elif self.external_database == 'SRA':
381-
return ExtractSraProjectBatchInfo(self.accession)
381+
return ExtractSraProjectBatchInfo(self.accession, metadata=dict(experiment_id=self.experiment_id))
382382
else:
383383
raise NotImplementedError('Extracting batch information from {} is not supported.'.format(self.external_database))
384384

0 commit comments

Comments
 (0)