示例#1
0
    def __init__(self,
                 bedfile: str,
                 spacing: int = 20,
                 mindata: int = 50,
                 maxpool: int = None,
                 lines: list = None):
        # spacing should be >= 0
        if not type(spacing) == int or spacing < 0:
            print("ROI: Invalid spacing: {0}; defaulting to 0".format(spacing))
            spacing = 0

        # mindata should be > 0
        if not type(mindata) == int or mindata <= 0:
            print("ROI: Invalid mindata: {0}; defaulting to 1".format(mindata))
            mindata = 1

        print("Loading .bed data.")
        if maxpool:
            print("ROI limited to max number of pools = {0}".format(maxpool))
        self.source = bedfile

        if lines is None:
            bed_file = BedFileLoader(bedfile)
            lines = bed_file.expand_columns()

        self.amplicons = self.load_amplicons(lines, maxpool, -1)
        if self.amplicons:
            self.targets = self.define_targets(spacing, mindata)
        else:
            return
示例#2
0
 def __init__(self, filename: str):
     bed_file = BedFileLoader(filename)
     print('Loading coverage data from {}'.format(filename))
     # noinspection PyProtectedMember
     if bed_file.file_type != bed_file._BedFileLoader__amplicon_cov:
         print('{} is not a valid amplicon_coverage file'.format(filename))
         sys.exit(1)
     self.targets, self.counters = self.define_targets(
         bed_file.expand_columns(), bed_file.columns)
示例#3
0
def test_len_columns_for_amplicon_cov():
    bed_file = BedFileLoader(mock_dir_path + 'amplicon_cov.tsv')
    expanded = bed_file.expand_columns()
    assert len(bed_file.columns) == len(expanded[0])
示例#4
0
def test_len_columns_for_effective_regions():
    bed_file = BedFileLoader(mock_dir_path + 'effective_regions.bed')
    expanded = bed_file.expand_columns()
    assert len(bed_file.columns) == len(expanded[0])
示例#5
0
def test_len_columns_for_general_bed():
    bed_file = BedFileLoader(mock_dir_path + 'general.bed')
    expanded = bed_file.expand_columns()
    assert len(bed_file.columns) == len(expanded[0])
示例#6
0
def test_len_columns_for_ampliseq_exome():
    bed_file = BedFileLoader(mock_dir_path + 'ampliseq_exome.bed')
    expanded = bed_file.expand_columns()
    assert len(bed_file.columns) == len(expanded[0])