Ruitulyu / KAS-Analyzer

New computational framework to process and analyze KAS-seq and spKAS-seq data.
MIT License
10 stars 4 forks source link

awk error #3

Closed kcleal closed 1 year ago

kcleal commented 1 year ago

Hi @Ruitulyu,

Im getting an awk error:

Extend the deduplicated reads in NO1_S10_kasseq_out.bed to 150.

awk: line 1: regular expression compile failed (missing operand)
+
'extend' done.

Pipeline was invoked with the command:

KAS-Analyzer KAS-seq -t 8 -a bowtie2 -i ${hg38} -s hg38 -o ${name}_kasseq_out -1 ${item}

The pipeline generated aligned reads e.g.

Bam_files
    - NO1_S10_kasseq_out_sorted.bam (2.1 Gb)
    - NO1_S10_kasseq_out_sorted.bam.bai
Bed_files
    - NO1_S10_kasseq_out.ext150.bed (EMPTY!)
BedGraph_files
    - NO1_S10_kasseq_out.ext150.bg (EMPTY!)

The trimming report contained:

=== Summary ===

Total reads processed:              54,649,139
Reads with adapters:                19,325,526 (35.4%)
Reads written (passing filters):    54,649,139 (100.0%)

Total basepairs processed: 4,152,978,777 bp
Quality-trimmed:               7,256,230 bp (0.2%)
Total written (filtered):  4,107,585,023 bp (98.9%)
kcleal commented 1 year ago

Hi @Ruitulyu, I would really appreciate some help with this if you have time. Thanks

Ruitulyu commented 1 year ago

Dear Kate,

I'm sorry to hear that you've encountered an error while implementing our KAS-Analyzer. Based on the error information you provided, it appears to be an issue with the awk syntax. Interestingly, I haven't experienced this issue on my end.

I suspect that you might be using the standard awk. As a first step, I recommend installing GNU awk with the following command:

sudo apt-get install gawk

After installing GNU awk, please test it using the command below along with a sample test.bed file:

bamToBed -i NO1_S10_kasseq_out_sorted.bam > NO1_S10_kasseq_out_sorted.bed

awk '$3-150>0 {if ($6~"+") printf("%s\t%d\t%d\t%s\t%d\t%s\n",$1,$2,$2+150,$4,$5,$6); else if ($6~"-") printf("%s\t%d\t%d\t%s\t%d\t%s\n",$1,$3-150,$3,$4,$5,$6)}' NO1_S10_kasseq_out_sorted.bed | head

This should help resolve the issue. If you still encounter any problems, please don't hesitate to reach out, and I'd be more than happy to assist you further.

Best, Ruitu