Changeset 955 for cpp/frams/_demos


Ignore:
Timestamp:
06/25/20 00:34:29 (4 years ago)
Author:
Maciej Komosinski
Message:

Genetic format ID becomes a string (no longer limited to a single character)

Location:
cpp/frams/_demos
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/_demos/f0_variants_test.cpp

    r720 r955  
    9595Geno g(gen);
    9696printf("\nSource genotype: '%s'\n",g.getGenes().c_str());
    97 printf("                  ( format %c %s)\n",
    98        g.getFormat(), g.getComment().c_str());
     97printf("                  ( format %s %s)\n",
     98       g.getFormat().c_str(), g.getComment().c_str());
    9999
    100100Model m(g);//.getConverted('0'));
  • cpp/frams/_demos/genoconv_test.cpp

    r739 r955  
    6666        {
    6767                name = "Test Converter #3";
    68                 in_format = 'z';
     68                in_format = "multiply";
    6969                out_format = '1';
    7070                mapsupport = 1;
     
    112112void printGen(Geno &g)
    113113{
    114         printf("Genotype:\n%s\nFormat: %c\nValid: %s\nComment: %s\n",
    115                 g.getGenes().c_str(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().c_str());
    116 }
    117 
    118 static int goodWidthForFormat(int genotype_format)
    119 {
    120         return genotype_format == '0' ? 45 : 15; // more space for long f0 lines
     114        printf("Genotype:\n%s\nFormat: %s\nValid: %s\nComment: %s\n",
     115               g.getGenes().c_str(), g.getFormat().c_str(), g.isValid() ? "yes" : "no", g.getComment().c_str());
     116}
     117
     118static int goodWidthForFormat(const SString& genotype_format)
     119{
     120        return genotype_format == "0" ? 45 : 15; // more space for long f0 lines
    121121}
    122122
     
    154154        else
    155155                src = "X";
    156         char dst = (argc > 2) ? *argv[2] : '0';
     156        SString dst = (argc > 2) ? *argv[2] : '0';
    157157        bool using_checkpoints = (argc > 3) ? (strcmp(argv[3], "checkpoints") == 0) : false;
    158158
     
    162162        MultiMap m;
    163163        Geno g2 = g1.getConverted(dst, &m, using_checkpoints);
    164         printf("*** Converted to f%c:\n", dst);
     164        printf("*** Converted to f%s:\n", dst.c_str());
    165165        printGen(g2);
    166166
     
    168168        { // using Model with checkpoints
    169169                Model m1(g2, false, true);//true=using_checkpoints
    170                 printf("\nModel built from the converted f%c genotype has %d checkpoints\n", g2.getFormat(), m1.getCheckpointCount());
     170                printf("\nModel built from the converted f%s genotype has %d checkpoints\n", g2.getFormat().c_str(), m1.getCheckpointCount());
    171171                Model m2(g1, false, true);//true=using_checkpoints
    172                 printf("Model built from the source f%c genotype has %d checkpoints\n", g1.getFormat(), m2.getCheckpointCount());
     172                printf("Model built from the source f%s genotype has %d checkpoints\n", g1.getFormat().c_str(), m2.getCheckpointCount());
    173173                // accessing individual checkpoint models (if available)
    174174                if (m1.getCheckpointCount() > 0)
     
    196196
    197197                Model mod1(g1, 1);
    198                 printf("\nModel map for f%c genotype:\n", g1.getFormat());
     198                printf("\nModel map for f%s genotype:\n", g1.getFormat().c_str());
    199199                ModelDisplayMap dm1(mod1);
    200200                dm1.print(goodWidthForFormat(g1.getFormat()));
     
    203203                mod1combined.print();
    204204                Model mod2(g2, 1);
    205                 printf("\nModel map for f%c genotype:\n", g2.getFormat());
     205                printf("\nModel map for f%s genotype:\n", g2.getFormat().c_str());
    206206                ModelDisplayMap dm2(mod2);
    207207                dm2.print(goodWidthForFormat(g2.getFormat()));
  • cpp/frams/_demos/genomanipulation.cpp

    r896 r955  
    258258        if (gc) printf("found converter accepting f1: \"%s\"\n", gc->name);
    259259        SListTempl<GenoConverter*> found;
    260         Geno::getConverters()->findConverters(&found, -1, '0');
     260        Geno::getConverters()->findConverters(&found, Geno::UNKNOWN_FORMAT, '0');
    261261        printf("found %d converter(s) producing f0\n", found.size());
    262262}
     
    281281        Geno g(gen);
    282282        printf("\nSource genotype: '%s'\n", g.getGenes().c_str());
    283         printf("                  ( format %c %s)\n",
    284                 g.getFormat(), g.getComment().c_str());
     283        printf("                  ( format %s %s)\n",
     284                g.getFormat().c_str(), g.getComment().c_str());
    285285
    286286        Model m(g);//.getConverted('0'));
  • cpp/frams/_demos/genooper_test.cpp

    r534 r955  
    88void printGen(Geno &g)
    99{
    10         printf("Genotype: %s\nFormat: %c\nValid: %s\nComment: %s\n",
    11                 g.getGenes().c_str(), g.getFormat(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : g.getComment().c_str());
     10        printf("Genotype: %s\nFormat: %s\nValid: %s\nComment: %s\n",
     11                g.getGenes().c_str(), g.getFormat().c_str(), g.isValid() ? "yes" : "no", g.getComment().len() == 0 ? "(empty)" : g.getComment().c_str());
    1212}
    1313
     
    3030        Geno gsrc(src, -1, "First");
    3131        printGenAndTitle(gsrc, "source genotype (gsrc)");
    32         char format = gsrc.getFormat();
     32        SString format = gsrc.getFormat();
    3333
    3434        Geno gmut = genetics.genman.mutate(gsrc);
     
    4141        printGenAndTitle(gsimplest, "simplest");
    4242
    43         Geno ginvalid("IT'S REALLY WRONG", format);
     43        Geno ginvalid("IT'S REALLY WRONG", format.c_str());
    4444        printGenAndTitle(ginvalid, "invalid");
    4545
  • cpp/frams/_demos/multiline_f0_test.cpp

    r745 r955  
    2727Geno g(gen);
    2828printf("\nSource genotype: '%s'\n",g.getGenes().c_str());
    29 printf("                  ( format %c %s)\n",
    30        g.getFormat(), g.getComment().c_str());
     29printf("                  ( format %s %s)\n",
     30       g.getFormat().c_str(), g.getComment().c_str());
    3131
    3232Model m(g);//.getConverted('0'));
Note: See TracChangeset for help on using the changeset viewer.