基于perl 提取基因家族内的串联重复基因对

基于perl 提取基因家族内的串联重复基因对

基于MCScanX串联重复分析结果中的tandem文件,提取属于特定基因家族内的串联重复基因对。

脚本文件名  

get_tandem_gene.pl ,运行命令为:
perl get_tandem_gene.pl  -id hqs.id  -tandem ganlan.tandem  -name hqs -od ./ 


命令解释:

get_tandem_gene.pl脚本文件名,最后写明全路径

-id  输入基因家族基因id,文件格式如下:

Bol014029
Bol014986
Bol021982
Bol023208
Bol005493
Bol008082
Bol021317
Bol021325
Bol033054
Bol033162


-tandem  输入MCScan的串联重复结果文件tandem( , 分隔),文件格式如下:

Bol004372,Bol004373
Bol004375,Bol004376
Bol004405,Bol004406
Bol004463,Bol004462
Bol004492,Bol004491
Bol004611,Bol004612
Bol004624,Bol004625
Bol004632,Bol004633
Bol004672,Bol004673
Bol004680,Bol004681


-name 输出文件名前缀

-od 输出路径

输出文件格式如下(\t 分隔):

Bol026623       Bol026622
Bol038386       Bol038387
Bol044343       Bol044344



全部perl 脚本内容如下:

use Data::Dumper;
use Getopt::Long;
use strict;
use Cwd qw(abs_path getcwd);


my %opts;

GetOptions (\%opts,"id=s","tandem=s","od=s","name=s"); 

my $od=$opts{od};
$od||=getcwd;
$od=abs_path($od);
unless(-d $od){    mkdir $od;}

####get target gene id
my $gene;
my @info;
my %hashG;
open (IN,"$opts{id}") || die "open $opts{id} failed\n";
while(<IN>){
    chomp;
    @info=split(/\s+/,$_);
    $gene=$info[0];
    $hashG{$gene}=$gene;
}
close(IN);


#######select tandem

my $Agene;
my $Bgene;
open(OUT,">$od/$opts{name}.tandem")||die "open $od/$opts{name}.tandem failed\n";
open (IN,"$opts{tandem}") || die "open $opts{tandem} failed\n";
while(<IN>){
    chomp;
    @info=split(/,/,$_);
    $Agene=$info[0];
    $Bgene=$info[1];
    if(exists $hashG{$Agene} && exists $hashG{$Bgene}){
        print OUT $Agene."\t".$Bgene."\n";
    }

}
close(IN);
close(OUT);


如果脚本提取没有结果:1.本身基因家族没有串联重复;2.如果是在windows当中粘贴了一下基因家族的ID列表,也没有结果,这里可能会有bug,建议手动excel确认一下是否真的没有串联重复基因。


MCScanX分析参考课程:

基因家族分析实操课程基因家族文献思路解读


更多生物信息课程:

1. 文章越来越难发?是你没发现新思路,基因家族分析发2-4分文章简单快速,学习链接:基因家族分析实操课程基因家族文献思路解读

2. 转录组数据理解不深入?图表看不懂?点击链接学习深入解读数据结果文件,学习链接:转录组(有参)结果解读转录组(无参)结果解读

3. 转录组数据深入挖掘技能-WGCNA,提升你的文章档次,学习链接:WGCNA-加权基因共表达网络分析

4. 转录组数据怎么挖掘?学习链接:转录组标准分析后的数据挖掘转录组文献解读

5. 微生物16S/ITS/18S分析原理及结果解读OTU网络图绘制cytoscape与网络图绘制课程

6. 生物信息入门到精通必修基础课:linux系统使用perl入门到精通perl语言高级R语言入门R语言画图

7. 医学相关数据挖掘课程,不用做实验也能发文章:TCGA-差异基因分析GEO芯片数据挖掘GEO芯片数据标准化GSEA富集分析课程TCGA临床数据生存分析TCGA-转录因子分析TCGA-ceRNA调控网络分析

8.其他,二代测序转录组数据自主分析NCBI数据上传二代测序数据解读


  • 发表于 2018-08-31 10:27
  • 阅读 ( 8157 )
  • 分类:perl

0 条评论

请先 登录 后评论
Daitoue
Daitoue

167 篇文章

作家榜 »

  1. omicsgene 658 文章
  2. 安生水 328 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. 红橙子 78 文章
  6. CORNERSTONE 72 文章
  7. xun 67 文章
  8. rzx 67 文章