trio_whole_exome_parse_peddy_ped_csv.pl 3.25 KiB
#!/usr/bin/perl -w
=head1 NAME
trio_whole_exome_parse_peddy_ped_csv.pl
=head1 AUTHOR
Alison Meynert (alison.meynert@igmm.ed.ac.uk)
=head1 DESCRIPTION
Checks the parent-child and parent-parent relationships from peddy output.
=cut
use strict;
use Getopt::Long;
use IO::File;
my $usage = qq{USAGE:
$0 [--help]
--output Output directory
--ped Pedigree file for project
--project Project id
--batch Batch id
};
my $help = 0;
my $ped_file;
my $project_id;
my $out_dir;
my $batch_id;
GetOptions(
'help' => \$help,
'project=s' => \$project_id,
'ped=s' => \$ped_file,
'output=s' => \$out_dir,
'batch=s' => \$batch_id
) or die $usage;
if ($help || !$project_id || !$ped_file || !$out_dir || !$batch_id)
{
print $usage;
exit(0);
}
# Read in the pedigree file
my $in_fh = new IO::File;
$in_fh->open($ped_file, "r") or die "Could not open $ped_file\n$!";
my %ped;
while (my $line = <$in_fh>)
{
chomp $line;
my ($family_id, $individual_id, $father_id, $mother_id, $sex, $aff) = split(/\t/, $line);
$ped{$family_id}{'count'}++;
$ped{$family_id}{$individual_id}{'father'} = $father_id;
$ped{$family_id}{$individual_id}{'mother'} = $mother_id;
if ($aff == 2)
{
$ped{$family_id}{'aff'} = $individual_id;
}
}
$in_fh->close();
my $out_file = "$out_dir/qc/$project_id.ped_check.txt";