comparison ParseInput.py @ 1:aba3655fdef0 draft

"planemo upload for repository https://github.com/ohsu-comp-bio/quantification commit 897a7dc7cb43e45d6f0fdfe2b2970e59f20f8853"
author watsocam
date Fri, 11 Mar 2022 23:35:52 +0000
parents 928db0f952e3
children
comparison
equal deleted inserted replaced
0:928db0f952e3 1:aba3655fdef0
6 """Function for parsing command line arguments for input to single-cell 6 """Function for parsing command line arguments for input to single-cell
7 data extraction""" 7 data extraction"""
8 8
9 #if __name__ == '__main__': 9 #if __name__ == '__main__':
10 parser = argparse.ArgumentParser() 10 parser = argparse.ArgumentParser()
11 parser.add_argument('--masks',nargs='*') 11 parser.add_argument('--masks',nargs='+', required=True)
12 parser.add_argument('--image') 12 parser.add_argument('--image', required=True)
13 parser.add_argument('--channel_names') 13 parser.add_argument('--channel_names', required=True)
14 parser.add_argument('--output') 14 parser.add_argument('--output', required=True)
15 parser.add_argument(
16 '--mask_props', nargs = "+",
17 help="""
18 Space separated list of additional metrics to be calculated for every mask.
19 This is for metrics that depend only on the cell mask. If the metric depends
20 on signal intensity, use --intensity-props instead.
21 See list at https://scikit-image.org/docs/dev/api/skimage.measure.html#regionprops
22 """
23 )
24 parser.add_argument(
25 '--intensity_props', nargs = "+",
26 help="""
27 Space separated list of additional metrics to be calculated for every marker separately.
28 By default only mean intensity is calculated.
29 If the metric doesn't depend on signal intensity, use --mask-props instead.
30 See list at https://scikit-image.org/docs/dev/api/skimage.measure.html#regionprops
31 Additionally available is gini_index, which calculates a single number
32 between 0 and 1, representing how unequal the signal is distributed in each region.
33 See https://en.wikipedia.org/wiki/Gini_coefficient
34 """
35 )
15 #parser.add_argument('--suffix') 36 #parser.add_argument('--suffix')
16 args = parser.parse_args() 37 args = parser.parse_args()
17 #Create a dictionary object to pass to the next function 38 #Create a dictionary object to pass to the next function
18 dict = {'masks': args.masks, 'image': args.image,\ 39 dict = {'masks': args.masks, 'image': args.image,\
19 'channel_names': args.channel_names,'output':args.output} 40 'channel_names': args.channel_names,'output':args.output,
41 'intensity_props': set(args.intensity_props if args.intensity_props is not None else []).union(["intensity_mean"]),
42 'mask_props': args.mask_props,
43 }
20 #Print the dictionary object 44 #Print the dictionary object
21 print(dict) 45 print(dict)
22 #Return the dictionary 46 #Return the dictionary
23 return dict 47 return dict