cygwinから仕事する時の注意 とにかくプリンターとかはwinX側から先に設定しておくこと。
あとはcygwinにログインすれば勝手に反映される。 gb2bed.pl
gbファイルからスタートの座標を得て、bedファイルを作るプログラム ##-----------------------------------------------## get + and - strands starts from .gb > out.bed ##-----------------------------------------------##
usage: grep "[[:space:]]chrX[[:space:]]" rat_uniq_gene.gb| perl gb2bed.pl- > out.bed
#!usr/bin/perl
#
# to get start1 and start2 from gb > out.bed
$| = 1; if ($#ARGV <0) {
print STDERR "\n";
print STDERR "Usage: perl gb2bed.plinfile.gb> out.bed";
print STDERR "\n";
exit;
} else {
$infile = $ARGV[0];
}
#print "$infile\n"; open(INFILE, "< $infile") || die "Can't open $infile";
while () {
chomp;
$id = (split(/\s+/, $_))[0];
$chr = (split(/\s+/, $_))[1];
$gb = (split(/\s+/, $_))[-1];
$gb =~ /^[^\d]*(\d+)\..*\.(\d+)[^\d]*$/;
$start1 = $1;
$start2 = $2;
if ($gb =~ /^[^\~]/) {
print "$chr\t$start1\t$start1\t$id\n";
} else {
print "$chr\t$start2\t$start2\t$id\n";
}
}
~
~
"gb2bed.pl" 32L, 675C
##-------------------##
infile.gb
##-------------------## [hoge@boss5 rn4]# grep "[[:space:]]chr1[[:space:]]" rat_uniq_gene.gb| head
AY389467 chr1 1306646..1307637
BC097929 chr1 join(2394947..2395129,2410229..2410403,2412555..2412712,2415186..2415366,2420858..2420979,2423589..2423694,2424824..2424982,2433081..2433207,2434116..2434250,2434624..2434750,2436213..2436572)
BC083823 chr1 join(5975207..5975361,5982673..5984713,5990203..5991212) ##------------------##
make .ps file
##------------------##
時々忘れるのでpsファイルの作り方書いておく。 [hoge@boss5 rn4]# a2ps gb2bed.pl-o gb2bed.ps
[gb2bed.pl(Perl): 1 page on 1 sheet]
[Total: 1 page on 1 sheet] saved into the file `gb2bed.ps' ##------------------------##
out.bed
##------------------------##
[hoge@boss5 rn4]# grep "[[:space:]]chrX[[:space:]]" rat_uniq_gene.gb| perl gb2bed.pl
- | tail
chrX 159696745 159696745 AY346151
chrX 159710430 159710430 Z19087
chrX 159821860 159821860 AY338195
・・・・・・
[hoge@boss5 rn4]# grep "[[:space:]]chrX[[:space:]]" rat_uniq_gene.gb| perl gb2bed.pl- | head
chrX 1438950 1438950 BC128763
chrX 2560524 2560524 BC167036
・・・・・・