Closed HuangDDU closed 8 months ago
Hi there,
I have changed some the of parameter names to be more intuitive (and updating the documents too). Have you followed the syntax in: https://pyvia.readthedocs.io/en/latest/ViaJupyter_Toy_Multifurcating.html
And
https://pyvia.readthedocs.io/en/latest/mESC_timeseries.html
This has different parameter names than those you wrote in your message. 0.1.94 pyvia is a soft launch of Via2.0 so you will be able to plot all the Atlas views and pathways (syntax examples and usage also in the Cartography tutorials)
Let me know how you get on Shobi
On Tue, 24 Oct 2023, 10:57 HuangDDU, @.***> wrote:
A good @job https://github.com/job! The result and plot is interseting! When I run the tutorial( https://pyvia.readthedocs.io/en/latest/ViaJupyter_Toy_Multifurcating.html) with Jupyter Notebook, I meet some troubles.
define parameters
ncomps, knn, random_seed, dataset, root_user =30,20, 42,'toy', ['M1'] v0 = VIA(adata_counts.obsm['X_pca'][:, 0:ncomps], true_label, jac_std_global=0.15, dist_std_local=1, knn=knn, cluster_graph_pruning_std=1, too_big_factor=0.3, root_user=root_user, preserve_disconnected=True, dataset='group', random_seed=random_seed)#, piegraph_arrow_head_width=0.2, piegraph_edgeweight_scalingfactor=1.0) v0.run_VIA()
I got the following error
TypeError Traceback (most recent call last) /home/huang/PyCode/scRNA/VIA/VIA-master/Jupyter Notebooks/Basic tutorial.ipynb 单元格 11 line 4 1 #define parameters 2 ncomps, knn, random_seed, dataset, root_user =30,20, 42,'toy', ['M1'] ----> 4 v0 = VIA(adata_counts.obsm['X_pca'][:, 0:ncomps], true_label, dist_std_local=1, 5 knn=knn, cluster_graph_pruning_std=1, too_big_factor=0.3, root_user=root_user, preserve_disconnected=True, dataset='group', 6 random_seed=random_seed)#, piegraph_arrow_head_width=0.2, piegraph_edgeweight_scalingfactor=1.0) 7 v0.run_VIA()
TypeError: init() got an unexpected keyword argument 'dist_std_local'
My python is 3.8.18 and pyVIA version is 0.1.94. The pyVIA version is the latest version following by pypi(https://pypi.org/project/pyVIA/) and github repository setup.py. May be version 2 is not upload?
(via) @.:~/PyCode/scRNA/VIA/VIA-master/Jupyter Notebooks$ pip list | grep pyVIA pyVIA 0.1.94 (via) @.:~/PyCode/scRNA/VIA/VIA-master/Jupyter Notebooks$ python Python 3.8.18 | packaged by conda-forge | (default, Oct 10 2023, 15:44:36)
I enter into the core.py VIA.init(...) where no parameter jac_std_global and cluster_graph_pruning_std appear.May be wrong source code version is uploaded? I will be pleasure to get your response.
— Reply to this email directly, view it on GitHub https://github.com/ShobiStassen/VIA/issues/47, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISI4SBDOHLQLTMUHHC7MBDYA4OB5AVCNFSM6AAAAAA6M6Q4A2VHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TQMZSGYZTKMY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Thanks for your reply, I stil have some problems flowed by your instruction https://pyvia.readthedocs.io/en/latest/ViaJupyter_Toy_Multifurcating.html.
core_via2
package is not available while the old pyVIA.core is useful
# from core_via2 import * #to be released soon # unuseful
from pyVIA.core import *
The the most plots can be reproducted. However, few plots function is error.
Such as the Overall trajectory
section
# draw overall pseudotime and main trajectories
plot_trajectory_curves(via_object=v0)# or set embedding=embedding_of_your_choice
plt.show()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/home/huang/PyCode/scRNA/VIA/VIA-master/Jupyter Notebooks/Basic workflow.ipynb 单元格 23 line 2
[1](vscode-notebook-cell://ssh-remote%2B192.168.1.2/home/huang/PyCode/scRNA/VIA/VIA-master/Jupyter%20Notebooks/Basic%20workflow.ipynb#Y122sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0) # draw overall pseudotime and main trajectories
----> [2](vscode-notebook-cell://ssh-remote%2B192.168.1.2/home/huang/PyCode/scRNA/VIA/VIA-master/Jupyter%20Notebooks/Basic%20workflow.ipynb#Y122sdnNjb2RlLXJlbW90ZQ%3D%3D?line=1) plot_trajectory_curves(via_object=v0)# or set embedding=embedding_of_your_choice
[3](vscode-notebook-cell://ssh-remote%2B192.168.1.2/home/huang/PyCode/scRNA/VIA/VIA-master/Jupyter%20Notebooks/Basic%20workflow.ipynb#Y122sdnNjb2RlLXJlbW90ZQ%3D%3D?line=2) plt.show()
File ~/.conda/envs/via/lib/python3.8/site-packages/pyVIA/plotting_via.py:2743, in plot_trajectory_curves(via_object, embedding, idx, title_str, draw_all_curves, arrow_width_scale_factor, scatter_size, scatter_alpha, linewidth, marker_edgewidth, cmap_pseudotime, dpi, highlight_terminal_states, use_maxout_edgelist) 2740 y_val = y_val.reshape((len(y_val), -1)) 2741 xp = np.linspace(minx, maxx, 500) -> 2743 gam50 = pg.LinearGAM(n_splines=4, spline_order=3, lam=10).gridsearch(x_val, y_val) 2744 XX = gam50.generate_X_grid(term=0, n=500) 2745 preds = gam50.predict(XX)
File ~/.local/lib/python3.8/site-packages/pygam/pygam.py:1894, in GAM.gridsearch(self, X, y, weights, return_scores, keep_best, objective, progress, **paramgrids) 1892 coef = models[-1].coef 1893 gam.setparams(coef=coef, force=True, verbose=False) -> 1894 gam.fit(X, y, weights) 1896 except ValueError as error: 1897 msg = str(error) + '\non model with params:\n' + str(param_grid)
File ~/.local/lib/python3.8/site-packages/pygam/pygam.py:920, in GAM.fit(self, X, y, weights) 917 self.statistics_['m_features'] = X.shape[1] 919 # optimize --> 920 self._pirls(X, y, weights) 921 # if self._opt == 0: 922 # self._pirls(X, y, weights) 923 # if self._opt == 1: 924 # self._pirls_naive(X, y) 925 return self
File ~/.local/lib/python3.8/site-packages/pygam/pygam.py:686, in GAM._pirls(self, X, Y, weights) 669 def _pirls(self, X, Y, weights): 670 """ 671 Performs stable PIRLS iterations to estimate GAM coefficients 672 (...) 684 None 685 """ --> 686 modelmat = self._modelmat(X) # build a basis matrix for the GLM 687 n, m = modelmat.shape 689 # initialize GLM coefficients if model is not yet fitted
File ~/.local/lib/python3.8/site-packages/pygam/pygam.py:459, in GAM._modelmat(self, X, term) 437 """ 438 Builds a model matrix, B, out of the spline basis for each feature 439 (...) 453 containing model matrix of the spline basis for selected features 454 """ 455 X = check_X(X, nfeats=self.statistics['m_features'], 456 edge_knots=self.edgeknots, dtypes=self.dtype, 457 features=self.feature, verbose=self.verbose) --> 459 return self.terms.build_columns(X, term=term)
File ~/.local/lib/python3.8/site-packages/pygam/terms.py:1719, in TermList.build_columns(self, X, term, verbose) 1717 columns = [] 1718 for term_id in term: -> 1719 columns.append(self._terms[term_id].build_columns(X, verbose=verbose)) 1720 return sp.sparse.hstack(columns, format='csc')
File ~/.local/lib/python3.8/site-packages/pygam/terms.py:784, in SplineTerm.build_columns(self, X, verbose) 768 """construct the model matrix columns for the term 769 770 Parameters (...) 780 scipy sparse array with n rows 781 """ 782 X[:, self.feature][:, np.newaxis] --> 784 splines = b_spline_basis(X[:, self.feature], 785 edge_knots=self.edgeknots, 786 spline_order=self.spline_order, 787 n_splines=self.n_splines, 788 sparse=True, 789 periodic=self.basis in ['cp'], 790 verbose=verbose) 792 if self.by is not None: 793 splines = splines.multiply(X[:, self.by][:, np.newaxis])
File ~/.local/lib/python3.8/site-packages/pygam/utils.py:649, in b_spline_basis(x, edge_knots, n_splines, spline_order, sparse, periodic, verbose) 646 aug_knots[-1] += 1e-9 # want last knot inclusive 648 # prepare Haar Basis --> 649 bases = (x >= aug_knots[:-1]).astype(np.int) * \ 650 (x < aug_knots[1:]).astype(np.int) 651 bases[-1] = bases[-2][::-1] # force symmetric bases at 0 and 1 653 # do recursion from Hastie et al. vectorized
File ~/.conda/envs/via/lib/python3.8/site-packages/numpy/init.py:305, in getattr(attr)
300 warnings.warn(
301 f"In the future np.{attr}
will be defined as the "
302 "corresponding NumPy scalar.", FutureWarning, stacklevel=2)
304 if attr in former_attrs:
--> 305 raise AttributeError(former_attrs[attr])
307 # Importing Tester requires importing all of UnitTest which is not a
308 # cheap import Since it is mainly used in test suits, we lazy import it
309 # here to save on the order of 10 ms of import time for most users
310 #
311 # The previous way Tester was imported also had a side effect of adding
312 # the full numpy.testing
namespace
313 if attr == 'testing':
AttributeError: module 'numpy' has no attribute 'int'.
np.int
was a deprecated alias for the builtin int
. To avoid this error in existing code, use int
by itself. Doing this will not modify any behavior and is safe. When replacing np.int
, you may wish to use e.g. np.int64
or np.int32
to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
The above problem may be from wrong package of numpy version or the import action in first cell.
2. Can you please synchronize the readthdoc and GitHub repository notebooks so I can run the tutorial code more easily?
3. What's more, other notebook updates is keenly awaited.
Looking forward for your reply!
Can you solve these problems
Hi @HuangDDU ,
A good job! The result and plot is interseting! When I run the tutorial(https://pyvia.readthedocs.io/en/latest/ViaJupyter_Toy_Multifurcating.html) with Jupyter Notebook, I meet some troubles.
I got the following error
My python is 3.8.18 and pyVIA version is 0.1.94. The pyVIA version is the latest version following by pypi(https://pypi.org/project/pyVIA/) and github repository setup.py. May be version 2 is not upload?
I enter into the core.py VIA.init(...) where no parameter
jac_std_global
andcluster_graph_pruning_std
appear.May be wrong source code version is uploaded? I will be pleasure to get your response.