Entering edit mode
17 months ago
Kiran
▴
80
Hi I am writing my first code is dsl2 Nextflow using Singularity container as below main.nf
process pbc_varicall {
publishDir "/data/shared/clinical/LongRead/Data/resources/"
container 'docker://google/deepvariant:1.5.0'
input:
path bam
output:
file "*"
path 'out_m84011_220902_175841_Chr20.vcf.gz'
script:
"""
run_deepvariant --model_type PACBIO --ref ${params.ref_genome} --reads ${bam} --output_vcf ${params.data_input}out_m84011_220902_175841_Chr20.vcf.gz --num_shards 20 --regions chr20
"""
}
workflow {
bam=channel.fromPath("${params.data_input}/m84011_220902_175841_Aln.bam")
pbc_varicall(bam)
}
when i execute the above command with Absolute PATH for BAM file in Script section it works file, but if i pass as $bam from Input and Abs path from Workflow bam channel it gives following error
`ValueError: FAILED_PRECONDITION: Cannot query without an index
[E::idx_find_and_load] Could not retrieve index file for 'm84011_220902_175841_Aln.bam'
I have BAI FAI
index files for Ref and BAM, i had same issue while passing $Ref thats fixed by passing ${params.ref_genome}
instead of $ref
from input channel
I already have Index file for BAM, how to pass bai to Script command as it takes only BAM
Just make a second channel with the index and provide it to the process. Many ways of doing that, e.g. via a tuple to permanently have bam and bai in the same object/variable, but this here is the simplest:
Then it gets staged and is available to the process.
I tried with above but it doesnt work unless it is paired and passed to workflow as below then it works perfectly
Channel.fromFilePairs('/data/shared/clinical/LongRead/Data/*_{Aln2.bam,Aln2.bam.bai}') .map { it[1] } .set { ch_bam_bai }
from.path only takes BAM then script gives index error,, So it need to be paired if one wants to pass in Workflow,, if direct BAM path is given in
script:
it works, not throught workflow channel