2828
2929logger = logging .getLogger (__name__ )
3030
31+ class sra (luigi .Config ):
32+ task_namespace = 'rnaseq_pipeline.sources'
33+ ncbi_public_dir : str = luigi .Parameter ()
34+
35+ sra_config = sra ()
36+
3137# columns to use when a runinfo file lacks a header
3238SRA_RUNINFO_COLUMNS = ['Run' , 'ReleaseDate' , 'LoadDate' , 'spots' , 'bases' , 'spots_with_mates' , 'avgLength' , 'size_MB' ,
3339 'AssemblyName' , 'download_path' , 'Experiment' , 'LibraryName' , 'LibraryStrategy' ,
@@ -164,12 +170,6 @@ class PrefetchSraRun(TaskWithMetadataMixin, luigi.Task):
164170
165171 retry_count = 3
166172
167- @staticmethod
168- def _get_ncbi_public_dir ():
169- ret = subprocess .run (['vdb-config' , '-p' ], stdout = subprocess .PIPE , universal_newlines = True )
170- config_xml = ET .fromstring (ret .stdout )
171- return config_xml .find ('repository' ).find ('user' ).find ('main' ).find ('public' ).find ('root' ).text
172-
173173 def run (self ):
174174 yield sratoolkit .Prefetch (srr_accession = self .srr ,
175175 output_file = self .output ().path ,
@@ -179,7 +179,7 @@ def run(self):
179179 walltime = timedelta (hours = 2 ))
180180
181181 def output (self ):
182- return luigi .LocalTarget (join (self . _get_ncbi_public_dir () , 'sra' , f'{ self .srr } .sra' ))
182+ return luigi .LocalTarget (join (sra_config . ncbi_public_dir , 'sra' , f'{ self .srr } .sra' ))
183183
184184@requires (PrefetchSraRun )
185185class DumpSraRun (luigi .Task ):
0 commit comments