Answers.Body: <p>You can try using Biostrings, depends on how large is your reference, if it is small, you can just pairwiseAlignment with the nucleotideSubstitutionMatrix which supposedly :</p>
  
  <pre><code>library(Biostrings)
  data(phiX174Phage)
  
  x = DNAString("TCCAWRSCGCAGAAGT")
  
  lapply(phiX174Phage,function(y)pairwiseAlignment(x,y,
  substitutionMatrix = nucleotideSubstitutionMatrix()))
  
  $Genbank
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $RF70s
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $SS78
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $Bull
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $G97
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $NEB03
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  </code></pre>
  
  <p>If it is much larger, you can convert the sequence of interest to a pwm and find it in the reference fasta, like shown in <a href="https://www.bioconductor.org/help/course-materials/2009/SeattleNov09/Biostrings/MatchAlign.pdf" rel="nofollow noreferrer">this example</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-04T09:24:25.143Z
Answers.LastActivityDate: 2020-03-04T09:24:25.143Z
Answers.UserDisplayName: StupidWolf
Body: <p>I want to align a short sequence to a reference, and both are encoded in the <a href="https://en.wikipedia.org/wiki/Nucleic_acid_notation" rel="nofollow noreferrer">extended IUPAC notation</a> (i.e. 16 letters).</p>
  
  <p>What alignment software can I use for that?</p>
  
  <p>For example, in <a href="http://bowtie-bio.sourceforge.net/bowtie2/news.shtml" rel="nofollow noreferrer">Bowtie</a> <em>"all non-A/C/G/T characters in reads become Ns",</em> so it ignores which extended letters are matching.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-05-20T22:14:42.837Z
Comments.Text: Found a very similar question here: https://biology.stackexchange.com/questions/7919/tool-for-nucleotide-alignment-with-all-nucleotide-codes-e-g-r-y-w-s-etc
Comments.UserDisplayName: Peter
Tags: <phylogenetics>
Title: Sequence alignment of extended IUPAC sequences
ThreadText: # Sequence alignment of extended IUPAC sequences
  
  (Asked by: username_0 on 2020-03-02)
  
  I want to align a short sequence to a reference, and both are encoded in the [extended IUPAC notation](https://en.wikipedia.org/wiki/Nucleic_acid_notation) (i.e. 16 letters).
  
  What alignment software can I use for that?
  
  For example, in [Bowtie](http://bowtie-bio.sourceforge.net/bowtie2/news.shtml) *"all non-A/C/G/T characters in reads become Ns",* so it ignores which extended letters are matching.
  
  **Tags:** phylogenetics
  
  > **Comments:**
  > **username_0**: Found a very similar question here: https://biology.stackexchange.com/questions/7919/tool-for-nucleotide-alignment-with-all-nucleotide-codes-e-g-r-y-w-s-etc  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-03-04. Score: 1 | Accepted answer
  
  You can try using Biostrings, depends on how large is your reference, if it is small, you can just pairwiseAlignment with the nucleotideSubstitutionMatrix which supposedly :
  
  ```
  library(Biostrings)
  data(phiX174Phage)
  
  x = DNAString("TCCAWRSCGCAGAAGT")
  
  lapply(phiX174Phage,function(y)pairwiseAlignment(x,y,
  substitutionMatrix = nucleotideSubstitutionMatrix()))
  
  $Genbank
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $RF70s
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $SS78
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $Bull
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $G97
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  $NEB03
  Global PairwiseAlignmentsSingleSubject (1 of 1)
  pattern: -------------TCCAWRSCGCAGAAGT...----------------------------
  subject: GAGTTTTATCGCTTCCATGACGCAGAAGT...TAAAAATGATTGGCGTATCCAACCTGCA
  score: -21491.92 
  
  ```
  
  If it is much larger, you can convert the sequence of interest to a pwm and find it in the reference fasta, like shown in [this example](https://www.bioconductor.org/help/course-materials/2009/SeattleNov09/Biostrings/MatchAlign.pdf)
  
  
  ---
  
  