Skip to content

Commit

Permalink
Merge pull request #2 from cokelaer/main
Browse files Browse the repository at this point in the history
Fix on path to input files and update requirements
  • Loading branch information
cokelaer authored Apr 18, 2023
2 parents fb6d17a + de43b7c commit 4cd65a1
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/apptainer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:
pull_request:
branches-ignore: []
schedule:
- cron: '0 0 * * SUN'
- cron: '0 0 15 * *'

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python: [3.7, 3.8, 3.9]
python: [ 3.8, 3.9, '3.10']
fail-fast: false


Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ on:
pull_request:
branches-ignore: []
schedule:
- cron: '0 0 * * SUN'
- cron: '0 0 15 * *'

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python: [3.7, 3.8, 3.9]
python: [3.8, 3.9, '3.10']
fail-fast: false


Expand Down
30 changes: 23 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@
.. image:: https://github.com/sequana/nanomerge/actions/workflows/main.yml/badge.svg
:target: https://github.com/sequana/nanomerge/actions/workflows

.. image:: https://coveralls.io/repos/github/sequana/nanomerge/badge.svg?branch=main
  :target: https://coveralls.io/github/sequana/nanomerge?branch=main


.. image:: http://joss.theoj.org/papers/10.21105/joss.00352/status.svg
:target: http://joss.theoj.org/papers/10.21105/joss.00352
:alt: JOSS (journal of open source software) DOI

.. image:: https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C3.10-blue.svg
:target: https://pypi.python.org/pypi/sequana
:alt: Python 3.8 | 3.9 | 3.10




Expand All @@ -28,9 +40,11 @@ You can install the packages using pip::

pip install sequana_nanomerge --upgrade

An optional requirements is pycoQC, which can be install with conda/mamba using e.g.:
An optional requirements is pycoQC, which can be install with conda/mamba using e.g.::

conda install pycoQC

conda install pycoQC.
you will also need graphviz installed.

Usage
~~~~~
Expand All @@ -49,9 +63,9 @@ otherwise all fastq files are in DATAPATH/::
sequana_nanomerge --input-directory DATAPATH --samplesheet samplesheet.csv
--summary summary.txt --input-pattern '*fastq.gz'

The --summary is optional and takes as input the output of albacore demultiplexing. usually a file called sequencing_summary.txt
The --summary is optional and takes as input the output of albacore/guppy demultiplexing. usually a file called sequencing_summary.txt

Note that the different between the two is the extra `*/` before the `*.fastq.gz` pattern since barcoded files are in individual subdirectories..
Note that the different between the two is the extra `*/` before the `*.fastq.gz` pattern since barcoded files are in individual subdirectories.

In both bases, the command creates a directory with the pipeline and configuration file. You will then need to execute the pipeline::

Expand All @@ -65,19 +79,19 @@ retrieve the pipeline itself and its configuration files and then execute the pi

Or use `sequanix <https://sequana.readthedocs.io/en/master/sequanix.html>`_ interface.

COncerning the sample sheet, whther your data is barcoded or not, it should be a CSV file ::
Concerning the sample sheet, whether your data is barcoded or not, it should be a CSV file ::

barcode,project,sample
barcode01,main,A
barcode02,main,B
barcode03,main,C

For a non-barcoded run, you must provide a file where the barcode column can be set (empty) or just removed::
For a non-barcoded run, you must provide a file where the barcode column can be set (empty)::

barcode,project,sample
,main,A

or::
or just removed::

project,sample
main,A
Expand Down Expand Up @@ -109,6 +123,7 @@ Requirements
This pipelines requires the following executable(s), which is optional:

- pycoQC
- dot

.. image:: https://raw.githubusercontent.com/sequana/nanomerge/main/sequana_pipelines/nanomerge/dag.png

Expand All @@ -132,6 +147,7 @@ Changelog
========= ====================================================================
Version Description
========= ====================================================================
1.0.1 Fix the pyco file paths, update requirements and doc
1.0.0 Stable release ready for production
0.0.1 **First release.**
========= ====================================================================
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sequana_pipetools>=0.8.1
sequana
6 changes: 2 additions & 4 deletions sequana_pipelines/nanomerge/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
# ============================================================================

# Keep input_readtag empty for nanopore
#input_directory: '/home/cokelaer/TEMP/fastq_pass/barcode21'
input_directory: '/home/cokelaer/TEMP/fastq_pass/'
input_directory:
input_readtag:
input_pattern: '*/*.fastq.gz'
summary: /home/cokelaer/TEMP/fastq_pass/sequencing_summary_AOI637_ef78de7c_aef0cc4b.txt
#samplesheet: "samplesheet1.csv"
summary:
samplesheet: "samplesheet.csv"

################################################################################
Expand Down
22 changes: 13 additions & 9 deletions sequana_pipelines/nanomerge/nanomerge.rules
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ else:


if config["summary"]:
qc_file = "pyco/pyco.html"
qc_file = ["pyco/pyco.html"]
else:
qc_file = ""
qc_file = []

# ========================================================================= pipeline starts here
expected_fastqs = expand("./{project}/{sample}.fastq.gz", zip, project=samples.df['project'], sample=samples.df['sample']),
expected_fastqs = expand("./{project}/{sample}.fastq.gz", zip, project=samples.df['project'],
sample=samples.df['sample'])


rule pipeline:
input:
expected_fastqs,
Expand All @@ -100,22 +103,22 @@ if config["summary"]:
input:
config['summary']
output:
temp(qc_file)
"pyco/pyco.html"
log:
temp(qc_file)
"pyco/pyco.log"
container:
config["apptainers"]["pycoqc"]
shell:
"""
pycoQC --summary_file {input} -o {output} > {log} 2>&1
"""


rule merge:
input:
get_input_merge
output:
"./{project}/{sample}.fastq.gz"

shell:
"""
cat {input} > {output}
Expand All @@ -134,7 +137,7 @@ rule rulegraph:

rule html_report:
input:
list(expected_fastqs) + [qc_file]
list(expected_fastqs) + qc_file
output:
"summary.html"
run:
Expand All @@ -144,11 +147,11 @@ rule html_report:
data = {"name": "nanomerge",
"rulegraph": ".sequana/rulegraph.svg",
"pipeline_version": nanomerge.version}
manager.teardown(extra_files_to_remove=["pyco/pyco.log", qc_file])
manager.teardown(extra_files_to_remove=["pyco/pyco.log", "pyco/pyco.html"])

dirs = ",".join([f'<a href="{x}/">{x}</a>' for x in samples.get_projects()])
if config['summary']:
with open(qc_file, "r") as fout:
with open("pyco/pyco.html", "r") as fout:
pycodata = fout.read()
pycodata = '<div class="columns">' + pycodata.split('<div class="columns">')[-1].replace("</div>\n</body>\n</html>","")

Expand All @@ -163,6 +166,7 @@ onsuccess:

print("Once done, please clean up the directory using\n'make clean'")
shell("chmod -R g+w .")
shell("rm -rf pyco rulegraph")

onerror:
from sequana_pipetools.errors import PipeError
Expand Down
1 change: 1 addition & 0 deletions sequana_pipelines/nanomerge/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
pycoQC
dot
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

_MAJOR = 1
_MINOR = 0
_MICRO = 0
_MICRO = 1
version = f"{_MAJOR}.{_MINOR}.{_MICRO}"
release = f"{_MAJOR}.{_MINOR}"

Expand Down

0 comments on commit 4cd65a1

Please sign in to comment.