From ccdff947b616b4aa8f6a1807a523e894cc036772 Mon Sep 17 00:00:00 2001 From: Francesco Asnicar Date: Tue, 29 May 2018 17:21:56 +0200 Subject: [PATCH] trying in fixing unused imports --- strainphlan.py | 6 +- strainphlan_src/add_metadata_tree.py | 26 ++--- strainphlan_src/build_tree_single_strain.py | 48 ++++----- strainphlan_src/compute_distance.py | 36 +++---- strainphlan_src/compute_distance_all.py | 18 ++-- strainphlan_src/extract_markers.py | 4 +- strainphlan_src/ooSubprocess.py | 20 ++-- strainphlan_src/plot_tree_ete2.py | 18 ++-- strainphlan_src/plot_tree_graphlan.py | 76 +++++++-------- strainphlan_src/sam_filter.py | 20 ++-- strainphlan_src/sample2markers.py | 102 ++++++++++---------- 11 files changed, 187 insertions(+), 187 deletions(-) diff --git a/strainphlan.py b/strainphlan.py index c33e3c9..6345297 100755 --- a/strainphlan.py +++ b/strainphlan.py @@ -35,9 +35,9 @@ import pandas import logging import logging.config -import sample2markers -import copy -import threading +# import sample2markers +# import copy +# import threading import numpy import random import gc diff --git a/strainphlan_src/add_metadata_tree.py b/strainphlan_src/add_metadata_tree.py index 93f7c34..934da73 100755 --- a/strainphlan_src/add_metadata_tree.py +++ b/strainphlan_src/add_metadata_tree.py @@ -3,14 +3,14 @@ # at CIBIO, University of Trento, Italy -import sys -import os +# import sys +# import os import argparse as ap import pandas -import copy -import ConfigParser +# import copy +# import ConfigParser import dendropy -import numpy +# import numpy # import ipdb @@ -18,13 +18,13 @@ def read_params(): p = ap.ArgumentParser() p.add_argument('--ifn_trees', nargs='+', required=True, default=None, type=str) p.add_argument('--ifn_metadatas', nargs='+', required=True, default=None, type=str) - p.add_argument('--string_to_remove', + p.add_argument('--string_to_remove', required=False, default='', type=str, help='string to be removed in the tree node names') p.add_argument( - '--metadatas', - nargs='+', - required=False, + '--metadatas', + nargs='+', + required=False, default=['all'], type=str, help='The metadata fields that you want to add. '\ @@ -52,9 +52,9 @@ def main(args): index_col = get_index_col(ifn) df = pandas.read_csv( ifn, - sep='\t', + sep='\t', dtype=unicode, - header=0, + header=0, index_col=index_col) df = df.transpose() df_list.append(df) @@ -73,8 +73,8 @@ def main(args): sample = node.get_node_str().strip("'") sample = sample.replace(' ', '_') sample = sample.replace(args['string_to_remove'], '') - prefixes = [prefix for prefix in - ['k__', 'p__', 'c__', 'o__', + prefixes = [prefix for prefix in + ['k__', 'p__', 'c__', 'o__', 'f__', 'g__', 's__'] \ if prefix in sample] diff --git a/strainphlan_src/build_tree_single_strain.py b/strainphlan_src/build_tree_single_strain.py index c1ede91..d4843c1 100755 --- a/strainphlan_src/build_tree_single_strain.py +++ b/strainphlan_src/build_tree_single_strain.py @@ -6,9 +6,9 @@ __version__ = '0.1' __date__ = '17 Sep 2015' -import sys +# import sys import os -import argparse +import argparse import numpy from Bio import SeqIO import glob @@ -17,34 +17,34 @@ def read_params(): p = argparse.ArgumentParser() p.add_argument( - '--ifn_alignments', + '--ifn_alignments', nargs='+', - required=True, - default=None, + required=True, + default=None, type=str, help='The alignment file.') p.add_argument( - '--log_ofn', - required=True, - default=None, + '--log_ofn', + required=True, + default=None, type=str, help='The log file.') p.add_argument( - '--nprocs', - required=True, - default=None, + '--nprocs', + required=True, + default=None, type=int, help='Number of processors.') p.add_argument( - '--bootstrap_raxml', - required=False, - default=0, + '--bootstrap_raxml', + required=False, + default=0, type=int, help='The number of runs for bootstraping when building the tree. '\ 'Default 0.') p.add_argument( - '--verbose', - required=False, + '--verbose', + required=False, dest='quiet', action='store_false', help='Show all information. Default "not set".') @@ -84,15 +84,15 @@ def main(args): if len(sample2polrate): log_line = '%s\t%d\t%d\t%f\n'%\ - (os.path.basename(ifn_polymorphic).replace('.polymorphic', ''), - len(singles), - len(sample2polrate), + (os.path.basename(ifn_polymorphic).replace('.polymorphic', ''), + len(singles), + len(sample2polrate), float(len(singles)) / len(sample2polrate)) else: log_line = '%s\t%d\t%d\t%f\n'%\ - (os.path.basename(ifn_polymorphic).replace('.polymorphic', ''), - len(singles), - len(sample2polrate), + (os.path.basename(ifn_polymorphic).replace('.polymorphic', ''), + len(singles), + len(sample2polrate), 0) lfile.write(log_line) @@ -116,7 +116,7 @@ def main(args): cmd += '-N %d '%(args.bootstrap_raxml) cmd += '-s %s '%os.path.abspath(ifn_alignment2) cmd += '-w %s '%os.path.abspath(os.path.dirname(ifn_alignment2)) - cmd += '-n %s '%output_suffix + cmd += '-n %s '%output_suffix cmd += '-p 1234 ' else: cmd = 'raxmlHPC-PTHREADS-SSE3 ' @@ -136,7 +136,7 @@ def main(args): ''' run(cmd) lfile.close() - + diff --git a/strainphlan_src/compute_distance.py b/strainphlan_src/compute_distance.py index 0e687c5..7fea071 100755 --- a/strainphlan_src/compute_distance.py +++ b/strainphlan_src/compute_distance.py @@ -15,8 +15,8 @@ from mixed_utils import dist2file, statistics import argparse as ap -from Bio import SeqIO, Seq, SeqRecord -from collections import defaultdict +from Bio import SeqIO#, Seq, SeqRecord +# from collections import defaultdict import numpy from ooSubprocess import ooSubprocess @@ -24,8 +24,8 @@ ''' SUBST = { 'A':{'A':0.0, 'C':1.0, 'G':1.0, 'T':1.0, '-':1.0}, - 'C':{'A':1.0, 'C':0.0, 'G':1.0, 'T':1.0, '-':1.0}, - 'G':{'A':1.0, 'C':1.0, 'G':0.0, 'T':1.0, '-':1.0}, + 'C':{'A':1.0, 'C':0.0, 'G':1.0, 'T':1.0, '-':1.0}, + 'G':{'A':1.0, 'C':1.0, 'G':0.0, 'T':1.0, '-':1.0}, 'T':{'A':1.0, 'C':1.0, 'G':1.0, 'T':0.0, '-':1.0}, '-':{'A':1.0, 'C':1.0, 'G':1.0, 'T':1.0, '-':0.0}} ''' @@ -35,14 +35,14 @@ def read_params(): p = ap.ArgumentParser() p.add_argument('--ifn_alignment', required=True, default=None, type=str) p.add_argument('--ofn_prefix', required=True, default=None, type=str) - p.add_argument('--count_gaps', + p.add_argument('--count_gaps', required=False, - dest='ignore_gaps', + dest='ignore_gaps', action='store_false') p.set_defaults(ignore_gaps=True) - p.add_argument('--overwrite', + p.add_argument('--overwrite', required=False, - dest='overwrite', + dest='overwrite', action='store_true') p.set_defaults(overwrite=False) @@ -72,7 +72,7 @@ def get_dist(seq1, seq2, ignore_gaps): rel_sim = 1.0 - rel_dist rel_snp = abs_snp / float(len(seq1)) return abs_dist, rel_dist, abs_sim, rel_sim, abs_snp, rel_snp - + def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): ofn_abs_dist = ofn_prefix + '.abs_dist' @@ -101,14 +101,14 @@ def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): for i in range(len(recs)): for j in range(i, len(recs)): - abs_d, rel_d, abs_s, rel_s, abs_sp, rel_sp = get_dist(recs[i].seq, + abs_d, rel_d, abs_s, rel_s, abs_sp, rel_sp = get_dist(recs[i].seq, recs[j].seq, ignore_gaps) abs_dist[i][j] = abs_d abs_dist[j][i] = abs_d abs_dist_flat.append(abs_d) - + rel_dist[i][j] = rel_d rel_dist[j][i] = rel_d rel_dist_flat.append(rel_d) @@ -116,7 +116,7 @@ def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): abs_sim[i][j] = abs_s abs_sim[j][i] = abs_s abs_sim_flat.append(abs_s) - + rel_sim[i][j] = rel_s rel_sim[j][i] = rel_s rel_sim_flat.append(rel_s) @@ -124,7 +124,7 @@ def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): abs_snp[i][j] = abs_sp abs_snp[j][i] = abs_sp abs_snp_flat.append(abs_sp) - + rel_snp[i][j] = rel_sp rel_snp[j][i] = rel_sp rel_snp_flat.append(rel_sp) @@ -198,7 +198,7 @@ def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): '--flabel_size', '5', '--slabel_size', '5', '--max_flabel_len', '200']) - ''' + ''' ofn_abs_snp = ofn_prefix + '.abs_snp' dist2file(abs_snp, labels, ofn_abs_snp) @@ -208,17 +208,17 @@ def compute_dist_matrix(ifn_alignment, ofn_prefix, ignore_gaps, overwrite): dist2file(rel_snp, labels, ofn_rel_snp) with open(ofn_rel_snp + '.info', 'w') as ofile: ofile.write(statistics(rel_snp_flat)[1]) - + def main(args): compute_dist_matrix( - args['ifn_alignment'], + args['ifn_alignment'], args['ofn_prefix'], args['ignore_gaps'], - args['overwrite']) - + args['overwrite']) + if __name__ == "__main__": args = read_params() main(args) diff --git a/strainphlan_src/compute_distance_all.py b/strainphlan_src/compute_distance_all.py index 1da053f..0e5e44e 100755 --- a/strainphlan_src/compute_distance_all.py +++ b/strainphlan_src/compute_distance_all.py @@ -13,9 +13,9 @@ os.environ['PATH'] += ':%s'%MAIN_DIR sys.path.append(MAIN_DIR) import argparse as ap -from Bio import SeqIO, Seq, SeqRecord -from collections import defaultdict -import numpy +from Bio import SeqIO#, Seq, SeqRecord +# from collections import defaultdict +# import numpy from compute_distance import compute_dist_matrix from ooSubprocess import parallelize @@ -24,9 +24,9 @@ def read_params(): p = ap.ArgumentParser() p.add_argument('--ifn_alignments', nargs='+', required=True, default=None, type=str) p.add_argument('--nprocs', required=True, default=None, type=int) - p.add_argument('--count_gaps', + p.add_argument('--count_gaps', required=False, - dest='ignore_gaps', + dest='ignore_gaps', action='store_false') p.set_defaults(ignore_gaps=True) @@ -37,11 +37,11 @@ def read_params(): def compute_dist_matrix_wrapper(args): compute_dist_matrix( - args['ifn_alignment'], + args['ifn_alignment'], args['ofn_prefix'], args['ignore_gaps'], - overwrite=True) - + overwrite=True) + def main(args): @@ -49,7 +49,7 @@ def main(args): for i in range(len(args['ifn_alignments'])): args_list.append({}) args_list[i]['ifn_alignment'] = args['ifn_alignments'][i] - args_list[i]['ofn_prefix'] = args['ifn_alignments'][i] + args_list[i]['ofn_prefix'] = args['ifn_alignments'][i] if not args['ignore_gaps']: args_list[i]['ofn_prefix'] += '.count_gaps' args_list[i]['ignore_gaps'] = args['ignore_gaps'] diff --git a/strainphlan_src/extract_markers.py b/strainphlan_src/extract_markers.py index 2c8ca9c..9b0f0c1 100755 --- a/strainphlan_src/extract_markers.py +++ b/strainphlan_src/extract_markers.py @@ -6,8 +6,8 @@ __version__ = '0.1' __date__ = '1 Sep 2014' -import sys -import os +# import sys +# import os import argparse as ap import pickle import bz2 diff --git a/strainphlan_src/ooSubprocess.py b/strainphlan_src/ooSubprocess.py index 66d435e..111138e 100755 --- a/strainphlan_src/ooSubprocess.py +++ b/strainphlan_src/ooSubprocess.py @@ -8,12 +8,12 @@ import multiprocessing from multiprocessing.pool import ThreadPool import sys -import cStringIO -from tempfile import NamedTemporaryFile +# import cStringIO +from tempfile import NamedTemporaryFile import which import functools import traceback -import numpy +# import numpy class ooSubprocessException(Exception): @@ -62,8 +62,8 @@ def ex( elif get_out_pipe: tmp_file = NamedTemporaryFile(dir=self.tmp_dir) p = subprocess.Popen( - cmd, - stdin=in_pipe, + cmd, + stdin=in_pipe, stdout=tmp_file, **kwargs) p.wait() @@ -74,15 +74,15 @@ def ex( elif out_fn: ofile = open(out_fn, 'w') if out_fn else None result = subprocess.check_call( - cmd, - stdin=in_pipe, - stdout=ofile, + cmd, + stdin=in_pipe, + stdout=ofile, **kwargs) ofile.close() else: result = subprocess.check_call( - cmd, - stdin=in_pipe, + cmd, + stdin=in_pipe, **kwargs) return result diff --git a/strainphlan_src/plot_tree_ete2.py b/strainphlan_src/plot_tree_ete2.py index 6906df0..60d3966 100755 --- a/strainphlan_src/plot_tree_ete2.py +++ b/strainphlan_src/plot_tree_ete2.py @@ -6,23 +6,23 @@ __version__ = '0.1' __date__ = '7 Sep 2016' -import sys -import os -import argparse +# import sys +# import os +import argparse from ete2 import Tree, TreeStyle, NodeStyle def read_params(): p = argparse.ArgumentParser() p.add_argument( - '--ifn', - required=True, - default=None, + '--ifn', + required=True, + default=None, type=str, help='The input tree file.') p.add_argument( - '--ofn', - required=False, - default=None, + '--ofn', + required=False, + default=None, type=str, help='The input tree file.') diff --git a/strainphlan_src/plot_tree_graphlan.py b/strainphlan_src/plot_tree_graphlan.py index f514f24..b405dbb 100755 --- a/strainphlan_src/plot_tree_graphlan.py +++ b/strainphlan_src/plot_tree_graphlan.py @@ -6,78 +6,78 @@ __version__ = '0.1' __date__ = '4 May 2015' -import sys -import os +# import sys +# import os import argparse as ap import dendropy from StringIO import StringIO import re from collections import defaultdict -import ConfigParser +# import ConfigParser import matplotlib.colors as colors import subprocess def read_params(): p = ap.ArgumentParser() - p.add_argument('--ifn_tree', - required=True, - default=None, + p.add_argument('--ifn_tree', + required=True, + default=None, type=str, help='The input tree in newick format.') - p.add_argument('--colorized_metadata', - required=False, - default='unset', + p.add_argument('--colorized_metadata', + required=False, + default='unset', type=str, help='The metadata field to colorize. Default "unset".') - p.add_argument('--fig_size', - required=False, - default=8, + p.add_argument('--fig_size', + required=False, + default=8, type=float, help='The figure size. Default "8".') - p.add_argument('--legend_marker_size', - required=False, - default=20, + p.add_argument('--legend_marker_size', + required=False, + default=20, type=int, help='The legend marker size. Default "20".' ) - p.add_argument('--legend_font_size', - required=False, - default=10, + p.add_argument('--legend_font_size', + required=False, + default=10, type=int, help='The legend font size. Default "10".' ) - p.add_argument('--legend_marker_edge_width', - required=False, - default=0.2, + p.add_argument('--legend_marker_edge_width', + required=False, + default=0.2, type=float, help='The legend marker edge width. Default "0.2".' ) - p.add_argument('--leaf_marker_size', - required=False, - default=20, + p.add_argument('--leaf_marker_size', + required=False, + default=20, type=int, help='The legend marker size. Default "20".' ) - p.add_argument('--leaf_marker_edge_width', - required=False, - default=0.2, + p.add_argument('--leaf_marker_edge_width', + required=False, + default=0.2, type=float, help='The legend marker edge width. Default "0.2".' ) - p.add_argument('--dpi', - required=False, - default=300, + p.add_argument('--dpi', + required=False, + default=300, type=int, help='The figure dpi.') - p.add_argument('--figure_extension', - required=False, - default='.png', + p.add_argument('--figure_extension', + required=False, + default='.png', type=str, help='The figure extension. Default ".png".') - p.add_argument('--ofn_prefix', - required=False, - default=None, + p.add_argument('--ofn_prefix', + required=False, + default=None, type=str, help='The prefix of output files.') return p.parse_args() @@ -88,7 +88,7 @@ def read_params(): def run(cmd): print cmd subprocess.call(cmd.split()) - + @@ -133,7 +133,7 @@ def main(args): ofile.write('branch_bracket_depth\t0\n') #ofile.write('branch_thickness\t1.25\n') ofile.write('annotation_background_width\t0\n') - + # legend ofile.write('#legends\n') ofile.write('class_legend_font_size\t%d\n'%args.legend_font_size) diff --git a/strainphlan_src/sam_filter.py b/strainphlan_src/sam_filter.py index 20a90e9..6079b31 100755 --- a/strainphlan_src/sam_filter.py +++ b/strainphlan_src/sam_filter.py @@ -7,28 +7,28 @@ __date__ = '18 Jul 2015' import sys -import os -import argparse +# import os +import argparse def read_params(): p = argparse.ArgumentParser() p.add_argument( - '--input_file', - required=False, - default=None, + '--input_file', + required=False, + default=None, type=str, help='The input sam file.') p.add_argument( - '--min_align_score', - required=True, - default=None, + '--min_align_score', + required=True, + default=None, type=int, help='The sam records with alignment score smaller than this value ' 'will be discarded.') p.add_argument( - '--verbose', - required=False, + '--verbose', + required=False, dest='quiet', action='store_false', help='Show all information. Default "not set".') diff --git a/strainphlan_src/sample2markers.py b/strainphlan_src/sample2markers.py index 8939529..7bd0d51 100755 --- a/strainphlan_src/sample2markers.py +++ b/strainphlan_src/sample2markers.py @@ -16,23 +16,23 @@ import glob import ooSubprocess from ooSubprocess import print_stderr, trace_unhandled_exceptions -import ConfigParser +# import ConfigParser from Bio import SeqIO, Seq, SeqRecord -import cStringIO +# import cStringIO import msgpack -import random -import subprocess -import bz2 -import gzip +# import random +# import subprocess +# import bz2 +# import gzip import logging import logging.config -import tarfile -import threading +# import tarfile +# import threading import multiprocessing import pysam from collections import defaultdict from scipy import stats -import numpy +# import numpy logging.basicConfig(level=logging.DEBUG, stream=sys.stderr, disable_existing_loggers=False, @@ -57,17 +57,17 @@ def read_params(): p.add_argument('--samtools_exe', required=False, default='samtools', type=str) p.add_argument('--bcftools_exe', required=False, default='bcftools', type=str) p.add_argument( - '--verbose', - required=False, + '--verbose', + required=False, dest='quiet', action='store_false', help='Show all information. Default "not set".') p.set_defaults(quiet=True) ''' p.add_argument( - '--use_processes', - required=False, - default=False, + '--use_processes', + required=False, + default=False, action='store_false', dest='use_threads', help='Use multiprocessing. Default "Use multithreading".') @@ -102,7 +102,7 @@ def build_bowtie2db(ifn_markers, tmp_dir, error_pipe=None): oosp = ooSubprocess.ooSubprocess(tmp_dir) if index_fns == []: oosp.ex( - 'bowtie2-build', + 'bowtie2-build', ['--quiet', ifn_markers, index_path], stderr=error_pipe) else: @@ -113,17 +113,17 @@ def build_bowtie2db(ifn_markers, tmp_dir, error_pipe=None): def sample2markers( - ifn_sample, + ifn_sample, min_read_len, min_align_score, min_base_quality, min_read_depth, error_rate, - ifn_markers, + ifn_markers, index_path, - nprocs=1, + nprocs=1, sam2file=None, - marker2file=None, + marker2file=None, tmp_dir='tmp', quiet=False, samtools_exe='samtools', @@ -136,7 +136,7 @@ def sample2markers( :param marker2file: the file name to store the consensus markers. :param sam2file: the file name to store the sam content. :returns: if marker2file==None, return the dictionary of the consensus - markers. Otherwise, save the result in fasta format to the file declared by + markers. Otherwise, save the result in fasta format to the file declared by marker2file ''' @@ -148,7 +148,7 @@ def sample2markers( # sample to sam sample_pipe = oosp.chain( - 'dump_file.py', + 'dump_file.py', args=['--input_file', ifn_sample], stderr=error_pipe ) @@ -159,7 +159,7 @@ def sample2markers( stderr=error_pipe ) bowtie2_pipe = oosp.chain( - 'bowtie2', + 'bowtie2', args=[ '-U', '-', '-x', index_path, @@ -173,13 +173,13 @@ def sample2markers( else: oosp.chain( 'compress_file.py', - args=['--output_file', sam2file], + args=['--output_file', sam2file], in_pipe=bowtie2_pipe, stderr=error_pipe, stop=True) sam_pipe = oosp.chain( - 'dump_file.py', + 'dump_file.py', args=['--input_file', sam2file], stderr=error_pipe) ofn_bam_sorted_prefix = os.path.join( @@ -187,14 +187,14 @@ def sample2markers( os.path.basename(ifn_sample) + '.bam.sorted') return sam2markers( - sam_file=sam_pipe, + sam_file=sam_pipe, ofn_bam_sorted_prefix=ofn_bam_sorted_prefix, min_align_score=min_align_score, min_base_quality=min_base_quality, min_read_depth=min_read_depth, error_rate=error_rate, - marker2file=marker2file, - oosp=oosp, + marker2file=marker2file, + oosp=oosp, tmp_dir=tmp_dir, quiet=quiet, samtools_exe=samtools_exe, @@ -211,14 +211,14 @@ def save2file(tmp_file, ofn): def sam2markers( - sam_file, + sam_file, ofn_bam_sorted_prefix, min_align_score=None, min_base_quality=30, min_read_depth=0, error_rate=0.01, - marker2file=None, - oosp=None, + marker2file=None, + oosp=None, tmp_dir='tmp', quiet=False, samtools_exe='samtools', @@ -247,12 +247,12 @@ def sam2markers( if type(sam_file) == str: p1 = oosp.chain( - 'dump_file.py', + 'dump_file.py', args=['--input_file', sam_file], stderr=error_pipe) else: p1 = sam_file - + # filter sam if min_align_score == None: p1_filtered = p1 @@ -264,8 +264,8 @@ def sam2markers( stderr=error_pipe) # sam to bam p2 = oosp.chain( - samtools_exe, - args=['view', '-bS', '-'], + samtools_exe, + args=['view', '-bS', '-'], in_pipe=p1_filtered, stderr=error_pipe) @@ -274,12 +274,12 @@ def sam2markers( for tmp_fn in tmp_fns: os.remove(tmp_fn) p3 = oosp.chain( - samtools_exe, - args=['sort', '-', '-o', ofn_bam_sorted_prefix], + samtools_exe, + args=['sort', '-', '-o', ofn_bam_sorted_prefix], in_pipe=p2, stderr=error_pipe) - # extract polimorphic information + # extract polimorphic information marker2seq = defaultdict(dict) pysam.index(p3.name) samfile = pysam.AlignmentFile(p3.name) @@ -307,30 +307,30 @@ def sam2markers( # bam to mpileup p3.seek(0) p4 = oosp.chain( - samtools_exe, - args=['mpileup', '-u', '-'], + samtools_exe, + args=['mpileup', '-u', '-'], in_pipe=p3, stderr=error_pipe) # mpileup to vcf p5 = oosp.chain( - bcftools_exe, - args=['view', '-c', '-g', '-p', '1.1', '-'], + bcftools_exe, + args=['view', '-c', '-g', '-p', '1.1', '-'], in_pipe=p4, stderr=error_pipe) #stderr=open(os.devnull, 'w')) # fix AF1=0 p6 = oosp.chain( - 'fix_AF1.py', - args=['--input_file', '-'], + 'fix_AF1.py', + args=['--input_file', '-'], in_pipe=p5, stderr=error_pipe) # vcf to fastq p7 = oosp.chain( - 'vcfutils.pl', - args=['vcf2fq'], + 'vcfutils.pl', + args=['vcf2fq'], in_pipe=p6, get_out_pipe=True, stderr=error_pipe, @@ -342,7 +342,7 @@ def sam2markers( marker2seq = dict(marker2seq) except Exception as e: logger.error("sam2markers failed on file " + sam_file) - raise + raise if type(p1) == file: p1.close() @@ -369,17 +369,17 @@ def run_sample(args_list): marker2file = output_prefix + args['marker2file_ext'] if args['input_type'] == 'fastq': sample2markers( - ifn_sample=ifn_sample, + ifn_sample=ifn_sample, min_read_len=args['min_read_len'], min_align_score=args['min_align_score'], min_base_quality=args['min_base_quality'], min_read_depth=args['min_read_depth'], error_rate=args['error_rate'], - ifn_markers=args['ifn_markers'], + ifn_markers=args['ifn_markers'], index_path=args['index_path'], nprocs=args['nprocs'], sam2file=sam2file, - marker2file=marker2file, + marker2file=marker2file, tmp_dir=args['output_dir'], quiet=args['quiet'], samtools_exe=args['samtools_exe'], @@ -389,7 +389,7 @@ def run_sample(args_list): args['output_dir'], os.path.basename(ifn_sample) + '.bam.sorted') sam2markers( - sam_file=ifn_sample, + sam_file=ifn_sample, ofn_bam_sorted_prefix=ofn_bam_sorted_prefix, min_align_score=args['min_align_score'], min_base_quality=args['min_base_quality'], @@ -435,7 +435,7 @@ def main(args): print e - + if __name__ == "__main__": args = read_params() main(args)