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

Cram support #609

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
18 changes: 11 additions & 7 deletions definitions/pipelines/rnaseq.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@ requirements:
- class: ScatterFeatureRequirement
- class: InlineJavascriptRequirement
inputs:
cram_reference:
type: File?
doc: Reference file used for cram decompression
reference_index:
type: File #this requires an extra file with the basename
secondaryFiles: [".1.ht2", ".2.ht2", ".3.ht2", ".4.ht2", ".5.ht2", ".6.ht2", ".7.ht2", ".8.ht2"]
reference_annotation:
type: File
instrument_data_bams:
instrument_data:
type: File[]
read_group_id:
type: string[]
Expand Down Expand Up @@ -76,12 +79,13 @@ outputs:
type: File
outputSource: kallisto/fusion_evidence
steps:
bam_to_trimmed_fastq_and_hisat_alignments:
run: ../subworkflows/bam_to_trimmed_fastq_and_hisat_alignments.cwl
scatter: [bam, read_group_id, read_group_fields]
input_to_trimmed_fastq_and_hisat_alignments:
run: ../subworkflows/input_to_trimmed_fastq_and_hisat_alignments.cwl
scatter: [input, read_group_id, read_group_fields]
scatterMethod: dotproduct
in:
bam: instrument_data_bams
cram_reference: cram_reference
input: instrument_data
read_group_id: read_group_id
read_group_fields: read_group_fields
adapters: trimming_adapters
Expand All @@ -99,7 +103,7 @@ steps:
kallisto_index: kallisto_index
strand: strand
fastqs:
source: bam_to_trimmed_fastq_and_hisat_alignments/fastqs
source: input_to_trimmed_fastq_and_hisat_alignments/fastqs
valueFrom: |
${
for(var i=0;i<self.length;i++){self[i] = self[i].reverse()}
Expand All @@ -117,7 +121,7 @@ steps:
merge:
run: ../tools/merge_bams.cwl
in:
bams: bam_to_trimmed_fastq_and_hisat_alignments/aligned_bam
bams: input_to_trimmed_fastq_and_hisat_alignments/aligned_bam
out:
[merged_bam]
index_bam:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ requirements:
- class: SubworkflowFeatureRequirement
- class: InlineJavascriptRequirement
inputs:
bam:
cram_reference:
type: File?
input:
type: File
adapters:
type: File
Expand Down Expand Up @@ -39,10 +41,21 @@ outputs:
type: File
outputSource: hisat2_align/aligned_bam
steps:
input_to_bam:
run: ../tools/input_to_bam.cwl
in:
input: input
cram_reference: cram_reference
out: [bam_file]
revert_bam:
run: ../tools/revert_input.cwl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could revert_input.cwl be run on CRAMs directly? If so seems like input_to_bam could be removed. If not, seems like it should be named revert_bam.cwl instead of revert_input.cwl to denote its specificity.

(Is this operation time and space-efficient enough that we're willing to do it on all inputs instead of only those that need it?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is the specificity, the tool in revert_input.cwl can be run on anything but you would have to use the input variable, currently bam, to grab the appropriate out file , basically would require some javascript i expect which i try to avoid in cwl. I think renaming to revert_bam.cwl is preferable from my perspective.

The flexibility in the PR does come at a computational cost for sure. I think we should run revert_input.cwl either way though so the cost is just converting whatever input to bam

in:
bam: input_to_bam/bam_file
out: [reverted_bam]
bam_to_fastq:
run: ../tools/bam_to_fastq.cwl
in:
bam: bam
bam: revert_bam/reverted_bam
out:
[fastq1, fastq2]
trim_fastq:
Expand All @@ -61,10 +74,10 @@ steps:
run: ../tools/hisat2_align.cwl
in:
reference_index: reference_index
fastq1:
fastq1:
source: trim_fastq/fastqs
valueFrom: $(self[0])
fastq2:
fastq2:
source: trim_fastq/fastqs
valueFrom: $(self[1])
read_group_id: read_group_id
Expand Down
42 changes: 42 additions & 0 deletions definitions/tools/input_to_bam.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env cwl-runner

class: CommandLineTool

cwlVersion: v1.0

baseCommand: [ "samtools", "view" ]

requirements:
- class: DockerRequirement
dockerImageId: zlskidmore/samtools:1.9
dockerPull: zlskidmore/samtools:1.9
- class: ResourceRequirement
ramMin: 20000
coresMin: 8

arguments:
- valueFrom: "8"
position: 1
prefix: "--threads"
- valueFrom: "file.bam"
position: 2
prefix: "-o"
- valueFrom: "-b"
position: 3

inputs:
input:
type: File
inputBinding:
position: 5
cram_reference:
type: File?
inputBinding:
position: 4
prefix: "-T"

outputs:
bam_file:
type: File
outputBinding:
glob: file.bam
30 changes: 30 additions & 0 deletions definitions/tools/revert_input.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env cwl-runner

cwlVersion: v1.0
class: CommandLineTool
label: "Picard: Revert Input"
baseCommand: ["/usr/bin/java", "-Xmx4g", "-jar", "/opt/picard/picard.jar", "RevertSam", "VALIDATION_STRINGENCY=SILENT"]
requirements:
- class: ResourceRequirement
coresMin: 1
ramMin: 6000
tmpdirMin: 25000
- class: DockerRequirement
dockerPull: "mgibio/rnaseq"
arguments:
- valueFrom: "reverted.bam"
position: 2
prefix: "O="

inputs:
bam:
type: File
inputBinding:
prefix: "I="
separate: false
position: 1
outputs:
reverted_bam:
type: File
outputBinding:
glob: "reverted.bam"
2 changes: 1 addition & 1 deletion example_data/rnaseq/workflow.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
instrument_data_bams:
instrument_data:
- class: File
path: gerald_H3MYFBBXX_4_GCCAAT_1k.bam
- class: File
Expand Down