<div dir="ltr">Many thanks <span style="font-size:12.8px;font-variant-ligatures:no-common-ligatures">Brian </span>for your comments, I'm just new in biopython, according to your guides, I wrote a script to get the similarity value and the output is "<b>92.3</b>":<div><br></div><div><div>from Bio.Emboss.Applications import WaterCommandline</div><div>import string</div><div><br></div><div>water_cmd = WaterCommandline(gapopen=10, gapextend=0.5, stdout=True, auto=True)</div><div>#water_cmd = WaterCommandline(gapopen=10, gapextend=0.5, aformat=True, stdout=True, auto=True)</div><div>water_cmd.asequence = "asis:ACCCGGGCGCGGT"</div><div>water_cmd.bsequence = "asis:ACCCGAGCGCGGT"</div><div>output = water_cmd()</div><div>output =  str(output[0])</div><div>for line in output.splitlines():</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">       </span>for word in line.split():</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">              </span>if word == "Similarity:":</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                    </span>similarity = float(line[line.index("(") + 1:line.rindex("%)")])</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                    </span>print similarity</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 5:26 AM, Brian Osborne <span dir="ltr"><<a href="mailto:bosborne11@verizon.net" target="_blank">bosborne11@verizon.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Islam,<div><br></div><div>I’m looking at the Bio.Emboss code and it seems that, generally speaking, this module runs EMBOSS applications but does not parse their output, which is what would be required to get the “similarity” value.</div><div><br></div><div>Also note that in your code example you haven’t yet run water, which you would do like "water_cmd()”. But you can always parse out this similarity value yourself, first by capturing the output, something like this:</div><div><br></div><div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">>>> water_cmd = WaterCommandline(gapopen=10, gapextend=0.5, stdout=True, auto=True)</span></div><span class=""><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">>>> water_cmd.asequence = "asis:ACCCGGGCGCGGT"</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">>>> water_cmd.bsequence = "asis:ACCCGAGCGCGGT"</span></div></span><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">>>> output = water_cmd()</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">>>> output</span></div><div style="margin:0px;font-size:14px;line-height:normal;font-family:Courier;background-color:rgb(179,187,255)"><span style="font-variant-ligatures:no-common-ligatures">('############################<wbr>############\n# Program: water\n# Rundate: Tue 21 Feb 2017 13:23:38\n# Commandline: water\n#    -auto\n#    -stdout\n#    -asequence asis:ACCCGGGCGCGGT\n#    -bsequence asis:ACCCGAGCGCGGT\n#    -gapopen 10\n#    -gapextend 0.5\n# Align_format: srspair\n# Report_file: stdout\n######################<wbr>##################\n\n#=======<wbr>==============================<wbr>==\n#\n# Aligned_sequences: 2\n# 1: asis\n# 2: asis\n# Matrix: EDNAFULL\n# Gap_penalty: 10.0\n# Extend_penalty: 0.5\n#\n# Length: 13\n# Identity:      12/13 (92.3%)\n# Similarity:    12/13 (92.3%)\n# Gaps:           0/13 ( 0.0%)\n# Score: 56.0\n# \n#\n#========================<wbr>===============\n\nasis               1 ACCCGGGCGCGGT     13\n                     |||||.|||||||\nasis               1 ACCCGAGCGCGGT     13\n\n\n#---------------------<wbr>------------------\n#---------<wbr>------------------------------<wbr>\n', '')</span></div></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div>Now just use your regex.</div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><span style="font-variant-ligatures:no-common-ligatures">Brian O.</span></div><div><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><br></div><div><br></div><div><br><div><blockquote type="cite"><div><div class="h5"><div>On Feb 19, 2017, at 7:28 PM, Islam Amin <<a href="mailto:eng.islamamin@gmail.com" target="_blank">eng.islamamin@gmail.com</a>> wrote:</div><br class="m_8794313972378939402Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr"><div>Dear All.</div><div>I would like to get the similarity between two sequences, I have found that there is attributes called "similarity" but I this it is boolean value, is there any way to get the similarity value between two sequences instead of writing a text file.</div><div><br></div><div>from Bio.Emboss.Applications import WaterCommandline</div><div>water_cmd = WaterCommandline(gapopen=10, gapextend=0.5)</div><div>water_cmd.asequence = "asis:ACCCGGGCGCGGT"</div><div>water_cmd.bsequence = "asis:ACCCGAGCGCGGT"</div><div>print water_cmd.similarity</div><div>> None</div><div><br></div>
</div></div></div>
______________________________<wbr>_________________<br>Biopython mailing list  -  <a href="mailto:Biopython@mailman.open-bio.org" target="_blank">Biopython@mailman.open-bio.<wbr>org</a><br><a href="http://mailman.open-bio.org/mailman/listinfo/biopython" target="_blank">http://mailman.open-bio.org/<wbr>mailman/listinfo/biopython</a></div></blockquote></div><br></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><span>Best Regards,<br>Islam Amin.<br><br><a href="http://www.egyptscience.net/" rel="nofollow nofollow" target="_blank">www.egyptscience.net</a><br></span><div>Scientific Research Group in EGYPT</div></div></div>
</div>