Skip to content

Instantly share code, notes, and snippets.

@mountainpenguin
Created November 18, 2019 16:58
Show Gist options
  • Select an option

  • Save mountainpenguin/5be04218c10bda08b23995c7f47a2373 to your computer and use it in GitHub Desktop.

Select an option

Save mountainpenguin/5be04218c10bda08b23995c7f47a2373 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import os
from Bio.Restriction import PstI, EcoRI
import pydna
import pydna.dseq
import pydna.dseqrecord
if __name__ == "__main__":
print(f"pydna version: {pydna.__version__}")
gitlog = os.path.join(pydna.__path__[0], "../.git/logs/HEAD")
if os.path.exists(gitlog):
with open(gitlog) as log:
lastcommit = log.readlines()[-1].split()[1]
print(f"Last git commit: {lastcommit}")
# part1 PstI part2 EcoRI part3
test_sequence = "AAAAAAAAAAACTGCAGCCCCCCCCCCGAATTCGGGGGGGGGG"
# 1 2 3 4
# 1234567890123456789012345678901234567890123
test_dseqr = pydna.dseqrecord.Dseqrecord(
pydna.dseq.Dseq(test_sequence)
)
test_dseqr.add_feature(0, 11, label="part1")
test_dseqr.add_feature(18, 27, label="part2")
test_dseqr.add_feature(34, 43, label="part3")
print("Features prior to cutting:")
print(test_dseqr.list_features())
print("Features after reassembling with PstI")
test_reassembly = test_dseqr.cut(PstI)[0] + test_dseqr.cut(PstI)[1]
print(test_reassembly.list_features())
print("Features after reassembling with EcoRI")
test_reassembly2 = test_dseqr.cut(EcoRI)[0] + test_dseqr.cut(EcoRI)[1]
print(test_reassembly2.list_features())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment