def test_bam_pe(data_dir): reads = load_reads(os.path.join(data_dir, 'test_reads_pe.bam'), format='bam', paired=True) assert reads.chroms == ['chr1', 'chr9'] assert reads.size == 2 assert reads._data['chr1'] == [150] assert reads._data['chr9'] == [2000]
def test_bedpe(data_dir): reads = load_reads(os.path.join(data_dir, 'test_reads.bedpe'), format='bedpe', paired=True) assert reads.chroms == ['chr1', 'chr9'] assert reads.size == 2 assert reads._data['chr1'] == [200] assert reads._data['chr9'] == [2400]
def test_bed(data_dir): reads = load_reads(os.path.join(data_dir, 'test_reads.bed'), format='bed', paired=False, shift=100) assert reads.chroms == ['chr1', 'chr2', 'chr9'] assert reads.size == 4 assert reads._data['chr1'] == [101, 400] assert reads._data['chr2'] == [12445] assert reads._data['chr9'] == [12245]
def load_input_data(args): """Load required input data.""" logger.info("Loading peaks of sample 1") peaks1 = load_manorm_peaks(path=args.peak_file1, format=args.peak_format, name=args.name1) logger.info("Loading peaks of sample 2") peaks2 = load_manorm_peaks(path=args.peak_file2, format=args.peak_format, name=args.name2) logger.info("Loading reads of sample 1") reads1 = load_reads(path=args.read_file1, format=args.read_format, paired=args.paired, shift=args.shift_size1, name=args.name1) logger.info("Loading reads of sample 2") reads2 = load_reads(path=args.read_file2, format=args.read_format, paired=args.paired, shift=args.shift_size2, name=args.name2) return peaks1, peaks2, reads1, reads2
def test_matched_bed(data_dir): with pytest.raises(FormatModeConflictError): load_reads(os.path.join(data_dir, 'test_reads.bed'), format='bed', paired=True)
def test_invalid_format(data_dir): with pytest.raises(FileFormatError): load_reads(os.path.join(data_dir, 'test_reads.bed'), format='bedpe', paired=True)
def test_unsupported_format(data_dir): with pytest.raises(ValueError): load_reads(os.path.join(data_dir, 'test_reads.bed'), format='unknown_format')