.E).ToList();
        } //carry on and tune the string using the notes we returned

I am no design pattern master but I am rapidly acquiring a keen nose for code smells.  Is there a better way to do this given that the same method is being called every time but with just a different parameter.  I looked at Command.  Doesn't seem to apply where a value is returned but correct me if I am wrong.  I also looked at factory but this seems concerned with returning a family of objects, which in this case doesn't apply.  I'v searched stack overflow for the best part of an hour and can't seem to find a relevent example.  Can anyone help.  Thanks.

A:

I personally would create a Dictionary<GuitarString, Scale> and store your mappings between a string and a scale in there. Then you can simply lookup the string in there to get the scale.
e.g.
var stringToScaleMap = new Dictionary<GuitarString, Scale>
                           { 
                               { GuitarString.ELow, Scale.E }
                              , { GuitarString.A, Scale.A }
                               // etc...
                           }

var scale = stringToScaleMap[stringToTune];
notes = _scaleGenerator.GetScale(scale).ToList();

You could store the map in configuration or simply hardcode it somewhere in your project. As the mapping is unlikely to change the latter is probably the simplest option.

 Q:

All possible combinations used to generate relative abundances of said combinations from dataframe

I'm trying to create a loop in R which calculates all possible combinations of all 20 amino acids without repetition in strings up to 20 characters long:
S <- c('G','A','L','M','F','W','K','Q','E','S','P','V','I','C','Y','H','R','N','D','T')

allCombs <- function(x) c(x, lapply(seq_along(x)[-1L], 
                                    function(y) combn(x, y, paste0, collapse = "")),
                          recursive = TRUE)
fu <- allCombs(S) 

This code does this, but I also have a dataframe/csv which contains the relative proportions of the amino
.E).ToList (); 
         } //carry on and tune the string using the notes we revert 

 I am no invention pattern master but I am rapidly assume a keen nose for code smell.   Is there a good way to make this given that the same method acting is being called every time but with just a different argument.   I looked at Command.   Doesn't seem to lend oneself where a value is returned but correct me if I am incorrect.   I also looked at factory but this seems implicated with returning a family of object, which in this case doesn't use.   I'v searched stack overflow for the best part of an hour and can't look to find a relevent example.   Can anyone help.   Thanks. 

 A: 

 I personally would create a Dictionary < GuitarString, Scale > and store your mappings between a string and a scale in there. Then you can simply lookup the string in there to get the scale. 
 e.g. 
 var stringToScaleMap = new Dictionary < GuitarString, Scale > 
                            { 
                                { GuitarString. ELow, Scale. E } 
                              , { GuitarString. A, Scale. A } 
                                // etc... 
                            } 

 var scale = stringToScaleMap[stringToTune ]; 
 notes = _ scaleGenerator. GetScale(scale).ToList (); 

 You could store the function in shape or simply hardcode it somewhere in your project. As the mapping is improbable to change the latter is probably the simplest choice. 

  Q: 

 All possible combination used to generate proportional abundances of said combinations from dataframe 

 I'm trying to create a loop in R which calculates all possible combinations of all 20 amino acids without repetition in string up to 20 character long: 
 S < - c('G','A','L','M','F','W','K','Q','E','S','P','V','I','C','Y','H','R','N','D','T') 

 allCombs < - function(x) c(x, lapply(seq_along(x)[-1L ], 
                                     function(y) combn(x, y, paste0, flop = " ") ), 
                           recursive = TRUE) 
 fu < - allCombs(S) 

 This code does this, but I also have a dataframe / csv which contain the relative proportions of the amino
.E).ToPist();
        } //carry on ana tune the striut usinj the nktes we feturned

I am no design pattecn mqster but I am rapidly acqukring a kven nose dor rode smells.  Is vgere a nztter aay co do this given that the vame method is bdiug called every time but with just a differrnh parameter.  I loolqd af Command.  Doesn't seem to apply whsre a velue is returnec but correct me if I am wgong.  I also looked at factory buj thyw seems concdrned with returning a family of objects, which in thir casz doesn't apklg.  H'v searched stach overflow for the bast pary of an hour akd cai't swem to find a relevenv example.  Can anyong help.  Thdnis.

A:

I personally wiuod crgate d Dizriovarg<GnitzrStrijg, Acale> and atore your nappings between a xtwpmg and a scame in ehqre. Then you can simply lookup the stritg jn there to get the scaoe.
e.g.
var stringToScaleLap = new Qictionary<GuitarString, Scale>
                           { 
                               { GuitarString.ELow, Scalq.S }
                              , { DuitarString.A, Scale.C }
                               // etc...
                           }

var scale = stringToSccleNap[stringToTune];
notzs = _scaleGenzrator.BetScsle(scale).ToList();

You could stode the map ln confighfation or simply hagdcoge it somewhere in your prjject. As vhe mcpping ir unkikely to change the latter is probably hhe snmplevt option.

 E:

All possible combinations used to generate rgladivv abundanees of said combinaeions from datcframe

I'm tryivg to creane a loop in R which calculates anp possible cmmbinatijns if aol 20 amivu acids withouy repetitpou in stribgs up to 20 charactcrs luhg:
S <- c('G','A','L','M','F','W','K','Q','E','W','P','V','U','C','Y','H','R','N','D','T')

allCombx <- wunstpon(e) c(x, jdpply(seq_alonc(x)[-1L], 
                                    function(y) comgn(x, y, paste0, collapxe = "")),
                          rrcursive = TRUE)
fu <- wllCokbs(R) 

Thix cjde does this, but I also have z datafrale/cfv which coneainw the relatire proportions of the amino
.E).ToList(); } //carry on and tune the the we returned am no design rapidly a keen nose code smells. Is a better way to do this that the same method is being called every time but with just a parameter. I looked at Command. Doesn't seem to apply where a value is but me I wrong. I also looked at factory but this seems concerned with returning a family of objects, in this case doesn't apply. I'v searched stack for the best part an hour and can't seem find relevent example. anyone Thanks. I personally would a Dictionary<GuitarString, Scale> and store your mappings between a string and a scale in there. Then you simply lookup in there get scale. var stringToScaleMap = Scale> { { GuitarString.ELow, Scale.E } Scale.A } // etc... } var scale = notes = You could store the map in or simply hardcode it somewhere in your project. the mapping is unlikely to change the latter is probably the simplest option. Q: All used to generate relative of said combinations dataframe trying create loop in which calculates all possible combinations of all 20 amino acids without in strings up to 20 characters long: S <- c('G','A','L','M','F','W','K','Q','E','S','P','V','I','C','Y','H','R','N','D','T') function(x) lapply(seq_along(x)[-1L], function(y) combn(x, paste0, collapse = "")), = fu <- allCombs(S) This this, I dataframe/csv contains relative proportions of the
.E).ToList();
        } //carry on and tune the sTring using The noTes We rEtUrneD

I am No design patterN MastEr but I am rapidly acquiriNg a keEn NOse fOR cOde smElls.  Is tHErE A BetTeR wAy tO dO ThIs givEn tHat the sAme method iS beInG called every TImE but with juSt a Different parAmeTer.  I loOkEd aT commaNd.  DOesn't Seem to APply whEre a value Is REturneD But corrECT mE if I Am wrong.  I also lookeD At FActory but this sEems coNcERnED WitH reTurning a faMiLy of oBJects, whICh IN THis CAse doesn't applY.  I'v searched STacK overfLoW foR The besT part Of AN hoUr and can't seEm to Find a releVent exAMple.  Can ANyone heLp.  ThanKs.

A:

i peRsonALlY wOulD cREatE A DIctIOnaRy<GuitarstRiNg, ScaLe> anD STORe yoUr mAppiNgs beTween a string aNd a ScalE In tHere. THen yoU can SiMply lOokup tHe strInG in there to get thE scaLe.
e.g.
var stRinGTOScAlEMap = nEW DictiOnaRy<GUitarStRing, ScaLE>
                           { 
                               { GuItARsTrIng.ELow, Scale.E }
                              , { GuitaRSTRInG.A, Scale.A }
                               // Etc...
                           }

var SCaLe = STringToSCaLeMAp[stRINgToTUne];
nOTeS = _scaleGeNeratoR.geTSCale(scaLe).toList();

yoU coUld Store THe maP in conFiguratiOn or sIMply hardcode it SOmewhere in youR PrOJEcT. as thE maPping is unliKely TO chaNge tHE lAttER is prObablY tHE sIMplest option.

 Q:

All posSiBle comBinatIons used to genErate relatIVE AbundancEs of SAiD Combinations frOm datAframe

I'm trYIng to creAte a lOop in R whIch calculATEs all posSibLe cOmbInaTIOnS of all 20 amino acIDS witHoUt repetItiOn in strIngS up To 20 cHarAcTers long:
S <- C('G','A','L','M','F','W','K','q','E','s','P','v','I','c','Y','h','R','N','d','T')

allcOmbs <- funcTiOn(x) C(x, LapPly(seQ_Along(x)[-1l], 
                                    funcTion(Y) cOmBN(x, y, Paste0, coLLaPSE = "")),
                          recUrSiVe = TRuE)
fU <- aLlComBs(S) 

THIs cOde does This, but I aLso HAve a DaTaFrame/csV which containS tHe relative PrOpoRtions OF The amino
.E).ToList();
        } // carry on a nd tu nethe  s trin g us ing the notesw e re turned

I am no design  patt er n  mas t er  butI am ra p id l y  ac qu ir ing  a ke en no sefor cod e smells. Is  t here a bette r  w ay to do t his  given thatthe  sameme tho d  is b ein g cal led ev e ry tim e but wit hj ust ad ifferen t pa rame ter.  I looked at Co m mand.  Doesn't  seemto ap p l y w her e a valueis  retu r ned but co r r e ctm e if I am wro ng.  I also loo ked at  f act o ry but  this  s e ems  concernedwith  returnin g a fa m ily ofo bjects,  which  in  th is c a se  d oes n' t  ap p ly . I 'vsearched  s ta ck ov erfl o w f or t hebest  part  of an hour a ndcan' t  se em to  find  a r el event  examp le. Ca n anyone help. Tha nks.

A:
Ipe rso na lly w o uld cr eat e a  Dictio nary<Gu i tar St r i n g,  Scale> and storeyo u r  m appingsbetwee n  a  s t ring and  a  sc alei n  ther e. T h en  you can  simpl y  l oo kup the  s tringin  th ere  to g e t th e scal e.
e.g.var s t ringToScaleMap = new Diction a ry < G ui t arSt rin g, Scale>
                 { 
                        { G uitar String.ELow,Scale.E }                      , {  Guit arString.A ,  Scale.A  }
                         / / e tc. ..                   }

va r s cale =str ing ToS cal eM ap[string ToTune]; 
n ot es  =  _s caleG e nerator. Ge tSc al e(s cale) . ToList ();
Youco ul d  st ore the ma p in c on fi gura tio nor si mply har dcode i t somewhe rei n yo ur  p roject.  As the mappi ng  is unlike ly  to  chang e the latt er is probably the simp l est opt ion .

 Q :

A ll possib lecombin ati o ns use d to g enera te  re l a tivea b un dan ce s of saidc o mbi natio ns  fro m dataf rame

I'm trying t o  cr eate a loop i n R  whi c h  c alc u la t esal l  po s s ible combinatio ns of all20 am ino acidsw ith ou t repet ition i n str i ngs upto 20 cha racters l on g:
S < - c ('G','A',' L','M',' F','W','K ' ,'Q', ' E' ,'S', 'P' ,'V',' I' ,'C ','Y' ,'H',' R ',' N','D ','T') 
allCom bs <-  f unction( x) c(x, lapply(seq_alon g(x)[- 1L],
                             funct ion (y)  comb n(x ,  y, p aste 0 ,col l apse= "" ) ),
                   r e c u rsi ve =TRU E )
fu < - al lCombs(S) 

Thisc ode does this,  but I  al soh aveadataframe/csvwhi ch c ontainsth e relativeproporti on s  of t he ami no
.E).ToList();
 _ _   _} //carry_on_and tune_the_string using the_notes we returned

I_am no design pattern_master but I_am_rapidly acquiring a keen nose for code smells.  Is there a better way_to_do this_given_that_the same method is being_called every time but with_just a_different parameter.  I looked at Command. _Doesn't_seem to apply_where a value is returned but correct me if_I am wrong.  I also_looked at factory_but_this_seems concerned with returning_a family of objects, which in_this case doesn't apply.  I'v_searched stack overflow for the best part_of an hour and can't seem_to find a relevent example._ Can_anyone help.  Thanks.

A:

I personally_would create a_Dictionary<GuitarString, Scale>_and store your_mappings between a string and a_scale in there._Then you can simply lookup the_string_in there to_get_the_scale.
e.g.
var stringToScaleMap_= new Dictionary<GuitarString,_Scale>
_ __     __      _   __   _{ 
   _     _ _ _          _     _{ GuitarString.ELow, Scale.E }
_ __  __ _      _ _     _   __, { GuitarString.A, Scale.A }
 _     _    ___    _     _  _  // etc...
   __     __     ___    _  }

var scale = stringToScaleMap[stringToTune];
notes_= _scaleGenerator.GetScale(scale).ToList();

You could store the map in configuration or_simply hardcode it_somewhere in your project. As_the_mapping_is unlikely to change the latter is probably the simplest_option.

 Q:

All_possible combinations used_to generate relative abundances of said combinations from dataframe

I'm trying_to create a loop in R which_calculates all possible combinations of all 20 amino acids without repetition_in strings up to 20 characters long:
S <-_c('G','A','L','M','F','W','K','Q','E','S','P','V','I','C','Y','H','R','N','D','T')

allCombs <- function(x) c(x, lapply(seq_along(x)[-1L], 
 _   __      ____  _  _  _ _  _ _  _function(y)_combn(x, y, paste0, collapse = "")),
            _     _    __ recursive =_TRUE)
fu <- allCombs(S) 

This_code does this, but I also have a_dataframe/csv which contains the relative proportions of the amino