Giter Site home page Giter Site logo

gpz-bioinfo / tmap Goto Github PK

View Code? Open in Web Editor NEW
30.0 30.0 10.0 11.69 MB

topological data analysis of population-scale microbiomes

Home Page: https://tmap.readthedocs.org

License: GNU General Public License v3.0

Python 99.92% Shell 0.08%
microbiome-analysis topological-data-analysis

tmap's People

Contributors

444thliao avatar haokui avatar lam-c avatar manto32bit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tmap's Issues

Import Error: can't import name gcd from fractions

When I run the script of "Network_generator.py" or "SAFE_analysis.py", I met this report:

Import Error: cannot import name 'gcd' from 'fractions'

But when I want to troubleshoot that, others who also meet this error claimed that I should update the "networkx" to โ‰ฅ 2.5.1.
https://stackoverflow.com/questions/66174862/import-error-cant-import-name-gcd-from-fractions
https://stackoverflow.com/questions/67165725/ubuntu-error-cannot-import-name-gcd-from-fractions

However the tmap 1.2 requires networkx=2.2. I am very confused about this bug.
Hope you help me with that.

long runtime for pairwise_coenrichment

Hi GPZ-Bioinfo,

I am experiencing a long runtime for pairwise_coenrichment. It appears that it will take 7 days to run on my data.
My data set is 714 samples by 1049 genus.The graph is 450 nodes.

I reduced the data set from 26000 OTU to 1049 genus in the hope of getting this running in a shorter time. Does this long runtime seem reasonable?

I see that there is a function called tmap.netx.coenrichment_analysis.coenrichment_for_nodes
that can do coenrichment for specified nodes and features. However there is no example of its use in the docs or in tmap_notebook.
Do you have a recommendation for its use?

Bye
parsifal9

Basic Usage of tmap - y contains previously unseen labels

In the starter scripts of tmap, I get the error, "y contains previously unseen labels"

show(data=X, graph=graph, color=color, fig_size=(10, 10), node_size=15, mode='spring', strength=0.04)
C:\intelpython3\lib\site-packages\numpy\lib\arraysetops.py:518: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
mask &= (ar1 != a)
Traceback (most recent call last):
File "C:\intelpython3\lib\site-packages\IPython\core\interactiveshell.py", line 2963, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
show(data=X, graph=graph, color=color, fig_size=(10, 10), node_size=15, mode='spring', strength=0.04)
File "C:\intelpython3\lib\site-packages\tmap-1.0-py3.6.egg\tmap\tda\plot.py", line 201, in show
label_color = legend_lookup.get(color.label_encoder.transform([label])[0], None)
File "C:\intelpython3\lib\site-packages\sklearn\preprocessing\label.py", line 257, in transform
_, y = encode(y, uniques=self.classes, encode=True)
File "C:\intelpython3\lib\site-packages\sklearn\preprocessing\label.py", line 110, in _encode
return _encode_numpy(values, uniques, encode)
File "C:\intelpython3\lib\site-packages\sklearn\preprocessing\label.py", line 53, in _encode_numpy
% str(diff))
ValueError: y contains previously unseen labels: [0]

Consolidated script (from https://tmap.readthedocs.io/en/latest/basic.html) is:

from sklearn.cluster.dbscan_ import DBSCAN
from sklearn.preprocessing.data import MinMaxScaler, StandardScaler
from sklearn.preprocessing.data import *

from sklearn import datasets
import pandas as pd
iris = datasets.load_iris()
X = iris.data
X = pd.DataFrame(X,columns = iris.feature_names)

from tmap.tda import mapper, filter
from tmap.tda.cover import Cover

Step1. initiate a Mapper

tm = mapper.Mapper(verbose=1)

Step2. Projection

lens = [filter.MDS(components=[0, 1])]
projected_X = tm.filter(X, lens=lens)
clusterer = DBSCAN(eps=0.75, min_samples=1)
cover = Cover(projected_data=MinMaxScaler().fit_transform(projected_X), resolution=20, overlap=0.75)

graph = tm.map(data=StandardScaler().fit_transform(X), cover=cover, clusterer=clusterer)

from tmap.tda.plot import show, Color
y = iris.target
color = Color(target=y, dtype="categorical")
show(data=X, graph=graph, color=color, fig_size=(10, 10), node_size=15, mode='spring', strength=0.04)

Cannot import name Mapping from collections

Hi,

I am having little difficulty in running "from tmap.tda import mapper, Filter" on python 3.10.

In Python 3.6 the code works perfectly fine.

I believe the problem is happening due to collections package as the Mapping is moved to collections.abc from collections. I changed that in my code.

Still the error is happening:

Importerror: cannot import name Mapping from collections (...../lib/python3.10/collections/init.py

Any idea how to fix it? Does Tmap run on python 3.10?

ImportError: cannot import name 'filter'

After updating tmap, I'm unable to import filter. E.g. following the "Basic usage" example:

In [3]: from tmap.tda import mapper, filter                                                                                
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-3-dbbed40b8ed5> in <module>
----> 1 from tmap.tda import mapper, filter

ImportError: cannot import name 'filter'

What am I doing wrong?


3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) [GCC 7.3.0]
tmap 1.1.3, installed via pip

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.