Skip to content

Commit 8696a1a

Browse files
committed
skipGT
1 parent 0ca9b39 commit 8696a1a

File tree

5 files changed

+18
-8
lines changed

5 files changed

+18
-8
lines changed

src/asmode.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ namespace torali {
3636

3737
struct AsmConfig {
3838
bool hasVcfFile;
39+
bool skipGenotyping;
3940
uint16_t minMapQual;
4041
uint32_t minClip;
4142
uint32_t minCliqueSize;

src/assemble.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ namespace torali
855855
tmpCons = svs[svid].consensus;
856856
svs[svid].consensus = svs[svid].consensus.substr(offsetTmpCons, svSize);
857857
}
858-
if (alignConsensus(c, hdr, seq, NULL, svs[svid], true)) msaSuccess = true;
858+
if ((c.skipGenotyping) || (alignConsensus(c, hdr, seq, NULL, svs[svid], true))) msaSuccess = true;
859859
if (!tmpCons.empty()) {
860860
svs[svid].consensus = tmpCons;
861861
svs[svid].consBp += offsetTmpCons;
@@ -865,7 +865,7 @@ namespace torali
865865
std::string suffix = boost::to_upper_copy(std::string(seq + svs[svid].svStart, seq + std::min(seqlen, svs[svid].svStart + c.minConsWindow)));
866866
msaWfa(c, seqStore[svid], svs[svid].consensus, prefix, suffix);
867867
if ((int32_t) svs[svid].consensus.size() < svs[svid].insLen + 4 * c.minConsWindow) {
868-
if (alignConsensus(c, hdr, seq, NULL, svs[svid], false)) msaSuccess = true;
868+
if ((c.skipGenotyping) || (alignConsensus(c, hdr, seq, NULL, svs[svid], false))) msaSuccess = true;
869869
}
870870
}
871871
//std::cerr << msaSuccess << std::endl;
@@ -921,7 +921,7 @@ namespace torali
921921
tmpCons = svs[svid].consensus;
922922
svs[svid].consensus = svs[svid].consensus.substr(offsetTmpCons, svSize);
923923
}
924-
if (alignConsensus(c, hdr, seq, sndSeq, svs[svid], true)) msaSuccess = true;
924+
if ((c.skipGenotyping) || (alignConsensus(c, hdr, seq, sndSeq, svs[svid], true))) msaSuccess = true;
925925
if (!tmpCons.empty()) {
926926
svs[svid].consensus = tmpCons;
927927
svs[svid].consBp += offsetTmpCons;
@@ -931,7 +931,7 @@ namespace torali
931931
std::string suffix = boost::to_upper_copy(std::string(seq + svs[svid].svStart, seq + std::min(seqlen, svs[svid].svStart + c.minConsWindow)));
932932
msaWfa(c, seqStore[svid], svs[svid].consensus, prefix, suffix);
933933
if ((int32_t) svs[svid].consensus.size() < svs[svid].insLen + 4 * c.minConsWindow) {
934-
if (alignConsensus(c, hdr, seq, NULL, svs[svid], false)) msaSuccess = true;
934+
if ((c.skipGenotyping) || (alignConsensus(c, hdr, seq, NULL, svs[svid], false))) msaSuccess = true;
935935
}
936936
}
937937
//std::cerr << msaSuccess << std::endl;

src/delly.h

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ namespace torali
6565
bool hasExcludeFile;
6666
bool hasVcfFile;
6767
bool hasDumpFile;
68+
bool skipGenotyping;
6869
std::set<int32_t> svtset;
6970
DnaScore<int> aliscore;
7071
boost::filesystem::path outfile;

src/modvcf.h

+5-3
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ vcfParse(TConfig const& c, bam_hdr_t* hd, std::vector<TStructuralVariantRecord>&
319319

320320
template<typename TConfig, typename TStructuralVariantRecord, typename TJunctionCountMap, typename TReadCountMap, typename TCountMap>
321321
inline void
322-
vcfOutput(TConfig const& c, std::vector<TStructuralVariantRecord> const& svs, TJunctionCountMap const& jctCountMap, TReadCountMap const& readCountMap, TCountMap const& spanCountMap)
322+
vcfOutput(TConfig const& c, std::vector<TStructuralVariantRecord>& svs, TJunctionCountMap const& jctCountMap, TReadCountMap const& readCountMap, TCountMap const& spanCountMap)
323323
{
324324
// BoLog class
325325
BoLog<double> bl;
@@ -416,10 +416,10 @@ vcfOutput(TConfig const& c, std::vector<TStructuralVariantRecord> const& svs, TJ
416416
now = boost::posix_time::second_clock::local_time();
417417
std::cerr << '[' << boost::posix_time::to_simple_string(now) << "] " << "Genotyping" << std::endl;
418418
bcf1_t *rec = bcf_init();
419-
for(typename TSVs::const_iterator svIter = svs.begin(); svIter!=svs.end(); ++svIter) {
419+
for(typename TSVs::iterator svIter = svs.begin(); svIter!=svs.end(); ++svIter) {
420420
if ((svIter->srSupport == 0) && (svIter->peSupport == 0)) continue;
421421
// In discovery mode, skip SVs that have less than 2 reads support after genotyping
422-
if (!c.hasVcfFile) {
422+
if ((!c.hasVcfFile) && (!c.skipGenotyping)) {
423423
uint32_t totalGtSup = 0;
424424
for(unsigned int file_c = 0; file_c < c.files.size(); ++file_c) {
425425
totalGtSup += spanCountMap[file_c][svIter->id].alt.size() + jctCountMap[file_c][svIter->id].alt.size();
@@ -449,6 +449,7 @@ vcfOutput(TConfig const& c, std::vector<TStructuralVariantRecord> const& svs, TJ
449449
padNumber.insert(padNumber.begin(), 8 - padNumber.length(), '0');
450450
id += padNumber;
451451
bcf_update_id(hdr, rec, id.c_str());
452+
if (c.skipGenotyping) svIter->alleles = _addAlleles("N", std::string(bamhd->target_name[svIter->chr2]), *svIter, svIter->svt);
452453
std::string alleles = _replaceIUPAC(svIter->alleles);
453454
bcf_update_alleles_str(hdr, rec, alleles.c_str());
454455
bcf_update_filter(hdr, rec, &tmpi, 1);
@@ -461,6 +462,7 @@ vcfOutput(TConfig const& c, std::vector<TStructuralVariantRecord> const& svs, TJ
461462
dellyVersion += dellyVersionNumber;
462463
bcf_update_info_string(hdr,rec, "SVMETHOD", dellyVersion.c_str());
463464
if (svIter->svt < DELLY_SVT_TRANS) {
465+
if (svEndPos <= svStartPos) svEndPos = svStartPos + 1;
464466
tmpi = svEndPos;
465467
bcf_update_info_int32(hdr, rec, "END", &tmpi, 1);
466468
} else {

src/tegua.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ namespace torali {
3939
bool hasExcludeFile;
4040
bool hasVcfFile;
4141
bool hasAltFile;
42+
bool skipGenotyping;
4243
uint16_t minMapQual;
4344
uint16_t minGenoQual;
4445
uint32_t minClip;
@@ -169,7 +170,7 @@ namespace torali {
169170
}
170171

171172
// SV Genotyping
172-
genotypeLR(c, svs, jctMap, rcMap);
173+
if (!c.skipGenotyping) genotypeLR(c, svs, jctMap, rcMap);
173174

174175
// VCF Output
175176
vcfOutput(c, svs, jctMap, rcMap, spanMap);
@@ -235,6 +236,7 @@ namespace torali {
235236
("pruning,j", boost::program_options::value<uint32_t>(&c.graphPruning)->default_value(1000), "graph pruning cutoff")
236237
("extension,e", boost::program_options::value<float>(&c.indelExtension)->default_value(0.5), "enforce indel extension")
237238
("scoring,s", boost::program_options::value<std::string>(&scoring)->default_value("3,-2,-3,-1"), "alignment scoring")
239+
("skipGT,k", "skip consensus realignment and genotyping (useful for complex SVs)")
238240
;
239241

240242
boost::program_options::positional_options_description pos_args;
@@ -382,6 +384,10 @@ namespace torali {
382384
}
383385
}
384386

387+
// Consensus alignment?
388+
if (vm.count("skipGT")) c.skipGenotyping = true;
389+
else c.skipGenotyping = false;
390+
385391
// Show cmd
386392
boost::posix_time::ptime now = boost::posix_time::second_clock::local_time();
387393
std::cerr << '[' << boost::posix_time::to_simple_string(now) << "] ";

0 commit comments

Comments
 (0)