<div dir="ltr"><div>Hello,</div><div><br></div><div>First what may be the simple answer: Looking at that code snippet, and</div><div>guessing that Seqfile is a SeqRecord object, both lists CompareBefore</div><div>and CompareAfter will be the same list. Thus you'd find no differences. </div><div><br></div><div>More generally, I would have recommend using slicing and addition of</div><div>SeqRecord chunks, which will reserve your features and shift their</div><div>coordinates accordingly - as long as each feature is fully within a chunk.</div><div>The tutorial covers this.</div><div><br></div><div>If you want to work more directly, you could try shifting a feature location</div><div>with an offset by adding (or subtracting an integer). (You could do something</div><div>similar with the (private) _shift methods, but that is not intended for direct use.)</div><div><br></div><div>However, it looks like you're taking what I would consider to be the hardest</div><div>option of rebuilding new location objects after all your sequence editing.</div><div>This is only reasonably straightforward if you have just simple locations</div><div>(like most bacterial features). Joins, origin wrapping, fuzzy locations etc</div><div>would need additional work.</div><div><br></div><div><div>Peter</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Nov 11, 2020 at 5:26 PM F.L. Ratzkowski <<a href="mailto:flr28@cam.ac.uk">flr28@cam.ac.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi,</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
i am new here so I am sorry if I am doing anything wrong, feel free to tell me.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I am farely new to biopython as well, currently i have written a script that reads in a .gbk file and then deletes and inserts different parts of the sequence. this would alter the absolute position of features. I have ultimately run a script that safes the
new positions in 2 dataframes. When i now want to update all features with the Featurelocation command it seems to not work. I saved the features in a variable before and after me updating the features and was hoping to then detect a difference but it fails.
here the basic part of the script i am struggling with</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
CompareBefore = Seqfile.features</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
for z in range(0, len(featureEndList)):
<div> feature_end = int(ELdf.iloc[z][1])</div>
<div> feature_start = int(SLdf.iloc[z][1])</div>
<div> feature_strand = Seqfile.features[z].location.strand</div>
<div> Seqfile.features[z].location = FeatureLocation(feature_start, feature_end,strand=feature_strand)</div>
<br>
<span style="background-color:rgb(255,255,255);display:inline">CompareAfter = Seqfile.features</span><br>
</div>
<div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
list = []
<div>for x in range(0,len(CompareAfter)):</div>
<div> if CompareBefore[x] != CompareAfter[x]:</div>
list.append(x)<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I get 0 hits in this list.</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Please help <span id="gmail-m_1991703643380665035🙂">🙂 thank you</span></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
</div>
</div>
_______________________________________________<br>
Biopython mailing list - <a href="mailto:Biopython@mailman.open-bio.org" target="_blank">Biopython@mailman.open-bio.org</a><br>
<a href="https://mailman.open-bio.org/mailman/listinfo/biopython" rel="noreferrer" target="_blank">https://mailman.open-bio.org/mailman/listinfo/biopython</a></blockquote></div>