Durenlab / LINGER

81 stars 17 forks source link

FileNotFoundError: chr1_cell_population_TF_RE_binding.txt' #42

Open ayavuzcakir opened 4 months ago

ayavuzcakir commented 4 months ago

Hi,

When I run the following function, LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method)# different from the previous version I have the following error,

FileNotFoundError: [Errno 2] No such file or directory: '/LINGER/output/chr1_cell_population_TF_RE_binding.txt'

I am using version 1.9.1 as shown in the tutorial. I checked the source code for "cell_type_specific_TF_RE_binding" function and it requires the chromosome specific txt.file, "mat=pd.read_csv(outdir+chrN+'_cell_population_TF_RE_binding.txt',sep='\t',index_col=0,header=0)"

I had some errors similar to this, seems like the PBMC.md is not up to date, could you please help with it? Kind regards, Yavuz

ayavuzcakir commented 4 months ago

So, seems like there are some bugs in versions ~1.91/ 1.92.

"cell_type_specific_TF_RE_binding" function requires chromosome specific "cell_population_TF_RE_binding.txt" on v1.92. But "TF_RE_binding" function does not create chromosome-specific mat. file in v1.92. I checked the other versions and it is changed after version 1.69. So I will try that version

zjprookie commented 4 months ago

Yes, I ran into the same problem when running the GRN_infer.md tutorial, I tried to run the 1.69 version after reading your suggestions。 LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method) but I still encountered new problems. `ValueError Traceback (most recent call last) Cell In[42], line 4 2 celltype='0'#use a string to assign your cell type 3 #method='LINGER' ----> 4 LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method)

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/LingerGRN/LL_net.py:363, in cell_type_specific_TF_RE_binding(GRNdir, adata_RNA, adata_ATAC, genome, celltype, outdir, method) 361 for i in tqdm(range(23)): 362 chrN=chrom[i] --> 363 out=cell_type_specific_TF_RE_binding_chr(adata_RNA,adata_ATAC,GRNdir,chrN,genome,celltype,outdir,method) 364 #result=pd.concat([result,out],axis=1).fillna(0) 365 result = pd.concat([result, out], join='outer', axis=0)

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/LingerGRN/LL_net.py:333, in cell_type_specific_TF_RE_binding_chr(adata_RNA, adata_ATAC, GRNdir, chrN, genome, celltype, outdir, method) 331 RE_cluster=RE_cluster/RE_cluster.mean() 332 RE_cluster = RE_cluster[:,None] --> 333 S = np.log(RE_cluster+0.1) + np.log(mat+TFbinding+0.1) + np.log(TF_cluster+0.1) 334 S = np.exp(S) 335 S.index=N_overlap

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/pandas/core/generic.py:2016, in NDFrame.array_ufunc(self, ufunc, method, *inputs, **kwargs) 2012 @final 2013 def array_ufunc( 2014 self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any ... 299 elif is_list_like(right) and not isinstance(right, (ABCSeries, ABCDataFrame)): 300 # GH 36702. Raise when attempting arithmetic with list of array-like. 301 if any(is_array_like(el) for el in right):

ValueError: Unable to coerce to Series/DataFrame, dimension must be <= 2: (39428, 1, 1039)` It's really confusing, have you ever had a similar problem?

karamveerverma37 commented 3 months ago

Hi, Were you able to solve this one? I am getting the same error.

Yes, I ran into the same problem when running the GRN_infer.md tutorial, I tried to run the 1.69 version after reading your suggestions。 LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method) but I still encountered new problems. `ValueError Traceback (most recent call last) Cell In[42], line 4 2 celltype='0'#use a string to assign your cell type 3 #method='LINGER' ----> 4 LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method)

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/LingerGRN/LL_net.py:363, in cell_type_specific_TF_RE_binding(GRNdir, adata_RNA, adata_ATAC, genome, celltype, outdir, method) 361 for i in tqdm(range(23)): 362 chrN=chrom[i] --> 363 out=cell_type_specific_TF_RE_binding_chr(adata_RNA,adata_ATAC,GRNdir,chrN,genome,celltype,outdir,method) 364 #result=pd.concat([result,out],axis=1).fillna(0) 365 result = pd.concat([result, out], join='outer', axis=0)

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/LingerGRN/LL_net.py:333, in cell_type_specific_TF_RE_binding_chr(adata_RNA, adata_ATAC, GRNdir, chrN, genome, celltype, outdir, method) 331 RE_cluster=RE_cluster/RE_cluster.mean() 332 RE_cluster = RE_cluster[:,None] --> 333 S = np.log(RE_cluster+0.1) + np.log(mat+TFbinding+0.1) + np.log(TF_cluster+0.1) 334 S = np.exp(S) 335 S.index=N_overlap

File /media/ssd/anaconda3/envs/LINGER_2/lib/python3.10/site-packages/pandas/core/generic.py:2016, in NDFrame.array_ufunc(self, ufunc, method, *inputs, kwargs) 2012 @Final 2013 def array_ufunc*( 2014 self, ufunc: np.ufunc, method: str, inputs: Any, **kwargs: Any ... 299 elif is_list_like(right) and not isinstance(right, (ABCSeries, ABCDataFrame)): 300 # GH 36702. Raise when attempting arithmetic with list of array-like. 301 if any(is_array_like(el) for el in right):

ValueError: Unable to coerce to Series/DataFrame, dimension must be <= 2: (39428, 1, 1039)` It's really confusing, have you ever had a similar problem?

yojetsharma commented 1 month ago

I am also facing this issue:

import LingerGRN.LL_net as LL_net
LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method)
Generate cell type specitic TF binding potential for cell type Radial-glia-3...

  0%|                                                                                                                                                                                                                           | 0/22 [00:00<?, ?it/s]

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Cell In[14], line 2
      1 import LingerGRN.LL_net as LL_net
----> 2 LL_net.cell_type_specific_TF_RE_binding(GRNdir,adata_RNA,adata_ATAC,genome,celltype,outdir,method)

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/LingerGRN/LL_net.py:501, in cell_type_specific_TF_RE_binding(GRNdir, adata_RNA, adata_ATAC, genome, celltype, outdir, method)
    499     for i in tqdm(range(22)):
    500         chrN='chr'+str(i+1)
--> 501         mat=pd.read_csv(outdir+chrN+'_cell_population_TF_RE_binding.txt',sep='\t',index_col=0,header=0)
    502         out=cell_type_specific_TF_RE_binding_chr(adata_RNA,adata_ATAC,GRNdir,chrN,genome,label0,outdir,method,mat)
    503 #result=pd.concat([result,out],axis=1).fillna(0)

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/pandas/io/parsers/readers.py:912, in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, date_format, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options, dtype_backend)
    899 kwds_defaults = _refine_defaults_read(
    900     dialect,
    901     delimiter,
   (...)
    908     dtype_backend=dtype_backend,
    909 )
    910 kwds.update(kwds_defaults)
--> 912 return _read(filepath_or_buffer, kwds)

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/pandas/io/parsers/readers.py:577, in _read(filepath_or_buffer, kwds)
    574 _validate_names(kwds.get("names", None))
    576 # Create the parser.
--> 577 parser = TextFileReader(filepath_or_buffer, **kwds)
    579 if chunksize or iterator:
    580     return parser

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1407, in TextFileReader.__init__(self, f, engine, **kwds)
   1404     self.options["has_index_names"] = kwds["has_index_names"]
   1406 self.handles: IOHandles | None = None
-> 1407 self._engine = self._make_engine(f, self.engine)

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/pandas/io/parsers/readers.py:1661, in TextFileReader._make_engine(self, f, engine)
   1659     if "b" not in mode:
   1660         mode += "b"
-> 1661 self.handles = get_handle(
   1662     f,
   1663     mode,
   1664     encoding=self.options.get("encoding", None),
   1665     compression=self.options.get("compression", None),
   1666     memory_map=self.options.get("memory_map", False),
   1667     is_text=is_text,
   1668     errors=self.options.get("encoding_errors", "strict"),
   1669     storage_options=self.options.get("storage_options", None),
   1670 )
   1671 assert self.handles is not None
   1672 f = self.handles.handle

File ~/miniconda3/envs/LINGER/lib/python3.10/site-packages/pandas/io/common.py:859, in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
    854 elif isinstance(handle, str):
    855     # Check whether the filename is to be opened in binary mode.
    856     # Binary mode does not support 'encoding' and 'newline'.
    857     if ioargs.encoding and "b" not in ioargs.mode:
    858         # Encoding
--> 859         handle = open(
    860             handle,
    861             ioargs.mode,
    862             encoding=ioargs.encoding,
    863             errors=errors,
    864             newline="",
    865         )
    866     else:
    867         # Binary mode
    868         handle = open(handle, ioargs.mode)

FileNotFoundError: [Errno 2] No such file or directory: '/home/user/Desktop/linger/chr1_cell_population_TF_RE_binding.txt'