minwoosun commited on
Commit
e6813cf
·
verified ·
1 Parent(s): 53dffc9

simplify paths

Browse files
Files changed (1) hide show
  1. app.py +8 -23
app.py CHANGED
@@ -78,28 +78,13 @@ def toggle_file_input(default_dataset):
78
 
79
 
80
  def main(input_file_path, species, default_dataset):
81
-
82
- # Get the current working directory
83
- current_working_directory = os.getcwd()
84
-
85
- # Print the current working directory
86
- print("Current Working Directory:", current_working_directory)
87
-
88
  # clone and cd into UCE repo
89
  os.system('git clone https://github.com/minwoosun/UCE.git')
90
- os.chdir('/home/user/app/UCE')
91
-
92
- # Get the current working directory
93
- current_working_directory = os.getcwd()
94
-
95
- # Print the current working directory
96
- print("Current Working Directory:", current_working_directory)
97
-
98
- # Specify the path to the directory you want to add
99
- new_directory = "/home/user/app/UCE"
100
 
101
  # Add the directory to the Python path
102
- sys.path.append(new_directory)
103
 
104
  # Set default dataset path
105
  default_dataset_1_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="100_pbmcs_proc_subset.h5ad")
@@ -117,17 +102,17 @@ def main(input_file_path, species, default_dataset):
117
  from evaluate import AnndataProcessor
118
  from accelerate import Accelerator
119
 
120
- dir_path = '/home/user/app/UCE/'
121
  model_loc = 'minwoosun/uce-100m'
122
 
123
  print(input_file_path)
124
- print(dir_path)
125
  print(model_loc)
126
 
127
  # Construct the command
128
  command = [
129
  'python',
130
- '/home/user/app/UCE/eval_single_anndata.py',
131
  '--adata_path', input_file_path,
132
  '--dir', dir_path,
133
  '--model_loc', model_loc
@@ -149,12 +134,12 @@ def main(input_file_path, species, default_dataset):
149
  # Set output file path
150
  file_name_with_ext = os.path.basename(input_file_path)
151
  file_name = os.path.splitext(file_name_with_ext)[0]
152
- pred_file = "/home/user/app/UCE/" + f"{file_name}_predictions.csv"
153
  model_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="tabula_sapiens_v1_logistic_regression_model_weights.json")
154
 
155
  file_name_with_ext = os.path.basename(input_file_path)
156
  file_name = os.path.splitext(file_name_with_ext)[0]
157
- output_file = "/home/user/app/UCE/" + f"{file_name}_uce_adata.h5ad"
158
  adata = sc.read_h5ad(output_file)
159
  x = adata.obsm['X_uce']
160
 
 
78
 
79
 
80
  def main(input_file_path, species, default_dataset):
81
+
 
 
 
 
 
 
82
  # clone and cd into UCE repo
83
  os.system('git clone https://github.com/minwoosun/UCE.git')
84
+ os.chdir(base_path)
 
 
 
 
 
 
 
 
 
85
 
86
  # Add the directory to the Python path
87
+ sys.path.append(base_path)
88
 
89
  # Set default dataset path
90
  default_dataset_1_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="100_pbmcs_proc_subset.h5ad")
 
102
  from evaluate import AnndataProcessor
103
  from accelerate import Accelerator
104
 
105
+ base_path = '/home/user/app/UCE/'
106
  model_loc = 'minwoosun/uce-100m'
107
 
108
  print(input_file_path)
109
+ print(base_path)
110
  print(model_loc)
111
 
112
  # Construct the command
113
  command = [
114
  'python',
115
+ base_path + 'eval_single_anndata.py',
116
  '--adata_path', input_file_path,
117
  '--dir', dir_path,
118
  '--model_loc', model_loc
 
134
  # Set output file path
135
  file_name_with_ext = os.path.basename(input_file_path)
136
  file_name = os.path.splitext(file_name_with_ext)[0]
137
+ pred_file = base_path + f"{file_name}_predictions.csv"
138
  model_path = hf_hub_download(repo_id="minwoosun/uce-misc", filename="tabula_sapiens_v1_logistic_regression_model_weights.json")
139
 
140
  file_name_with_ext = os.path.basename(input_file_path)
141
  file_name = os.path.splitext(file_name_with_ext)[0]
142
+ output_file = base_path + f"{file_name}_uce_adata.h5ad"
143
  adata = sc.read_h5ad(output_file)
144
  x = adata.obsm['X_uce']
145