-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprimer_toBed.pl
executable file
·60 lines (36 loc) · 952 Bytes
/
primer_toBed.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/local/bin/perl
#script that will map oligonucleotide sequences (specifically the output from PCRtiler) and output bed file. Ideally used for small genome snapshots on IGV.
#08/14/2014 EJM
use strict;
open (MMTV, "<$ARGV[0]") || "Could not open: $ARGV[0]\n"; #input sequence
open(PRIMERS, "<$ARGV[1]") || "Could not open: $ARGV[0]\n"; #primer sequences
open (BED, ">>$ARGV[2]"); #output file
my $genome_seq="";
my $seqID='';
while(<MMTV>){
chomp;
if(/^>/){
$seqID=substr($_,1);
}
else{
$genome_seq .=$_;
}
}
print BED "#ggfTags\n";
while(<PRIMERS>){
next if (!/^\d/);
chomp;
my $left='';
my $right='';
my @line=split("\t",$_);
if($genome_seq=~/($line[1])/){
#print "Found a match\n";
$left=$-[0];
}
my $rc=reverse($line[2]);
$rc=~tr/AGTC/TCAG/;
if($genome_seq=~/($rc)/){
$right=$+[0];
}
print BED "$seqID\t".$left."\t".$right."\tPrimer_".$line[0]."\t1\t.\n";
}