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
| def get_number() | |
| while True: #(!num) through a big error | |
| try: | |
| print('Please enter a number for the Collatz sequence:') | |
| num = int(input()) # Prompt for a number | |
| return num | |
| break | |
| except ValueError: # If we couldn't make it an int... | |
| print("enter an integer") # ... complain |
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
| def collatz(number): | |
| ## global number | |
| if number % 2 == 0: | |
| number = number // 2 | |
| print(number) | |
| return number | |
| else: | |
| number = number * 3 + 1 |
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
| def collatz(): | |
| global number | |
| if number % 2 == 0: | |
| number = number // 2 | |
| print(number) | |
| return number | |
| else: | |
| number = number * 3 + 1 |
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
| prot_seq = "MAGAHAHAJJSJS" | |
| def protein(prot_sequence): | |
| s = prot_sequence | |
| spaces = ' '.join(s) | |
| print(spaces) |
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
| import os | |
| test_sequence = 'aTGAGTAAAGGAGAAGaacttttcactggagttgtcccaattcttgttgaattagatggtgatgttaatgggcacaaattttctgtcagtggagagggtgaaggtgatgcaacatacggaaaacttacccttaaatttatttgcactactggaaaactacctgttccgtggccaacacttgtcactactttctctaagggtgttcaatgcttttcccgttatccggatcacatgaaacgGcatgactttttcAAAagCgccatgcccgaaggttatgtacaggaacgcactatatctttcaaagatgacgggaactacaagacgcgtgctgaagtcaagtttgaaggtgatacccttgttaatcgtatcgagttaaaaggtattgattttaaagaagatggaaacattctcggacacaaactggagtacaactataactcacacaatgtatacatcacggcagacaaacaaaagaatggaatcaaagctaacttcaaaattcgccacaacattgaagatggctccgttcaactagcagaccattatcaacaaaatactccaattggcgatggccctgtccttttaccagacaaccattacctgtccacacaatctgccctttcgaaagatcccaacgaaaagcgtgaccacatggtccttcttgagtttgtaactgctgctgggattacacatggcatggatgagctctacaaacaccaccaccaccaccac' | |
| print('Usage, triplets(Input DNA sequence, "name of gene")') | |
| def triplets(Gene_Sequence, Gene_Name): | |
| s = Gene_Sequence.upper() | |
| s[::3] | |
| z = zip(s[::3], s[1::3], s[2::3]) |
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
| import re | |
| import csv | |
| re_degenerates = re.compile(r"[wsmkrybdhvn]") | |
| def get_patterns(filename): | |
| with open(filename) as f: | |
| lines = f.readlines()[2:] # the first two lines aren't data | |
| for record in csv.reader(lines): | |
| index = record[0] # the first column is the pattern id |
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
| import re | |
| import csv | |
| re_degenerates = re.compile(r"[wsmkrybdhvn]") | |
| def get_patterns(filename): | |
| with open(filename) as f: | |
| lines = f.readlines()[2:] # the first two lines aren't data | |
| for record in csv.reader(lines): | |
| index = record[0] # the first column is the pattern id |