File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -331,6 +331,25 @@ def test_fetch(self):
331331 # implicitly tested with test_to_ascii
332332 pass
333333
334+ def test_fetch_qual_length_bug (self ):
335+ # fetch was not trimming qual to the length of the sequence resulting
336+ # in qual scores for positions beyond the length of the sequence.
337+ with tempfile .NamedTemporaryFile ('r+' , suffix = '.fq' ,
338+ delete = False ) as f :
339+ f .write (fqdata_variable_length )
340+
341+ self .to_remove .append (f .name )
342+ to_hdf5 (f .name , self .hdf5_file )
343+
344+ exp = [('a' , [(b"@a_0 orig_bc=abc new_bc=abc bc_diffs=0\n xyz\n +\n "
345+ "ABC\n " )]),
346+ ('b' , [(b"@b_0 orig_bc=abw new_bc=wbc bc_diffs=4\n qwe\n +\n "
347+ "DFG\n " ),
348+ (b"@b_1 orig_bc=abw new_bc=wbc bc_diffs=4\n qwexx\n +\n "
349+ "DEF#G\n " )])]
350+
351+ obs = [(s [0 ], list (s [1 ])) for s in to_per_sample_ascii (self .hdf5_file )]
352+ self .assertEqual (obs , exp )
334353
335354seqdata = """>a_1 orig_bc=abc new_bc=abc bc_diffs=0
336355x
@@ -370,5 +389,19 @@ def test_fetch(self):
370389DEF
371390"""
372391
392+ fqdata_variable_length = """@a_1 orig_bc=abc new_bc=abc bc_diffs=0
393+ xyz
394+ +
395+ ABC
396+ @b_1 orig_bc=abw new_bc=wbc bc_diffs=4
397+ qwe
398+ +
399+ DFG
400+ @b_2 orig_bc=abw new_bc=wbc bc_diffs=4
401+ qwexx
402+ +
403+ DEF#G
404+ """
405+
373406if __name__ == '__main__' :
374407 main ()
You can’t perform that action at this time.
0 commit comments