Skip to content

Commit

Permalink
changed tempdir handling in q2_itsxpress. Vsearch cannot find the inp…
Browse files Browse the repository at this point in the history
…ut sequences. the tempdir system needs to be refined fir qiime
  • Loading branch information
arivers committed Sep 20, 2024
1 parent 968423a commit dc27066
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions itsxpress/q2_itsxpress.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import pathlib
import shutil
import math
import tempfile

import pandas as pd
from q2_types.per_sample_sequences import (SingleLanePerSamplePairedEndFastqDirFmt,
Expand All @@ -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,
Expand Down Expand Up @@ -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


Expand Down Expand Up @@ -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

0 comments on commit dc27066

Please sign in to comment.