-
not populated not populated authorednot populated not populated authored
trio_whole_exome_create_parameter_files.pl 3.42 KiB
#!/usr/bin/perl -w
=head1 NAME
trio_whole_exome_create_parameter_files.pl
=head1 AUTHOR
Alison Meynert (alison.meynert@igmm.ed.ac.uk)
=head1 DESCRIPTION
Creates the files:
$prefix.family_ids.txt - format <pcr_plate_id>_<family_id>
$prefix_$family_id.ped - select only the individuals in a given family,
prefix <family_id> with <pcr_plate_id> and
add suffix <family_id> to <individual_id>
=cut
use strict;
use Getopt::Long;
use IO::File;
my $usage = qq{USAGE:
$0 [--help]
--prefix Output prefix for files
--ped Pedigree file for project
--suffix Sample suffix
};
my $help = 0;
my $ped_file;
my $output_prefix;
my $sample_suffix;
GetOptions(
'help' => \$help,
'prefix=s' => \$output_prefix,
'suffix=s' => \$sample_suffix,
'ped=s' => \$ped_file
) or die $usage;
if ($help || !$output_prefix || !$sample_suffix || !$ped_file)
{
print $usage;
exit(0);
}
# Read in the file_list.tsv file(s) from the Edinburgh Genomics project delivery folder
my %family;
while (my $line = <>)
{
next if ($line =~ /^File/);
next if ($line =~ /unassigned/);
chomp $line;
my @tokens = split(/\t/, $line);
my $sample_dir = $tokens[7];
# remove the sample suffix
$sample_dir =~ /(.+)$sample_suffix/;
my $sample_full_id = $1;
my ($pcr_plate_id, $individual_id, $family_id) = split('_', $sample_full_id);
$family{$family_id}{'pcr_plate_id'} = $pcr_plate_id;
$family{$family_id}{'individual_id'}{$individual_id}++;
}