Answers.Body: <p>Spike Wuhan is <a href="https://www.ncbi.nlm.nih.gov/nuccore/MN996527.1?from=21530&amp;to=25351&amp;report=fasta" rel="nofollow noreferrer">here</a></p>
  <p>Using Python then use the BioPython <code>Bio.pairwise2</code> program <a href="https://biopython.org/docs/1.75/api/Bio.pairwise2.html" rel="nofollow noreferrer">here</a></p>
  <p>Yours sequence is the reference, the shorter Wuhan query is the query.
  The genomic positions <code>position1</code> and <code>position2</code> will then be defined via the output of <code>pairwise2</code>, then cut it by using the genomic position -1 as follows:</p>
  <pre><code>spike = completegenome[int(position1)-1:int(position2)-1]
  </code></pre>
  <p><code>-1</code> is needed because lists start at 0 rather than 1.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-21T20:05:53.267Z
Answers.LastActivityDate: 2022-07-21T22:14:01.120Z
Answers.LastEditDate: 2022-07-21T22:14:01.120Z
Answers.UserDisplayName: M__
Body: <p>I have a complete genome sequence of a Sars-CoV-2 variant, but I am only interested in the Spike sequence?</p>
  <p>I should note that I am not a biologist (nor bioinformatics).</p>
  <p>The complete genome looks like the following:</p>
  <pre><code>AAACAAACCAACCAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTG
  TCACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGACAGGACAC
  GAGTAACTCGTCT...
  </code></pre>
  <p>Its length is 30230.</p>
  <p>My question is, is there a way to know where exactly the spike sequence lies among this complete genome sequence, and if possible, are there already existing tools to extract it programmatically (in Python).
  Thanks in advance.</p>
  
Tags: <genome><covid-19><sars-cov-2><python>
Title: Is there a way to extract spike sequence from a Sars-CoV-2 complete genome (preferably in Python)?
ThreadText: # Is there a way to extract spike sequence from a Sars-CoV-2 complete genome (preferably in Python)?
  
  (Asked by: username_0 on 2022-07-21)
  
  I have a complete genome sequence of a Sars-CoV-2 variant, but I am only interested in the Spike sequence?
  
  I should note that I am not a biologist (nor bioinformatics).
  
  The complete genome looks like the following:
  
  ```
  AAACAAACCAACCAACTTTCGATCTCTTGTAGATCTGTTCTCTAAACGAACTTTAAAATCTGTGTGGCTG
  TCACTCGGCTGCATGCTTAGTGCACTCACGCAGTATAATTAATAACTAATTACTGTCGTTGACAGGACAC
  GAGTAACTCGTCT...
  
  ```
  
  Its length is 30230.
  
  My question is, is there a way to know where exactly the spike sequence lies among this complete genome sequence, and if possible, are there already existing tools to extract it programmatically (in Python).
  Thanks in advance.
  
  **Tags:** genome, covid-19, sars-cov-2, python
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2022-07-21. Score: 0
  
  Spike Wuhan is [here](https://www.ncbi.nlm.nih.gov/nuccore/MN996527.1?from=21530&to=25351&report=fasta)
  
  Using Python then use the BioPython `Bio.pairwise2` program [here](https://biopython.org/docs/1.75/api/Bio.pairwise2.html)
  
  Yours sequence is the reference, the shorter Wuhan query is the query.
  The genomic positions `position1` and `position2` will then be defined via the output of `pairwise2`, then cut it by using the genomic position -1 as follows:
  
  ```
  spike = completegenome[int(position1)-1:int(position2)-1]
  
  ```
  
  `-1` is needed because lists start at 0 rather than 1.
  
  
  ---
  
  