Skip to content

Commit

Permalink
Update splitchr_ped.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdb authored May 20, 2022
1 parent 5be9d95 commit 0c5e6fe
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions script/geno_prep/splitchr_ped.pl
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
# 22 82139

if (!($ARGV[0] =~ /.*\.ped$/)) {
die "Filename must end in .ped\n";
die "Error: File name must end with .ped!\n";
exit;
}

$basefn = $ARGV[0];
$basefn =~ s/\.ped$//;

open(DATAFILE, $ARGV[0]) || die "Couldn't open $ARGV[0]\n";
open(SIZES, $ARGV[1]) || die "Couldn't open $ARGV[1]\n";
open(DATAFILE, $ARGV[0]) || die "Error: Cannot open $ARGV[0]\n";
open(SIZES, $ARGV[1]) || die "Error: Cannot open $ARGV[1]\n";
while(<SIZES>) {
chomp;
($chr, $n) = split;
Expand All @@ -31,7 +31,7 @@
$endcol[$i] = $startcol[$i] + (2 * $size[$i]) - 1;
if($startcol[$i] < $endcol[$i]) { print "$i, $startcol[$i], $endcol[$i]\n";}
$fname = $basefn . "_chr" . $i . ".ped";
open($fh[$i], ">$fname") || die "Cannot open $fname for writing\n";
open($fh[$i], ">$fname") || die "Error: Cannot open $fname for writing!\n";
}

while(<DATAFILE>) {
Expand Down

0 comments on commit 0c5e6fe

Please sign in to comment.