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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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()));
Note: See TracChangeset for help on using the changeset viewer.