Exemple #1
0
    def construct_command(self):

        commandline_collection = [
            self.binary, "--input-dir", self.config.base_calls_input,
            "--output-dir", self.config.output
        ]

        if self.config.barcode_mismatches:
            commandline_collection.append("--barcode-mismatches " +
                                          self.config.barcode_mismatches)

        if self.config.tiles:
            commandline_collection.append("--tiles " + self.config.tiles)

        if self.config.use_base_mask:
            # Note that for the base mask the "--use-bases-mask" must be included in the
            # commandline passed.
            commandline_collection.append(self.config.use_base_mask)
        else:
            length_of_indexes = Bcl2FastqConfig.get_length_of_indexes(
                self.config.runfolder_input)
            samplesheet = Samplesheet(self.config.samplesheet_file)
            lanes_and_base_mask = Bcl2FastqConfig.\
                get_bases_mask_per_lane_from_samplesheet(samplesheet, length_of_indexes)
            for lane, base_mask in lanes_and_base_mask.iteritems():
                commandline_collection.append(
                    "--use-bases-mask {0}:{1}".format(lane, base_mask))

        if self.config.additional_args:
            commandline_collection.append(self.config.additional_args)

        command = " ".join(commandline_collection)
        print("Generated command: " + command)
        return command
Exemple #2
0
    def test_get_bases_mask_per_lane_from_samplesheet_invalid_length_combo(self):
        # These are to short compared to the length indicated in the samplesheet
        mock_read_index_lengths = {2: 4, 3: 4}
        samplesheet = Samplesheet(TestBcl2FastqConfig.samplesheet_file)

        with self.assertRaises(ArteriaUsageException):
            Bcl2FastqConfig. \
                get_bases_mask_per_lane_from_samplesheet(samplesheet, mock_read_index_lengths, False)
Exemple #3
0
    def construct_command(self):

        ##################################
        # First run configureBcl2fastq.pl
        ##################################

        # Assumes configureBclToFastq.pl on path
        commandline_collection = [
            "configureBclToFastq.pl",
            "--input-dir",
            self.config.base_calls_input,
            "--sample-sheet",
            self.config.samplesheet_file,
            "--output-dir",
            self.config.output,
            "--fastq-cluster-count 0",  # No upper-limit on number of clusters per output file.
            "--force"  # overwrite output if it exists.
        ]

        if self.config.barcode_mismatches:
            commandline_collection.append("--mismatches " +
                                          self.config.barcode_mismatches)

        if self.config.tiles:
            commandline_collection.append("--tiles " + self.config.tiles)

        if self.config.use_base_mask:
            commandline_collection.append("--use_bases_mask " +
                                          self.config.use_base_mask)
        else:
            length_of_indexes = Bcl2FastqConfig.get_length_of_indexes(
                self.config.runfolder_input)
            samplesheet = Samplesheet(self.config.samplesheet_file)
            lanes_and_base_mask = \
                Bcl2FastqConfig.get_bases_mask_per_lane_from_samplesheet(samplesheet, length_of_indexes)
            base_masks_as_set = set(lanes_and_base_mask.values())

            assert len(base_masks_as_set) is 1, "For bcl2fastq 1.8.4 there is no support for " \
                                                "mixing different bases masks for different lanes"

            # Here we are forced to use the same bases mask was always used for all lanes.
            commandline_collection.append("--use_bases_mask " +
                                          lanes_and_base_mask.values()[0])

        if self.config.additional_args:
            commandline_collection.append(self.config.additional_args)

        ##################################
        # Then run make
        ##################################

        commandline_collection.append(" && make -j{0}".format(
            self.config.nbr_of_cores))

        command = " ".join(commandline_collection)
        print("Generated command: " + command)
        return command
Exemple #4
0
 def test_get_bases_mask_per_lane_from_samplesheet_single_read(self):
     mock_read_index_lengths = {2: 9, 3: 9}
     expected_bases_mask = {1: "y*,i8n*,i8n*",
                            2: "y*,i6n*,n*",
                            3: "y*,i6n*,n*",
                            4: "y*,i7n*,n*",
                            5: "y*,i7n*,n*",
                            6: "y*,i7n*,n*",
                            7: "y*,i7n*,n*",
                            8: "y*,i7n*,n*",
                            }
     samplesheet = Samplesheet(TestBcl2FastqConfig.samplesheet_file)
     actual_bases_mask = Bcl2FastqConfig. \
         get_bases_mask_per_lane_from_samplesheet(samplesheet, mock_read_index_lengths, True)
     self.assertEqual(expected_bases_mask, actual_bases_mask)
Exemple #5
0
 def test_get_bases_mask_per_lane_from_samplesheet_no_tag(self):
     # If we don't have tag for one lane in the samplesheet.
     mock_read_index_lengths = {2: 6}
     expected_bases_mask = {1: "y*,n*,y*",
                            2: "y*,n*,y*",
                            3: "y*,i6,y*",
                            4: "y*,i6,y*",
                            5: "y*,i6,y*",
                            6: "y*,i6,y*",
                            7: "y*,n*,y*",
                            8: "y*,n*,y*",
                            }
     samplesheet = Samplesheet(TestBcl2FastqConfig.samplesheet_with_no_tag)
     actual_bases_mask = Bcl2FastqConfig. \
         get_bases_mask_per_lane_from_samplesheet(samplesheet, mock_read_index_lengths, False)
     self.assertEqual(expected_bases_mask, actual_bases_mask)