#!/usr/bin/perl -w #1_copy_both_spp.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_copy_both_spp.pl \n" if (@ARGV!=1); print "Processing file $ARGV[0]\n"; ##counting groups that have a single copy in both spp my $bothspp=0; my $outfile ="1_copy_both_spp_output.txt"; open (my $out, ">$outfile") or die ("Problem with opening $outfile: $!"); while (my $line=<>){ next unless($line=~m/group\d{1,4}\:\s+cct\|\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 in both spp\n"; close($out); ##output "There are 1468 groups of protein families that contain a single copy in both spp.