BjornFJohansson / pydna

Clone with Python! Data structures for double stranded DNA & simulation of homologous recombination, Gibson assembly, cut & paste cloning.
Other
160 stars 39 forks source link

Instantiate Dseq from full sequence and left and right overhangs #147

Closed manulera closed 8 months ago

manulera commented 8 months ago

As is, to create a double stranded dna with overhangs, you can provide watson, crick and ovhg, with ovhg being the "stagger between the watson and crick strands". Another way to think about the stagger is how much the 3' of the crick protrudes:

>>> Dseq(watson="AAAAA",crick="TTT",ovhg=1)
Dseq(-6)
 AAAAA
TTT

>>> Dseq(watson="AAAAA",crick="TTT",ovhg=-1)
Dseq(-5)
AAAAA
 TTT

To instantiate this in pydna, you would do Dseq(watson="AAAAA",crick="TTT",ovhg=2), etc.

I think it would be good to have a class method to instantiate a Dseqrecord object like this:

https://github.com/manulera/ShareYourCloning_backend/blob/67b4ec7731fb42c8187a7fd64491c37afc48a0ed/dna_functions.py#L65C1-L82

With this function, you can create the Dseqrecord from the entire sequence, and the 3' overhangs of each strand (see example below). This is nice, because you could think of storing a sequence with overhangs in a gb file or something, just two integers to indicate the overhangs.

>>> dseq_from_both_overhangs('AAAAAA', overhang_crick_3prime=2, overhang_watson_3prime=2)
Dseq(-6)
  AAAA
TTTT
>>> dseq_from_both_overhangs('AAAAAA', overhang_crick_3prime=-2, overhang_watson_3prime=2)
Dseq(-6)
AAAAAA
  TT
>>> dseq_from_both_overhangs('AAAAAA', overhang_crick_3prime=2, overhang_watson_3prime=-2)
Dseq(-6)
  AA
TTTTTT
>>> dseq_from_both_overhangs('AAAAAA', overhang_crick_3prime=-2, overhang_watson_3prime=-2)
Dseq(-6)
AAAA
  TTTT
BjornFJohansson commented 8 months ago

Hi, that's a good Idea I think. The constructor of Dseq takes a single strand as is but the result is a blunt sequence. Should the Dseq be modified or should this be done in a separate function?

manulera commented 8 months ago

Thanks for merging! Closing