<commit_before>use VRPipe::Base;

class VRPipe::Steps::vcf_concat with VRPipe::StepRole {
	method options_definition {
		return { vcf_concat_exe => VRPipe::StepOption->get(description => 'path to vcf-concat executable',
				optional => 1,
				default_value => 'vcf-concat'),
		};
	}
	method inputs_definition {
		return { vcf_files => VRPipe::StepIODefinition->get(type => 'bin', min_files => 1, max_files => -1, description => 'vcf files to concat, in chromosome order'),
		};
	}

    method body_sub {
        return sub {

            my $self = shift;
            my $options = $self->options;
            my $vcf_concat_exe = $options->{vcf_concat_exe};

			my $merge_list = $self->output_file(output_key => 'merge_list', basename => "merge_list.txt", type => 'txt', temporary => 1);
			my $ofh = $merge_list->openw;

            foreach my $vcf (@{$self->inputs->{vcf_files}}) {
				print $ofh $vcf->path,"\n";
            }

			my $merged_vcf = $self->output_file(output_key => 'merged_vcf', basename => "merged.vcf.gz", type => 'bin');
			my $merged_vcf_path = $merged_vcf->path;
			my $merge_list_path = $merge_list->path;

			my $cmd = qq[$vcf_concat_exe -f $merge_list_path | bgzip -c > $merged_vcf_path];
            my $req = $self->new_requirements(memory => 500, time => 1);
			$self->dispatch([$cmd, $req, {output_files => [$merged_vcf, $merge_list]}]); 
        };
    }
    method outputs_definition {
        return { merged_vcf => VRPipe::StepIODefinition->get(type => 'bin', max_files => 1, description => 'a merged catanated .vcf.gz file for each set of input vcfs')};
    }
    method post_process_sub {
        return sub { return 1; };
    }
    method description {
        return "Run vcf-merge, generating one catanated vcf per input set of vcf";
    }
    method max_simultaneous {
        return 0; # meaning unlimited
    }
}

1;<commit_msg>new mod to call vcf-concat<commit_after>use VRPipe::Base;

class VRPipe::Steps::vcf_concat with VRPipe::StepRole {
	method options_definition {
		return { vcf_concat_exe => VRPipe::StepOption->get(description => 'path to vcf-concat executable',
				optional => 1,
				default_value => 'vcf-concat'),
		};
	}
	method inputs_definition {
		return { vcf_files => VRPipe::StepIODefinition->get(type => 'bin', min_files => 1, max_files => -1, description => 'vcf files to concat, in chromosome order'),
		};
	}

    method body_sub {
        return sub {

            my $self = shift;
            my $options = $self->options;
            my $vcf_concat_exe = $options->{vcf_concat_exe};

			my $merge_list = $self->output_file(output_key => 'merge_list', basename => "merge_list.txt", type => 'txt', temporary => 1);
			my $ofh = $merge_list->openw;

            foreach my $vcf (@{$self->inputs->{vcf_files}}) {
				print $ofh $vcf->path,"\n";
            }

			my $concat_vcf = $self->output_file(output_key => 'concat_vcf', basename => "merged.vcf.gz", type => 'bin');
			my $concat_vcf_path = $concat_vcf->path;
			my $merge_list_path = $merge_list->path;

			my $cmd = qq[$vcf_concat_exe -f $merge_list_path | bgzip -c > $concat_vcf_path];
            my $req = $self->new_requirements(memory => 500, time => 1);
			$self->dispatch([$cmd, $req, {output_files => [$concat_vcf, $merge_list]}]); 
        };
    }
    method outputs_definition {
        return { concat_vcf => VRPipe::StepIODefinition->get(type => 'bin', max_files => 1, description => 'a merged catanated .vcf.gz file for each set of input vcfs')};
    }
    method post_process_sub {
        return sub { return 1; };
    }
    method description {
        return "Run vcf-concat, generating one catanated vcf per input set of vcfs";
    }
    method max_simultaneous {
        return 0; # meaning unlimited
    }
}

1;
{'fraction_non_alphanumeric': 0.14817770683692472, 'fraction_numerical': 0.006384676775738229, 'mean_word_length': 3.1228070175438596, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 81, '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': '3849017', 'n_tokens_mistral': 1380, 'n_tokens_neox': 1274, 'n_words': 303}