| 1 | // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/matchExtender/matchExtender-dump.C`/ |
| 2 | // Copyright (c) 2004 Applied Biosystems |
| 3 | // Copyright (c) 2005 J. Craig Venter Institute |
| 4 | // Author: Dan Fasulo |
| 5 | // Author: Brian Walenz |
| 6 | // |
| 7 | // This program is free software; you can redistribute it and/or modify |
| 8 | // it under the terms of the GNU General Public License as published by |
| 9 | // the Free Software Foundation; either version 2 of the License, or |
| 10 | // (at your option) any later version. |
| 11 | // |
| 12 | // This program is distributed in the hope that it will be useful, |
| 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | // GNU General Public License for more details. |
| 16 | // |
| 17 | // You should have received (LICENSE.txt) a copy of the GNU General Public |
| 18 | // License along with this program; if not, write to the Free Software |
| 19 | // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 20 | |
| 21 | #include <stdio.h> |
| 22 | #include <stdlib.h> |
| 23 | #include <unistd.h> |
| 24 | |
| 25 | #include "bio++.H"cxx . . $ `<file>/libbio/bio++.H`/ |
| 26 | #include "match.H"cxx . . $ `<file>/atac-driver/matchExtender/match.H`/ |
| 27 | |
| 28 | |
| 29 | void |
| 30 | match_scxx . . $ match_s#::dumpcxx . . $ match_s#dump(29bc4bd13aa9ae2e).(FILE *out, const char *descr, bool showSeq) { |
| 31 | fprintf(out, "%s: ID:%s range1:"uint32FMTcxx . . $ `libutil/util.h:65:10`!","uint32FMTcxx . . $ `libutil/util.h:65:10`!" _pos="uint32FMTcxx . . $ `libutil/util.h:65:10`!" (seqlen="uint32FMTcxx . . $ `libutil/util.h:65:10`!")\n", |
| 32 | descr, _matchIdcxx . . $ match_s#_matchId., |
| 33 | _acc1cxx . . $ match_s#_acc1.->getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).(), _acc1cxx . . $ match_s#_acc1.->getRangeLengthcxx . . $ FastAAccessor#getRangeLength(db52760e79bf9054).(), _acc1cxx . . $ match_s#_acc1.->_poscxx . . $ FastAAccessor#_pos., _seq1cxx . . $ match_s#_seq1.->sequenceLengthcxx . . $ seqInCore#sequenceLength(ddd8539a2fcdd4ce).()); |
| 34 | fprintf(out, "%s ID:%s range2:"uint32FMTcxx . . $ `libutil/util.h:65:10`!","uint32FMTcxx . . $ `libutil/util.h:65:10`!" _pos="uint32FMTcxx . . $ `libutil/util.h:65:10`!" (seqlen="uint32FMTcxx . . $ `libutil/util.h:65:10`!") diag:"uint32FMTcxx . . $ `libutil/util.h:65:10`!" %s\n", |
| 35 | descr, _matchIdcxx . . $ match_s#_matchId., |
| 36 | _acc2cxx . . $ match_s#_acc2.->getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).(), _acc2cxx . . $ match_s#_acc2.->getRangeLengthcxx . . $ FastAAccessor#getRangeLength(db52760e79bf9054).(), _acc2cxx . . $ match_s#_acc2.->_poscxx . . $ FastAAccessor#_pos., _seq2cxx . . $ match_s#_seq2.->sequenceLengthcxx . . $ seqInCore#sequenceLength(ddd8539a2fcdd4ce).(), |
| 37 | _diagonalcxx . . $ match_s#_diagonal., (_ori1cxx . . $ match_s#_ori1. != _ori2cxx . . $ match_s#_ori2.) ? "reversed" : ""); |
| 38 | |
| 39 | if (showSeq) { |
| 40 | FastAAccessorcxx . . $ FastAAccessor# &A = *_acc1cxx . . $ match_s#_acc1.; |
| 41 | FastAAccessorcxx . . $ FastAAccessor# &B = *_acc2cxx . . $ match_s#_acc2.; |
| 42 | |
| 43 | // Save the position of the accessors |
| 44 | // |
| 45 | uint32cxx . . $ uint32# acc1pos = A._poscxx . . $ FastAAccessor#_pos.; |
| 46 | uint32cxx . . $ uint32# acc2pos = B._poscxx . . $ FastAAccessor#_pos.; |
| 47 | |
| 48 | A.setPositioncxx . . $ FastAAccessor#setPosition(dfa6e707f7696010).(A.getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).()); |
| 49 | B.setPositioncxx . . $ FastAAccessor#setPosition(dfa6e707f7696010).(B.getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).()); |
| 50 | |
| 51 | uint32cxx . . $ uint32# margin = 5; |
| 52 | uint32cxx . . $ uint32# i = 0; |
| 53 | char *seq = new char [_acc1cxx . . $ match_s#_acc1.->getRangeEndcxx . . $ FastAAccessor#getRangeEnd(db52760e79bf9054).() - _acc1cxx . . $ match_s#_acc1.->getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).() + margin + margin + 32]; |
| 54 | char *las = seq; |
| 55 | |
| 56 | strcpy(seq, ">>> "); |
| 57 | while (*las) las++; |
| 58 | |
| 59 | for (i=0; i<margin; i++) |
| 60 | --cxx . . $ FastAAccessor#operator--(ab00271b6674b0d4).A; |
| 61 | for (i=0; i<margin; i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).A) |
| 62 | if (A.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 63 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).A; |
| 64 | else |
| 65 | *las++ = ' '; |
| 66 | *las++ = ':'; |
| 67 | for (i=0; i<_acc1cxx . . $ match_s#_acc1.->getRangeEndcxx . . $ FastAAccessor#getRangeEnd(db52760e79bf9054).() - _acc1cxx . . $ match_s#_acc1.->getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).(); i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).A) |
| 68 | if (A.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 69 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).A; |
| 70 | else |
| 71 | *las++ = ' '; |
| 72 | *las++ = ':'; |
| 73 | for (i=0; i<margin; i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).A) |
| 74 | if (A.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 75 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).A; |
| 76 | else |
| 77 | *las++ = ' '; |
| 78 | |
| 79 | *las++ = 0; |
| 80 | fprintf(out, "%s\n", seq); |
| 81 | |
| 82 | las = seq; |
| 83 | |
| 84 | strcpy(seq, (_ori1cxx . . $ match_s#_ori1. == _ori2cxx . . $ match_s#_ori2.) ? ">>> " : "<<< "); |
| 85 | while (*las) las++; |
| 86 | |
| 87 | for (i=0; i<margin; i++) |
| 88 | --cxx . . $ FastAAccessor#operator--(ab00271b6674b0d4).B; |
| 89 | for (i=0; i<margin; i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).B) |
| 90 | if (B.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 91 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).B; |
| 92 | else |
| 93 | *las++ = ' '; |
| 94 | *las++ = ':'; |
| 95 | for (i=0; i<_acc1cxx . . $ match_s#_acc1.->getRangeEndcxx . . $ FastAAccessor#getRangeEnd(db52760e79bf9054).() - _acc1cxx . . $ match_s#_acc1.->getRangeBegincxx . . $ FastAAccessor#getRangeBegin(db52760e79bf9054).(); i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).B) |
| 96 | if (B.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 97 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).B; |
| 98 | else |
| 99 | *las++ = ' '; |
| 100 | *las++ = ':'; |
| 101 | for (i=0; i<margin; i++, ++cxx . . $ FastAAccessor#operator++(ab00271b6674b0d4).B) |
| 102 | if (B.isValidcxx . . $ FastAAccessor#isValid(c9857a73d68e59ba).()) |
| 103 | *las++ = *cxx . . $ FastAAccessor#`operator*`(1b8b762cbef9c2c9).B; |
| 104 | else |
| 105 | *las++ = ' '; |
| 106 | |
| 107 | *las++ = 0; |
| 108 | fprintf(out, "%s\n", seq); |
| 109 | |
| 110 | delete [] seq; |
| 111 | |
| 112 | // Restore positions |
| 113 | _acc1cxx . . $ match_s#_acc1.->_poscxx . . $ FastAAccessor#_pos. = acc1pos; |
| 114 | _acc2cxx . . $ match_s#_acc2.->_poscxx . . $ FastAAccessor#_pos. = acc2pos; |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 |