Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to extract the location information of all transcripts in GFF by perl

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to extract the location information of all transcripts in GFF by perl". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to extract the location information of all transcripts in GFF by perl.

Extract the location information of all gene transcripts in the genome annotation file GFF, as well as the ID of the corresponding genes:

The perl code is as follows:

#! / usr/bin/perl-wuse strict;use Cwd qw (abs_path getcwd); use Getopt::Long;use Data::Dumper;die "perl $0" unless (@ ARGV==2); my$gff=$ARGV [0]; my%gene= (); my%gene_region= (); my%mRNA2Gene= (); open IN, "$gff" or die "$!"; open OUT, "> $ARGV [1]" or die "$!"; print OUT "# mRNA_ID\ tgene_ID\ tchr\ tstart\ tend\ tstrand\ n"; while () {chomp Next if (/ ^ # /); my@tmp=split (/\ t /); if ($tmp [2] = ~ / ^ gene/) {my ($id) = ($tmp [8] = ~ / ID= ([^;] +) /); $gene {$id} = 1 leading genetic region {$id} = [$tmp [0], $tmp [3], $tmp [4], $tmp [6]; # print "gene:$id\ n"; # my$gene_chr- > {$id = $tmp [0] } if ($tmp [2] = ~ / mRNA | transcript/i) {my ($id) = ($tmp [8] = ~ / ID= ([^;] +) /); my ($pid) = ($tmp [8] = ~ / Parent= ([^;] +) /); if (exists $gene {$pid}) {print OUT "$id\ t$pid\ t$tmp [0]\ t$tmp [3]\ t$tmp [4]\ t$tmp [6]\ n";} # print "mRNA:$id\ n";}} close (IN); close (OUT) At this point, I believe you have a deeper understanding of "how perl extracts the location information of all transcripts in GFF". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report