Hi,
I am trying to carry out some analysis with ScanPy Anndata object where I have a dataframe containing clustering information at different resolution as shown in the columns of louvain_0.1, louvain_0.5 below.
I am trying to generate a clustree using the following command
ct = clustree(e12_df, prefix="louvain_0.1", draw=True, output_path="/home/analysis/processing/mirza/Scanpy/", images=/home/analysis/processing/mirza/Scanpy/")
My first query: Am I doing something wrong while specifying the command. I tried my best to find documentation to this tool, but unfortunately couldnt get one.
Second Query: When I run, the above command, I get the following error
File ~/.local/lib/python3.9/site-packages/clustree/_handle_pars.py:24, in get_and_check_cluster_cols(cols, prefix, user_kk)
21 cols = [x for x in cols if re.match(pattern, x)]
22 cols_as_int = [int(ele.removeprefix(prefix)) for ele in cols]
---> 24 if max(cols_as_int) != len(cols_as_int):
25 raise ValueError(
26 f"cols with prefix '{prefix}' should be consecutive integers: \
27 '{prefix}1', '{prefix}2', ..., '{prefix}N'"
28 )
29 return max(cols_as_int)
ValueError: max() arg is an empty sequence
`
I would be happy if someone can assist me in this regard.
Hi, I am trying to carry out some analysis with ScanPy Anndata object where I have a dataframe containing clustering information at different resolution as shown in the columns of louvain_0.1, louvain_0.5 below.
Index(['index', 'type', 'sample', 'batch', 'n_genes_by_counts', 'log1p_n_genes_by_counts', 'total_counts', 'log1p_total_counts', 'pct_counts_in_top_20_genes', 'total_counts_mt', 'log1p_total_counts_mt', 'pct_counts_mt', 'n_genes', 'n_counts', 'louvain_0.1', 'louvain_0.5', 'louvain_0.8', 'louvain_1.0'], dtype='object')
I am trying to generate a clustree using the following command
ct = clustree(e12_df, prefix="louvain_0.1", draw=True, output_path="/home/analysis/processing/mirza/Scanpy/", images=/home/analysis/processing/mirza/Scanpy/")
My first query: Am I doing something wrong while specifying the command. I tried my best to find documentation to this tool, but unfortunately couldnt get one.
Second Query: When I run, the above command, I get the following error
`
ValueError Traceback (most recent call last) File ~/.local/lib/python3.9/site-packages/clustree/_graph.py:129, in clustree(data, prefix, images, output_path, draw, node_color, node_color_aggr, node_cmap, edge_color, edge_cmap, orientation, layout_reingold_tilford, min_cluster_number, border_size, figsize, arrows, node_size, node_size_edge, dpi, kk) 43 """ 44 45 Parameters (...) 125 take values in 0, ..., K-1. 126 """ 128 _data = handle_data(data=data) --> 129 kk = get_and_check_cluster_cols(cols=_data.columns, prefix=prefix, user_kk=kk) 131 border_size = float(border_size) 132 images = str(images)
File ~/.local/lib/python3.9/site-packages/clustree/_handle_pars.py:24, in get_and_check_cluster_cols(cols, prefix, user_kk) 21 cols = [x for x in cols if re.match(pattern, x)] 22 cols_as_int = [int(ele.removeprefix(prefix)) for ele in cols] ---> 24 if max(cols_as_int) != len(cols_as_int): 25 raise ValueError( 26 f"cols with prefix '{prefix}' should be consecutive integers: \ 27 '{prefix}1', '{prefix}2', ..., '{prefix}N'" 28 ) 29 return max(cols_as_int)
ValueError: max() arg is an empty sequence `
I would be happy if someone can assist me in this regard.