error opening file after QIIME script: add_qiime_labels.py
2
0
Entering edit mode
6.6 years ago
aester • 0

So I am trying to add qiime labels. when I run the script

add_qiime_labels.py -i . -m mouse_ForwardMap.txt -c SampleID  -o combined_fasta


It says that it can't read one of my files. But when I open the file with the less command its perfectly fine. Is there any thing that i should double check?

I already validated the mapping file, no errors detected.

MacQIIME ford132-r05216:~ \$ validate_mapping_file.py -m /Users/aester/Desktop/qiime_generated/ae_ForwardMap.txt -o mapping_output
No errors or warnings were found in mapping file.


but when I run the script like I said it gives back:

Traceback (most recent call last):
File "/macqiime/bin/add_qiime_labels.py", line 4, in <module>
File "build/bdist.macosx-10.4-x86_64/egg/pkg_resources/__init__.py", line 698, in run_script
File "build/bdist.macosx-10.4-x86_64/egg/pkg_resources/__init__.py", line 1616, in run_script
File "/macqiime/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/EGG-INFO/scripts/add_qiime_labels.py", line 111, in <module>
main()
File "/macqiime/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/EGG-INFO/scripts/add_qiime_labels.py", line 107, in main
output_dir, count_start)
fasta_files = get_fasta_fps(fasta_dir, fasta_name_to_sample_id.keys())
File "/macqiime/lib/python2.7/site-packages/qiime-1.9.0-py2.7.egg/qiime/add_qiime_labels.py", line 123, in get_fasta_fps
raise IOError("Unable to open %s" % curr_fp)
IOError: Unable to open ./F2.all.fa

less F2.all.fa

>M01205:41:000000000-AF9F7:1:1101:14308:1960 1:N:0:6
TACGGAGGATCCGAGTGTTATCCGGATTTATTGGGTTTAAAGGGTGCGTAGGCGGAGGATCAAGTCAGTGGTGAAATGGTGCGGCTCAACCGTAGCATTGCCGTTGAAACTGGTTTTCTAGAGTGCGAATGAGGTGGGCGGAATGTGTCATGTAGCGGTGAAATGCATAGATATGACAAAGAACACCGATGGCGAAGGCAGCTGACTGGGACGAAACTGACGCTGAGGCACGAAAGTGCGGGGATCGAACA
>M01205:41:000000000-AF9F7:1:1101:15221:1970 1:N:0:6
TACGTAGGTGGCGAGCGTTATCCGGAATTATTGGGCGTAAAGAGTGAGCAGGCGGCATGGTAAGTTTGGAGTGAAAGCGTTGGGCTCAACCCCATACAGCTTCGAAAACTGCCAGGCTAGAGTACGGGAGAGGTAAACGGAACTCCATGTGTAGCGGTGAAATGCGTAGATATTAGGAGGAACACCAGTGGCGAAGGCGGCTTACTGGACTGTAACTGACGTTGAGGCACGAAAGCGTGGGGAGCAAACA


amplicon qiime • 3.4k views
0
Entering edit mode
6.6 years ago
Josh Herr 5.7k

It doesn't look like you have added any sample information to your fasta output sequences -- QIIME will merge all the fasta files and then edit the sequence headers to have sample, treatment, etc. data in the fasta header.  This is not happening here.

You should actually set your input fasta file (i.e. -i . is not acceptable for an input, you should use the respective file names and path for all of your input files)  -- the python script does not know which files to act upon given your input.

When you are running a script it is a good idea to know what type of input you need to provide and what the expected output should be.  You're not getting the expected output and the input fasta file is not being modified.

Just a personal note -- I don't actually use this python script in QIIME as it's easy to change fasta headers from the command line with other tools and I have found that sometimes errors arise from this first script.

0
Entering edit mode
2.7 years ago
Payal ▴ 110

Two things figured: 1. The file should be fasta files. So convert your fastq files to fastq file using qiime scipts - convert_fastqual_fastq.py That will create .fna files 2. Now while you are running the add_qiime_labels.py, the mapping file name should be exactly similar to whats in your folder. So make sure to change your .fna files to just the name of th efile given. Eg. if your fasta filename is sample1.fa/sample1.fasta/sample1.fna, just change them to sample1 in the folder and then the script will recognize the filename.

It may work other way round, where you change the name of the files in the mapping file, but i used the previous method and it worked for me