How to extract tandem repeat gene pairs in gene family based on perl
This article introduces the knowledge of "how to extract tandem repeat gene pairs in the gene family based on perl". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Based on the tandem file in the results of MCScanX tandem repeat analysis, the tandem repeat gene pairs belonging to specific gene families were extracted.
Script file name
Get_tandem_gene.pl, run the command as follows:
Perl get_tandem_gene.pl-id hqs.id-tandem ganlan.tandem-name hqs-od. /
The command explains:
Get_tandem_gene.pl script file name, and finally indicate the full path
-id is imported into the gene family gene id. The file format is as follows:
Bol014029Bol014986Bol021982Bol023208Bol005493Bol008082Bol021317Bol021325Bol033054Bol033162
-tandem enter the concatenated repeat result file tandem (, delimited) of MCScan in the following file format:
Bol004372,Bol004373Bol004375,Bol004376Bol004405,Bol004406Bol004463,Bol004462Bol004492,Bol004491Bol004611,Bol004612Bol004624,Bol004625Bol004632,Bol004633Bol004672,Bol004673Bol004680,Bol004681
-name output file name prefix
-od output path
The output file format is as follows (\ t delimited):
Bol026623 Bol026622Bol038386 Bol038387Bol044343 Bol044344
The full perl script is as follows:
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;} my $gene;my @ info;my% hashG;open (IN, "$opts {id}") | die "open $opts {id} failed\ n"; while () {chomp @ info=split (/\ sbadger _); $gene=$info [0]; $hashG {$gene} = $gene;} close (IN); 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 () {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); "how to extract tandem repeat gene pairs in the gene family based on perl". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!