C: kmer similarity: small improvements

This commit is contained in:
Celine Mercier
2019-07-06 16:30:32 +02:00
parent f765c6f41e
commit 86bfa96fbe
2 changed files with 6 additions and 14 deletions

View File

@ -78,8 +78,7 @@ Obi_ali_p kmer_similarity(Obiview_p view1, OBIDMS_column_p column1, index_t idx1
Obi_ali_p ali = NULL;
int i, j;
bool switched_seqs;
bool left_ali;
double score = 0.0;
int score = 0;
Obi_blob_p blob1 = NULL;
Obi_blob_p blob2 = NULL;
Obi_blob_p temp_blob = NULL;
@ -397,8 +396,6 @@ Obi_ali_p kmer_similarity(Obiview_p view1, OBIDMS_column_p column1, index_t idx1
keep_seq2_end = true;
}
score = max_common_kmers + kmer_size - 1;
ali = (Obi_ali_p) malloc(sizeof(Obi_ali_t));
if (ali == NULL)
{
@ -407,6 +404,7 @@ Obi_ali_p kmer_similarity(Obiview_p view1, OBIDMS_column_p column1, index_t idx1
return NULL;
}
score = max_common_kmers + kmer_size - 1; // aka the number of nucleotides in the longest stretch of kmers perfectly matching
abs_shift = abs(best_shift);
// Save result in Obi_ali structure
@ -417,15 +415,9 @@ Obi_ali_p kmer_similarity(Obiview_p view1, OBIDMS_column_p column1, index_t idx1
ali->consensus_seq = NULL;
ali->consensus_qual = NULL;
if (((best_shift <= 0) && (!switched_seqs)) || ((best_shift > 0) && switched_seqs))
{
left_ali = true;
strcpy(ali->direction, "left");
}
else
{
left_ali = false;
strcpy(ali->direction, "right");
}
// Build the consensus sequence if asked
if (build_consensus)

View File

@ -27,7 +27,7 @@
* @brief Alignment structure, with informations about the similarity and to rebuild the alignment.
*/
typedef struct Obi_ali {
double score; /**< Alignment score.
int score; /**< Alignment score, corresponding to the number of matches (identical nucleotides aligned).
*/
int consensus_length; /**< Length of the final consensus sequence.
*/
@ -37,10 +37,10 @@ typedef struct Obi_ali {
*/
uint8_t* consensus_qual; /**< Consensus quality built as to reconstruct a pairedend read.
*/
int shift; /**< Shift chosen to align the sequences (for shifted alignment).
int shift; /**< Shift chosen to align the sequences.
*/
char direction[6]; /**< Alignment direction (positive/right or negative/left shift).
*/
char direction[6]; /**< Alignement direction (positive/right or negative/left shift) (for shifted alignment).
*/ // TODO but sequences switched around depending on size..... discuss
} Obi_ali_t, *Obi_ali_p;