-
-
Save SimonGreenhill/5856225 to your computer and use it in GitHub Desktop.
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 random | |
def shotgun(iterable, size=12): | |
""" """ | |
start = random.choice(range(0, len(iterable)-size)) | |
return(start, iterable[start:start+size]) | |
def paired_end(iterable, read_size=10, gap_size=15): | |
""" """ | |
start = random.choice(range(0, len(iterable)-(read_size+gap_size))) | |
first_read = iterable[start:start+read_size] | |
second_read =iterable[start+read_size+gap_size: start+read_size+gap_size+read_size] | |
return start, first_read + gap_size*"-" + second_read | |
sentence = """ | |
It has not escaped our notice that the specific pairing we have postulated immediately suggests a possible copying mechanism for the genetic material. | |
""".strip() | |
def main(): | |
sequencing_run = [paired_end(sentence, 12) for i in range(25)] | |
print sentence | |
for index, chunk in sorted(sequencing_run): | |
sread = [] | |
for space in range(index): | |
sread.append(" ") | |
sread.append(chunk) | |
print"".join(sread) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment