modified: Makefile
[GalaxyCodeBases.git] / perl / etc / justonce / primer.pl
blob6c9057f710e5a724d3b3164860f640829f17a5e0
1 #!/usr/bin/env perl
2 =pod
3 Author: Hu Xuesong @ BGI <huxuesong@genomics.org.cn>
4 Version: 1.0.0 @ 20170612
5 =cut
6 use strict;
7 use warnings;
8 use Galaxy::IO;
9 use Galaxy::IO::FASTA qw(FastaReadNextA);
11 open O,'>','toPCR.p3' or die "Error opening [toPCR.p3]: $!\n";
12 print O <<'HEAD';
13 PRIMER_MIN_SIZE=18
14 PRIMER_MAX_SIZE=24
15 PRIMER_THERMODYNAMIC_PARAMETERS_PATH=/usr/local/opt/primer3/share/primer3/primer3_config/
16 PRIMER_PRODUCT_SIZE_RANGE=100-600
17 PRIMER_MIN_TM=56
18 PRIMER_OPT_TM=58
19 PRIMER_MAX_TM=60
20 PRIMER_NUM_RETURN=1
22 HEAD
24 my $in = openfile('u.fa');
25 while (my $ret = FastaReadNextA($in)) {
26 my ($seqname,$genome,$seqdesc) = @$ret;
27 #print $seqname," | $seqdesc\n";
28 #my ($chr,$begin,$end) = split /[:-]/,$seqname;
29 #my $thePos = $begin +300;
30 my $seqlen = length $genome;
31 my $begin = 501;
32 my $tglen = $seqlen - 1000;
33 #print "--- $chr,$begin,$end\n";
34 print O <<" ITEM";
35 SEQUENCE_ID=${seqname}_$tglen
36 SEQUENCE_TEMPLATE=$genome
37 SEQUENCE_TARGET=501,$tglen
38 SEQUENCE_INTERNAL_EXCLUDED_REGION=501,$tglen
40 ITEM
42 print "\n";
43 close $in;
44 close O;
45 print "Run [primer3_core < toPCR.p3 > toPCR.out] now.\n";
46 __END__
47 primer3_core -format_output < toPCR.p3.test
48 primer3_core < toPCR.p3.test
50 其中一端的引物距离目标位点少于50bp
52 perl -lane 'print "$F[0]:",$F[1]-300,"-",$F[1]+300' uGRCh37SNPs.txt >uGRCh37SNPs.reg
53 samtools faidx Homo_sapiens_assembly19.fasta -r uGRCh37SNPs.reg >u.fa &
55 SEQUENCE_PRIMER_PAIR_OK_REGION_LIST=251,50,, ; ,,301,50