Commit ff8fb17e authored by Haowen Zhang's avatar Haowen Zhang Committed by Li Song
Browse files

Only warn the users when whitelist is NA.

parent 114d6754
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -1393,7 +1393,13 @@ void Chromap<MappingRecord>::MapPairedEndReads() {
        barcode_batch_for_loading);
    read_batch1_for_loading.SwapSequenceBatch(read_batch1);
    read_batch2_for_loading.SwapSequenceBatch(read_batch2);
    if (!is_bulk_data_) {
      barcode_batch_for_loading.SwapSequenceBatch(barcode_batch);
      // TODO(Haowen): simplify this condition check.
      if (num_loaded_pairs > 0) {
        output_tools_.SetBarcodeLength(barcode_batch.GetSequenceLengthAt(0));
      }
    }

    // Setup thread private vectors to save mapping results.
    std::vector<std::vector<std::vector<MappingRecord>>>
@@ -2790,7 +2796,15 @@ void Chromap<MappingRecord>::MapSingleEndReads() {
    uint32_t num_loaded_reads = LoadSingleEndReadsWithBarcodes(
        &read_batch_for_loading, &barcode_batch_for_loading);
    read_batch_for_loading.SwapSequenceBatch(read_batch);

    if (!is_bulk_data_) {
      barcode_batch_for_loading.SwapSequenceBatch(barcode_batch);
      // TODO(Haowen): simplify this condition check.
      if (num_loaded_reads > 0) {
        output_tools_.SetBarcodeLength(barcode_batch.GetSequenceLengthAt(0));
      }
    }

    std::vector<std::vector<std::vector<MappingRecord>>>
        mappings_on_diff_ref_seqs_for_diff_threads;
    std::vector<std::vector<std::vector<MappingRecord>>>
@@ -6159,16 +6173,17 @@ void ChromapDriver::ParseArgsAndRun(int argc, char *argv[]) {
      mapping_parameters.read_file2_paths =
          result["read2"].as<std::vector<std::string>>();
    }

    if (result.count("b")) {
      mapping_parameters.is_bulk_data = false;
      mapping_parameters.barcode_file_paths =
          result["barcode"].as<std::vector<std::string>>();
      if (result.count("barcode-whitelist") == 0) {
        chromap::Chromap<>::ExitWithMessage(
            "There are input barcode files but a barcode whitelist file is "
            "missing!");
        std::cerr << "WARNING: there are input barcode files but a barcode "
                     "whitelist file is missing!\n";
      }
    }

    if (result.count("barcode-whitelist")) {
      if (mapping_parameters.is_bulk_data) {
        chromap::Chromap<>::ExitWithMessage(
@@ -6178,6 +6193,7 @@ void ChromapDriver::ParseArgsAndRun(int argc, char *argv[]) {
      mapping_parameters.barcode_whitelist_file_path =
          result["barcode-whitelist"].as<std::string>();
    }

    if (result.count("p")) {
      mapping_parameters.matrix_output_prefix =
          result["matrix-output-prefix"].as<std::string>();
+4 −0
Original line number Diff line number Diff line
@@ -70,6 +70,10 @@ class OutputTools {
    mapping_output_format_ = format;
  }

  inline void SetBarcodeLength(uint32_t cell_barcode_length) {
    cell_barcode_length_ = cell_barcode_length;
  }

  inline void FinalizeMappingOutput() { fclose(mapping_output_file_); }

  inline void AppendMappingOutput(const std::string &line) {