8 kyu

DNA to RNA Conversion

52,475 of 153,749torret
Description
Loading description...
Fundamentals
Strings
  • Please sign in or sign up to leave a comment.
  • arcoasis19 Avatar

    ooooooo! I'm so happy. It's the second Kata i solved by myself.

  • Ataraxia-nervosa Avatar

    "'TTTTUUUUU' should equal 'UUUU' 'GCATUU' should equal 'GCAU'"

    Say what now? I thought this was supposed to be just about converting Ts to Us. What is this?

  • Ardi_- Avatar

    This comment has been hidden.

  • DeCaTou Avatar

    This comment has been hidden.

  • stellartux Avatar
  • metatable Avatar
  • ocamposbio Avatar

    bad kata, bad science, bad everything, be better.

  • Belphegor27 Avatar

    This comment has been hidden.

  • The.Last.Iteration Avatar

    This cata is deeply wrong. Biological sequenses do not behave themself on transcription such a way. G always equals C in both DNA and RNA. A = U in RNA, but T transcripts into A in RNA. So compare that and cata! Science must be science. Take this cata away or figure out the topic!

  • Fanisimos Avatar

    This comment has been hidden.

  • Idongesit-joseph Avatar

    funny how two lines of code just solved this question using python. How many lines was yours, and which language?

  • MohammedNainia Avatar

    in javascript you can easily make it harder for your self by using arrays and methods, work smart not hard , stick to the basics and ' go through each letter ' ;).

  • GregB93 Avatar

    This comment has been hidden.

  • DHaverkort Avatar

    This comment has been hidden.

  • cperez1012 Avatar

    This comment has been hidden.

  • NoRockie Avatar

    Honestly, I never considered just replacing occurrences of 'T' in the argument with 'U', but I guess that would be more efficient than the method I used. I turned the argument into a character array using toCharArray() and added each character to a new string unless it was theh character 'T' in which case I added 'U'. You gotta work smarter not harder though.

  • 53B45T14N Avatar

    Hey everyone :) My code runs on the sample tests, but fails at the random tests. The error message keeps telling me, that a couple of random tests work. At some point, at the end of my rna string is an additional letter attached, which causes this test to fail. So far, it's always been an "1" or an "A". I can't reproduce it on the given tests and ran out of ideas by now. Any suggestions what it could be? I use C.

  • okcuoglu Avatar

    This comment has been hidden.

  • daniel307 Avatar

    This comment has been hidden.

  • uniapi Avatar

    RISCV Translation

    • vector fun on board to boot
  • Will86 Avatar

    I'm not so keen on the lack of camelCase for the function name, but that's just OCD :'D

    Great Kata, thank you.

  • Nikita0x Avatar

    This comment has been hidden.

  • Faridalim Avatar

    This comment has been hidden.

  • kalibriAI Avatar

    This comment has been hidden.

  • SilentFog Avatar

    Remove this bs chemistry DNA and etc, remove useless water text, it's all about programming....

  • Fuminshou Avatar

    This comment has been hidden.

  • punkbibi Avatar

    This comment has been hidden.

  • jmendes16 Avatar

    C lang : My solution is passing the test but failing the attempt. When it fails the attempt it is because on longer strings in the ACTUAL return it is giving a load of garbage characters at the start and then the rest of the response matches the expected.

    When I add code in to shift the pointer to start after these garbage characters I then get pointer error.

  • caramandvd Avatar

    Quite a nice start to the journey :)

  • cdelta1975 Avatar

    That one was easier than I thought.

  • Dead-Newbie Avatar

    This comment has been hidden.

  • Fairebol Avatar

    This comment has been hidden.

  • tommy4221 Avatar

    This comment has been hidden.

  • Peskay Avatar

    This comment has been hidden.

  • KayleighWasTaken Avatar
  • Madjosz Avatar

    C: Since this is a beginner level kata the initial solution setup should tell the user about manually allocating a buffer and return it.

  • amirov Avatar

    Great beginning!

  • ameenj Avatar

    Good 'ol bioinformatics :)

  • fajar034 Avatar

    This comment has been hidden.

  • asedsami Avatar

    This comment has been hidden.

  • Kathth Avatar

    This comment has been hidden.

  • jmroigcourtis Avatar

    This comment has been hidden.

  • mike-ledkov Avatar

    This comment has been hidden.

  • msjones3 Avatar

    I love the concept here. However, to be more true to reality each of the bases should be changed into its complement. A's complement will be U rather than T. C -> G G -> C T -> A A -> U

  • ejini战神 Avatar

    C# Function name should use PascalCase

  • djl90037 Avatar

    This comment has been hidden.

  • zvereva-s Avatar

    This comment has been hidden.

  • Steven Belk Avatar

    Does anyone know why dna.splice(3, 1, 'U') is not a function? Im using Javascript

  • Ogospodigosha15 Avatar

    This comment has been hidden.

  • Mendala Avatar

    This comment has been hidden.

  • AbsDZ Avatar

    works a treat in my IDE but only passes three tests in here. when i use the input from the failed tests, i get the right(exoected) output...confused.com lol ps its with Java

  • oinasjo Avatar

    This comment has been hidden.

  • euphmin Avatar

    The title is misleading. A DNA sequence is transformed into RNA through the transcription process which involves the replacement of all nucleic acids in the DNA strand into their complement but with the thymine (T) replaced by uracil (U). Maybe if that aspect was reflected in this kata, it might have increased its difficulty and involved more thinking.

  • astha9 Avatar

    can't load package: package codewarrior/kata: solution.go:4:10: expected 'STRING', found newline

    Getting this error. Is there problem in my code or kata. Can someone help?

  • IvanThatIsNotAlreadyTaken Avatar

    It would be more interesting if this kata was about full transcription.

  • CognitiveFrinking Avatar

    This comment has been hidden.

  • user452967402 Avatar

    This comment has been hidden.

  • mvaydev Avatar

    C#

    If you don't know a Linq, then you'll think it's 7kyu

  • akar-0 Avatar

    COBOL translation (author inactive).

  • ejini战神 Avatar

    CS, JS and TS function name should be in camelCase

  • TuCrG123 Avatar

    Anyone know what I'm suppose to use in this one for java?

  • user5533680 Avatar

    Maybe Codewars can have 9 and 10 kyu ranks for really easy kata, such as this one?

  • Amber Cahill Avatar

    Some of the test string in C don't have null terminators, making this challenge impossible unless you specifically test for those strings, those being "ATACGTGAATAATACT" in normal test cases and "GTACACTAGTAATATTTCTTTCGCGTTCTGT" in random test cases

  • ejini战神 Avatar

    No random tests in

    • C#
    • Elixir
    • Rust
  • renaissance542 Avatar

    Maybe the word 'translate' could be changed to 'convert', to avoid confusion with the biology term translation.

  • GeorgCantor Avatar

    This task is 7 not 8

  • mdkbe Avatar

    This comment has been hidden.

  • bobahop Avatar

    This comment has been hidden.

  • Ghost_Hash Avatar

    After my 4th attempt I solve.

  • milex Avatar

    This comment has been hidden.

  • aa-ag Avatar

    Tried three times. Only solved it once I got rid of all my code, and tried to solve it in the most simple way.

  • Nyambura254 Avatar

    This comment has been hidden.

  • WestwardLand968 Avatar

    Python method name must be written in snake case. (as of PEP8) Rename DNAtoRNA to dna_to_rna

    P.S.: If someone ever comes to edit this, do it in a way that does not invalidate everything.

  • user8436785 Avatar

    This comment has been hidden.

  • i_wdt Avatar

    Ruby method name must be written in snake case. Rename DNAtoRNA to dna_to_rna

  • WestwardLand968 Avatar

    Python - Needs random tests

  • ParanoidUser Avatar

    There is a typo in the description: "Create a func[TI]on which translates a given DNA string into RNA."

  • masterOfUkemi Avatar

    Hi, I have a problem with my answer. When I execute my code in my terminal, it prints correct translation from dns to rna but when I run my code in here these extra characters(��) are added to end of my return value. Othervice the return value is correct. Have anyone any idea what is going on?

  • mitron6 Avatar
  • razvra Avatar

    Can somebody help me? My code seems to behave correctly when I test it in a different IDE; and it passes all sample tests when I click the "run sample tests" button. However, when I hit ctrl+s or try to run the full test suite, I get an error. The last string in each test fails because my program returns more letters than there are in the string.

  • stauntonjr Avatar

    Though cute, this Kata would have been cuter if the DNA was correctly transcribed into a complementary RNA strand, i.e. (G -> C, C -> G, T -> A, A -> U)

  • TechStar Avatar

    this is hard

  • TheLamia Avatar

    Also... fuck you, FArekkusu, the "C Programming Expert" is either a fucking dunce, or something you made up, just so you can be a fucking asshole to somebody in comments again.

    As much as I am equally annoyed by the "Appeal to an Authority Figure" as I am to the whole "Distrust all Proported Authority Figures"... the fact you've thrown that off hand once... and then hit the solve issue button without having that supposed real life--and not at all imaginary or fucking delusional--C Programmer Expert to tip their hat in... just has me even more irritated with you... and honestly...

    IT would be so much fucking better, if when people were having issues, that YOU FArekkusu were to just shut the fuck up--and not proceed to come in and be a fucking rude piece of burning landfill dumpster fire that you are in EVERY FUCKING INTERACTION you have on this website. You provide nothing of any clarification or help when you type--so much as just condescending assholish responses--that you have a large tendency to be completely fucking incorrect about.

    Also... hitting as issue over the Kata... as there really does not seem to be a better way to point out this as being an issue--and various other attempts that other social media websites have attempted to deal with this scenario only seem to further exacerbate it.

    Look... I get that you've gotten up to 1kyu... but you fucking suck at interacting with people. Even in a text based interaction... and every fucking interaction you do, is mixed with you making the interaction worse--and often you spouting off incorrect statements and informations while just coming across as literally the fucking worse. Please... just... please... lay off of it for a bit. There are other people who do these matters better, solve matters more effectively and do not have people thinking they are dealing with a total fucking asshole. If you see an issue/suggestion or anything that requires you to interact with a human... maybe get somebody who is capable of resembling a person to do this instead?

  • TheLamia Avatar

    Learn how to fucking read FArekkusu, you fucking dejectable human piece of shit to interact with on this website.

    The issue is not just that my "solution crashes"... it is that it crashes in random and unpredictable manners. It will actually run through the sample test cases fine... and will go through a fair amount of the random test cases before it just decides to give a core dump--with an error that really does not tell me what is going on.

    What is more... the website is giving me a fair amount of "success information" before OUT OF NOWHERE it crashes without any reason given.

    The fact I've stated, that I can get rather far into the random tests before it crashes should have fucking clued you in, to why what you are saying is fucking stupid nonsense bullshit, you giant fucking aggrevating douche bag to work with.

    No... the issue is not fucking solved. Please, do not hit "issue solved" simply because you are too fucking basic to follow a simple interaction.

    Especially when part of what the issue is, involves a possible security issue with CodeWars.

    That is... assuming it is not that the test cases do not misapply "free()" in a way, that could cause issues for the person doing the C version of the Kata--if the person doing the C solution.

  • TheLamia Avatar

    This comment has been hidden.

  • donaldsebleung Avatar

    PureScript Translation Kumited - please accept :D

  • POIUYTREWQ15 Avatar

    blah blah blah

  • POIUYTREWQ15 Avatar

    im using comments for free xp

  • uniapi Avatar

    Please, C Translation

  • a.merezhanyi Avatar

    TypeScript translation has been provided. Please, review and approve.

  • GiacomoSorbi Avatar

    Crystal translation added.

  • pol6energetik Avatar

    Please add C language.

  • nikkirow Avatar

    This comment has been hidden.

  • Opening_Introduction Avatar

    The Python solution is super easy. Python, baby.

  • thegleemat@gmail.com Avatar

    This comment has been hidden.

  • a.2.c.4 Avatar

    Failed tests in Java have incorrect message. e.g(not accurate but you can get what I mean): expected "GCAT" but was "GCAU", while in truth it has to be reversed.

  • hjacobs3 Avatar

    [Java] the name of the class should have been Bio ( not Bio() )

  • Souzooka Avatar

    I've made a NASM translation for this kata.

  • clcraig Avatar

    Published a fix for a compile error in the Java version. Also added some randomized tests for good measure. If someone can approve it, then several of the open issues can be resolved.

    @GiacomoSorbi, @dinglemouse, @Blind4Basics, could one of you do this? The original author is long gone. Thanks.

  • MarekWu Avatar

    Typo "class Bio()" should be "class Bio"

  • Jack Frost Avatar

    A should convert to T and T should convert to U if its converting from DNA to RNA. Also, C converts to G while G converts to C.

  • SeeFoEv Avatar

    Typo "class Bio()" should be be "class Bio"

  • taurean11 Avatar

    This comment has been hidden.

  • donaldsebleung Avatar

    Javascript version of Kata could ideally have included random tests, keep that in mind when authoring future Kata :)

  • willibaur Avatar

    Thanks, good kata for strings

  • tu6619 Avatar

    This comment has been hidden.

  • pergk Avatar

    class Bio() should be class Bio instead(no parenthesis in a class declaration)

  • pre Avatar

    Typo: funciton --> function :)

  • cscase Avatar

    Thanks for the kata! Description 3rd line contains a typo in the word function.

  • Bodigrim Avatar

    Haskell translation kumited.

  • user3028132 Avatar

    java translation has a compile error in the class declaration it should be "public class Bio" instead of "public class Bio()"

  • JeffEng Avatar

    The Java translation has a compile error.

    Bio() -> Bio

  • marcsantiago Avatar

    Left a Java translation if you want to take a look at it.

  • alBz Avatar

    This comment has been hidden.

  • GiacomoSorbi Avatar

    Translated into Ruby, if you want to approve it; also, would you like random tests for JS and Python version too :)?

    Oh, and you miss the JS sample case in the description, but don't fix it before you approve my translation (provided you want it, of course), otherwise it could give some problem with the approval process.

  • colbydauph Avatar

    This is essentially a duplicate of the (already approved) kata "Complementary DNA"