Skip to content

Commit

Permalink
BUG: Laneless casava transformer now writes the correct path (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
David-Rod authored Jan 29, 2020
1 parent adf2699 commit abcfda0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
9 changes: 8 additions & 1 deletion q2_types/per_sample_sequences/_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ def _single_lane_per_sample_fastq_helper(dirfmt, output_cls, parse_lane=True):
barcode_id=barcode_id,
lane_number=lane_number,
read_number=read_number)
manifest_fh.write('%s,%s,%s\n' % (sample_id, path, direction))

filepath = result.sequences.path_maker(sample_id=sample_id,
barcode_id=barcode_id,
lane_number=lane_number,
read_number=read_number)
name = filepath.name

manifest_fh.write('%s,%s,%s\n' % (sample_id, name, direction))

manifest_fh.close()
result.manifest.write_data(manifest, FastqManifestFormat)
Expand Down
Binary file not shown.
21 changes: 20 additions & 1 deletion q2_types/per_sample_sequences/tests/test_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
SingleEndFastqManifestPhred64V2,
PairedEndFastqManifestPhred33V2,
PairedEndFastqManifestPhred64V2,
QIIME1DemuxDirFmt)
QIIME1DemuxDirFmt,
FastqGzFormat)
from q2_types.per_sample_sequences._transformer import (
_validate_header,
_validate_single_end_fastq_manifest_directions,
Expand Down Expand Up @@ -119,6 +120,24 @@ def test_slpssefdf_to_qiime1demuxdf_bad_sample_ids(self):
SingleLanePerSampleSingleEndFastqDirFmt,
QIIME1DemuxDirFmt, filenames=filenames)

def test_casava_one_eight_laneless_per_sample_dirfmt_to_slpspefd(self):
filenames = ('Human-Kneecap_S1_R1_001.fastq.gz',
'Human-Armpit_S2_R1_001.fastq.gz')

input, dirfmt = self.transform_format(
CasavaOneEightLanelessPerSampleDirFmt,
SingleLanePerSamplePairedEndFastqDirFmt, filenames=filenames
)
expected_filepaths = ['Human-Kneecap_S1_L001_R1_001.fastq.gz',
'Human-Armpit_S2_L001_R1_001.fastq.gz']

for path, view in dirfmt.sequences.iter_views(FastqGzFormat):
self.assertIn(path.name, expected_filepaths)

df = dirfmt.manifest.view(pd.DataFrame)
for name in df['forward']:
self.assertTrue((dirfmt.path / name).exists())

def test_casava_one_eight_single_lane_per_sample_dirfmt_to_slpssefdf(self):
filenames = ('Human-Kneecap_S1_L001_R1_001.fastq.gz',)
input, obs = self.transform_format(
Expand Down

0 comments on commit abcfda0

Please sign in to comment.