Esempio n. 1
0
 def validate_inputs(self):
     """Validate inputs."""
     validate_bam_file(self.bam, check_exist=True)
     validate_bed_file(self.output)
     validate_string(self.quant, choices=["cDNA", "reads"])
     validate_integer(self.multimax)
     validate_string(self.group_by, choices=["start", "middle", "end"])
Esempio n. 2
0
 def validate_yes_no(self, column_name):
     """Validate that ``value`` is "yes" or "no"."""
     for sample_name, element in zip(self.sample_names,
                                     self.get_column(column_name)):
         try:
             validate_string(element,
                             choices=["yes", "no"],
                             allow_empty=True)
         except ValueError:
             self.error(
                 'SAMPLE: {} - Value {} in column {} should be "yes", "no" or empty.'
                 .format(sample_name, element, column_name))
Esempio n. 3
0
    def test_validate_string(self):
        message = "Value 123 should be a string."
        with self.assertRaisesRegex(ValueError, message):
            validate_string(123)

        message = "Value C should be one of A, B."
        with self.assertRaisesRegex(ValueError, message):
            validate_string("C", choices=["A", "B"])

        validate_string("A")
        validate_string("B", choices=["A", "B"])

        validate_string("", allow_empty=True)