@@ -6,7 +6,7 @@ import tempfile
66import subprocess
77import argparse
88
9- __version__ = "0.6.5 "
9+ __version__ = "0.6.6 "
1010
1111def pfd (args , srr_id , extra_args ):
1212 tmp_dir = tempfile .TemporaryDirectory (prefix = "pfd_" ,dir = args .tmpdir )
@@ -43,6 +43,7 @@ def pfd(args, srr_id, extra_args):
4343 wfd [fo ] = open (os .path .join (args .outdir ,fo ), "wb" )
4444 with open (os .path .join (tmp_path ,fo ), "rb" ) as fd :
4545 shutil .copyfileobj (fd , wfd [fo ])
46+ os .remove (os .path .join (tmp_path ,fo ))
4647
4748def split_blocks (start , end , n_pieces ):
4849 total = (end - start + 1 )
@@ -73,6 +74,14 @@ def partition(f, l):
7374 r [1 ].append (i )
7475 return r
7576
77+ def is_sra_file (path ):
78+ f = os .path .basename (path )
79+ if f .lower ().endswith ('.sra' ): return True
80+ if "SRR" in f .upper (): return True
81+ if "ERR" in f .upper (): return True
82+ if "DRR" in f .upper (): return True
83+ return False
84+
7685def main ():
7786 parser = argparse .ArgumentParser (description = "parallel fastq-dump wrapper, extra args will be passed through" )
7887 parser .add_argument ("-s" ,"--sra-id" , help = "SRA id" , action = "append" )
@@ -90,9 +99,7 @@ def main():
9099 sys .exit (0 )
91100
92101 elif args .sra_id :
93- extra_srrs , extra_args = partition (
94- lambda s : "SRR" in s .upper () or s .lower ().endswith ('.sra' ),
95- extra )
102+ extra_srrs , extra_args = partition (is_sra_file ,extra )
96103 args .sra_id .extend (extra_srrs )
97104 sys .stderr .write ("SRR ids: {}\n " .format (args .sra_id ))
98105 sys .stderr .write ("extra args: {}\n " .format (extra_args ))
0 commit comments