Skip to content

Instantly share code, notes, and snippets.

@ChemicalJames
Created October 17, 2012 15:54
Show Gist options
  • Save ChemicalJames/3906331 to your computer and use it in GitHub Desktop.
Save ChemicalJames/3906331 to your computer and use it in GitHub Desktop.
HW3
#!bin/perl
use strict;
# number of 3'UTR
open(IN, "grep -c 'three_prime' ath_chr1.gff | ") || die $!;
while(my $count = <IN>) {
open(my $outfh => "UTR.txt") || die $!;
print $outfh "$count\n";
}
# number of introns
my $fh = "ath_chr1.gff";
open(my $fh => 'ath_chr1.gff') || die $!;
while (<$fh>) {
chomp;
my @cols = split("\t",$_), $fh;
my ( $l, $r ) = ( 0, 0 );
for ( $l = 0 ; $l <= $#cols ;) {
for ( $r = 0 ; $r <= $#cols ;) {
open(my $outfh => "intron.txt") || die $!;
print $outfh "$cols[$l] - $cols[$r], "\n"";
}
}
}
# avg length of genes
#still working on this one
cat UTR.txt intron.txt length.txt > ath_chr1_stats.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment