@@ -72,72 +72,75 @@ void write_record(Cluster const & cluster,
72
72
73
73
if (mate1.seq_name == mate2.seq_name )
74
74
{
75
- size_t const insert_size = cluster.get_average_inserted_sequence_size ();
76
- int const distance = mate2.position - mate1.position - 1 ;
77
- int sv_length{};
78
- int sv_length_iGenVar{};
79
- std::string sv_type;
80
-
81
- // Tandem Duplication
82
- // In case of a small deletion inside of a duplication, the distance is a small positive value
83
- if (cluster.get_common_tandem_dup_count () > 0 && static_cast <uint64_t >(distance) <= args.max_tol_deleted_length )
75
+ if (mate1.orientation == strand::forward)
84
76
{
85
- record.alt () = {" <DUP:TANDEM>" };
86
- // Increment end by 1 because VCF is 1-based
87
- record.info ().push_back ({.id = " END" , .value = mate2.position + 1 });
88
- sv_length = distance + 2 ;
89
- sv_length_iGenVar = insert_size;
90
- sv_type = " DUP" ;
91
- }
92
- // Deletion OR Inversion
93
- else if (distance > 0 )
94
- {
95
- // Inversion
96
- // An Inversion consists of 2 Breakpoints, thus it looks like a deletion with an inserted sequence
97
- if (insert_size >= args.min_var_length )
77
+ size_t const insert_size = cluster.get_average_inserted_sequence_size ();
78
+ int const distance = mate2.position - mate1.position - 1 ;
79
+ int sv_length{};
80
+ int sv_length_iGenVar{};
81
+ std::string sv_type;
82
+
83
+ // Tandem Duplication
84
+ // In case of a small deletion inside of a duplication, the distance is a small positive value
85
+ if (cluster.get_common_tandem_dup_count () > 0 && static_cast <uint64_t >(distance) <= args.max_tol_deleted_length )
98
86
{
99
- // Increment position by 1 because INV mate1 points on its last element
100
- record.pos () += 1 ;
101
- record.alt () = {" <INV>" };
87
+ record.alt () = {" <DUP:TANDEM>" };
102
88
// Increment end by 1 because VCF is 1-based
103
- // Increment end by 1 because inversion ends one base before mate2 begins
104
89
record.info ().push_back ({.id = " END" , .value = mate2.position + 1 });
105
- sv_length = distance;
106
- sv_length_iGenVar = sv_length ;
107
- sv_type = " INV " ;
90
+ sv_length = distance + 2 ;
91
+ sv_length_iGenVar = insert_size ;
92
+ sv_type = " DUP " ;
108
93
}
109
- // Deletion
110
- // In case of a small insertion inside of an deletion, the insert_size is a small positive value.
111
- else if (insert_size <= args.max_tol_inserted_length )
94
+ // Deletion OR Inversion
95
+ else if (distance > 0 )
112
96
{
113
- record.alt () = {" <DEL>" };
97
+ // Inversion
98
+ // An Inversion consists of 2 Breakpoints, thus it looks like a deletion with an inserted sequence
99
+ if (insert_size >= args.min_var_length )
100
+ {
101
+ // Increment position by 1 because INV mate1 points on its last element
102
+ record.pos () += 1 ;
103
+ record.alt () = {" <INV>" };
104
+ // Increment end by 1 because VCF is 1-based
105
+ // Increment end by 1 because inversion ends one base before mate2 begins
106
+ record.info ().push_back ({.id = " END" , .value = mate2.position + 1 });
107
+ sv_length = distance;
108
+ sv_length_iGenVar = sv_length;
109
+ sv_type = " INV" ;
110
+ }
111
+ // Deletion
112
+ // In case of a small insertion inside of a deletion, the insert_size is a small positive value.
113
+ else if (insert_size <= args.max_tol_inserted_length )
114
+ {
115
+ record.alt () = {" <DEL>" };
116
+ // Increment end by 1 because VCF is 1-based
117
+ // Decrement end by 1 because deletion ends one base before mate2 begins
118
+ record.info ().push_back ({.id = " END" , .value = mate2.position });
119
+ sv_length = -distance;
120
+ sv_length_iGenVar = sv_length;
121
+ sv_type = " DEL" ;
122
+ }
123
+ }
124
+ // Insertion (sv_length is positive)
125
+ // In case of a small deletion inside of an insertion, the distance is a small positive value
126
+ else if (insert_size > 0 && static_cast <uint64_t >(distance) <= args.max_tol_deleted_length )
127
+ {
128
+ record.alt () = {" <INS>" };
114
129
// Increment end by 1 because VCF is 1-based
115
- // Decrement end by 1 because deletion ends one base before mate2 begins
116
- record.info ().push_back ({.id = " END" , .value = mate2.position });
117
- sv_length = -distance;
130
+ record.info ().push_back ({.id = " END" , .value = mate1.position + 1 });
131
+ sv_length = insert_size;
118
132
sv_length_iGenVar = sv_length;
119
- sv_type = " DEL" ;
133
+ sv_type = " INS" ;
134
+ }
135
+ // The SVLEN is neither too short nor too long than specified by the user.
136
+ if (std::abs (sv_length) >= args.min_var_length &&
137
+ std::abs (sv_length) <= args.max_var_length )
138
+ {
139
+ record.info ().push_back ({.id = " SVLEN" , .value = sv_length});
140
+ record.info ().push_back ({.id = " iGenVar_SVLEN" , .value = sv_length_iGenVar});
141
+ record.info ().push_back ({.id = " SVTYPE" , .value = sv_type});
142
+ found_SV = true ;
120
143
}
121
- }
122
- // Insertion (sv_length is positive)
123
- // In case of a small deletion inside of an insertion, the distance is a small positive value
124
- else if (insert_size > 0 && static_cast <uint64_t >(distance) <= args.max_tol_deleted_length )
125
- {
126
- record.alt () = {" <INS>" };
127
- // Increment end by 1 because VCF is 1-based
128
- record.info ().push_back ({.id = " END" , .value = mate1.position + 1 });
129
- sv_length = insert_size;
130
- sv_length_iGenVar = sv_length;
131
- sv_type = " INS" ;
132
- }
133
- // The SVLEN is neither too short nor too long than specified by the user.
134
- if (std::abs (sv_length) >= args.min_var_length &&
135
- std::abs (sv_length) <= args.max_var_length )
136
- {
137
- record.info ().push_back ({.id = " SVLEN" , .value = sv_length});
138
- record.info ().push_back ({.id = " iGenVar_SVLEN" , .value = sv_length_iGenVar});
139
- record.info ().push_back ({.id = " SVTYPE" , .value = sv_type});
140
- found_SV = true ;
141
144
}
142
145
}
143
146
}
0 commit comments