Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #9 from USDA-ARS-GBRU/reversed_primers
Browse files Browse the repository at this point in the history
Added support for reversed primers
  • Loading branch information
Adam Rivers authored Dec 10, 2019
2 parents debce44 + 672ae7b commit a2a2e7b
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 58 deletions.
8 changes: 3 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
dist: trusty
sudo: false

# command to install dependencies
before_install:
- wget -q https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
Expand All @@ -10,8 +10,8 @@ before_install:
- export PATH="$MINICONDAS/bin:$PATH"
- conda config --set always_yes yes
- conda update -q conda
- wget https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py35-linux-conda.yml
- conda env create -n test-env --file qiime2-latest-py35-linux-conda.yml
- wget https://raw.githubusercontent.com/qiime2/environment-files/master/latest/staging/qiime2-latest-py36-linux-conda.yml
- conda env create -n test-env --file qiime2-latest-py36-linux-conda.yml
- source activate test-env
install:
- conda config --add channels bioconda
Expand All @@ -28,5 +28,3 @@ script:

after_success:
- codecov


4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Requirements/Dependencies
-------------------------

* Qiime2 is required to run Q2-itsxpress (for stand alone software see ITSxpress_)
* To install Qiime2 follow these instructions: https://docs.qiime2.org/2018.8/install/
* To install Qiime2 follow these instructions: https://docs.qiime2.org/2019.10/install/

Q2_itsxpress Installation
-------------------------
Expand All @@ -61,7 +61,7 @@ Q2_itsxpress Installation

.. code-block:: bash
source activate qiime2-2018.8
source activate qiime2-2019.10
2. Install Q2_itsxpress using BioConda_. Be sure to install Q2_itsxpres in the Qiime2 environment.

Expand Down
41 changes: 0 additions & 41 deletions meta.yaml

This file was deleted.

14 changes: 12 additions & 2 deletions q2_itsxpress/_itsxpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _set_fastqs_and_check(fastq: str,
fastq2: str,
sample_id: str,
single_end: bool,
reversed_primers: bool,
threads: int) -> object:
"""Checks and writes the fastqs as well as if they are paired end, interleaved and single end.
Expand Down Expand Up @@ -69,14 +70,16 @@ def _set_fastqs_and_check(fastq: str,
# Create SeqSample objects and merge if needed.
if paired_end and interleaved:
sobj = itsxpress.SeqSamplePairedInterleaved(fastq=fastq,
tempdir=None)
tempdir=None,
reversed_primers=reversed_primers)
sobj._merge_reads(threads=threads)
return sobj

elif paired_end and not interleaved:
sobj = itsxpress.SeqSamplePairedNotInterleaved(fastq=fastq,
fastq2=fastq2,
tempdir=None)
tempdir=None,
reversed_primers=reversed_primers)
sobj._merge_reads(threads=threads)
return sobj

Expand Down Expand Up @@ -116,6 +119,7 @@ def trim_single(per_sample_sequences: SingleLanePerSampleSingleEndFastqDirFmt,
region=region,
paired_in=False,
paired_out=False,
reversed_primers=False,
cluster_id=cluster_id)
return results

Expand All @@ -125,13 +129,15 @@ def trim_pair(per_sample_sequences: SingleLanePerSamplePairedEndFastqDirFmt,
region: str,
taxa: str = "F",
threads: int = 1,
reversed_primers: bool = False,
cluster_id: float = default_cluster_id) -> CasavaOneEightSingleLanePerSampleDirFmt:
results = main(per_sample_sequences=per_sample_sequences,
threads=threads,
taxa=taxa,
region=region,
paired_in=True,
paired_out=False,
reversed_primers=reversed_primers,
cluster_id=cluster_id)
return results

Expand All @@ -140,13 +146,15 @@ def trim_pair_output_unmerged(per_sample_sequences: SingleLanePerSamplePairedEnd
region: str,
taxa: str = "F",
threads: int = 1,
reversed_primers: bool = False,
cluster_id: float = default_cluster_id) -> CasavaOneEightSingleLanePerSampleDirFmt:
results = main(per_sample_sequences=per_sample_sequences,
threads=threads,
taxa=taxa,
region=region,
paired_in=True,
paired_out=True,
reversed_primers=reversed_primers,
cluster_id=cluster_id)
return results
# The ITSxpress handling
Expand All @@ -156,6 +164,7 @@ def main(per_sample_sequences,
region: str,
paired_in: bool,
paired_out: bool,
reversed_primers: bool,
cluster_id: float) -> CasavaOneEightSingleLanePerSampleDirFmt:
"""The main communication between the plugin and the ITSxpress program.
Expand Down Expand Up @@ -190,6 +199,7 @@ def main(per_sample_sequences,
fastq2=sample.reverse if paired_in else None,
sample_id=sample.Index,
single_end=paired_out,
reversed_primers=reversed_primers,
threads=threads)
# Deduplicate
if math.isclose(cluster_id, 1,rel_tol=1e-05):
Expand Down
18 changes: 12 additions & 6 deletions q2_itsxpress/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Int,
Float,
Range,
Bool,
Citations)

from q2_itsxpress._itsxpress import (trim_single,
Expand All @@ -17,19 +18,20 @@

plugin = Plugin(
name='itsxpress',
version='1.7.4',
version='1.8.0',
package='q2_itsxpress',
website='https://github.com/USDA-ARS-GBRU/q2_itsxpress '
'ITSxpress: https://github.com/USDA-ARS-GBRU/itsxpress',
description='ITSxpress trims amplicon reads down to the just their ITS region. '
description='ITSxpress trims amplicon reads down to their ITS region. '
'ITSxpress is designed to support the calling of exact sequence variants '
'rather than OTUs. This newer method of sequence error-correction requires '
'quality score data from each sequence, so each input sequence must be trimmed. '
'ITSxpress makes this possible by taking FASTQ data, de-replicating the '
'sequences then identifying the start and stop sites using HMMSearch. '
'Results are parsed and the trimmed files are returned. '
'The ITS 1, ITS2 or the entire ITS region including the 5.8s rRNA gene can be selected. '
'ITSxpress uses the hmm models from ITSx so results are comparable.',
'The ITS 1, ITS2 or the entire ITS region including the 5.8s rRNA'
'gene can be selected. ALL requires very long reads so it is not routinely'
'used with Illumina data. ITSxpress uses the hmm models from ITSx so results are comparable.',
short_description='Plugin for using ITSxpress to rapidly trim the\n'
'internally transcribed spacer (ITS) region of FASTQ files.',
citations=Citations.load('citations.bib', package='q2_itsxpress')
Expand Down Expand Up @@ -89,6 +91,7 @@
parameters={'region': Str % Choices(['ITS2', 'ITS1', 'ALL']),
'taxa': Str % Choices(taxaList),
'threads': Int,
'reversed_primers': Bool,
'cluster_id': Float % Range(0.97, 1.0, inclusive_start=True, inclusive_end=True)},
outputs=[('trimmed', SampleData[JoinedSequencesWithQuality])],
input_descriptions={'per_sample_sequences': 'The artifact that contains the sequence file(s). '
Expand All @@ -98,7 +101,8 @@
'region': ('\nThe regions ITS2, ITS1, and ALL that can be selected from.'),
'taxa': ('\nThe selected taxonomic group sequenced that can be selected from.'),
'threads': ('\nThe number of processor threads to use in the run.'),
'cluster_id': ('\nThe percent identity for clustering reads, set to 1 for exact dereplication.')
'cluster_id': ('\nThe percent identity for clustering reads, set to 1 for exact dereplication.'),
'reversed_primers': ('\n Primers are in reverse orientation as in Taylor et al. 2016, DOI:10.1128/AEM.02576-16.')
},
output_descriptions={'trimmed': 'The resulting trimmed sequences from ITSxpress'},
name='Trim paired-end reads, output merged reads for use with Deblur',
Expand Down Expand Up @@ -136,6 +140,7 @@
parameters={'region': Str % Choices(['ITS2', 'ITS1', 'ALL']),
'taxa': Str % Choices(taxaList),
'threads': Int,
'reversed_primers': Bool,
'cluster_id': Float % Range(0.97, 1.0, inclusive_start=True, inclusive_end=True)},
outputs=[('trimmed', SampleData[PairedEndSequencesWithQuality])],
input_descriptions={'per_sample_sequences': 'The artifact that contains the sequence file(s). '
Expand All @@ -145,7 +150,8 @@
'region': ('\nThe regions ITS2, ITS1, and ALL that can be selected from.'),
'taxa': ('\nThe selected taxonomic group sequenced that can be selected from.'),
'threads': ('\nThe number of processor threads to use in the run.'),
'cluster_id': ('\nThe percent identity for clustering reads, set to 1 for exact dereplication.')
'cluster_id': ('\nThe percent identity for clustering reads, set to 1 for exact dereplication.'),
'reversed_primers': ('\n Primers are in reverse orientation as in Taylor et al. 2016, DOI:10.1128/AEM.02576-16.')
},
output_descriptions={'trimmed': 'The resulting trimmed sequences from ITSxpress'},
name='Trim paired-end reads, output unmerged reads for use with Dada2',
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='q2_itsxpress',
version='1.7.4',
version='1.8.0',
packages=['q2_itsxpress'],
author='Adam R. Rivers, Kyle C. Weber',
author_email='adam.rivers@ars.usda.gov, kweber1@ufl.edu',
Expand All @@ -19,7 +19,7 @@
python_requires=">3.5",
include_package_data=True,
install_requires=[
'itsxpress>=1.7.2',
'itsxpress>=1.8.0',
'qiime2',
'pandas',
],
Expand Down
5 changes: 5 additions & 0 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def test_single(self):
fastq2=None,
sample_id=sample.Index,
single_end=True,
reversed_primers=False,
threads=1)
self.assertTrue("4774-1-MSITS3" in obs.fastq)

Expand All @@ -88,6 +89,7 @@ def test_paired(self):
fastq2=sample.reverse,
sample_id=sample.Index,
single_end=True,
reversed_primers=False,
threads=1)
self.assertTrue("4774-1-MSITS3" in obs.fastq)

Expand All @@ -98,6 +100,7 @@ def test_paired_unmerged(self):
fastq2=sample.reverse,
sample_id=sample.Index,
single_end=False,
reversed_primers=False,
threads=1)
self.assertTrue("4774-1-MSITS3" in obs.fastq)
self.assertTrue("4774-1-MSITS3" in obs.fastq2)
Expand All @@ -109,11 +112,13 @@ def test_trim_pair_no_bb(self):
fastq2=sample.reverse,
sample_id=sample.Index,
single_end=False,
reversed_primers=False,
threads=1))
raises(ValueError, lambda: _itsxpress._set_fastqs_and_check(fastq=sample.forward,
fastq2=sample.reverse,
sample_id=sample.Index,
single_end=True,
reversed_primers=False,
threads=1))


Expand Down

0 comments on commit a2a2e7b

Please sign in to comment.