Skip to content

Commit

Permalink
Merge pull request #25 from cancerit/dev
Browse files Browse the repository at this point in the history
Revises gender determination to be based on normal sample only.
  • Loading branch information
keiranmraine committed Jan 13, 2015
2 parents 69138b1 + f2d2700 commit c8509e8
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 22 deletions.
5 changes: 3 additions & 2 deletions perl/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@ docs/pod_html/CN_to_VCF.html
docs/pod_html/failed_cn_csv.html
docs/pod_html/index.html
docs/pod_html/Sanger/CGP/Ascat.html
docs/reports_html/blib-lib-Sanger-CGP-Ascat-pm--subroutine.html
docs/reports_html/blib-lib-Sanger-CGP-Ascat-pm.html
docs/reports_html/common.js
docs/reports_html/cover.14
docs/reports_html/cover.css
docs/reports_html/coverage.html
docs/reports_html/css.js
docs/reports_html/digests
docs/reports_html/index.html
docs/reports_html/lib-Sanger-CGP-Ascat-pm--subroutine.html
docs/reports_html/lib-Sanger-CGP-Ascat-pm.html
docs/reports_html/standardista-table-sorting.js
docs/reports_text/coverage.txt
lib/Sanger/CGP/Ascat.pm
Expand Down
2 changes: 1 addition & 1 deletion perl/MYMETA.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
}
},
"release_status" : "stable",
"version" : "v1.5.0"
"version" : "v1.5.1"
}
2 changes: 1 addition & 1 deletion perl/MYMETA.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ no_index:
- inc
requires:
Const::Fast: '0.014'
version: v1.5.0
version: v1.5.1
Binary file modified perl/docs.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion perl/lib/Sanger/CGP/Ascat.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use strict;
use Const::Fast qw(const);
use base 'Exporter';

our $VERSION = '1.5.0';
our $VERSION = '1.5.1';
our @EXPORT = qw($VERSION);

const my $LICENSE =>
Expand Down
23 changes: 6 additions & 17 deletions perl/lib/Sanger/CGP/Ascat/Implement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -284,40 +284,29 @@ sub determine_gender {
}

my $command = _which('alleleCounter');
$command .= sprintf $ALLELE_COUNT_PARA, $options->{'tumour'}, File::Spec->catfile($options->{'tmp'}, 'tumour_gender.tsv'), $gender_loci;
$command .= '-m '.$options->{'minbasequal'} if exists $options->{'minbasequal'};
system($command);
my $tum_gender = _parse_gender_results(File::Spec->catfile($options->{'tmp'}, 'tumour_gender.tsv'));
$command = _which('alleleCounter');
$command .= sprintf $ALLELE_COUNT_PARA, $options->{'normal'}, File::Spec->catfile($options->{'tmp'}, 'normal_gender.tsv'), $gender_loci;
$command .= '-m '.$options->{'minbasequal'} if exists $options->{'minbasequal'};
system($command);
my $norm_gender = _parse_gender_results(File::Spec->catfile($options->{'tmp'}, 'normal_gender.tsv'));
if($tum_gender ne $norm_gender) {
die "Gender loci gacve incolclusive results see $options->{tmp}/*_gender.tsv";
}
return $tum_gender;
return $norm_gender;
}

sub _parse_gender_results {
my $file = shift @_;
my $male_loci = 0;
my $total_loci = 0;
my $gender = 'XX';
open my $fh, '<', $file;
while(my $line = <$fh>) {
next if($line =~ m/^#/);
chomp $line;
#CHR POS Count_A Count_C Count_G Count_T Good_depth
my ($chr, $pos, $a, $c, $g, $t, $depth) = split /\t/, $line;
# all we really care about is the depth
$male_loci++ if($depth > 5);
$total_loci++;
if($depth > 5) {
$gender = 'XY';
last; # presence of ANY male loci in normal is sufficient, we shouldn't be using this to check for 'matchedness'
}
}
close $fh;
my $gender = 'XX';
if($male_loci/$total_loci >= 0.5) {
$gender = 'XY';
}
return $gender;
}

Expand Down

0 comments on commit c8509e8

Please sign in to comment.