def test_fastqfactory(): try: snaketools.FastQFactory("*", read_tag='error') assert False except: assert True try: snaketools.FastQFactory("*", read_tag='[12]') assert False except: assert True directory = os.path.dirname( sequana_data("Hm2_GTGAAA_L005_R1_001.fastq.gz")) ff = snaketools.FastQFactory(directory + os.sep + "Hm2*gz", read_tag='R[12]') assert ff.paired is True assert ff.tags == ['Hm2_GTGAAA_L005_'] ff = snaketools.FastQFactory(directory + os.sep + "Hm2*gz", read_tag=None) assert ff.paired is False assert sorted(ff.tags) == sorted( ['Hm2_GTGAAA_L005_R2_001', 'Hm2_GTGAAA_L005_R1_001'])
def test_file_name_factory(): import glob def inner_test(ff): len(ff) print(ff) ff.filenames ff.realpaths ff.all_extensions ff.pathnames ff.extensions #list list_files = glob.glob("*.py") ff = snaketools.FileFactory(list_files) inner_test(ff) # glob ff = snaketools.FileFactory("*py") inner_test(ff) directory = os.path.dirname( sequana_data("Hm2_GTGAAA_L005_R1_001.fastq.gz")) ff = snaketools.FastQFactory(directory + "/Hm2*fastq.gz", verbose=True) assert ff.tags == ['Hm2_GTGAAA_L005'] ff.get_file1(ff.tags[0]) ff.get_file2(ff.tags[0]) assert len(ff) == 1