This repository has been archived by the owner on Jul 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MANTA-1521 Improve evidence bam thread usage
Use finer-grained file locking when writing out evidence bams
- Loading branch information
Showing
13 changed files
with
196 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/c++/lib/applications/GenerateSVCandidates/SynchronizedBamWriter.hh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// Manta - Structural Variant and Indel Caller | ||
// Copyright (c) 2013-2019 Illumina, Inc. | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU General Public License | ||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
// | ||
// | ||
|
||
/// \file | ||
/// \author Chris Saunders | ||
/// | ||
|
||
#pragma once | ||
|
||
#include <mutex> | ||
|
||
#include "boost/noncopyable.hpp" | ||
|
||
#include "htsapi/bam_dumper.hh" | ||
|
||
|
||
/// Extends the standard BAM writer to allow synchronized writing to the same file from multiple threads | ||
class SynchronizedBamWriter : private boost::noncopyable | ||
{ | ||
public: | ||
SynchronizedBamWriter( | ||
const char* filename, | ||
const bam_hdr_t& header) | ||
: m_bamWriter(filename, header) | ||
{} | ||
|
||
/// Add another BAM record to the file. File must not be closed. | ||
void | ||
put_record(const bam1_t* brec) | ||
{ | ||
std::lock_guard<std::mutex> lock(m_writeMutex); | ||
m_bamWriter.put_record(brec); | ||
} | ||
|
||
private: | ||
bam_dumper m_bamWriter; | ||
std::mutex m_writeMutex; | ||
}; |
Oops, something went wrong.