-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathprofile_utils.py
85 lines (77 loc) · 2.6 KB
/
profile_utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import os
import pathlib
import argparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-s", "--sql_file", help="the filename of the sqlite file")
parser.add_argument("-b", "--batch", help="string indicating the batch name")
parser.add_argument("-p", "--plate_name", help="string indicating the platename")
parser.add_argument("-f", "--platemap_file", help="path of platmap identifiers")
parser.add_argument("-a", "--barcode_platemap_file", help="path of plate info")
parser.add_argument("-m", "--moa_file", help="path of moa/target data storing")
parser.add_argument("-o", "--output_dir", help="the directory to output the files")
parser.add_argument(
"-i", "--cell_id", default="A549", help="the profiled cell line"
)
parser.add_argument("-c", "--cell_count_dir", help="directory to save cell counts")
parser.add_argument(
"-w",
"--well_col",
default="Image_Metadata_Well",
help="which column to represent wells",
)
parser.add_argument(
"-l",
"--plate_col",
default="Image_Metadata_Plate",
help="which column to represent plate",
)
args = parser.parse_args()
return args
def get_pipeline_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"-o",
"--overwrite",
action="store_true",
help="reprocess and overwrite all data",
)
parser.add_argument(
"-b",
"--batch",
default="2016_04_01_a549_48hr_batch1",
help="string indicating the batch name",
)
parser.add_argument(
"-p", "--plate_prefix", default="SQ", help="Prefix to identify plates"
)
parser.add_argument(
"-w",
"--well_col",
default="Image_Metadata_Well",
help="which column to represent wells",
)
parser.add_argument(
"-l",
"--plate_col",
default="Image_Metadata_Plate",
help="which column to represent plate",
)
parser.add_argument(
"-e",
"--extract_cell_line",
action="store_true",
help="Add flag to extract cell line from platemap id",
)
args = parser.parse_args()
return args
def find_incomplete_plates(
plates, output_dir="backend", file_match="normalized_feature_select.csv.gz"
):
incomplete_plates = []
for plate in plates:
plate_data_dir = pathlib.PurePath(f"{output_dir}/{plate}/")
dir_contents = os.listdir(plate_data_dir)
if not any([file_match in x for x in dir_contents]):
incomplete_plates.append(plate)
return incomplete_plates