Created
February 22, 2016 09:06
-
-
Save meso-cacase/b175636519125a033908 to your computer and use it in GitHub Desktop.
GGRNAをつかいプローブIDと遺伝子の対応表を作成
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use warnings ; | |
use strict ; | |
use LWP::Simple ; | |
while (<>){ | |
chomp ; | |
# ProbeIDを標準入力から取得 | |
my $probeid = $_ ; | |
$probeid =~ s/(^\s+|\s+$)//g ; # 前後のスペースを除去 | |
# print "ProbeID : $probeid\n" ; | |
# ProbeIDを塩基配列に変換 | |
# 例:http://probe.dbcls.jp/1552311_a_at.txt | |
# print "Get : http://probe.dbcls.jp/$probeid.txt\n" ; | |
my $seq = get("http://probe.dbcls.jp/$probeid.txt") ; | |
# print "Result :\n$seq\n" ; | |
# GGRNAでヒトRefSeq RNAに対してプローブ配列検索 | |
$seq =~ s/^\s*/seq:/ ; | |
$seq =~ s/\s+$// ; | |
$seq =~ s/\s+/+seq:/g ; | |
# print "Get : http://ggrna.dbcls.jp/hs/$seq.txt\n" ; | |
my $gene = get("http://ggrna.dbcls.jp/hs/$seq.txt") ; | |
# print "Result :\n$gene\n" ; | |
# SymbolおよびGeneIDを出力 | |
my @gene = split("\n", $gene) ; | |
@gene = grep !/^\#/, @gene ; # ヒット以外の情報を除去 | |
foreach (@gene){ | |
chomp ; | |
my $symbol = (split /\t/)[4] // '' ; | |
my $geneid = (split /\t/)[6] // '' ; | |
$_ = "$symbol $geneid" ; | |
} | |
foreach (unique_map(@gene)){ | |
print "$probeid $_\n" ; | |
} | |
} | |
exit ; | |
# ==================== | |
sub unique_map { | |
my @array = @_ ; | |
my %hash = map {$_, 1} @array ; | |
return keys %hash ; | |
} | |
# ==================== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment