| 1 | // This file is part of A2Amapper.cxx . . $ `<file>/atac-driver/libatac/atacFeature.C`/ |
| 2 | // Copyright (c) 2005, 2006 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 <stdio.h> |
| 20 | #include <stdlib.h> |
| 21 | #include <unistd.h> |
| 22 | |
| 23 | #include "bio++.H"cxx . . $ `<file>/libbio/bio++.H`/ |
| 24 | #include "atac.H"cxx . . $ `<file>/atac-driver/libatac/atac.H`/ |
| 25 | |
| 26 | |
| 27 | static |
| 28 | uint32cxx . . $ uint32# |
| 29 | decodeAtacNamecxx . . $ decodeAtacName(fb80c8a16196665a).(char *atac, |
| 30 | char *label) { |
| 31 | if (label) { |
| 32 | while (*atac && (*atac != ':')) |
| 33 | *label++ = *atac++; |
| 34 | *label = 0; |
| 35 | } else { |
| 36 | while (*atac && (*atac != ':')) |
| 37 | atac++; |
| 38 | } |
| 39 | if (*atac) |
| 40 | return(strtouint32cxx . . $ `libutil/util.h:82:10`!(atac+1, 0L)); |
| 41 | return(~uint32ZEROcxx . . $ `libutil/util.h:60:10`!); |
| 42 | } |
| 43 | |
| 44 | |
| 45 | atacFeaturecxx . . $ atacFeature#::atacFeaturecxx . . $ atacFeature#atacFeature(fda57c8427c60377).(char *line) { |
| 46 | decodecxx . . $ atacFeature#decode(fda57c8427c60377).(line); |
| 47 | } |
| 48 | |
| 49 | |
| 50 | atacFeaturecxx . . $ atacFeature#::atacFeaturecxx . . $ atacFeature#atacFeature(553789a0a5baebce).(char *fuid, |
| 51 | char *puid, |
| 52 | uint32cxx . . $ uint32# fiid, |
| 53 | char *t, |
| 54 | uint32cxx . . $ uint32# i, uint32cxx . . $ uint32# p, uint32cxx . . $ uint32# l) { |
| 55 | |
| 56 | strcpy(featureuidcxx . . $ atacFeature#featureuid., fuid); |
| 57 | strcpy(parentuidcxx . . $ atacFeature#parentuid., puid); |
| 58 | |
| 59 | featureuidcxx . . $ atacFeature#featureuid.[15] = 0; |
| 60 | parentuidcxx . . $ atacFeature#parentuid.[15] = 0; |
| 61 | |
| 62 | featureiidcxx . . $ atacFeature#featureiid. = fiid; |
| 63 | |
| 64 | typecxx . . $ atacFeature#type.[0] = 0; |
| 65 | typecxx . . $ atacFeature#type.[1] = 0; |
| 66 | typecxx . . $ atacFeature#type.[2] = 0; |
| 67 | typecxx . . $ atacFeature#type.[3] = 0; |
| 68 | strcpy(typecxx . . $ atacFeature#type., t); |
| 69 | |
| 70 | iidcxx . . $ atacFeature#iid. = i; |
| 71 | poscxx . . $ atacFeature#pos. = p; |
| 72 | lencxx . . $ atacFeature#len. = l; |
| 73 | } |
| 74 | |
| 75 | |
| 76 | void |
| 77 | atacFeaturecxx . . $ atacFeature#::decodecxx . . $ atacFeature#decode(fda57c8427c60377).(char *line) { |
| 78 | |
| 79 | splitToWordscxx . . $ splitToWords# Wcxx . . $ splitToWords#splitToWords(fda57c8427c60377).(line); |
| 80 | |
| 81 | strcpy(featureuidcxx . . $ atacFeature#featureuid., W[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).2]); |
| 82 | strcpy(parentuidcxx . . $ atacFeature#parentuid., W[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).3]); |
| 83 | |
| 84 | featureuidcxx . . $ atacFeature#featureuid.[15] = 0; |
| 85 | parentuidcxx . . $ atacFeature#parentuid.[15] = 0; |
| 86 | |
| 87 | featureiidcxx . . $ atacFeature#featureiid. = 0; |
| 88 | |
| 89 | typecxx . . $ atacFeature#type.[0] = 0; |
| 90 | typecxx . . $ atacFeature#type.[1] = 0; |
| 91 | typecxx . . $ atacFeature#type.[2] = 0; |
| 92 | typecxx . . $ atacFeature#type.[3] = 0; |
| 93 | strcpy(typecxx . . $ atacFeature#type., W[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).1]); |
| 94 | |
| 95 | iidcxx . . $ atacFeature#iid. = decodeAtacNamecxx . . $ decodeAtacName(fb80c8a16196665a).(W[cxx . . $ splitToWords#`operator[]`(f109d7e0a0ca42b3).4], 0L); |
| 96 | poscxx . . $ atacFeature#pos. = strtouint32cxx . . $ `libutil/util.h:82:10`!(W[5], 0L); |
| 97 | lencxx . . $ atacFeature#len. = strtouint32cxx . . $ `libutil/util.h:82:10`!(W[6], 0L); |
| 98 | } |
| 99 | |
| 100 | |
| 101 | bool |
| 102 | atacFeaturecxx . . $ atacFeature#::sanitycxx . . $ atacFeature#sanity(306adc10abbe5009).(seqCachecxx . . $ seqCache# *A, char *inLine) { |
| 103 | |
| 104 | bool featureOK = true; |
| 105 | |
| 106 | if (A) { |
| 107 | if ((poscxx . . $ atacFeature#pos.) > A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iidcxx . . $ atacFeature#iid.) || (poscxx . . $ atacFeature#pos. + lencxx . . $ atacFeature#len.) > A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iidcxx . . $ atacFeature#iid.)) { |
| 108 | chompcxx . . $ `libutil/util.h:330:9`!(inLine); |
| 109 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Feature longer than sequence (by "uint32FMTcxx . . $ `libutil/util.h:65:10`!"bp): seqLen="uint32FMTWcxx . . $ `libutil/util.h:64:10`!(8)" %s\n", |
| 110 | poscxx . . $ atacFeature#pos. + lencxx . . $ atacFeature#len. - A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iidcxx . . $ atacFeature#iid.), |
| 111 | A->getSequenceLengthcxx . . $ seqCache#getSequenceLength(2141b656ce2cc063).(iidcxx . . $ atacFeature#iid.), inLine); |
| 112 | featureOK = false; |
| 113 | } |
| 114 | |
| 115 | if (iidcxx . . $ atacFeature#iid. >= A->getNumberOfSequencescxx . . $ seqCache#getNumberOfSequences(db52760e79bf9054).()) { |
| 116 | chompcxx . . $ `libutil/util.h:330:9`!(inLine); |
| 117 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Feature references invalid sequence iid: %s\n", inLine); |
| 118 | featureOK = false; |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | return(featureOK); |
| 123 | } |