#!/usr/bin/perl -w #1_cp_ppb_x_cp_cct.pl use strict; use warnings; ##NB: To run this script on the file my_orthomcl_dir/groups.txt, specify it when runniong the script to add it to the @AGRV array die "usage: 1_cp_ppb_x_cp_cct.pl \n" if (@ARGV!=1); print "Processing file $ARGV[0]\n"; ##counting groups that have a single copy in ppb and multiple copies in cct my $bothspp=0; my $outfile ="1_cp_ppb_x_cp_cct_output.txt"; open (my $out, ">$outfile") or die ("Problem with opening $outfile: $!"); while (my $line=<>){ next unless($line=~m/cct\|\w{6}\scct\|\w{6}/); next unless ($line=~m/ppb/); next if ($line=~m/ppb\|\w{6}\sppb\|\w{6}/); $bothspp++; my $count+= ()=($line =~ m/\|/g); print $out "$line \($count proteins\)\n"; } print "There are $bothspp groups of protein families that contain a single copy of ppb, but multiple copies of cct\n"; ## "There are 7 groups of protein families that contain a single copy of ppb, but multiple copies of cct. my %count; my $file = shift or die "Usage: $0 FILE\n";