awk syntax within GNU parallel
0
0
Entering edit mode
7 weeks ago

I have bedpe files where I want to remove interchromosome mappings for each bedpe file. I am doing this using GNU parallel.

Example code:

parallel -j 12  "awk \‘$1==$4\' {1} > {1.}_filt.bed" ::: $path/*resort.bed

Where column 1 is the chromosome read 1 maps to and column 4 is the chromosome read 2 maps to.

This code throws the following error:

/usr/bin/bash: /*resort_filt.bed: Permission denied

However, if I run awk ‘$1==$4' file.bed > file_filt.bed on a file per file basis, it works no problem.

I'm thinking this has to do the the awk syntax within GNU parallel, but can anyone point me in the right direction?

Thanks

EDIT (to add my comment below)

To avoid issues with the quoting, I have now edited the code to call on an awk function. As such:

awk_code() { awk '$1==$4' }

export -f awk_code

parallel -j 12 "awk_code {1} > {1.}_filt.bed" ::: $path/*resort.bed

This throws no error, but the resulting bed file is empty.

EDIT SOLVED! $path/resort.bed needed quotes - "$path/"resort.bed

bed GNU parallel files awk • 309 views
ADD COMMENT
0
Entering edit mode

Because $path is empty.

ADD REPLY
0
Entering edit mode

To avoid issues with the quoting, I have now edited the code to call on an awk function. As such:

awk_code() { awk '$1==$4' }

export -f awk_code

parallel -j 12 "awk_code {1} > {1.}_filt.bed" ::: $path/*resort.bed

This throws no error, but the resulting bed file is empty.

ADD REPLY

Login before adding your answer.

Traffic: 1753 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6