Answers.Body: <pre><code>   left_lineagelist = [x.split('_')[-1].split('|')[0] 
                            for x in left_lineagelist]
          right_lineagelist = set([x.split('_')[-1].split('|')[0] 
                            for x in right_lineagelist])
  </code></pre>
  <p>Allows for extraction of 6 digit EPI, provided the file has had sequences removed prior; as such:</p>
  <pre><code>for line in lines:
      if line[0] == '&gt;':
          print(line[1:])
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-12-06T20:19:30.873Z
Answers.LastActivityDate: 2020-12-06T20:19:30.873Z
Answers.UserDisplayName: Theo Jones
Body: <p>I’m very new to python, and having some difficulty getting hang of some more complicated things</p>
  <p>I have multiple files which look like so:</p>
  <blockquote>
  <p>hCoV-19/Singapore/4/2020|EPI_ISL_410535|2020-02-03</p>
  </blockquote>
  <blockquote>
  <p>hCoV-19/USA/WA13-UW9/2020|EPI_ISL_413601|2020-03-02</p>
  </blockquote>
  <blockquote>
  <p>hCoV-19/USA/WA-UW142/2020|EPI_ISL_416680|2020-03-11</p>
  </blockquote>
  <p><strong>Please be aware that the lines above are meant to be one file</strong></p>
  <p>I want to extract the EPI_ISL_000000 for an easy comparison among files.</p>
  <p>Could someone please advise on:</p>
  <ol>
  <li><p>A programme to extract this data into new files (There’s many lines in each file - 1000+)</p>
  </li>
  <li><p>A programme to then give a % comparison between two or more files - comparing all lines in one file against all lines in a second+ file</p>
  </li>
  </ol>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-13T17:15:15.140Z
Comments.Text: Anyway I get it, the first part is reg-ex, either via Python's re module, sed or a perl onliner. The second part, is easier to do in MEGA X.
Comments.UserDisplayName: M__
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-10-14T20:40:53.230Z
Comments.Text: I have now figured this out, thank you!
Comments.UserDisplayName: Theo Jones
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-01T10:34:03.357Z
Comments.Text: If you have figured it out please answer your own question and accept it. thank you.
Comments.UserDisplayName: user438383
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-02T07:26:24.557Z
Comments.Text: I didn't study this subject... however, the percentage between two organisms may depend heavily on local protein aligniments and the same other active genetic material (because not active rna or not protein make rna has to have weight 0)
Comments.UserDisplayName: RosLuP
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-12-11T18:10:52.520Z
Comments.Text: compile proteins of virus1 compile proteins of virus2 search % equality of proteins of the 2 viruses... or align the genome of 2 viruses and find uguagliance i don't know what number is more significative
Comments.UserDisplayName: RosLuP
Tags: <phylogenetics><genomics><covid-19><sars-cov-2>
Title: How to get % similarity between strains and mutation files
ThreadText: # How to get % similarity between strains and mutation files
  
  (Asked by: username_0 on 2020-10-13)
  
  I’m very new to python, and having some difficulty getting hang of some more complicated things
  
  I have multiple files which look like so:
  
  > hCoV-19/Singapore/4/2020|EPI\_ISL\_410535|2020-02-03
  
  > hCoV-19/USA/WA13-UW9/2020|EPI\_ISL\_413601|2020-03-02
  
  > hCoV-19/USA/WA-UW142/2020|EPI\_ISL\_416680|2020-03-11
  
  **Please be aware that the lines above are meant to be one file**
  
  I want to extract the EPI\_ISL\_000000 for an easy comparison among files.
  
  Could someone please advise on:
  
  1. A programme to extract this data into new files (There’s many lines in each file - 1000+)
  2. A programme to then give a % comparison between two or more files - comparing all lines in one file against all lines in a second+ file
  
  **Tags:** phylogenetics, genomics, covid-19, sars-cov-2
  
  > **Comments:**
  > **username_1**: Anyway I get it, the first part is reg-ex, either via Python's re module, sed or a perl onliner. The second part, is easier to do in MEGA X.  
  > **username_0**: I have now figured this out, thank you!  
  > **username_2**: If you have figured it out please answer your own question and accept it. thank you.  
  > **username_3**: I didn't study this subject... however, the percentage between two organisms may depend heavily on local protein aligniments and the same other active genetic material (because not active rna or not protein make rna has to have weight 0)  
  > **username_3**: compile proteins of virus1 compile proteins of virus2 search % equality of proteins of the 2 viruses... or align the genome of 2 viruses and find uguagliance i don't know what number is more significative  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-12-06. Score: 0 | Accepted answer
  
  ```
     left_lineagelist = [x.split('_')[-1].split('|')[0] 
                            for x in left_lineagelist]
          right_lineagelist = set([x.split('_')[-1].split('|')[0] 
                            for x in right_lineagelist])
  
  ```
  
  Allows for extraction of 6 digit EPI, provided the file has had sequences removed prior; as such:
  
  ```
  for line in lines:
      if line[0] == '>':
          print(line[1:])
  
  ```
  
  
  ---
  
  