Skip to content

Refactor custom features #38

@jonblack

Description

@jonblack

Custom features should be simplified, which requires some design improvements. There are also some minor coding issues.

design

These design issues we need to chat about. It'll be easier when it's clear what the config settings are for.

  • Rename ConfParser to CustomFeatureParser unless other settings can be loaded other than features (in which case, let's chat about it);
  • Why is there a FeatureSettings and RawFeatureSettings? Also, why are they plural? Moreover, there is no information about what the different fields in the conf file mean and how they affect FastaData.
  • get_conf_data takes a FastaData const&, copies it, adds the returns and returns it. Why not just pass a non-const reference in? Or better, have get_conf_data return a list of Feature's that can be added to FastaData after it returns. In the latter case, get_conf_data can be seen as a function that translates the config domain models (FeatureSettings) into the fasta parsing domain models. In reality they both share the concept of a Feature (among others) so perhaps we can factor out these common models.

code

  • In get_conf_data, seq.seq_no should probably always be >= 0 so I'd check this during parsing. Also, the warning message states that it should be between 1 and sequence length (not equal to zero);
  • In get_conf_data, don't cast size_t to signed, they aren't always the same. Instead cast the positions parsed from the config file to size_t;
  • Use static_cast<T> instead of c style casts as they are much safer;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions