# HG changeset patch # User jdv # Date 1507925602 14400 # Node ID 8a9f61d082011f89e52985f2bad6511020dacb10 # Parent d561e3f9ccbb848c6ce017584d5527ef9dbc8246 planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/albacore commit 9a7fa5134243f712595bef72121b8006be8a318b diff -r d561e3f9ccbb -r 8a9f61d08201 albacore_1D.py --- a/albacore_1D.py Tue Oct 03 20:12:09 2017 -0400 +++ b/albacore_1D.py Fri Oct 13 16:13:22 2017 -0400 @@ -31,12 +31,16 @@ "--reads_per_fastq_batch", "999999999" ] + ["--barcoding"] * demux ) + out_path = "out_dir/workspace" + pass_path = os.path.join( out_path, "pass" ) + if os.path.exists( pass_path ): + out_path = pass_path if demux: #check for demuxed albacore output and copy to Galaxy output final_dir = "final" if not os.path.exists(final_dir): os.makedirs(final_dir) - dirs = glob.glob("out_dir/workspace/*") + dirs = glob.glob( os.path.join(out_path, "*") ) for d in dirs: if out_fmt == 'fastq': @@ -51,11 +55,16 @@ shutil.copy(found_file, out) elif out_fmt == 'fast5': - bc = os.path.basename( os.path.normpath( d ) ) + ".fast5.tar.gz" - print(d) - print(bc) + if (os.path.isfile(d)): + if (d.endswith('.fast5')): + bc = os.path.basename( os.path.normpath(d) ) + ".tar.gz" + files = [d] + else: + continue + else: + bc = os.path.basename( os.path.normpath( d ) ) + ".fast5.tar.gz" + files = glob.glob( os.path.join( d, "**", "*.fast5"), recursive=True) out = os.path.join( final_dir, bc ) - files = glob.glob( os.path.join( d, "**", "*.fast5"), recursive=True) if len(files) < 1: raise ValueError('No FAST5 output files found') tar = tarfile.open(out, 'w:gz') @@ -68,18 +77,18 @@ else: if out_fmt == 'fastq': #check for single albacore output and copy to Galaxy output - files = glob.glob("out_dir/workspace/*.fastq") + files = glob.glob( os.path.join(out_path, "*.fastq") ) if len(files) != 1: raise ValueError('No or multiple FASTQ output files found') found_file = files[0] shutil.copy(found_file, out_file) elif out_fmt == 'fast5': #check for single albacore output and copy to Galaxy output - files = glob.glob("out_dir/workspace/**/*.fast5", recursive=True) + files = glob.glob( os.path.join(out_path,"**","*.fast5"), recursive=True ) if len(files) < 1: raise ValueError('No FAST5 output files found') tar = tarfile.open(out_file, 'w:gz') - tar.add("out_dir/workspace") + tar.add(out_path) tar.close() else: raise ValueError('Bad output format specified') @@ -97,6 +106,7 @@ # default, so it's easier/safer here just to call the system tar subprocess.call([ "tar", + "--warning=no-unknown-keyword", "-xf", fn, "-C",