comparison ALFA/ALFA_wrapper.py @ 28:2496883e588b draft

Uploaded
author charles-bernard
date Fri, 04 Nov 2016 06:12:07 -0400
parents f1a20d50c495
children c8acc8808b52
comparison
equal deleted inserted replaced
27:c3f91012ac19 28:2496883e588b
42 parser.add_argument('--log_report', dest='log_report', action='store', nargs=1, metavar='log_filename', type=str) 42 parser.add_argument('--log_report', dest='log_report', action='store', nargs=1, metavar='log_filename', type=str)
43 parser.add_argument('--tool_dir', dest='GALAXY_TOOL_DIR', action='store', nargs=1, metavar='galaxy_tool_dir_path', type=str) 43 parser.add_argument('--tool_dir', dest='GALAXY_TOOL_DIR', action='store', nargs=1, metavar='galaxy_tool_dir_path', type=str)
44 args = parser.parse_args() 44 args = parser.parse_args()
45 return args 45 return args
46 46
47 def mv_and_rename_user_indexes(stranded_index, unstranded_index): 47 def symlink_user_indexes(stranded_index, unstranded_index):
48 index='index' 48 index='index'
49 shutil.copy(stranded_index, index + '.stranded.index') 49 os.symlink(stranded_index, index + '.stranded.index')
50 shutil.copy(unstranded_index, index + '.unstranded.index') 50 os.symlink(unstranded_index, index + '.unstranded.index')
51 #shutil.copy(stranded_index, index + '.stranded.index')
52 #shutil.copy(unstranded_index, index + '.unstranded.index')
51 return index 53 return index
52 54
53 def get_input2_args(reads_list, format): 55 def get_input2_args(reads_list, format):
54 n = len(reads_list) 56 n = len(reads_list)
55 if n%2 != 0: 57 if n%2 != 0:
97 def main(): 99 def main():
98 args = get_arg() 100 args = get_arg()
99 101
100 if not (args.output_pdf or args.output_png or args.output_svg or args.output_indexes or args.output_count): 102 if not (args.output_pdf or args.output_png or args.output_svg or args.output_indexes or args.output_count):
101 exit_and_explain('Error: no output to return\nProcess Aborted\n') 103 exit_and_explain('Error: no output to return\nProcess Aborted\n')
102
103 tmp_dir = tempfile.mkdtemp(prefix='tmp', suffix='') 104 tmp_dir = tempfile.mkdtemp(prefix='tmp', suffix='')
104
105 logging.basicConfig(level=logging.INFO, filename=args.log_report[0], filemode="a+", format='%(message)s') 105 logging.basicConfig(level=logging.INFO, filename=args.log_report[0], filemode="a+", format='%(message)s')
106
107 alfa_path = os.path.join(args.GALAXY_TOOL_DIR[0], 'ALFA.py') 106 alfa_path = os.path.join(args.GALAXY_TOOL_DIR[0], 'ALFA.py')
108 107
109 #INPUT1: Annotation File 108 #INPUT1: Annotation File
110 if args.indexes: 109 if args.indexes:
111 # The indexes submitted by the user must exhibit the suffix '.(un)stranded.index' and will be called by alfa by their prefix 110 # The indexes submitted by the user must exhibit the suffix '.(un)stranded.index' and will be called by alfa by their prefix
112 index = mv_and_rename_user_indexes(args.indexes[0], args.indexes[1]) 111 index = symlink_user_indexes(args.indexes[0], args.indexes[1])
113 input1_args = '-g %s' % index 112 input1_args = '-g %s' % index
114 elif args.bi_indexes: 113 elif args.bi_indexes:
115 input1_args = '-g %s' % args.bi_indexes[0] 114 input1_args = '-g %s' % args.bi_indexes[0]
116 elif args.annotation_file: 115 elif args.annotation_file:
117 input1_args = '-a %s' % args.annotation_file[0] 116 input1_args = '-a %s' % args.annotation_file[0]