您好,登錄后才能下訂單哦!
這篇“perl怎么提取基因組所有基因的啟動子序列”文章的知識點大部分人都不太理解,所以小編給大家總結了以下內容,內容詳細,步驟清晰,具有一定的借鑒價值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來看看這篇“perl怎么提取基因組所有基因的啟動子序列”文章吧。
腳本運行命令:
perl gene_promoter.pl -fa Donkey_Hic_genome.20180408.fa -gff Donkey_Hic_genome.20180408.gff3 -out gene_promoter.fa -n 2000
其中 -fa 后跟基因組染色體序列;-gff 后跟基因組gff文件;-n后跟數字,表示要提取基因上游多少bp的序列。
腳本代碼:
#!/usr/bin/perl -w use strict; use warnings; use Getopt::Long; use Data::Dumper; use Config::General; use Cwd qw(abs_path getcwd); use FindBin qw($Bin $Script); use File::Basename qw(basename dirname); use Bio::SeqIO; use Bio::Seq; my $version = "1.3"; ## prepare parameters ####################################################################### ## ------------------------------------------------------------------------------------------- ## GetOptions my %opts; GetOptions(\%opts, "gff=s","fa=s", "out=s", "n=s","h"); if(!defined($opts{out}) || !defined($opts{gff}) || || !defined($opts{fa}) ||defined($opts{h})) { print <<"Usage End."; Description: $version:lefse analysis Usage Forced parameter: -gff gff file <infile> must be given -out outdir <outfile> must be given -n num <int> -fa genome fasta file <infile> must be given Other parameter: -h Help document Usage End. exit; } $opts{n} ||= 2000; my $n = $opts{n}; my $in = Bio::SeqIO->new(-file => "$opts{fa}" , -format => 'Fasta'); my %fasta; while ( my $seq = $in->next_seq() ) { my($id,$sequence)=($seq->id,$seq->seq); $fasta{$id}=$sequence; } open(IN,"$opts{gff}") ||die "open file $opts{gff} faild.\n"; open(OUT,">$opts{out}") ||die "open file $opts{out} faild.\n"; while(<IN>){ next if(/^#/); my @line = split ("\t",$_); if($line[2] eq "gene"){ $line[8] =~ /ID=([^;]*);/; my $name = $1; if($line[6] eq "+"){ my $gene = substr( $fasta{$line[0]},$line[3]-$n-1, $n); print OUT ">$name\n$gene\n"; }elsif($line[6] eq "-"){ my $gene = substr( $fasta{$line[0]},$line[4], $n); $gene = &reverse_complement_IUPAC($gene); print OUT ">$name\n$gene\n"; } } } close(OUT); close(IN); sub reverse_complement_IUPAC { my $dna = shift; # reverse the DNA sequence my $revcomp = reverse($dna); # complement the reversed DNA sequence $revcomp =~ tr/ABCDGHMNRSTUVWXYabcdghmnrstuvwxy/TVGHCDKNYSAABWXRtvghcdknysaabwxr/; return $revcomp; } sub reverse_complement { my $dna = shift; # reverse the DNA sequence my $revcomp = reverse($dna); # complement the reversed DNA sequence $revcomp =~ tr/ACGTacgt/TGCAtgca/; return $revcomp; }
以上就是關于“perl怎么提取基因組所有基因的啟動子序列”這篇文章的內容,相信大家都有了一定的了解,希望小編分享的內容對大家有幫助,若想了解更多相關的知識內容,請關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。