# What is the “primer masterfile” format?

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:

1. Chromosome
2. Target region start
3. Target region end
4. 5' Primer name
5. 5' Primer start
6. 5' Primer end
7. 3' Primer name
8. 3' Primer start
9. 3' Primer end
10. 5' Primer sequence
11. 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.

• Did you tried to contact with the tech support? Looking at the source code it seems that it accepts some "panel bedfiles" – llrs Nov 23 '18 at 14:20
• @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 Nov 23 '18 at 14:35

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    .   -

• 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 Nov 24 '18 at 16:42
• 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 Nov 24 '18 at 16:46
• 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 Nov 24 '18 at 17:21
• 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 Nov 24 '18 at 17:28
• 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 Nov 25 '18 at 20:44