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

Add the denominator detection in awk #99

Open
Wang-Taiwei opened this issue Dec 13, 2024 · 0 comments
Open

Add the denominator detection in awk #99

Wang-Taiwei opened this issue Dec 13, 2024 · 0 comments

Comments

@Wang-Taiwei
Copy link

Wang-Taiwei commented Dec 13, 2024

Hello,

When I ran the pipeline I met an error aborting the program and here is the log:

awk 'BEGIN{FS=OFS=" "} FNR>0 && FNR==NR{a[$4]=$4 OFS $0; next} FNR>0{print $0,a[$4]?a[$4]:" "}' /Path/to/TSS_shared_density.bed /Path/to/gene_body_shared_density.bed | awk -v OFS=' ' '{ if ($6 == "+"){print $9, $10, $3, $4,sqrt((($15+$7)/sqrt(($3-$10)^2))^2),($15/sqrt(($11-$10)^2))/($7/sqrt(($3-$2)^2)), $6} else {print $9, $10, $3, $12,sqrt((($15+$7)/sqrt(($10-$2)^2))^2),($15/sqrt(($11-$10)^2))/($7/sqrt(($3-$2)^2)), $6}}' | env LC_COLLATE=C sort -k1,1 -k2,2n > /Path/to/tmpfile (1056631,1056632,1056633)

awk: cmd. line:1: (FILENAME=- FNR=12754) fatal: division by zero attempted

And I am not sure if this is normal for zero to appear in the denominator, and I check there is only one gene which did that.

In order to enable the next procedure to proceed,I add a denominator detection in the peppro.py line 3267, and don't know if it is appropriate but may be useful for others with the same promblems. Thank you for the nice tool!

cmd5 = ("awk 'BEGIN{FS=OFS=\"\t\"} FNR>0 && " + "FNR==NR{a[$4]=$4 OFS $0; next} " + "FNR>0{print $0,a[$4]?a[$4]:\"\t\"}' " + shared_TSS_density + " " + shared_body_density + " | awk -v OFS='\t' '{ if ($6 == \"+\")" + "{print $9, $10, $3, $4," + "$3!=$10?sqrt((($15+$7)/sqrt(($3-$10)^2))^2):\"NaN\"," + "($11!=$10 && $3!=$2)?($15/sqrt(($11-$10)^2))/($7/sqrt(($3-$2)^2)):\"NaN\", $6} " + "else {print $9, $10, $3, $12," + "$10!=$2?sqrt((($15+$7)/sqrt(($10-$2)^2))^2):\"NaN\"," + "($11!=$10 && $3!=$2)?($15/sqrt(($11-$10)^2))/($7/sqrt(($3-$2)^2)):\"NaN\", $6}}' " + "| env LC_COLLATE=C sort -k1,1 -k2,2n > " + temp.name)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant