123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!perl -w
- use strict;
- use warnings;
- use Getopt::Long;
- use ScriptManager;
- my ($out,$in);
- GetOptions(
- "help|h" =>\&USAGE,
- "o:s"=>\$out,
- "i:s"=>\$in,
- );
- &USAGE unless ($in && $out);
- my @lncRNA_type=qw (lncRNA 3prime_overlapping_ncRNA antisense bidirectional_promoter_lncRNA lincRNA macro_lncRNA non_coding processed_transcript sense_intronic sense_overlapping TEC lnc_RNA);
- my %type;
- map {$type{$_}=1} @lncRNA_type;
- open IN,$in or die $!;
- open OUT,">$out";
- while (<IN>) {
- next if(/^\#/);
- print OUT $_ if(/gene_biotype \"([^\"]+)\"/ && $type{$1});
- print OUT $_ if(/transcript_biotype \"([^\"]+)\"/ && $type{$1});
- }
- close IN;
- close OUT;
- # remove $out if $out is empty
- #unlink $out if -f $out && -z $out;
- sub USAGE{
- my $usage=<<"USAGE";
- Usage:perl $0 -i reference.gtf -o lncRNA.gtf
- Options:
- -i <file> reference.gtf containing "gene_biotype" attribute, forced
- -o <file> output file, forced
- -h|help help
- USAGE
- print$usage;
- exit;
- }
|