Created
December 18, 2019 07:49
-
-
Save soh-i/05dce4a217c4be51e3f8402982bd35e8 to your computer and use it in GitHub Desktop.
Generate IDT handmix nucleotide code
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_others(nuc): | |
| return list(x for x in ['A', 'T', 'G', 'C'] if nuc != x) | |
| target_sites = {'GeneA': 'TGCAGAGTAGAGGCCGCAGGATAGTTTAGA'} | |
| def gen_handmix_code(target): | |
| five_const = 'ATGC' | |
| three_const = 'CGTA' | |
| # -> [5' const][handmix region][3' const] | |
| error_rate = 12 # 12%, hand-mix error rate (average 4% each) | |
| error_rate_per_base = error_rate/3 | |
| data = {} | |
| for i, seq in enumerate(target, start=1): | |
| d = {s:error_rate_per_base for s in get_others(seq)} | |
| d.update({seq: 100-error_rate}) | |
| data[i] = d | |
| hand_mix_region = '' | |
| for k, v in data.items(): | |
| # order should be A->C->G->T in IDT hand mix synthesis | |
| hand_mix_region += '(%02d%02d%02d%02d)' % (v['A'], v['C'], v['G'], v['T']) | |
| synthesis_seq = five_const + hand_mix_region + three_const | |
| return synthesis_seq | |
| if __name__ == '__main__': | |
| for name, seq in sorted(target_sites.items()): | |
| print '%s\t%s\t%s' % (name, seq, gen_handmix_code(seq)) |
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
| GeneA TGCAGAGTAGAGGCCGCAGGATAGTTTAGA ATGC(04040488)(04048804)(04880404)(88040404)(04048804)(88040404)(04048804)(04040488)(88040404)(04048804)(88040404)(04048804)(04048804)(04880404)(04880404)(04048804)(04880404)(88040404)(04048804)(04048804)(88040404)(04040488)(88040404)(04048804)(04040488)(04040488)(04040488)(88040404)(04048804)(88040404)CGTA |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment