faircloth-lab / phyluce

software for UCE (and general) phylogenomics
http://phyluce.readthedocs.org/
Other
78 stars 49 forks source link

Issue running Quality control step in Tutorial 1 #163

Closed BenjaminBlanchard closed 5 years ago

BenjaminBlanchard commented 5 years ago

Hello! I get the following error when I try to run the code listed in the "Quality control" step of Tutorial 1 in phyluce:

"UnboundLocalError: local variable 'lengths' referenced before assignment"

I have been unable to determine the cause of this error! Any idea what might be causing it? One things is, I am using macOS 10.14.3 - could this be the problem?

brantfaircloth commented 5 years ago

It's not clear at which step this is occurring...

BenjaminBlanchard commented 5 years ago

Apologies for my non-clarity! It is when I attempt to run:

for i in *; do phyluce_assembly_get_fastq_lengths --input $i/split-adapter-quality-trimmed/ --csv; done

It returns the error:

Traceback (most recent call last): File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 86, in main() File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 68, in main lengths = numpy.array(lengths) UnboundLocalError: local variable 'lengths' referenced before assignment Traceback (most recent call last): File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 86, in main() File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 68, in main lengths = numpy.array(lengths) UnboundLocalError: local variable 'lengths' referenced before assignment Traceback (most recent call last): File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 86, in main() File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 68, in main lengths = numpy.array(lengths) UnboundLocalError: local variable 'lengths' referenced before assignment Traceback (most recent call last): File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 86, in main() File "/anaconda2/envs/phyluce/bin/phyluce_assembly_get_fastq_lengths", line 68, in main lengths = numpy.array(lengths) UnboundLocalError: local variable 'lengths' referenced before assignment

BenjaminBlanchard commented 5 years ago

Just checking in - have I provided enough details? I'm fairly new to the submitting-issues-on-github game!

brantfaircloth commented 5 years ago

It looks like something is going wrong with the reading of the fastq files, although I am not sure what that could be. The error is due, in part, to some sloppy coding on my end. You could edit the code for phyluce_assembly_get_fastq_lengths to output the possible error in these lines.

You want that to look like:

if stderr == '':
        lengths = [int(l.strip()) for l in open(templen, 'rU')]
else:
       print stderr
BenjaminBlanchard commented 5 years ago

Just getting back to this now - thank you! Making this change allowed me to diagnose the problem which is... my Users directory has a space in it, which confuses the program. Sigh. It's high time I changed that! Thanks again.

luishdez35 commented 2 years ago

Hello, I have the same problem, I already replace te line code, but I have the same issue, I check the dir names and all is ok, I don't know what else to do, can you please help me with that.

Thanks.

brantfaircloth commented 2 years ago

You can effectively skip this step if you are running the tutorial. If you are running with actual data, without additional detail, I cannot help diagnose the issue too much (and even with more detail, it may be hard to diagnose). The issue could be file paths or there could be a problem with your fastq files. One way for you to help determine what is going wrong is to only run the code against a single set of files and see what happens (e.g. run it outside of the loop suggested in the tutorial). Be sure to try several sets of paired files in case one set, in particular, is causing the problem.

You could also try something like fastx_quality_stats (from http://hannonlab.cshl.edu/fastx_toolkit/commandline.html) and see if that solves the issue.

luishdez35 commented 2 years ago

Thanks for the quick reply, I try your suggestions, but again, I have the same problem, and yes, I try to get the stats with my own data, the other stats like AssemblyQC work fine, I don't know why this part of the tutorial don't work with my data.

Traceback (most recent call last): File "/opt/anaconda3/envs/phyluce-1.7.1/bin/phyluce_assembly_get_fastq_lengths", line 106, in <module> main() File "/opt/anaconda3/envs/phyluce-1.7.1/bin/phyluce_assembly_get_fastq_lengths", line 68, in main lengths = numpy.array(lengths) UnboundLocalError: local variable 'lengths' referenced before assignment

Thanks a lot for your suggestions.