| 1 | // This file is part of A2Amapper. |
| 2 | // Copyright (c) 2005 J. Craig Venter Institute |
| 3 | // Author: Brian Walenz |
| 4 | // |
| 5 | // This program is free software; you can redistribute it and/or modify |
| 6 | // it under the terms of the GNU General Public License as published by |
| 7 | // the Free Software Foundation; either version 2 of the License, or |
| 8 | // (at your option) any later version. |
| 9 | // |
| 10 | // This program is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received (LICENSE.txt) a copy of the GNU General Public |
| 16 | // License along with this program; if not, write to the Free Software |
| 17 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | |
| 19 | #include "overlap.H" |
| 20 | |
| 21 | int |
| 22 | sortMatches1(const void *a, const void *b) { |
| 23 | const atacMatch *A = *((const atacMatch * const *)a); |
| 24 | const atacMatch *B = *((const atacMatch * const *)b); |
| 25 | |
| 26 | if (A->iid1 < B->iid1) return(-1); |
| 27 | if (A->iid1 > B->iid1) return(1); |
| 28 | if (A->pos1 < B->pos1) return(-1); |
| 29 | if (A->pos1 > B->pos1) return(1); |
| 30 | if (A->len1 > B->len1) return(-1); |
| 31 | if (A->len1 < B->len1) return(1); |
| 32 | if (A->fwd1 > B->fwd1) return(-1); |
| 33 | if (A->fwd1 < B->fwd1) return(1); |
| 34 | return(0); |
| 35 | } |
| 36 | |
| 37 | int |
| 38 | sortMatches2(const void *a, const void *b) { |
| 39 | const atacMatch *A = *((const atacMatch * const *)a); |
| 40 | const atacMatch *B = *((const atacMatch * const *)b); |
| 41 | |
| 42 | if (A->iid2 < B->iid2) return(-1); |
| 43 | if (A->iid2 > B->iid2) return(1); |
| 44 | if (A->pos2 < B->pos2) return(-1); |
| 45 | if (A->pos2 > B->pos2) return(1); |
| 46 | if (A->len2 > B->len2) return(-1); |
| 47 | if (A->len2 < B->len2) return(1); |
| 48 | if (A->fwd2 > B->fwd2) return(-1); |
| 49 | if (A->fwd2 < B->fwd2) return(1); |
| 50 | return(0); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | |
| 55 | int |
| 56 | spanCompare(const void *a, const void *b) { |
| 57 | const span_t *A = *((const span_t * const *)a); |
| 58 | const span_t *B = *((const span_t * const *)b); |
| 59 | |
| 60 | if (A->_iid < B->_iid) return(-1); |
| 61 | if (A->_iid > B->_iid) return(1); |
| 62 | if (A->_beg < B->_beg) return(-1); |
| 63 | if (A->_beg > B->_beg) return(1); |
| 64 | return(0); |
| 65 | } |