RemiAllio / MitoFinder

MitoFinder: efficient automated large-scale extraction of mitogenomic data from high throughput sequencing data
86 stars 14 forks source link

Failure during checking for circularization #26

Closed nikolasjohnston closed 2 years ago

nikolasjohnston commented 2 years ago

Hi I have been running the pipeline and all works well until I receive the following error:

MitoFinder found a single mitochondrial contig Checking resulting contig for circularization... Traceback (most recent call last): File "/home/nikolasjohnston/MitoFinder/mitofinder", line 961, in fourthStep = Popen(args1, stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb')).communicate()[0] File "/usr/lib/python2.7/subprocess.py", line 394, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

I'm not sure what the cause of this error is. Any suggestions?

Cheers, Nik

RemiAllio commented 2 years ago

Hi Nikolas,

That's complicated for me to found out what happened here without more information. Please, could you tell me what files were created by MitoFinder during the run? Did MitoFinder work for another sample or is this your first try? Could you please send me the log of the run (SeqID_MitoFinder.log) and the geneChecker_error.log and geneChecker.log files?

Cheers, Rémi

nikolasjohnston commented 2 years ago

Hi Rémi,

Thanks for your reply, its a bit of a unique situation. I have run analyses successfully using the MitoFinder container using the megahit assembler. However I find that the version of spades included in the container (v.3.13) causes issues for the instance of Linux I am using.

By manually installing, I was able to update to version 3.15 which does not have issues on my computer, however, now I am having the above error. I know its not my input files because they work in the singularity container with the megahit assembler.

Below is the mitofinder log as requested.

pectinata_MitoFinder.log

As for the files created from what I can see the assembly runs fine and I get final contigs, but there's something causing an error in the annotation step. There are no files present in the final results folder and the MiTFi folder has not been created nor has the tmp folder.

Any help you can provide is much appreciated!

Cheers, Nik

RemiAllio commented 2 years ago

Hi,

Indeed, there is something wrong with the circularization check step. Could you please send me the "geneChecker_error.log" and "geneChecker.log" files?

One of the explanation could be that MitoFinder does not find a file. Do version v3.15 and version v3.13 of spades create the same output (with the same name)? If not, MitoFinder looks for a file created by version v3.13 when this file is named differently with version v3.15. This could cause the problem. Do you see what I mean? In other words, at this step, MitoFinder is looking for this file: [SeqID]/[SeqID]_metaspades/scaffolds.fasta. Does this file exist?

Another possible explanation: You never found a single contig with MEGAHIT and therefore never tried the circularization check step. In this case, the python command line could be wrong (for your system?). Could you please try to manually add shell=True to line 961 of the mitofinder file: fourthStep = Popen(args1, stdout=subprocess.PIPE, stderr=open(os.devnull, 'wb'), shell=True).communicate()[0]

Hope one of this two explanations is right!

On the other hand, I am not sure to understand what you mean by "I find that the version of spades included in the container (v.3.13) causes issues for the instance of Linux I am using". Do you mean the singularity container? Indeed, the singularity container is independent and should not depend on the linux you're using.

Cheers, Rémi

nikolasjohnston commented 2 years ago

Hi Rémi,

In response to your possible explainations:

1) The scaffolds.fasta is produced no problems so I don't think the issues are being caused by mitofinder not recognising the out put from metaspades.

2) I tried including the changes to the code and it did progress the program a few more steps but I still hit errors here:

MitoFinder found a single mitochondrial contig Checking resulting contig for circularization...

Evidences of circularization could not be found, but everyother step was successful

Creating summary statistics for the mtDNA contig rudis_DNA: 1: /home/nikolasjohnston/MitoFinder/rename_fasta_seqID.py: not found

Annotating mitochondrial contig

Traceback (most recent call last): File "/home/nikolasjohnston/MitoFinder/mitofinder", line 1135, in if check_if_string_in_file(pathtowork + "/geneChecker.log","MiTFi failed.") or (os.stat(pathOfFinalResults+"MiTFi.log").st_size != 0 and not check_if_string_in_file(pathOfFinalResults+"MiTFi.log","hits")) : OSError: [Errno 2] No such file or directory: '/home/nikolasjohnston/rudis_DNA/rudis_DNA_MitoFinder_metaspades_mitfi_Final_Results/MiTFi.log'

3) What I mean by the version of spades included in the container causing issues, is that across many pieces of software I have found that using Spades v.3.13 causes an error (er code: 11) I have solved this issue in other software packages I regularly use by updating to v.3.15. So when I saw the same error code output from the singularity container instance of MitoFinder I suspected that the issue may again be with spades v.3.13. Is it possible to update the version of spades within the container? I have also added the error reponse I get from the singularity container version of MitoFinder to this thread (note: I don't get any errors at all when I run the singularity container version of MitoFinder with the MegaHit assembler metaspades.log ).

Thanks for all your help with this! Nik

RemiAllio commented 2 years ago

Hi Nikolas,

I don't understand what's going wrong... To try to fix this, I updated MitoFinder by including Spades v3.15 and adding a new -c argument that allows the user to specify another configuration file for MitoFinder.

Indeed, you can't update Spades inside the singularity container. Instead, you can now use the -c option to specify a configuration file with the path to your Spades v3.15. This is useless now because I have updated Spades too but if I hadn't done so, this option was created for that.

Anyway, I have to upload the new singularity container, but for now you can get it here: https://filesender.renater.fr/?s=download&token=65d765cc-e20a-447f-af60-2a2a9f707f55

Please, could you try to run MitoFinder with this new container and let me know if it works? singularity run MitoFinder_v1.4.1.sif --metaspades -j [seqid] -1 [left_reads.fastq.gz] -2 [right_reads.fastq.gz] -r [genbank_reference.gb] -o [genetic_code] -p [threads] -m [memory]

Cheers, Rémi

nikolasjohnston commented 2 years ago

Hi Remi,

Thanks for you help and for updating the MitoFinder singularity container. I downloaded the version you sent through and tested it, but unfortunately it still did not work.

However, by using the new -c function I was able to make a config file that pointed the software to my installation of spades v3.15 and I'm happy to say that worked with no issues and I got a full set of good quality results. This new function is an excellent addition!!

I'm not sure why the instance of 3.15 you have placed inside the container is still producing errors on my machine, but ive provided the compressed output folder of a failed run as an attachment for you to look through. new_container_test.zip

Cheers, Nik

RemiAllio commented 2 years ago

Hi!

Indeed, I still do not understand why Spades produces an error in your machine, even from inside the container!

Anyway, I am happy the new -c option finally made it work :-)

Thank you for your feedback! Cheers, Rémi