def should_to_tap_one_file(f_should): f_tap = f_should + PROG_TAG + TAP_SUFFIX f_tap = f_tap.replace(SHOULD_SUFFIX, '') f_log = f_should + PROG_TAG + LOG_SUFFIX f_log = f_log.replace(SHOULD_SUFFIX, '') f_vdj = f_should + PROG_TAG + '.vdj' f_vdj = f_vdj.replace(SHOULD_SUFFIX, '') print "<== %s" % f_should vdj = repseq_vdj.VDJ_File() vdj.parse_from_gen(repseq_vdj.should_results_from_vidjil(args.program.replace('{directory}',args.directory), f_should, f_log)) print "==> %s" % f_vdj vdj.write(open(f_vdj, 'w')) write_should_results_to_tap(vdj, f_tap)
tap_line = should_result_to_tap(should, result, tap_id + 1) if tap_line is not None: if args.verbose or '#!' in tap_line: print tap_line ff.write(tap_line + '\n') if __name__ == '__main__': for f_should in args.file: if '.vdj' in f_should: f_vdj = f_should f_tap = f_vdj + TAP_SUFFIX vdj = repseq_vdj.VDJ_File() vdj.parse_from_file(open(f_vdj)) write_should_results_to_tap(vdj, f_tap) continue should_to_tap_one_file(f_should) if args.revcomp: f_should_rc = f_should + '.rc' os.system('python ../../germline/revcomp-fasta.py < %s > %s' % (f_should, f_should_rc)) should_to_tap_one_file(f_should_rc) print print "=== Summary, should-vdj tests ===" + (' (only locus)' if args.after_two else '')