Last active
December 18, 2015 22:39
-
-
Save dwinter/5855978 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. | |
""" | |
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() |
Cheers - that's what I get for not checking something before I pasted it..
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fun. But needs an "import random" and a line 19 needs to change "s" to "sentence"