<commit_before>#!/usr/bin/perl -w

##################################################################################################################################################
###This script is designed to run GATK HC and UG variant callers using GATK Queue
###
###
###Author: R.F.Ernst
###Latest change: Added UG
###TODO:
##################################################################################################################################################

package illumina_calling;

use strict;
use POSIX qw(tmpnam);

sub runVariantCalling {
    my $configuration = shift;
    my %opt = %{$configuration};
    my $runName = (split("/", $opt{OUTPUT_DIR}))[-1];
    my @sampleBams;
    my @runningJobs;
    my $jobID = "VC_".get_job_id();

    ### Skip variant calling if .raw_variants.vcf already exists
    if (-e "$opt{OUTPUT_DIR}/logs/VariantCaller.done"){
	warn "WARNING: $opt{OUTPUT_DIR}/logs/VariantCaller.done exists, skipping \n";
	return \%opt;
    }
    
    ### Create gvcf folder if CALLING_GVCF eq yes
    if((! -e "$opt{OUTPUT_DIR}/gvcf" && $opt{CALLING_GVCF} eq 'yes')){
	mkdir("$opt{OUTPUT_DIR}/gvcf") or die "Couldn't create directory: $opt{OUTPUT_DIR}/gvcf\n";
    }
    
    ### Build Queue command
    my $javaMem = $opt{CALLING_MASTERTHREADS} * $opt{CALLING_MEM};
    my $command = "java -Xmx".$javaMem."G -Xms".$opt{CALLING_MEM}."G -jar $opt{QUEUE_PATH}/Queue.jar ";
    $command .= "-jobQueue $opt{CALLING_QUEUE} -jobNative \"-pe threaded $opt{CALLING_THREADS}\" -jobRunner GridEngine -jobReport $opt{OUTPUT_DIR}/logs/VariantCaller.jobReport.txt "; #Queue options

    ### Add caller and UG specific settings
    $command .= "-S $opt{CALLING_SCALA} ";
    if ($opt{CALLING_UGMODE}) {
	$command .= " -glm $opt{CALLING_UGMODE} ";
    }

    ### Common settings
    $command .= "-R $opt{GENOME} -O $runName -mem $opt{CALLING_MEM} -nct $opt{CALLING_THREADS} -nsc $opt{CALLING_SCATTER} -stand_call_conf $opt{CALLING_STANDCALLCONF} -stand_emit_conf $opt{CALLING_STANDEMITCONF} ";<commit_msg>Set queue calling job memory<commit_after>#!/usr/bin/perl -w

##################################################################################################################################################
###This script is designed to run GATK HC and UG variant callers using GATK Queue
###
###
###Author: R.F.Ernst
###Latest change: Added UG
###TODO:
##################################################################################################################################################

package illumina_calling;

use strict;
use POSIX qw(tmpnam);

sub runVariantCalling {
    my $configuration = shift;
    my %opt = %{$configuration};
    my $runName = (split("/", $opt{OUTPUT_DIR}))[-1];
    my @sampleBams;
    my @runningJobs;
    my $jobID = "VC_".get_job_id();

    ### Skip variant calling if .raw_variants.vcf already exists
    if (-e "$opt{OUTPUT_DIR}/logs/VariantCaller.done"){
	warn "WARNING: $opt{OUTPUT_DIR}/logs/VariantCaller.done exists, skipping \n";
	return \%opt;
    }
    
    ### Create gvcf folder if CALLING_GVCF eq yes
    if((! -e "$opt{OUTPUT_DIR}/gvcf" && $opt{CALLING_GVCF} eq 'yes')){
	mkdir("$opt{OUTPUT_DIR}/gvcf") or die "Couldn't create directory: $opt{OUTPUT_DIR}/gvcf\n";
    }
    
    ### Build Queue command
    my $javaMem = $opt{CALLING_MASTERTHREADS} * $opt{CALLING_MEM};
    my $javaJobMem = $opt{CALLING_THREADS} * $opt{CALLING_MEM};
    my $command = "java -Xmx".$javaMem."G -Xms".$opt{CALLING_MEM}."G -jar $opt{QUEUE_PATH}/Queue.jar ";
    $command .= "-jobQueue $opt{CALLING_QUEUE} -jobNative \"-pe threaded $opt{CALLING_THREADS}\" -jobRunner GridEngine -jobReport $opt{OUTPUT_DIR}/logs/VariantCaller.jobReport.txt -memLimit $javaJobMem "; #Queue options

    ### Add caller and UG specific settings
    $command .= "-S $opt{CALLING_SCALA} ";
    if ($opt{CALLING_UGMODE}) {
	$command .= " -glm $opt{CALLING_UGMODE} ";
    }

    ### Common settings
    $command .= "-R $opt{GENOME} -O $runName -mem $opt{CALLING_MEM} -nct $opt{CALLING_THREADS} -nsc $opt{CALLING_SCATTER} -stand_call_conf $opt{CALLING_STANDCALLCONF} -stand_emit_conf $opt{CALLING_STANDEMITCONF} ";
{'fraction_non_alphanumeric': 0.2800096223237912, 'fraction_numerical': 0.0004811161895597787, 'mean_word_length': 4.889518413597734, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5274421', 'n_tokens_mistral': 1398, 'n_tokens_neox': 1345, 'n_words': 302}