view snpEff_2_1a/snpEff_2_1a/scripts/data/rice5/mRnaAddParent.pl @ 3:c052639fa666 default tip

Uploaded
author pcingola
date Fri, 20 Apr 2012 11:22:59 -0400
parents
children
line wrap: on
line source

#!/usr/bin/perl

#-------------------------------------------------------------------------------
# Add 'Parent' option in mRNA lines
#
# 								Pablo Cingolani
#-------------------------------------------------------------------------------

while( $l = <STDIN> ) {
	chomp $l;
	@t = split /\t/,$l;

	$type = $t[2];

	# Is it an mRNA?
	if( $type eq 'mRNA' ) {
		# Parse ID in options 
		$opts = $t[8];
		if( $opts =~ /ID=(.*?)-\d+;/ ) {
			$pid = $1;
			$pid =~ tr/t/g/;
			# Add 'Parent' option
			$l .= ";Parent=$pid";
		}
	}

	print "$l\n";
}