| 1 | #cxx . . $ `<file>/seagen/filterMRNA.C`/include <stdio.h> |
| 2 | #include <stdlib.h> |
| 3 | #include <unistd.h> |
| 4 | #include <string.h> |
| 5 | #include <errno.h> |
| 6 | #include "aHit.H"cxx . . $ `<file>/seagen/aHit.H`/ |
| 7 | #include "hitReader.H"cxx . . $ `<file>/seagen/hitReader.H`/ |
| 8 | |
| 9 | |
| 10 | int |
| 11 | maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 12 | |
| 13 | if (argc < 2) |
| 14 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "ESTmapper utility function -- not for human use.\n"), exitcxx . . $ exit(44ed87f96534fad7).(1); |
| 15 | |
| 16 | hitReadercxx . . $ hitReader# HRcxx . . $ hitReader#hitReader(d4f767463ce0a6b3).(argc); |
| 17 | double L = 0.2; |
| 18 | double H = 0.6; |
| 19 | double V = 0.7; |
| 20 | double M = 0.3; |
| 21 | double MC = 0.2; |
| 22 | uint32cxx . . $ uint32# ML = 150; |
| 23 | bool beVerbose = false; |
| 24 | |
| 25 | int arg = 1; |
| 26 | while (arg < argc) { |
| 27 | if (strncmp(argv[arg], "-v", 2) == 0) { |
| 28 | beVerbose = true; |
| 29 | } else if (strcmp(argv[arg], "-l") == 0) { |
| 30 | L = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]); |
| 31 | } else if (strcmp(argv[arg], "-h") == 0) { |
| 32 | H = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]); |
| 33 | } else if (strcmp(argv[arg], "-v") == 0) { |
| 34 | V = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]); |
| 35 | } else if (strcmp(argv[arg], "-m") == 0) { |
| 36 | M = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]); |
| 37 | } else if (strcmp(argv[arg], "-mc") == 0) { |
| 38 | MC = atofcxx . . $ atof(9b0361fcbc284e4f).(argv[++arg]); |
| 39 | } else if (strcmp(argv[arg], "-ml") == 0) { |
| 40 | ML = atoicxx . . $ atoi(f5ecf3191ed0cd93).(argv[++arg]); |
| 41 | } else { |
| 42 | HR.addInputFilecxx . . $ hitReader#addInputFile(fda57c8427c60377).(argv[arg]); |
| 43 | } |
| 44 | |
| 45 | arg++; |
| 46 | } |
| 47 | |
| 48 | if (beVerbose) { |
| 49 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "Filtering with:\n"); |
| 50 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " score difference of %4.2f or less -> 100.0%% of best score\n", L); |
| 51 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " score difference of %4.2f or more -> %5.1f%% of best score\n", H, 100*V); |
| 52 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " scores at least %4.2f are always output\n", M); |
| 53 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, " scores at least %4.2f AND at least "uint32FMTcxx . . $ `libutil/util.h:65:10`!" bases covered are always output\n", MC, ML); |
| 54 | } |
| 55 | |
| 56 | while (HR.loadHitscxx . . $ hitReader#loadHits(c9857a73d68e59ba).()) { |
| 57 | HR.sortByCoveragecxx . . $ hitReader#sortByCoverage(49f6e7a06ebc5aa8).(); |
| 58 | |
| 59 | double hiCov = HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).0].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.; |
| 60 | double loCov = HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).0].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.; |
| 61 | for (uint32cxx . . $ uint32# i=0; i < HR.numHitscxx . . $ hitReader#numHits(db52760e79bf9054).(); i++) |
| 62 | if ((HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].acxx . . $ $anonymous_type_cf7e7b12f763008e_1#a.._mergedcxx . . $ aHit#_merged. == false) && (loCov > HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.)) |
| 63 | loCov = HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.; |
| 64 | |
| 65 | double h = hiCov - loCov; |
| 66 | double p = 0.0; |
| 67 | |
| 68 | if (h <= L) p = 1.0; |
| 69 | if (h >= H) p = V; |
| 70 | if (p == 0.0) p = 1.0 - (1.0 - V) * (h - L) / (H - L); |
| 71 | |
| 72 | // check p; it should be between V and 1.0 |
| 73 | if ((p > 1.0) || (p < V)) |
| 74 | fprintf(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error in p; p=%f\n", p); |
| 75 | |
| 76 | // Output the top p% hits, by score. |
| 77 | |
| 78 | double cutL = HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).0].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage. - p * h; |
| 79 | if (cutL > M) |
| 80 | cutL = M; |
| 81 | |
| 82 | // Save the hit if it has good coverage and it's either above |
| 83 | // the minimum coverage or long. Also blindly save merged |
| 84 | // hits. |
| 85 | // |
| 86 | for (uint32cxx . . $ uint32# i=0; i < HR.numHitscxx . . $ hitReader#numHits(db52760e79bf9054).(); i++) |
| 87 | if (((cutL <= HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.) && ((MC <= HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].coveragecxx . . $ $anonymous_type_cf7e7b12f763008e_1#coverage.) || |
| 88 | (ML <= HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].acxx . . $ $anonymous_type_cf7e7b12f763008e_1#a.._coveredcxx . . $ aHit#_covered.))) || |
| 89 | (HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].acxx . . $ $anonymous_type_cf7e7b12f763008e_1#a.._mergedcxx . . $ aHit#_merged.)) |
| 90 | ahit_printASCIIcxx . . $ ahit_printASCII(6c917abaf95665ca).(&HR[cxx . . $ hitReader#`operator[]`(38191595156c9293).i].acxx . . $ $anonymous_type_cf7e7b12f763008e_1#a., stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!); |
| 91 | } |
| 92 | |
| 93 | return(0); |
| 94 | } |