If I have a primer with redundant bases, how do I generate all associated primer combinations
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vishwaratn Asthana
il 30 Apr 2023
Commentato: Vishwaratn Asthana
il 2 Mag 2023
As an example, if I have the following primer:
primer = 'AGCTYRSWKMACGT';
And these are the options for each redundant base:
options = {'C', 'T'; ... % Y
'A', 'G'; ... % R
'C', 'G'; ... % S
'A', 'T'; ... % W
'G', 'T'; ... % K
'A', 'C';}; % M
How do I generate all primer combinations, i.e. 1) AGCTCACAGAACGT, 2) AGCTTACAGAACGT, 3) AGCTCGCAGAACGT, etc? There should be 64 primer combinations for the above example. Thanks!
0 Commenti
Risposta accettata
Tim DeFreitas
il 2 Mag 2023
Per your last comment, here's a longer but more robust approach that works regardless of where the ambiguous bases are in the primer sequence:
primer = 'AWCTARCTAMGT';
allPrimers = char.empty(1,0);
for b = 1:numel(primer)
base = primer(b);
switch base
case 'Y'
nextBases = 'CT';
case 'R'
nextBases = 'AG';
case 'S'
nextBases = 'CG';
case 'W'
nextBases = 'AT';
case 'K'
nextBases = 'GT';
case 'M'
nextBases = 'AC';
otherwise
nextBases = base; % Unambiguous base
end
% Extend allPrimers by the first (and possibly only) candidate base
allPrimers(:, end+1) = nextBases(1);
if numel(nextBases) > 1
% Make a copy of all current primers and change the trailing base to the
% other candidate for the ambiguous base
alternatePrimers = allPrimers;
alternatePrimers(:, end) = nextBases(2);
allPrimers = [allPrimers; alternatePrimers];
end
end
allPrimers
If you want to automate against a bunch of primers, I'd suggest turning the above script into a function with the primer sequence as the input.
Hope this helps,
-Tim
Più risposte (1)
Tim DeFreitas
il 1 Mag 2023
Here's one way to do it:
options = ['CT' 'AG' 'CG' 'AT' 'GT' 'AC'];
% Enumerate indices into options producing valid primers
base = 1:2:11;
offsets = dec2bin(0:63) == '1';
allPrimers = cell(1,64);
for p = 1:64
allPrimers{p} = ['AGCT', options(base + offsets(p, :)), 'ACGT'];
end
This works by arranging our options string such that indexing into it with an odd number selects the base from the first set of options, and indexing with an even number selects the base from the other set of options. For instance
options([1, 3, 5, 7, 9, 11])
selects entirely from your first column, and
options([2, 4, 6, 8, 10, 12])
selects entirely from your second column. If we then enumerate all possible ways to index into this choosing only one element from each pair, we will produce every possible primer. Because there are 2 choices, and 6 candidate bases, we can produce these offsets using dec2bin from 0 to 2^6-1.
Vedere anche
Categorie
Scopri di più su Genomics and Next Generation Sequencing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!