sbslee / dokdo

A Python package for microbiome sequencing analysis with QIIME 2
https://dokdo.readthedocs.io
MIT License
42 stars 12 forks source link

import process issue #56

Closed yeon-y closed 1 year ago

yeon-y commented 1 year ago

Hi,

I encountered an issue during the import process while working with Dokdo. I followed the tutorial to write the code and executed it.

Here is my code:

import dokdo
import matplotlib.pyplot as plt

qzv_file = "taxa-bar-plots.qzv"

dokdo.taxa_abundance_bar_plot(qzv_file, level=2, count=8,figsize=(9,7))

plt.tight_layout()

However, I noticed a problem with the import section of the Dokdo/api/ordinate file during execution. ImportError: cannot import name 'diversity_lib' from 'qiime2.plugins' (~/envs/qiime2/lib/python3.8/site-packages/qiime2/plugins.py)

It fails to recognize the following part:

from qiime2.plugins import diversity_lib
from qiime2.plugins import feature_table
from qiime2.plugins import diversity

I am using Python version 3.8.17 and have installed Qiime2 and Dokdo in a virtual environment. Qiime2 is at its latest version, 2023.7.

Is there anything I might have done wrong while using it? Or could this be a problem caused by Dokdo not being updated? If it's the latter, I'm curious if there are any plans for an update.

Thank you.

yeon-y commented 1 year ago

Here is the additional information:

I installed Qiime2 using the command: conda install -c qiime2 qiime2

For Dokdo installation, I followed the instructions in the 'Getting Started' section:

$ git clone https://github.com/sbslee/dokdo
$ cd dokdo
$ pip install .
sbslee commented 1 year ago

@yeon-y,

Thanks for providing all the details. QIIME 2 requires many tools and plugins to run, and I don't think the command $ conda install -c qiime2 qiime2 installs all the required packages. Please follow their installation guide and reinstall QIIME 2 in the proper way. Please let me know if the problem still persists.

yeon-y commented 1 year ago

Hello, @sbslee

I hope this message finds you well. I wanted to express my gratitude for your assistance. I encountered an unexpected conflict issue on my server, which prevented me from downloading files using wget. So I try to install qiime2 using the command:$ conda install -c qiime2 qiime2.

As a solution, I followed your advice and installed Qiime2 with offical guide. It turns out that the issue with Dokdo not functioning correctly was related to the installation method. Now Dokdo runs smoothly without any issues. I appreciate your support in providing such a valuable visualization tool.

And I have another question. Is there a way to use the pretty_taxa feature when creating a bar plot with taxa_abundance_plot? I'd like to display only genus and species names by using level=[6,7]. If this feature is not currently supported in Dokdo, I'll try alternative methods and sharing the results.

Additionally, I have a question regarding the read_quality plot. I noticed that the tutorial demonstrates creating a boxplot-like graph, but I'm curious if it's possible to generate a histogram for Demultiplexed sequence counts summary. If this functionality is not currently available, I'm also willing to experiment with different approaches and share the outcomes.

Thank you once again for your assistance.

sbslee commented 1 year ago

@yeon-y,

As for the dokdo.taxa_abundance_bar_plot method, you can do the following:

import dokdo
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
sns.set()

qzv_file = '/Users/sbslee/Desktop/dokdo/data/moving-pictures-tutorial/taxa-bar-plots.qzv'

dokdo.taxa_abundance_bar_plot(
    qzv_file,
    figsize=(10, 7),
    level=7,
    count=8,
    legend_short=True,
    pname_kws={'levels': [6, 7]}
)

plt.tight_layout()

out

As for your second question, I think the dokdo.denoising_stats_plot method could be what you are looking for. Please see the method's documentation page.

sbslee commented 1 year ago

Closed due to inactivity. Please feel free to re-open it if necessary.