Skip to content

Commit

Permalink
Merge branch 'hotfix/v2.1.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranmraine committed May 23, 2016
2 parents e606c12 + 613eadc commit 02fa689
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
3 changes: 0 additions & 3 deletions perl/bin/ascatCnToVCF.pl
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ sub setup{
PCAP::Cli::file_for_reading('sbw', $opts{'sbw'});
PCAP::Cli::file_for_reading('r', $opts{'r'});

# required: direct input
pod2usage(-message => "\nERROR: rs|reference-species must be defined.\n", -verbose => 1, -output => \*STDERR) unless($opts{'rs'});

pod2usage(-message => "\nERROR: msq|sample-sequencing-protocol-mut must be defined.\n", -verbose => 1, -output => \*STDERR) if(exists $opts{'msq'} && ! defined $opts{'msq'});
pod2usage(-message => "\nERROR: wsq|sample-sequencing-protocol-norm must be defined.\n", -verbose => 1, -output => \*STDERR) if(exists $opts{'wsq'} && ! defined $opts{'wsq'});

Expand Down
2 changes: 0 additions & 2 deletions perl/bin/utilities/ascatSnpPanelFromVcfs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@
my $result = evaluate_set($cluster, \%sample_dist);
print $result if($result);

warn Dumper(\%sample_dist);

sub evaluate_set {
my ($cluster, $sample_dist) = @_;
my $retval;
Expand Down
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 = '2.1.2';
our $VERSION = '2.1.3';
our @EXPORT = qw($VERSION);

const my $LICENSE =>
Expand Down
8 changes: 5 additions & 3 deletions perl/lib/Sanger/CGP/Ascat/Implement.pm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ sub ascat {
PCAP::Threaded::touch_success(File::Spec->catdir($tmp, 'progress'), 'merge_counts_wt', 0);
}

my $core_chrs = snpLociChrs($options);

my $command = "cd $ascat_out; "._which('Rscript');

my $mod_path = dirname(abs_path($0)).'/../share';
Expand All @@ -166,6 +168,7 @@ sub ascat {
$command .= ' '.$options->{'normal_name'};
$command .= ' '.$normcountfile;
$command .= ' '.$options->{'gender'};
$command .= ' '.$core_chrs;
$command .= ' '.$rdata;

if(defined($options->{'ploidy'}) && defined($options->{'purity'})){
Expand Down Expand Up @@ -245,13 +248,12 @@ sub finalise {
$command .= " -msp $options->{platform} -wsp $options->{platform}" if(defined $options->{'platform'});

my $vcf_gz = $new_vcf.'.gz';
my $bgzip = _which('bgzip');
$bgzip .= sprintf ' -c %s > %s', $new_vcf, $vcf_gz;
my $sort_gz = sprintf q{(grep '^#' %s ; grep -v '^#' %s | sort -k 1,1 -k 2,2n) | %s -c > %s}, $new_vcf, $new_vcf, _which('bgzip'), $vcf_gz;

my $tabix = _which('tabix');
$tabix .= sprintf ' -p vcf %s', $vcf_gz;

push @commands, $command, $bgzip, $tabix;
push @commands, $command, $sort_gz, $tabix;

PCAP::Threaded::external_process_handler(File::Spec->catdir($tmp, 'logs'), \@commands, 0);

Expand Down
21 changes: 13 additions & 8 deletions perl/share/ascat/runASCAT.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ if(length(args)==0){
normal_sample = args[6]
normal_count_file = args[7]
gender = args[8]
rdat_out = args[9]
purity = as.numeric(args[10])
ploidy = as.numeric(args[11])
refchrs = args[12]
chrCount = as.numeric(args[9])
rdat_out = args[10]
purity = as.numeric(args[11])
ploidy = as.numeric(args[12])
refchrs = args[13]

refCN = ifelse(args[13]=="NA",NA,as.numeric(args[13]))
refCN = ifelse(args[14]=="NA",NA,as.numeric(args[14]))
if(is.na(refchrs)||refchrs=="NA") {
refchrs = NA
}

}

cat(chrCount,' : chr Count \n')

## checkpointing: if the RData file exists, only rerun the last step of ASCAT
if(length(dir(pattern=rdat_out))==0) {

Expand Down Expand Up @@ -76,8 +79,9 @@ if(length(dir(pattern=rdat_out))==0) {
## This gives every SNP a name (to be able to do GC correction)
SNPposWithNames = read.table(SNP_pos_with_names,sep="\t",header=T,row.names=1)

ctrans = 1:24
names(ctrans)=c(1:22,"X","Y")
ctrans = 1:chrCount
nonGenderChrs = chrCount - 2
names(ctrans)=c(1:nonGenderChrs,"X","Y")
newnames = ctrans[as.vector(SNPposWithNames[,1])]*1000000000+SNPposWithNames[,2]
newnamesSEQ = ctrans[as.vector(SNPpos[,1])]*1000000000+as.numeric(SNPpos[,2])

Expand Down Expand Up @@ -213,7 +217,8 @@ if(!is.null(ascat.output$nA)) {
colnames(gCN) = c("Chromosome","Position","Log R", "segmented LogR", "BAF", "segmented BAF", "Copy number", "Minor allele", "Raw copy number")
gCN[,1]=as.vector(ascat.bc$SNPpos[,1])
gCN[,2]=ascat.bc$SNPpos[,2]
gCN[gCN[,1]=="X",1]=23
# X chr is the first one after the main, all includes X+Y
gCN[gCN[,1]=="X",1]=chrCount-1
gCN[,3]=ascat.bc$Tumor_LogR[,1]
gCN[,4]=ascat.bc$Tumor_LogR_segmented[,1]
gCN[,5]=ascat.bc$Tumor_BAF[,1]
Expand Down

0 comments on commit 02fa689

Please sign in to comment.