-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpreprocess_data.py
More file actions
44 lines (37 loc) · 1.91 KB
/
preprocess_data.py
File metadata and controls
44 lines (37 loc) · 1.91 KB
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
from ritini.utils.utils import load_config, get_device
from ritini.utils.preprocess import process_trajectory_data
def preprocess(config_path: str = 'configs/config.yaml'):
# Load configuration
config = load_config(config_path)
# Device configuration
device = get_device(config['device'])
print(f"Using device: {device}")
# Data parameters from config
raw_trajectory_file = config['data']['raw']['trajectory_file']
raw_gene_names_file = config['data']['raw']['gene_names_file']
interest_genes_file = config['data']['raw']['interest_genes_file']
prior_graph_mode = config['data']['prior_graph_mode']
n_highly_variable_genes = config['data']['n_highly_variable_genes']
use_existing_prior_adjacency = config['data'].get('use_existing_prior_adjacency', False)
existing_prior_adjacency_file = config['data'].get('existing_prior_adjacency_file')
# Processed data parameters from config
trajectory_file = config['data']['processed']['trajectory_file']
gene_names_file = config['data']['processed']['gene_names_file']
prior_graph_adjacency_file = config['data']['processed']['prior_graph_adjacency_file']
prior_graph_output_plot = config['data']['processed']['prior_graph_plot_file']
# Preprocess input data
process_trajectory_data(
raw_trajectory_file,
raw_gene_names_file,
interest_genes_file,
output_trajectory_file=trajectory_file,
output_gene_names_file=gene_names_file,
output_prior_adjacency_file=prior_graph_adjacency_file,
output_prior_graph_plot_file=prior_graph_output_plot,
prior_graph_mode=prior_graph_mode,
n_highly_variable_genes=n_highly_variable_genes,
use_existing_prior_adjacency=use_existing_prior_adjacency,
existing_prior_adjacency_file=existing_prior_adjacency_file)
print(f"\nData preprocessed successfully:")
if __name__ == "__main__":
preprocess()