Created
October 14, 2012 15:47
-
-
Save ychaouche/3888973 to your computer and use it in GitHub Desktop.
better version of the lazy ADN parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| is_valid_sequence = lambda x:all(character in "ACTG" for character in x) | |
| >>> is_valid_sequence("ACTG") | |
| True | |
| >>> is_valid_sequence("ACTGAAA") | |
| True | |
| >>> is_valid_sequence("ACTGa") | |
| False | |
| >>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sir will u give me code for these diff fuctionss I'm nt geting the desired result
1.
Header insert_sequence:
Type Contract (str, str, int) -> str
The first two parameters are DNA sequences and the third parameter is an index. Return the DNA sequence obtained by inserting the second DNA sequence into the first DNA sequence at the given index. (You can assume that the index is valid.)
For example, If you call this function with arguments 'CCGG', 'AT', and 2, then it should return 'CCATGG'.
When coming up with more examples, think about where the second DNA sequence might be inserted: what are the extremes?
.......................................................................................................................................................................................................................................
2.
Header get_complement:
Type Contract (str) -> str
Description:
The first parameter is a nucleotide ('A', 'T', 'C' or 'G'). Return the nucleotide's complement.
..........................................................................................................................................................................................................................
3.
Header get_complementary_sequence:
Type Contract( str) -> str
Description:
The parameter is a DNA sequence. Return the DNA sequence that is complementary to the given DNA sequence.
For exmaple, if you call this function with 'AT' as the argument, it should return 'TA'.
plzzzz sirr