File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -687,6 +687,20 @@ double BundleFactory::next_valid_alignment(const ReadHit*& bh)
687687
688688 if (spans_bad_intron (tmp))
689689 continue ;
690+
691+ // Check for reads with no matching CIGAR entries. Generally such a read should have been rejected
692+ // as unmapped, but such records have been seen in the wild. If they were allowed to stay they would cause
693+ // trouble when converted to Scaffolds, yielding an invalid aug_ops vector.
694+ const vector<CigarOp>& cig = tmp.cigar ();
695+ bool found_match = false ;
696+ for (vector<CigarOp>::const_iterator it = cig.begin (), itend = cig.end (); it != itend && !found_match; ++it)
697+ if (it->opcode == MATCH)
698+ found_match = true ;
699+
700+ if (!found_match) {
701+ fprintf (stderr, " Skipping hit with no Match operators in its CIGAR string\n " );
702+ continue ;
703+ }
690704
691705 int order = _hit_fac->ref_table ().observation_order (tmp.ref_id ());
692706 if (_prev_pos != 0 )
@@ -755,7 +769,7 @@ double BundleFactory::next_valid_alignment(const ReadHit*& bh)
755769
756770 if (hit_within_mask)
757771 continue ;
758-
772+
759773 // if the user's asked for read trimming, do it here.
760774 if (trim_read_length > 0 )
761775 {
You can’t perform that action at this time.
0 commit comments