User Tag List

Results 1 to 5 of 5

Thread: String characters substitution

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    String characters substitution

    For a puzzle I'm making I have a list of DNA sequences:

    GTTG
    CTAT
    TAAA
    AGGC
    TAAG
    etc.

    I need to generate a similar list of strings in which every "G" is replaced by a "C" and viceversa and every "T" is replaced by an "A" and viceversa.
    How can I achieve that easily?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Replacing characters is easy enough with the Substring Replace extension, although given that you need to go two ways (G to C and C to G) it is a bit more complicated. You will want to loop through individual characters in each String. For each character, check what the character is and add its opposite to the end of a (perhaps) separate Alterable String. One this is complete, set the list item to the contents of the Alterable String.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Jaffob. I was just thinking that could be safer to first replace the original letters G,T,A,C with numbers 1,2,3,4 and then replace them with the new letters. That should avoid messing up in the process.
    I do have the Substring Replace object but it comes without example files or documentation and I'm trying to figure out how to use it. I see it can only be used in the expression editor under "Compare two general values" but it's not clear what exactly are the three "> Enter string here <" entries. Maybe the string to analyze, the text to search and the replacement text?

  4. #4
    Clicker Fusion 2.5 DeveloperiOS Export Module
    ChrisBurrows's Avatar
    Join Date
    May 2011
    Location
    Tasmania, Australia
    Posts
    622
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is incredibly easy.

    http://www.whenthereisnoroominhellth...om/MMF/DNA.mfa

    Reversing the letters can be done with only 1 line of code using the auto replace option. I also added a generate strand button, thought it might be handy.

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleUnicode Add-on
    Boba Fonts's Avatar
    Join Date
    Jan 2009
    Location
    Northern Italy
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you very much Chris, you're very kind! That's brilliant.

Similar Threads

  1. Get the number of characters in a string
    By UltraHammer in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 12th September 2013, 03:33 AM
  2. Foreign String Characters in IOS - Not Possible?
    By hcem in forum iOS Export Module Version 2.0
    Replies: 6
    Last Post: 24th January 2013, 01:51 PM
  3. Best way to count the characters of a string
    By Boba Fonts in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 23rd April 2012, 12:01 PM
  4. replace characters in a string?
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 10th October 2011, 01:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •