#!/usr/local/ensembl/bin/perl

use strict;
use warnings;

my $postfix = 1;

my $copied = 0;
my $id;

#
# Read from STDIN use 2nd col as ids and split ids into 
# files with 100 ids each
#
while(<>) {
  chomp;
  (undef, $id) = split;

  open(FH, ">PeptideSet.$postfix") if($copied == 0);

  print FH "$id\n";
  $copied++;

  if($copied == 100) {
    close FH;
    $copied = 0;
    $postfix++;
  }
}

#!/usr/local/ensembl/bin/perl

use strict;
use warnings;
use Getopt::Long;

my $postfix = 1;

my $maxids = 50;
my $copied = 0;
my $id;

GetOptions('maxids=i' => \$maxids);

#
# Read from STDIN use 2nd col as ids and split ids into 
# files with 100 ids each
#
while(<>) {
  chomp;
  (undef, $id) = split;

  open(FH, ">PeptideSet.$postfix") if($copied == 0);

  print FH "$id\n";
  $copied++;

  if($copied == $maxids) {
    close FH;
    $copied = 0;
    $postfix++;
  }
}

Set the default number of ids per file to 50 rather than 100. That makes blast jobs shorter 15-20 min rather 30-35 min. The default value can now be modified with --maxids option
Set the default number of ids per file to 50 rather than 100. That makes blast jobs shorter 15-20 min rather 30-35 min. The default value can now be modified with --maxids option
