Answers.Body: <p>Both of @haci's solutions are very cool:</p>
  <ul>
  <li><a href="https://github.com/paulstothard/sequence_manipulation_suite/blob/master/docs/scripts/primer_map.js" rel="nofollow noreferrer">Primer Map</a></li>
  <li><a href="https://github.com/primer3-org/primer3" rel="nofollow noreferrer">Primer3 CLI</a></li>
  </ul>
  <p>I wasn't aware that Primer3 was available as a CLI (command line interface).</p>
  <p>The solution I had in mind was <em>in silico</em> PCR one example being <a href="https://github.com/PaulGreenfieldOz/WorkingDogs/tree/master/Kelpie" rel="nofollow noreferrer">Kelpie</a> and the associated paper is <a href="https://peerj.com/articles/6174/" rel="nofollow noreferrer">here</a>, however I am not exactly sure about the application of the &quot;primer mapping&quot;, but most &quot;primer&quot; applications concern PCR.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-09-26T18:57:33.763Z
Answers.LastActivityDate: 2023-09-26T19:24:34.613Z
Answers.LastEditDate: 2023-09-26T19:24:34.613Z
Answers.UserDisplayName: M__
Body: <p>Could you help me bioinformatics SE people.</p>
  <p>So I have been duckduckgo-ing up a storm and even consulted the AI overlords and haven't come up with a solid way to do this, but it is so fundamental to bioinformatics that it has to already exists and I don't need to be re-inventing the wheel...</p>
  <p>So imagine you have a fasta/q file with a &quot;reference&quot; sequence:</p>
  <p><code>AATTTTAAAAAAACCCCAAAAAAAAAAAGGGGGAAACCACAAAA</code></p>
  <p>And a list of short oligo sequences:
  <code>TTTT, CCCC, GGGG</code></p>
  <p>How would be the best way to map (if that is the right terminology) the short oligos to the reference seq so that a configurable mismatch amount is allowed:</p>
  <pre><code>  TTTT       CCCC           GGGG    CCCC    
  AATTTTAAAAAAACCCCAAAAAAAAAAAGGGGAAAACCACAAAA
  </code></pre>
  <p>Blast, BWA and Bowtie2 from my understanding aren't ideal for this because they aren't built for really short sequences, something about them using seeded reference lookup?
  Using Smith-Watterman or Needleman-Wunsch technically gets the local aligning right but the mismach allowance is based on score not X total allowed. Plus, iterating over hundreds of oligos and aligning against dozens of large references seems inefficient.
  The closest thing I have found to what I'm trying to do is <a href="https://www.bioinformatics.org/sms2/primer_map.html" rel="nofollow noreferrer">Sequence Manipulation Suites' Primer Map</a>. This tool is almost perfect except a) it is a web tool, not a module I could import into python or incorporate into a CLI and b) does not appear to offer any tolerance for mismatches.</p>
  <p>Am I just searching with the wrong vocabulary? This has to be an already solved bioinformatics process right?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T16:04:37.017Z
Comments.Text: A reference FASTQ is not a thing: A reference sequence is curated in some way, and a curated sequence does not come with quality scores.
Comments.UserDisplayName: Ram RS
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:03:48.400Z
Comments.Text: Here is the source code of [Primer Map](https://github.com/paulstothard/sequence_manipulation_suite/blob/master/docs/scripts/primer_map.js) You are not restricted to use it as a web tool only. Moreover you can modify it according to your needs.
Comments.UserDisplayName: haci
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:09:11.867Z
Comments.Text: @RamRS this is why I put reference in quotes lol. Basically the bare sequences are parsed out of a fasta/q file and are used as targets to align all the shorter oligos to.
Comments.UserDisplayName: RPINerd
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:09:20.160Z
Comments.Text: @M__ I'm trying to determine coverage of a pool of primers against arbitrary target(s)
Comments.UserDisplayName: RPINerd
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:10:08.447Z
Comments.Text: @haci Thanks! I cloned a copy and am working on dissecting it and figuring out if it has the ability to be modified for mismatching. Still feel like this is something that already exists and I just don't have the right search terms to find it...
Comments.UserDisplayName: RPINerd
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T17:55:10.610Z
Comments.Text: @RPINerd I don't quite understand what you mean by "coverage of primers" but you might want to check out [primer3](https://primer3.ut.ee/). I used this in the past to design/test a large number of primers. You can customize and run via CLI.
Comments.UserDisplayName: haci
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-09-26T20:22:22.527Z
Comments.Text: @haci taking the example I gave in the OP, the "coverage" would be (4 bp * 4 oligos)/ 44 bp target sequence, so about 36%. And taking start stop positions into account I could also make some statistics on the distance between aligned sites
Comments.UserDisplayName: RPINerd
Tags: <phylogenetics><read-mapping><multiple-sequence-alignment><primer>
Title: Mapping List of Probes/Primers/Short Oligos to a Reference Fasta/q
ThreadText: # Mapping List of Probes/Primers/Short Oligos to a Reference Fasta/q
  
  (Asked by: username_0 on 2023-09-26)
  
  Could you help me bioinformatics SE people.
  
  So I have been duckduckgo-ing up a storm and even consulted the AI overlords and haven't come up with a solid way to do this, but it is so fundamental to bioinformatics that it has to already exists and I don't need to be re-inventing the wheel...
  
  So imagine you have a fasta/q file with a "reference" sequence:
  
  `AATTTTAAAAAAACCCCAAAAAAAAAAAGGGGGAAACCACAAAA`
  
  And a list of short oligo sequences:
  `TTTT, CCCC, GGGG`
  
  How would be the best way to map (if that is the right terminology) the short oligos to the reference seq so that a configurable mismatch amount is allowed:
  
  ```
    TTTT       CCCC           GGGG    CCCC    
  AATTTTAAAAAAACCCCAAAAAAAAAAAGGGGAAAACCACAAAA
  
  ```
  
  Blast, BWA and Bowtie2 from my understanding aren't ideal for this because they aren't built for really short sequences, something about them using seeded reference lookup?
  Using Smith-Watterman or Needleman-Wunsch technically gets the local aligning right but the mismach allowance is based on score not X total allowed. Plus, iterating over hundreds of oligos and aligning against dozens of large references seems inefficient.
  The closest thing I have found to what I'm trying to do is [Sequence Manipulation Suites' Primer Map](https://www.bioinformatics.org/sms2/primer_map.html). This tool is almost perfect except a) it is a web tool, not a module I could import into python or incorporate into a CLI and b) does not appear to offer any tolerance for mismatches.
  
  Am I just searching with the wrong vocabulary? This has to be an already solved bioinformatics process right?
  
  **Tags:** phylogenetics, read-mapping, multiple-sequence-alignment, primer
  
  > **Comments:**
  > **username_1**: A reference FASTQ is not a thing: A reference sequence is curated in some way, and a curated sequence does not come with quality scores.  
  > **username_2**: Here is the source code of [Primer Map](https://github.com/paulstothard/sequence_manipulation_suite/blob/master/docs/scripts/primer_map.js) You are not restricted to use it as a web tool only. Moreover you can modify it according to your needs.  
  > **username_0**: @username_1 this is why I put reference in quotes lol. Basically the bare sequences are parsed out of a fasta/q file and are used as targets to align all the shorter oligos to.  
  > **username_0**: @username_3 I'm trying to determine coverage of a pool of primers against arbitrary target(s)  
  > **username_0**: @username_2 Thanks! I cloned a copy and am working on dissecting it and figuring out if it has the ability to be modified for mismatching. Still feel like this is something that already exists and I just don't have the right search terms to find it...  
  > **username_2**: @username_0 I don't quite understand what you mean by "coverage of primers" but you might want to check out [primer3](https://primer3.ut.ee/). I used this in the past to design/test a large number of primers. You can customize and run via CLI.  
  > **username_0**: @username_2 taking the example I gave in the OP, the "coverage" would be (4 bp * 4 oligos)/ 44 bp target sequence, so about 36%. And taking start stop positions into account I could also make some statistics on the distance between aligned sites  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2023-09-26. Score: 1
  
  Both of @username_2's solutions are very cool:
  
  * [Primer Map](https://github.com/paulstothard/sequence_manipulation_suite/blob/master/docs/scripts/primer_map.js)
  * [Primer3 CLI](https://github.com/primer3-org/primer3)
  
  I wasn't aware that Primer3 was available as a CLI (command line interface).
  
  The solution I had in mind was *in silico* PCR one example being [Kelpie](https://github.com/PaulGreenfieldOz/WorkingDogs/tree/master/Kelpie) and the associated paper is [here](https://peerj.com/articles/6174/), however I am not exactly sure about the application of the "primer mapping", but most "primer" applications concern PCR.
  
  
  ---
  
  