<p>this is the swift standard primer file. You are a bit off in your interpretation of the columns (seems like you missed one as there are 12 columns, not 11 which threw everything off):</p>

<p>1) Chromosome</p>

<p>2) Target Start</p>

<p>3) Target Stop</p>

<p>4) <strong>Target Name</strong> (change which affected everything downstream in counting) </p>

<p>5) 5' Primer Start</p>

<p>6) 5' Primer Stop</p>

<p>7) 5' Primer Name</p>

<p>8) 3' Primer Start</p>

<p>9) 3' Primer Stop</p>

<p>10) 3' Primer Name</p>

<p>11) 5' Primer Sequence</p>

<p>12) 3' Primer Sequence</p>

<p>To convert to a BEDPE describing the primer locations, you only will need columns 1, 5, 6, 8, and 9 (and optionally 4). The last letter of the Region name for the denotes the strand orientation of the region. For example Region 1 has _F denoting forward or (+) strand for BEDPE usage, while region 2 has _R in name denoting reverse or (-) strand for BEDPE. Putting all this together, you can convert to BEDPE with:</p>

<pre><code><span class="math-container">$ awk -v OFS="\t" '{ 
            o="."; 
            if($4~/_F\//){
                o="+"
            }
            else if($4~/_R\//){
                o="-"
            } 
            print $1,$5,$6,$1,$8,$9,$</span>4,".",o}' foo.masterfile
1   43814932    43814951    1   43815064    43815081    MPL_S505N-A519T_F/2 .   +
1   115256457   115256480   1   115256576   115256602   NRAS_G60-S65_new_R/1    .   -
</code></pre>

CC BY-SA 4.0
2018-11-24T16:42:14.260Z
Thanks, I meant 4 was the target name, I just wrote it wrong in the question. But why would I use the first 4 columns? I want the positions of the primers, not of the target. So, for a bedpe file, wouldn't I need columns 1,5,6,1,8,9 and then `-` or `+` depending on the "F" or "R"? Aren't the 1st 4 columns describing the target and not the primer?
terdon
CC BY-SA 4.0
2018-11-24T16:46:29.293Z
I see, it was not clear to me that you wanted the location of primers and not the target. The primer orientation is also included in the primer names. The columns still remain the same, so if you would like primer info just use the information in the corresponding primer columns. The orientation of each primer is in its name as well. You would use columns 1, 5,6,7 for 5' primer and 1, 8,9,10 for 3' primer. Using name columns only for primer orientation (but BEDPE can also accept a 4th column for the name of the region if you'd like).
d_kennetz
CC BY-SA 4.0
2018-11-24T17:21:29.900Z
Yes, sorry, my question wasn't very clear on that (I edited now). Do you have any idea what the numbers at the end of the target names are? I mean the `2` at the end of `MPL_S505N-A519T_F/2` and the `1` at the end of `NRAS_G60-S65_new_R/1`. Could they be the phase? And, if so, with respect to what?
terdon
CC BY-SA 4.0
2018-11-24T17:28:12.823Z
By the way, I took the liberty of adding an `awk` command to make the conversion since I think that might be useful to future visitors. I hope you don't mind.
terdon
CC BY-SA 4.0
2018-11-25T20:44:14.490Z
The awk command adds a nice touch! I am not super sure what the 1 and 2 mean with respect to the genes or orientations as with IDT orders I know they have a different meaning. Specifically, I think they refer to exon number but that could not be the case here. I don’t want to give you misinformation, but that is something you should check first with respect to your target set.
d_kennetz
CC BY-SA 4.0
2018-11-24T05:27:50.647Z
2018-11-24T17:27:42.603Z
2018-11-24T17:27:42.603Z
d_kennetz
<p>I am working with an amplicon kit from Swift Bioscience and they provide the primer locations in what they call a "masterfile". The format is like this:</p>

<pre><code>$ head -n2 Acel-Amplicon_56g_masterfile.txt
1       43814951        43815064        MPL_S505N-A519T_F/2     43814932        43814951        MPL_S505N-A519T_F/2_primer      43815064  43815081 MPL_S505N-A519T_R/1_primer      GCCTGGATCTCCTTGGTGA     CTTCGGCTCCACCTGGT
1       115256480       115256576       NRAS_G60-S65_new_R/1    115256457       115256480       NRAS_G60-S65_new_R/1_primer     115256576 115256602        NRAS_G60-S65_new_F/2_primer     TGATGGCAAATACACAGAGGAAG CAGGATTCTTACAGAAAACAAGTGGT
</code></pre>

<p>This is the format which is understood by <a href="https://github.com/swiftbiosciences/primerclip" rel="nofollow noreferrer">Swift's primer clipping tool</a>, but in order to use other tools, I would like to convert it to BEDPE so I can then use standard tools to clip the primers from my bam files. However, I can't do that since I am not sure what the fields in this file are. </p>

<p>This is what I think thy are:</p>

<ol>
<li>Chromosome</li>
<li>Target region start</li>
<li>Target region end</li>
<li>5' Primer name</li>
<li>5' Primer start</li>
<li>5' Primer end</li>
<li>3' Primer name</li>
<li>3' Primer start</li>
<li>3' Primer end</li>
<li>5' Primer sequence</li>
<li>3' primer sequence</li>
</ol>

<p>Is my interpretation correct? Also, is this a standard file format or something specific to the Swift tool? I couldn't find any documentation about a "masterfile" format online.</p>

CC BY-SA 4.0
2018-11-23T14:20:31.293Z
Did you tried to contact with the tech support? Looking at the source code it seems that it accepts some "panel bedfiles"
llrs
CC BY-SA 4.0
2018-11-23T14:35:00.193Z
@Llopis yes, I am talking to their tech support because I have other issues with the file. My question here is about this file format and whether it is some sort of standard format I am not aware of.
terdon
<file-formats><format-conversion><primer>
What is the "primer masterfile" format?
# What is the "primer masterfile" format?

(Asked by: username_0 on 2018-11-23)

I am working with an amplicon kit from Swift Bioscience and they provide the primer locations in what they call a "masterfile". The format is like this:
$ head -n2 Acel-Amplicon_56g_masterfile.txt
1       43814951        43815064        MPL_S505N-A519T_F/2     43814932        43814951        MPL_S505N-A519T_F/2_primer      43815064  43815081 MPL_S505N-A519T_R/1_primer      GCCTGGATCTCCTTGGTGA     CTTCGGCTCCACCTGGT
1       115256480       115256576       NRAS_G60-S65_new_R/1    115256457       115256480       NRAS_G60-S65_new_R/1_primer     115256576 115256602        NRAS_G60-S65_new_F/2_primer     TGATGGCAAATACACAGAGGAAG CAGGATTCTTACAGAAAACAAGTGGT

This is the format which is understood by Swift's primer clipping tool, but in order to use other tools, I would like to convert it to BEDPE so I can then use standard tools to clip the primers from my bam files. However, I can't do that since I am not sure what the fields in this file are. 
This is what I think thy are:

Chromosome
Target region start
Target region end
5' Primer name
5' Primer start
5' Primer end
3' Primer name
3' Primer start
3' Primer end
5' Primer sequence
3' primer sequence

Is my interpretation correct? Also, is this a standard file format or something specific to the Swift tool? I couldn't find any documentation about a "masterfile" format online.

**Tags:** file-formats, format-conversion, primer
> **Comments:**
> **username_1**: Did you tried to contact with the tech support? Looking at the source code it seems that it accepts some "panel bedfiles"  
> **username_0**: @Llopis yes, I am talking to their tech support because I have other issues with the file. My question here is about this file format and whether it is some sort of standard format I am not aware of.  

---

## 1 answers

### Answer by username_2 on 2018-11-24. Score: 2 | Accepted answer

this is the swift standard primer file. You are a bit off in your interpretation of the columns (seems like you missed one as there are 12 columns, not 11 which threw everything off):
1) Chromosome
2) Target Start
3) Target Stop
4) Target Name (change which affected everything downstream in counting) 
5) 5' Primer Start
6) 5' Primer Stop
7) 5' Primer Name
8) 3' Primer Start
9) 3' Primer Stop
10) 3' Primer Name
11) 5' Primer Sequence
12) 3' Primer Sequence
To convert to a BEDPE describing the primer locations, you only will need columns 1, 5, 6, 8, and 9 (and optionally 4). The last letter of the Region name for the denotes the strand orientation of the region. For example Region 1 has _F denoting forward or (+) strand for BEDPE usage, while region 2 has _R in name denoting reverse or (-) strand for BEDPE. Putting all this together, you can convert to BEDPE with:
$ awk -v OFS="\t" '{ 
            o="."; 
            if($4~/_F\//){
                o="+"
            }
            else if($4~/_R\//){
                o="-"
            } 
            print $1,$5,$6,$1,$8,$9,$4,".",o}' foo.masterfile
1   43814932    43814951    1   43815064    43815081    MPL_S505N-A519T_F/2 .   +
1   115256457   115256480   1   115256576   115256602   NRAS_G60-S65_new_R/1    .   -

> **Comments:**
> **username_0**: Thanks, I meant 4 was the target name, I just wrote it wrong in the question. But why would I use the first 4 columns? I want the positions of the primers, not of the target. So, for a bedpe file, wouldn't I need columns 1,5,6,1,8,9 and then `-` or `+` depending on the "F" or "R"? Aren't the 1st 4 columns describing the target and not the primer?  
> **username_2**: I see, it was not clear to me that you wanted the location of primers and not the target. The primer orientation is also included in the primer names. The columns still remain the same, so if you would like primer info just use the information in the corresponding primer columns. The orientation of each primer is in its name as well. You would use columns 1, 5,6,7 for 5' primer and 1, 8,9,10 for 3' primer. Using name columns only for primer orientation (but BEDPE can also accept a 4th column for the name of the region if you'd like).  
> **username_0**: Yes, sorry, my question wasn't very clear on that (I edited now). Do you have any idea what the numbers at the end of the target names are? I mean the `2` at the end of `MPL_S505N-A519T_F/2` and the `1` at the end of `NRAS_G60-S65_new_R/1`. Could they be the phase? And, if so, with respect to what?  
> **username_0**: By the way, I took the liberty of adding an `awk` command to make the conversion since I think that might be useful to future visitors. I hope you don't mind.  
> **username_2**: The awk command adds a nice touch! I am not super sure what the 1 and 2 mean with respect to the genes or orientations as with IDT orders I know they have a different meaning. Specifically, I think they refer to exon number but that could not be the case here. I don’t want to give you misinformation, but that is something you should check first with respect to your target set.  

---

