Skip to content

Instantly share code, notes, and snippets.

@ychaouche
Created October 14, 2012 15:22
Show Gist options
  • Save ychaouche/3888894 to your computer and use it in GitHub Desktop.
Save ychaouche/3888894 to your computer and use it in GitHub Desktop.
ADN parser
>>> bar = lambda x:all(map(lambda x:x in "ATCG",x))
>>> bar("AGCT")
True
>>> bar("AGCTACCCTTA")
True
>>> bar("AGCTACCCTTA1")
False
>>>
@anshumanv2
Copy link

sir this is not what i want

Header :is_valid_sequence:
Type Contarct :(str) -> bool

There are at least 2 ways to approach this. One way is to can count the number of characters that are not nucleotides and then at the end check whether there were more than zero. Another way is to use a Boolean variable that represents whether you have found a non-nucleotide character; it would start off as True and would be set to False if you found something that wasn't an 'A', 'T', 'C' or 'G'.
You should construct examples that contain only 'A's, 'T's, 'C's and 'G's, and you should also create examples that contain other characters. Lowercase characters are not valid.

@anshumanv2
Copy link

sir plss give me suggestion regarding these descripton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment