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

Division by zero error? #2

Open
leannmlindsey opened this issue Jun 14, 2022 · 6 comments
Open

Division by zero error? #2

leannmlindsey opened this issue Jun 14, 2022 · 6 comments

Comments

@leannmlindsey
Copy link

leannmlindsey commented Jun 14, 2022

I tried running your Prophage_Tracer for the first time today and I got this error
awk: cmd. line:1: fatal: division by zero attempted

I followed your directions to index with bwa, then map with bwa then use samtools and everything worked up to this point in the script:

${prophage_dir}/prophage_tracer.sh -m ${output_dir}/test_strain.rmdup.sam -r ${ref_genome} -p test_strain

Do you have any test data that I can try to see if it is a problem with the input data?

Thank you
LeAnn

@WangLab-SCSIO
Copy link
Owner

Hi LeAnn,

Thank you for using Prophage_Tracer. I think this error may be caused the command on line 81 in the prophage_tracer.sh script.

insert_size=head -n 10000 $sam_file | awk '($2 ~ /163|83|99|147/ )' | cut -f9 | awk '{print sqrt($0^2)}' | awk '$0<10000'| awk '{ sum += $0;i++ } END { print int(sum/i) }'``

The purpose of this command is to estimate the insert_size of the DNA inserted fragment size of your constructed sequencing library. It is usually ~500 bp for paired-end libraries when resequencing bacterial genomes.

Therefore, there may be a few situations caused this error.

  1. Your sequencing library is a single-end library.
  2. Incorrect mapping reads to your reference genome. If in this case, it may caused by using a wrong reference genome.
  3. If you ensure your sequencing library is a paired-end library and the mapping is correct. You can manually change this command to insert_size=500.
  4. You can also show me the first few lines of your SAM file. You can run the command head test_strain.rmdup.sam in your terminal and show me the output.

Kaihao Tang

@leannmlindsey
Copy link
Author

Thank you for your quick response. I was using a single-end library, so I will try again will a paired end library and let you know if I have any further trouble. Thank you.

@WangLab-SCSIO
Copy link
Owner

I will update my script to be suitable for analysis of a single-end library. This is on my schedule. But if your analysis is very urgent, you can re-run using your single-end library data with reserving temporary files. In order to reserve temporary files, you should firstly delete the command on line 810 rm contiglength.file $prefix.sr.temp.1 $prefix.reads.fasta makeblastdb.log blastn.log $prefix.sr.temp.2 $prefix.sr.temp.3 $prefix.sr.temp.out $prefix.drp.temp.1 $prefix.sr-drp.temp.out $prefix.drp.temp.2 $prefix.drp.temp.left $prefix.drp.temp.out $prefix.temp.out $prefix.nuclDB.*. The temporary files ends with "sr.temp.2" "sr.temp.3" "sr.temp.out" may contain candidate prophage information. These files contain only coordinate information. If you can not read through these files, you can send these three files to me and I can manually check these file and give you information of candidate prophages/

@seharmaaz
Copy link

I tried running your Prophage_Tracer for the first time today and I got this error
awk: cmd. line:1: fatal: division by zero attempted.
Please help me how i can fix this issue?

@WangLab-SCSIO
Copy link
Owner

I tried running your Prophage_Tracer for the first time today and I got this error awk: cmd. line:1: fatal: division by zero attempted. Please help me how i can fix this issue?

Hi, seharmaaz
As I responsed above, I think this error may be caused the command on line 81 in the prophage_tracer.sh script. You can modify de script as suggested or provided more information about how you generated your SAM file.

@saif-asghar
Copy link

saif-asghar commented Jan 6, 2024

Hello WangLab-SCSIO,
Could you possibly provide test directory in the repository which contains sample files ( ex. sample.fasta, 1.fastq.gz, 2.fastq.gz etc. ) for execution to better understand the journey to the output by implementing a test run.

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

4 participants