How to extract the number and name of lncRNA from GTF
This article will explain in detail how to extract the number and name of lncRNA from GTF. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Extract the ID and name of lncRNA from the GTF file
When extracting the expression of lncRNA from TCGA data, you need to know the number of lncRNA and the corresponding name. This information can be extracted from the GTF file.
If you extract it, you can implement it in the following code.
#! / usr/bin/perl-wuse strict;my $biotype_file = shift @ ARGV;my $gtf = shift @ ARGV;my $biotype = shift @ ARGV;my% biotype_list;open my $fh2, $biotype_file or die;while () {chomp; my @ array = split /\ t fh2, $_; if ($array [2] eq $biotype) {$biotype_list {$array [0]} = 1;} close $fh2;open my $out, "> ${biotype} _ info.txt" or die Print $out "Gene_id\ tGene_id_info\ tgene_name\ tbiotype\ n"; open my $fh3, $gtf or die;while () {chomp; next if / ^ # /; my @ array = split /\ t gene, $_; next unless ($array [2] eq "gene"); $array [8] = ~ / gene_id\ s + "(\ swatches?)";. * gene_type\ s + "(\ swatches?)";. * gene_name\ s + "(\ sbanks?)"; / My $geneid = $1; my $genebiotype = $2; my $genename = $3; my $gene_id_norm= (split ("\\.", $geneid)) [0]; if ($biotype_list {$genebiotype}) {print $out "$gene_id_norm\ t$geneid\ t$genename\ t$genebiotype\ n";} close $fh3 This is the end of the article on "how to extract the number and name of lncRNA from GTF". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.