def check_mask_genome_hash(input_format,num_features): """Checks that a |GenomeHash| is correctly parsed from arguments, by making sure that it is of the right subclass, and that it contains the expected number of features Parameters ---------- input_format : str Format of input file ("BED","BigBed", or "PSL") num_features : int Number of features in input file """ argstr = "--mask_annotation_format %s --mask_annotation_files %s" % (input_format,MINI["%s_file" % input_format.lower()]) args = mask_file_parser.parse_args(shlex.split(argstr)) mask_hash = get_genome_hash_from_mask_args(args) # check correct return type and make sure features are populated if input_format == "BigBed": assert_true(isinstance(mask_hash,BigBedGenomeHash)) assert_equal(mask_hash.bigbedreaders[0].num_records,num_features) else: assert_true(isinstance(mask_hash,GenomeHash)) assert_equal(len(mask_hash.feature_dict),num_features)
def test_mask_genome_hash_is_empty_if_no_file(): argstr = "--mask_annotation_format BED" args = mask_file_parser.parse_args(shlex.split(argstr)) mask_hash = get_genome_hash_from_mask_args(args) assert_true(isinstance(mask_hash,GenomeHash)) assert_equal(len(mask_hash.feature_dict),0)