Skip to content

Commit

Permalink
Reduce dependencies (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonperdomo committed Jun 1, 2023
1 parent 04fb164 commit 9512541
Show file tree
Hide file tree
Showing 10 changed files with 555 additions and 649 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ RUN tar -xf ont-vbz-hdf-plugin-1.0.1-Linux-x86_64.tar.gz
RUN conda env create -f environment.yml

# Activate the environment
RUN echo "conda activate lrst_py39" >> ~/.bashrc
RUN echo "conda activate longreadsum" >> ~/.bashrc
SHELL ["/bin/bash", "--login", "-c"]

# Ensure the correct environment is being used
RUN export PATH="/opt/conda/envs/lrst_py39/bin/python"
RUN export PATH="/opt/conda/envs/longreadsum/bin/python"
RUN which python

# Build LongReadSum
Expand All @@ -30,4 +30,4 @@ RUN make
ENV HDF5_PLUGIN_PATH="/longreadsum/lib/"

# The code to run when container is started:
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "lrst_py39", "python", "/app/longreadsum"]
ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "longreadsum", "python", "/app/longreadsum"]
10 changes: 3 additions & 7 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lrst_py39
name: longreadsum
channels:
- bioconda
- anaconda
Expand All @@ -9,12 +9,8 @@ dependencies:
- hdf5
- htslib
- swig
- matplotlib
- plotly=4.14
- plotly
- pytest
- pip
- pip:
- kaleido

# conda env create --file=environment.yml
# conda activate lrst_py39
# conda activate longreadsum
124 changes: 0 additions & 124 deletions src/bam_plot.py

This file was deleted.

87 changes: 38 additions & 49 deletions src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ def get_common_param(margs):
try:
if not os.path.isdir(output_dir):
os.makedirs(output_dir)
if not os.path.isdir(output_dir + '/' + getDefaultImageFolder()):
os.makedirs(output_dir + '/' +
getDefaultImageFolder())

except OSError as e:
this_error_str += "Cannot create folder for " + \
Expand Down Expand Up @@ -164,12 +161,11 @@ def fq_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
plot_filepaths = create_base_quality_plots(fq_output, param_dict, "FASTQ: Basic statistics")
for static in [True, False]:
fq_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_st", "read_length_hist", "base_st", "basic_info", "base_quality",
"read_avg_base_quality"], "FASTQ QC", param_dict], plot_filepaths, static=static)
fq_html_gen.generate_st_html()
plot_filepaths = plot(fq_output, param_dict, 'FASTQ')
fq_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_bar", "read_length_hist", "base_counts", "base_quality",
"read_avg_base_quality"], "FASTQ QC", param_dict], plot_filepaths, static=False)
fq_html_gen.generate_st_html()

logging.info("Completed.")
else:
Expand Down Expand Up @@ -208,15 +204,11 @@ def fa_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
from src import fasta_plot
plot_filepaths = fasta_plot.plot(fa_output, param_dict)

# TODO: Unused 'static' variable results in redundant function call
for static in [True, False]:
fa_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_st", "read_length_hist", "base_st", "basic_info"], "FASTA QC",
param_dict], plot_filepaths, static=True)
fa_html_gen.generate_st_html()
plot_filepaths = plot(fa_output, param_dict, 'FASTA')
fa_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_bar", "read_length_hist", "base_counts"], "FASTA QC",
param_dict], plot_filepaths, static=True)
fa_html_gen.generate_st_html()

else:
logging.error("QC did not generate.")
Expand Down Expand Up @@ -252,14 +244,13 @@ def bam_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
from src import bam_plot
plot_filepaths = bam_plot.plot(bam_output, param_dict)
plot_filepaths = plot(bam_output, param_dict, 'BAM')

for static in [True, False]:
bam_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "map_st", "err_st", "read_length_st", "read_length_hist", "base_st", "basic_info",
"base_quality"], "BAM QC", param_dict], plot_filepaths, static=static)
bam_html_gen.generate_st_html()
# TODO: Add read average base quality plot (not currently generated by bam_plot.plot)
bam_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_alignments_bar", "base_alignments_bar", "read_length_bar", "read_length_hist", "base_counts", "basic_info",
"base_quality"], "BAM QC", param_dict], plot_filepaths, static=False)
bam_html_gen.generate_st_html()

else:
logging.error("QC did not generate.")
Expand Down Expand Up @@ -301,18 +292,17 @@ def seqtxt_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
from src import seqtxt_plot
plot_filepaths = seqtxt_plot.plot(seqtxt_output, param_dict)
for static in [True, False]:
if margs.seq == 0:
f5_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_st", "read_length_hist", "base_st", "basic_info"],
"sequencing_summary.txt QC", param_dict], plot_filepaths, static=static)
else:
f5_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_st", "read_length_hist", "basic_info"], "sequencing_summary.txt QC",
param_dict], plot_filepaths, static=static)
f5_html_gen.generate_st_html()
plot_filepaths = plot(seqtxt_output, param_dict, 'SeqTxt')

if margs.seq == 0:
seqtxt_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_bar", "read_length_hist", "base_counts", "base_quality", "basic_info"],
"sequencing_summary.txt QC", param_dict], plot_filepaths, static=False)
else:
seqtxt_html_gen = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_bar", "read_length_hist", "basic_info"], "sequencing_summary.txt QC",
param_dict], plot_filepaths, static=False)
seqtxt_html_gen.generate_st_html()
else:
logging.error("QC did not generate.")

Expand Down Expand Up @@ -348,12 +338,12 @@ def fast5_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
plot_filepaths = create_base_quality_plots(fast5_output, param_dict, "FAST5: Basic statistics")
for static in [True, False]:
fast5_html_obj = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_st", "read_length_hist", "base_st", "basic_info", "base_quality",
"read_avg_base_quality"], "FAST5 QC", param_dict], plot_filepaths, static=static)
fast5_html_obj.generate_st_html()
plot_filepaths = plot(fast5_output, param_dict, 'FAST5')
fast5_html_obj = generate_html.ST_HTML_Generator(
[["basic_st", "read_length_bar", "read_length_hist", "base_counts", "basic_info", "base_quality",
"read_avg_base_quality"], "FAST5 QC", param_dict], plot_filepaths, static=False)
fast5_html_obj.generate_st_html()

else:
logging.error("QC did not generate.")

Expand Down Expand Up @@ -390,13 +380,12 @@ def fast5_signal_module(margs):
if exit_code == 0:
logging.info("QC generated.")
logging.info("Generating HTML report...")
from src import fast5_signal_plot
dynamic_plots, plot_filepaths = fast5_signal_plot.plot(fast5_output, param_dict)

# Generate a dynamic HTML file
plot_filepaths = plot(fast5_output, param_dict, 'FAST5s')
fast5_html_obj = generate_html.ST_HTML_Generator(
[[], "FAST5 signal QC", param_dict], plot_filepaths, static=False)
fast5_html_obj.generate_st_html(signal_plots=dynamic_plots)
[["basic_st", "read_length_bar", "read_length_hist", "base_counts", "basic_info", "base_quality",
"read_avg_base_quality", "ont_signal"], "FAST5 QC", param_dict], plot_filepaths, static=False)
fast5_html_obj.generate_st_html(signal_plots=True)

else:
logging.error("QC did not generate.")

Expand Down
Loading

0 comments on commit 9512541

Please sign in to comment.