Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix hard filter #14

Merged
merged 6 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dockers_consensus.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
TOOL|DOCKER
-|-
bcftools_annotate.cwl|pgc-images.sbgenomics.com/d3b-bixu/vcfutils:latest
bcftools_filter_vcf.cwl|pgc-images.sbgenomics.com/d3b-bixu/bvcftools:latest
bcftools_filter_vcf.cwl|pgc-images.sbgenomics.com/d3b-bixu/bcftools:1.20
bcftools_strip_ann.cwl|pgc-images.sbgenomics.com/d3b-bixu/vcfutils:latest
echtvar_anno.cwl|pgc-images.sbgenomics.com/d3b-bixu/echtvar:0.2.0
generic_rename_outputs.cwl|None
Expand Down
2 changes: 1 addition & 1 deletion docs/dockers_somatic.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
TOOL|DOCKER
-|-
add_strelka2_fields.cwl|pgc-images.sbgenomics.com/d3b-bixu/add-strelka2-fields:1.0.0
bcftools_filter_vcf.cwl|pgc-images.sbgenomics.com/d3b-bixu/bvcftools:latest
bcftools_filter_vcf.cwl|pgc-images.sbgenomics.com/d3b-bixu/bcftools:1.20
bcftools_strip_ann.cwl|pgc-images.sbgenomics.com/d3b-bixu/vcfutils:latest
echtvar_anno.cwl|pgc-images.sbgenomics.com/d3b-bixu/echtvar:0.2.0
gatk_variant_filter.cwl|pgc-images.sbgenomics.com/d3b-bixu/gatk:4.1.1.0
Expand Down
67 changes: 40 additions & 27 deletions tools/bcftools_filter_vcf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,59 @@ doc: "More generic tool to take in an include expression and optionally an exclu
requirements:
- class: ShellCommandRequirement
- class: DockerRequirement
dockerPull: 'pgc-images.sbgenomics.com/d3b-bixu/bvcftools:latest'
dockerPull: 'pgc-images.sbgenomics.com/d3b-bixu/bcftools:1.20'
- class: ResourceRequirement
ramMin: 1000
coresMin: 1
ramMin: 16000
coresMin: 8
dmiller15 marked this conversation as resolved.
Show resolved Hide resolved
- class: InlineJavascriptRequirement
baseCommand: [bash -c 'set -eo pipefail &&]
baseCommand: []
arguments:
- position: 1
- position: 0
shellQuote: false
valueFrom: >-
${
var out_base = inputs.output_basename;
if (out_base == null){
out_base = inputs.input_vcf.nameroot + ".bcf_filtered"
var cmd = "bcftools view"
if ( inputs.sample_name != null ){
cmd += " --threads " + inputs.threads + " -s " + inputs.sample_name + " " + inputs.input_vcf.path + " | bcftools view ";
dmiller15 marked this conversation as resolved.
Show resolved Hide resolved
}
var cmd = "bcftools view ";
if (inputs.include_expression != null){
cmd += "--include \"" + inputs.include_expression + "\" " + inputs.input_vcf.path;
if (inputs.exclude_expression != null){
cmd += " | bcftools view --exclude \"" + inputs.exclude_expression + "\"' -O z > " + out_base + ".vcf.gz;";
} else {
cmd += " -O z > " + out_base + ".vcf.gz;";
}
} else if (inputs.include_expression == null && inputs.exclude_expression != null){
cmd += "--exclude \"" + inputs.exclude_expression + "\" " + inputs.input_vcf.path + " -O z > " + out_base + ".vcf.gz;";
} else if (inputs.include_expression == null && inputs.exclude_expression == null){
cmd = "cp " + inputs.input_vcf.path + " ./" + out_base + ".vcf.gz;";
}
cmd += "tabix " + out_base + ".vcf.gz;'"
return cmd;
}
- position: 2
shellQuote: false
valueFrom: >-
${
var arg = " -o " + inputs.output_basename + ".bcf_filtered"
if (inputs.output_type == "v"){
arg += ".vcf"
} else if (inputs.output_type == "z"){
arg += ".vcf.gz && tabix " + inputs.output_basename + ".bcf_filtered.vcf.gz"
} else if (inputs.output_type == "b"){
arg += ".bcf.gz"
} else{
arg += ".bcf"
}
if (inputs.sample_name == null){
arg = inputs.input_vcf.path + arg;
}
return arg;
}

inputs:
input_vcf: File
include_expression: ['null', string]
exclude_expression: ['null', string]
output_basename: ['null', string]
include_expression: { type: 'string?', doc: "See bcftools docs for valid expression. Can't be used at the same time as exclude_expression. Use double quotes when a string needs to be quoted",
inputBinding: { position: 1, prefix: "--include", shellQuote: true} }
threads: { type: 'int?', default: 4, inputBinding: {position: 1, prefix: "--threads"} }
exclude_expression: { type: 'string?', doc: "See bcftools docs for valid expression. Can't be used at the same time as include_expression. Use double quotes when a string needs to be quoted",
inputBinding: { position: 1, prefix: "--exclude", shellQuote: true} }
filter_expression: { type: 'string?', doc: "Add values from FILTER field to subset on",
inputBinding: { position: 1, prefix: "-f"}}
output_type: { type: [ 'null', {type: enum, name: output_type, symbols: [ "u", "b", "v", "z"]}],
inputBinding: { position: 1, prefix: "-O"}, default: "z" }
sample_name: { type: 'string?', doc: "csv string of samples if user wishes to apply filtering to and output specific samples"}
output_basename: string
outputs:
filtered_vcf:
type: File
outputBinding:
glob: '*.vcf.gz'
secondaryFiles: [.tbi]
glob: "*.{v,b}cf{,.gz}"
secondaryFiles: ['.tbi?']
5 changes: 3 additions & 2 deletions tools/kf_mskcc_vcf2maf.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ arguments:
- position: 1
shellQuote: false
valueFrom: >-
$(inputs.input_vcf.path) > input_file.vcf
> input_file.vcf
&& perl vcf2maf.pl
--input-vcf input_file.vcf
--output-maf $(inputs.output_basename).$(inputs.tool_name).vep.maf

inputs:
reference: { type: 'File', secondaryFiles: [.fai], doc: "Fasta genome assembly with index",
inputBinding: {position: 2, prefix: "--ref-fasta"} }
input_vcf: { type: 'File', secondaryFiles: [.tbi], doc: "VEP annotated vcf file." }
input_vcf: { type: File, doc: "VEP annotated vcf file.",
inputBinding: { position: 0 } }
output_basename: string
tumor_id: { type: string, inputBinding: {position: 3, prefix: "--tumor-id"} }
normal_id: { type: string, inputBinding: {position: 4, prefix: "--normal-id"} }
Expand Down
2 changes: 1 addition & 1 deletion workflows/kfdrc-germline-snv-annot-workflow.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,6 @@ sbg:license: Apache License 2.0
sbg:publisher: KFDRC

"sbg:links":
- id: 'https://github.com/kids-first/kids-first/kf-annotation-tools/releases/tag/v1.1.0'
- id: 'https://github.com/kids-first/kids-first/kf-annotation-tools/releases/tag/v1.2.2'
label: github-release

2 changes: 1 addition & 1 deletion workflows/kfdrc-somatic-snv-annot-workflow.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -352,5 +352,5 @@ $namespaces:
"sbg:license": Apache License 2.0
"sbg:publisher": KFDRC
"sbg:links":
- id: 'https://github.com/kids-first/kf-annotation-tools/releases/tag/v1.2.1'
- id: 'https://github.com/kids-first/kf-annotation-tools/releases/tag/v1.2.2'
label: github-release
Loading