Skip to content

Commit 7dece9e

Browse files
committed
added option in CLI to only calculate qc and skip staging
1 parent c88174a commit 7dece9e

3 files changed

Lines changed: 16 additions & 12 deletions

File tree

macsima2mc/CLI.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ def get_args():
6363
help='measure features of contrast, intensity and sharpness of each image'
6464
)
6565

66+
parser.add_argument('-oqc',
67+
'--only_qc_file',
68+
action='store_true',
69+
help='skips the stacking of the tiles and only calculates the qc table. Still flag -wt is required to write the table. '
70+
)
71+
6672
parser.add_argument('-wt',
6773
'--write_table',
6874
action='store_true',

macsima2mc/macsima2mc.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,30 @@ def main():
2121
cycle_info = tools.append_metadata( cycle_info )
2222

2323
# Create stack
24-
output_dirs = tools.create_stack(cycle_info,
24+
cycle_number=int(cycle_info['cycle'].unique()[0])
25+
if args.only_qc_file:
26+
pass
27+
else:
28+
output_dirs = tools.create_stack(cycle_info,
2529
output,
2630
ref_marker=ref,
2731
hi_exp=args.hi_exposure_only,
2832
ill_corr=basicpy_corr,
2933
out_folder=out_folder_name)
30-
# Save markers file in each output directory
31-
for path in output_dirs:
32-
mc_tools.write_markers_file(path,args.remove_reference_marker)
34+
# Save markers file in each output directory
35+
for path in output_dirs:
36+
mc_tools.write_markers_file(path,args.remove_reference_marker)
3337

34-
cycle_number=int(cycle_info['cycle'].unique()[0])
35-
message_1='staging for cycle {c} is done'.format( c=f'{ cycle_number:03d}' )
36-
print(message_1)
3738
# Calculate and append ome metadata info contained in each file
38-
if args.qc_metrics:
39+
if (args.qc_metrics or args.only_qc_file) :
3940
import qc
40-
print("image qc is being calculated")
4141
cycle_info=qc.append_qc(cycle_info)
4242

4343
if args.write_table:
4444
qc_output_dir=output / "cycle_info"
4545
qc_output_dir.mkdir(parents=True, exist_ok=True)
4646
cycle_info.to_csv( qc_output_dir / 'cycle_{c}.csv'.format( c=f'{ cycle_number:03d}' ), index=False )
4747

48-
49-
5048

5149
if __name__ == '__main__':
5250
main()

macsima2mc/mc_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def write_markers_file( data_path, rm_ref_marker,ref_marker='DAPI'):
103103
if rm_ref_marker:
104104
earliest_cycle=mks_file_df['cycle_number'].min()
105105
condition=( mks_file_df['marker_name']== ref_marker ) & ( mks_file_df['cycle_number']>earliest_cycle )
106-
mks_file_df.loc[ condition , ['remove'] ]=True
106+
mks_file_df.loc[ condition , ['remove'] ]='TRUE'
107107

108108
mks_file_df.to_csv( data_path.parent.absolute() / 'markers.csv' , index=False )
109109

0 commit comments

Comments
 (0)