Commit c1109649 authored by Mikaël Salson's avatar Mikaël Salson

algo: Remove compilation warnings due to signed/unsigned comparisons

parent b469295a
...@@ -117,7 +117,7 @@ int main(int argc, char* argv[]) ...@@ -117,7 +117,7 @@ int main(int argc, char* argv[])
reads = fa.getAll(); reads = fa.getAll();
list<string> labels; list<string> labels;
for (int i=0; i < reads.size(); i++) { for (size_t i=0; i < reads.size(); i++) {
labels.push_back(fa.label(i)); labels.push_back(fa.label(i));
} }
......
...@@ -39,7 +39,7 @@ unsigned long long filesize(const char* filename) ...@@ -39,7 +39,7 @@ unsigned long long filesize(const char* filename)
return in.tellg(); return in.tellg();
} }
void Fasta::init(int extract_field, string extract_separator, int mark_pos) void Fasta::init(int extract_field, string extract_separator, size_t mark_pos)
{ {
this -> extract_field = extract_field ; this -> extract_field = extract_field ;
this -> extract_separator = extract_separator ; this -> extract_separator = extract_separator ;
...@@ -108,7 +108,7 @@ void Fasta::add(Sequence seq) { ...@@ -108,7 +108,7 @@ void Fasta::add(Sequence seq) {
} }
int Fasta::size() const{ return (int)reads.size(); } int Fasta::size() const{ return (int)reads.size(); }
int Fasta::totalSize() const { return total_size ; } size_t Fasta::totalSize() const { return total_size ; }
list<Sequence> Fasta::getAll() const { list<Sequence> Fasta::getAll() const {
list<Sequence> reads; list<Sequence> reads;
...@@ -235,7 +235,7 @@ void OnlineFasta::addLineToCurrentSequence(string line) ...@@ -235,7 +235,7 @@ void OnlineFasta::addLineToCurrentSequence(string line)
current.sequence += c; current.sequence += c;
if (mark_pos) { if (mark_pos) {
if (current.sequence.length() + current_gaps == mark_pos) if ((int) current.sequence.length() + current_gaps == mark_pos)
current.marked_pos = current.sequence.length(); current.marked_pos = current.sequence.length();
} }
} }
......
...@@ -17,7 +17,7 @@ typedef struct read_t ...@@ -17,7 +17,7 @@ typedef struct read_t
string sequence; // Sequence: original string representation string sequence; // Sequence: original string representation
string quality; string quality;
int* seq; // Sequence: seq representation int* seq; // Sequence: seq representation
int marked_pos; // Some marked position in the sequence size_t marked_pos; // Some marked position in the sequence
} Sequence; } Sequence;
typedef enum { typedef enum {
...@@ -32,9 +32,9 @@ unsigned long long filesize(const char* filename); ...@@ -32,9 +32,9 @@ unsigned long long filesize(const char* filename);
class Fasta class Fasta
{ {
void init(int extract_field, string extract_separator, int mark_pos=0); void init(int extract_field, string extract_separator, size_t mark_pos=0);
int total_size; size_t total_size;
int extract_field; int extract_field;
int mark_pos; int mark_pos;
string extract_separator; string extract_separator;
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
string name; string name;
string basename; string basename;
int size() const; int size() const;
int totalSize() const; size_t totalSize() const;
/** /**
* Get all the sequences from the FASTA file * Get all the sequences from the FASTA file
......
...@@ -44,7 +44,7 @@ protected: ...@@ -44,7 +44,7 @@ protected:
int s; // span of the seed (s >= k) int s; // span of the seed (s >= k)
string seed ; string seed ;
size_t nb_kmers_inserted; size_t nb_kmers_inserted;
int max_size_indexing; size_t max_size_indexing;
public: public:
......
...@@ -103,7 +103,7 @@ string AlignBox::refToString(int from, int to) { ...@@ -103,7 +103,7 @@ string AlignBox::refToString(int from, int to) {
if (i == start) if (i == start)
s << color; s << color;
if (j > 0 && j <= ref.size()) if (j > 0 && (size_t)j <= ref.size())
s << ref[j-1] ; s << ref[j-1] ;
else else
s << "."; s << ".";
...@@ -684,7 +684,7 @@ string check_and_resolve_overlap(string seq, int seq_begin, int seq_end, ...@@ -684,7 +684,7 @@ string check_and_resolve_overlap(string seq, int seq_begin, int seq_end,
int trim_l[overlap+1]; int trim_l[overlap+1];
int trim_r[overlap+1]; int trim_r[overlap+1];
for(int i=0; i<=overlap; i++) { for(size_t i=0; i<=(size_t)overlap; i++) {
score_l[i] = i < seq_left.size() ? dp_l.best_score_on_i(seq_left.size() - i, trim_l + i) : MINUS_INF ; score_l[i] = i < seq_left.size() ? dp_l.best_score_on_i(seq_left.size() - i, trim_l + i) : MINUS_INF ;
score_r[i] = i < seq_right.size() ? dp_r.best_score_on_i(seq_right.size() - i, trim_r + i) : MINUS_INF ; score_r[i] = i < seq_right.size() ? dp_r.best_score_on_i(seq_right.size() - i, trim_r + i) : MINUS_INF ;
} }
......
...@@ -139,7 +139,7 @@ int dna_to_int(const string &word, int size) { ...@@ -139,7 +139,7 @@ int dna_to_int(const string &word, int size) {
string nuc_to_aa(const string &word) { string nuc_to_aa(const string &word) {
string aa; string aa;
int index_word = 0; int index_word = 0;
int i = 0; size_t i = 0;
for (; i < word.length() ; i++) { for (; i < word.length() ; i++) {
index_word = (index_word << 2) | nuc_to_int(word[i]); index_word = (index_word << 2) | nuc_to_int(word[i]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment