def get_results(self): self.wait() self.results_lock.acquire() if self.result_alignment is not None: self.results_lock.release() return self.result_alignment if self.killed: raise RuntimeError("PastaAligner Job killed") if self.align_job_list: raise RuntimeError("hmm, this should be empty") else: j_list = self.merge_job_list if j_list: # These are merge jobs that need transitivity merging if self.skip_merge: r = self.multilocus_dataset.new_with_shared_meta() r.append(j_list[0].get_results()[0]) #TODO: this should be changed to be multi-locus for j in j_list[1:]: r[0].merge_in(j.get_results()[0]) #TODO: this should be changed to be multi-locus j.clear_results_object() #assert all(x.is_aligned() for x in r) else: # These are pairwise merges r = self.multilocus_dataset.new_with_shared_meta() for j in j_list: a = CompactAlignment() a.update_from_alignment(j.get_results()) r.append(a) self.result_alignment = r self.finished = True else: r = None # this can happen if jobs are killed self.results_lock.release() return r
parser.add_argument( '-filterfragments', metavar='N', type=int, help='sequences with less than N non-gap sequences will be removed') parser.add_argument( '-rename', metavar='MappingFile', type=argparse.FileType('r'), help= 'Rename sequences, according to the mapping file generated by PASTA') # parser.add_argument('actions', nargs='*', # help='a list of actions (separated by space). Supported actions are: mask (see maskmin), rename (see namemap)') args = parser.parse_args() alg = CompactAlignment() alg.read_file_object(args.infile, args.informat) # if args.actions: # print >>sys.stderr, "will perform the following actions: %s" %",".join(args.actions) # else: # print >>sys.stderr, "No actions will be taken. Input in %s will be written to output in %s." %(args.informat,args.outformat) if args.masksites: alg.mask_gapy_sites(args.masksites) if args.filterfragments: rem = [] for k, v in alg.items(): if len(v.seq) < args.filterfragments: rem.append(k)
help='name of the output file (default: standard output)') parser.add_argument('-informat', nargs='?', default="FASTA", choices = ["COMPACT3", "FASTA"], help='format of the input file (default: FASTA)') parser.add_argument('-outformat', nargs='?', default="FASTA", choices = ["COMPACT3", "FASTA", "PHYLIP"], help='format of the output file (default: FASTA)') parser.add_argument('-masksites', metavar='N', type=int, help='sites with less than N non-gap characters will be masked out') parser.add_argument('-filterfragments', metavar='N', type=int, help='sequences with less than N non-gap sequences will be removed') parser.add_argument('-rename', metavar='MappingFile', type=argparse.FileType('r'), help='Rename sequences, according to the mapping file generated by PASTA') # parser.add_argument('actions', nargs='*', # help='a list of actions (separated by space). Supported actions are: mask (see maskmin), rename (see namemap)') args = parser.parse_args() alg = CompactAlignment() alg.read_file_object(args.infile,args.informat) # if args.actions: # print >>sys.stderr, "will perform the following actions: %s" %",".join(args.actions) # else: # print >>sys.stderr, "No actions will be taken. Input in %s will be written to output in %s." %(args.informat,args.outformat) if args.masksites: alg.mask_gapy_sites(args.masksites) if args.filterfragments: rem = [] for k, v in alg.iteritems(): if len(v.seq) < args.filterfragments: rem.append(k)