@@ -29,10 +29,8 @@ def process_proteomics_data(path: Path) -> pd.DataFrame:
2929# read map to convert to entrez
3030async def load_gene_symbol_map (gene_symbols : list [str ], entrez_map : Path | None = None ):
3131 """Add descirption...."""
32- config = Config ()
33- filepath = config .data_dir / "proteomics_entrez_map.csv"
34- if filepath .exists ():
35- df = pd .read_csv (filepath , index_col = "gene_symbol" )
32+ if entrez_map and entrez_map .exists ():
33+ df = pd .read_csv (entrez_map , index_col = "gene_symbol" )
3634 else :
3735 biodbnet = BioDBNet ()
3836 df = await biodbnet .async_db2db (
@@ -158,15 +156,20 @@ async def proteomics_gen(
158156 quantile : int = 25 ,
159157):
160158 """Generate proteomics data."""
161- config = Config ()
162- if not config_file :
163- raise ValueError ("Config file must be provided" )
159+ if not config_filepath .exists ():
160+ raise FileNotFoundError (f"Config file not found at { config_filepath } " )
161+ if config_filepath .suffix not in (".xlsx" , ".xls" ):
162+ raise FileNotFoundError (f"Config file must be an xlsx or xls file at { config_filepath } " )
163+
164+ if not matrix_filepath .exists ():
165+ raise FileNotFoundError (f"Matrix file not found at { matrix_filepath } " )
166+ if matrix_filepath .suffix not in {".csv" }:
167+ raise FileNotFoundError (f"Matrix file must be a csv file at { matrix_filepath } " )
164168
165169 if quantile < 0 or quantile > 100 :
166170 raise ValueError ("Quantile must be an integer from 0 to 100" )
167171 quantile /= 100
168172
169- prot_config_filepath = config .data_dir / "config_sheets" / config_file
170173 logger .info (f"Config file is at '{ prot_config_filepath } '" )
171174
172175 xl = pd .ExcelFile (prot_config_filepath )
0 commit comments