diff --git a/itsxpress/q2_itsxpress.py b/itsxpress/q2_itsxpress.py index 3ab980a..f28f704 100644 --- a/itsxpress/q2_itsxpress.py +++ b/itsxpress/q2_itsxpress.py @@ -19,6 +19,7 @@ import pathlib import shutil import math +import tempfile import pandas as pd from q2_types.per_sample_sequences import (SingleLanePerSamplePairedEndFastqDirFmt, @@ -28,8 +29,14 @@ from itsxpress.definitions import (taxa_dict, ROOT_DIR) -default_cluster_id=0.995 +#default_cluster_id=0.995 +default_cluster_id=1.0 +try: + tempdir = tempfile.mkdtemp(prefix='itsxpress_') + print("tempdir location {}".format(tempdir)) +except Exception as e: + raise ValueError("Could not create temporary directory") def _set_fastqs_and_check(fastq: str, fastq2: str, @@ -67,18 +74,18 @@ def _set_fastqs_and_check(fastq: str, raise ValueError("There is a problem with the fastq file(s) you selected") # Create SeqSample objects and merge if needed. - + if paired_end: sobj = itsxpress.SeqSamplePairedNotInterleaved(fastq=fastq, fastq2=fastq2, - tempdir=None, + tempdir=tempdir, reversed_primers=reversed_primers) sobj._merge_reads(threads=threads,stagger=allow_staggered_reads) return sobj elif not paired_end: sobj = itsxpress.SeqSampleNotPaired(fastq=fastq, - tempdir=None) + tempdir=tempdir) return sobj @@ -250,6 +257,6 @@ def main(per_sample_sequences, wri_file=True, tempdir=sobj.tempdir) # Deleting the temp files. - shutil.rmtree(sobj.tempdir) + shutil.rmtree(tempdir) # Writing out the results. return results