@@ -83,7 +83,7 @@ def test_chop_genome(self):
8383 self .assertTrue (BedTool ().from_dataframe (coords_incl ).intersect (interval ).count ()== len (coords_incl ))
8484 self .assertTrue (BedTool ().from_dataframe (coords_excl ).intersect (interval ).count ()== 0 )
8585
86- def test_writer_target_bam (self ):
86+ def test_write_load_target_bam (self ):
8787 coords = pd .DataFrame ({
8888 'chrom' : ["chr19" , "chr19" ],
8989 'start' : [0 , 3 ],
@@ -126,7 +126,7 @@ def test_writer_target_bam(self):
126126 self .assertEqual (target [0 ].item (), 2.0 )
127127 self .assertEqual (label [1 ].item (), 1 )
128128
129- def test_writer_target_bw (self ):
129+ def test_write_load_target_bw (self ):
130130 coords = pd .DataFrame ({
131131 'chrom' : ["chr19" , "chr19" ],
132132 'start' : [0 , 3 ],
@@ -159,7 +159,7 @@ def test_writer_target_bw(self):
159159 self .assertEqual (target [0 ].item (), 999.0 )
160160 self .assertEqual (label [1 ].item (), 1 )
161161
162- def test_write_chrom_target_none (self ):
162+ def test_write_load_chrom_target_none (self ):
163163 coords = pd .DataFrame ({
164164 'chrom' : ["chr19" , "chr19" ],
165165 'start' : [0 , 3 ],
@@ -177,6 +177,15 @@ def test_write_chrom_target_none(self):
177177 compress = True ,
178178 numProcessors = 2 )
179179 self .assertIsFile (os .path .join (self .tempdir , "test_target_none_0.tar.gz" ))
180+ ds = wds .DataPipeline (
181+ wds .SimpleShardList ([os .path .join (self .tempdir , "test_target_none_0.tar.gz" )]),
182+ wds .tarfile_to_samples (),
183+ wds .decode (), wds .to_tuple ("seq.npy" , "chrom.npy" , "target.npy" , "label.npy" ),
184+ wds .batched (2 )
185+ )
186+ seq , chrom , target , label = next (iter (ds ))
187+ self .assertEqual (seq [1 ,0 ,4 ].item (), 1.0 )
188+ self .assertEqual (label [1 ].item (), 1 )
180189
181190 def test_wds_loader (self ):
182191 it = iter (SeqChromDatasetByWds (["data/test_0.tar.gz" ], dataloader_kws = {"batch_size" :3 }))
0 commit comments