Plink prefix and wdl

ilya_at_vividilya_at_vivid Member
edited April 25 in Ask the FireCloud Team

Hi,

I am trying to create a WDL that runs plink and takes as an input a prefix to the bed/bim/fam file

I am using Cromwell and docker to run it

for example:

plink -bfile prefix --recode --out prefix

Cromwell copies over the input files. How do I configure the wdl to use a prefix and grab the files associated with the prefix without explicitly defining the files. Also even if I can get the files copied over how do I pass a prefix to the files?

Thanks,

Ilya

Best Answer

  • edited April 29 Accepted Answer

    I was able to solve this issue by reading in the plink file and using sub to get the prefix. For example.

    --bfile = ${sub(bedFile,".bed","")}

    Post edited by ilya_at_vivid on

Answers

  • AdelaideRAdelaideR Member admin

    HI Ilya -

    Have you got a draft of your WDL I might look at for trouble shooting?

    Usually, a wildcard in a bash command will recognize all files that start with the same pattern, for example:

    myfile1.bam
    myfile2.bam
    myfile3.bam
    
    

    Can be copied by using a wild card

    cp myfile*.bam /some/directory/

    If each file needs to be acted on separately, the method I would use in a bash command is xargs

    ls myfile* | xargs -I {} -L 1 samtools sort {} > {}.sorted.bam

    This takes in each file that matches the wildcard one at a time and performs a bash command on each file separately. The {} indicates a filename, so you can use this filename as a variable in the command following the pipe, so this example xarg command would output:

    myfile1.bam.sorted.bam
    myfile2.bam.sorted.bam
    myfile3.bam.sorted.bam
    
    

    There are more elegant ways to do this, but I would need a little more information to figure out how your plink calls commands on each file.

  • ilya_at_vividilya_at_vivid Member
    edited April 29 Accepted Answer

    I was able to solve this issue by reading in the plink file and using sub to get the prefix. For example.

    --bfile = ${sub(bedFile,".bed","")}

    Post edited by ilya_at_vivid on
  • AdelaideRAdelaideR Member admin

    Great! Thank you for posting the more elegant answer.

  • ilya_at_vividilya_at_vivid Member

    Thanks! I do have a request to more easily get the path of the input file. A path function would be great.

Sign In or Register to comment.