if($#ARGV<1){
  print "usage: $0 myINfile myOUTfilestream\n";
  print "Processes PMID file\n";
}
else{
  my $file = $ARGV[0];
  my $outstem = $ARGV[1];
  $i=0;
  $cpt=1;
  $file=~s/\\/\\\\/g;
  $outfile=$outstem.$cpt.".txt";

  open(IN,"$file") || die "cannot open $file for reading\n";
  open(OUT,">$outfile") || die "cannot open query for writing\n";
  while(<IN>){
    chomp;
    $line=$_;
    ($pmid,$sim10)=$line=~/([^\t]+)\t([^\t]+).+/;
    if($sim10<=0.1){
      $i++;
      if($i % 215 != 0){print OUT "$pmid,";}

    if(($i>0)&&($i % 215 == 0)){
      print OUT "$pmid";
      $cpt ++;
      close(OUT);
      $outfile=$outstem.$cpt.".txt";
      open(OUT,">$outfile") || die "cannot open $outfile for writing\n";
    }
    }
  }
  close(OUT);
  print"prepared $i pmid";
}
