datasnakes / OrthoEvolution

An easy to use and comprehensive python package which aids in the analysis and visualization of orthologous genes. 🐵
https://orthoevolution.readthedocs.io/en/master/
29 stars 4 forks source link

Update Alignment configuration. #93

Closed grabear closed 6 years ago

grabear commented 6 years ago

While the other modules are configuring successfully [now](), the data management class's configuration for the alignment class needs to change. Since each alignment takes different parameters, Each type of alignment will have it's own nested key-value pairs in the Alignment_config variable that exists in the YAML files. Guidance for example will look like this:

Alignment_config:
  aln_program: 'GUIDANCE2'
  Guidance_config:
    seqFile: "~\\Datasnakes-Scripts\\Datasnakes\\Manager\\config\\test.faa"
    msaProgram: "CLUSTALW"
    seqType: "nuc"

Further down the road we can do this for a consensus alignment:

Alignment_config:
  aln_program: 'GUIDANCE2'
  Consensus_config:
    Guidance_config:
      seqFile: "~\\Datasnakes-Scripts\\Datasnakes\\Manager\\config\\test.faa"
      msaProgram: "CLUSTALW"
      seqType: "nuc"
    IQ-Tree_config:
      var1:  "hope"
      var2: "dreams"

Obviously there are other options, but for now we've got to KISS.

grabear commented 6 years ago

Helped fixed with function dispatching in commit 9d6bd5068ec66fcdff28c0e873859c3a9e9a2824.

Function dispatching looks like this:

self.config_options = {"Guidance_config": ["GUIDANCE2", self.guidance2], "Pal2Nal_config": ["PAL2NAL", self.pal2nal], "ClustalO_config": ["CLUSTALO", self.clustalo]}

Where you use a function in a dictionary without making an actual call to it. This helps with identifying what function to use based on the config options set in the YAML config file:

Alignment_config:
  aln_program: 'GUIDANCE2'
  Guidance_config:
    seqFile: "~\\Datasnakes-Scripts\\Datasnakes\\Manager\\config\\test.faa"
    msaProgram: "CLUSTALW"
    seqType: "nuc"