Discussion:
[miso-users] cannot import name defaultdict error about MISO
Huajing Teng
2012-07-13 11:48:08 UTC
Permalink
Dear Dr,
I have installed MISO. When module_availability.py was used, all modules are available. However when i run test_miso.py, i got error:cannot import name defaultdict
[tenghuajing at master misopy]$ python2.6 test_miso.py
Testing conversion of SAM to BAM...
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/sam_to_bam.py --convert /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output
Converting SAM to BAM...
- Executing: samtools view -Sbh /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam > /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam
[samopen] SAM header is present: 35 sequences.
Sorting BAM file...
- Executing: samtools sort /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted
Indexing BAM...
- Executing: samtools index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam
Conversion took 0.02 minutes.
.Testing gene-level Psi...
Testing GFF indexing of: /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py --index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed
Traceback (most recent call last):
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py", line 11, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py --compute-genes-psi /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam --output-dir /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/gene-psi-output --read-len 35
Traceback (most recent call last):
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py", line 9, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
.
----------------------------------------------------------------------
Ran 2 tests in 3.596s

OK

I wonder whether you can give me some suggestion. Thank you very much.


--------------
Huajing Teng
Gabriel Otte
2012-07-16 17:59:03 UTC
Permalink
Hi. I have the same error when running my test. Please advise.

Best,

Gabe
Post by Huajing Teng
Dear Dr,
I have installed MISO. When module_availability.py was used, all modules are available. However when i run test_miso.py, i got error:cannot import name defaultdict
[tenghuajing at master misopy]$ python2.6 test_miso.py
Testing conversion of SAM to BAM...
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/sam_to_bam.py --convert /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output
Converting SAM to BAM...
- Executing: samtools view -Sbh /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam > /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam
[samopen] SAM header is present: 35 sequences.
Sorting BAM file...
- Executing: samtools sort /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted
Indexing BAM...
- Executing: samtools index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam
Conversion took 0.02 minutes.
.Testing gene-level Psi...
Testing GFF indexing of: /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py --index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py", line 11, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py --compute-genes-psi /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam --output-dir /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/gene-psi-output --read-len 35
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py", line 9, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
.
----------------------------------------------------------------------
Ran 2 tests in 3.596s
OK
I wonder whether you can give me some suggestion. Thank you very much.
--------------
Huajing Teng
_______________________________________________
miso-users mailing list
miso-users at mit.edu
http://mailman.mit.edu/mailman/listinfo/miso-users
Yarden Katz
2012-07-16 18:22:38 UTC
Permalink
Hi all,

I just checked with the latest GitHub version and cannot reproduce the error. I did:

$ git clone https://github.com/yarden/MISO.git
$ cd MISO/
$ make Pythonpackage
$ python setup.py install
$ cd misopy/
$ python test_miso.py

And it ran successfully.

Are you sure you're not using an old Python version that is pre-collections? The line:

from collections import defaultdict

Should work on any Python 2.6 or later, I believe. You should be able to type:

$ python
Post by Gabriel Otte
Post by Huajing Teng
from collections import defaultdict
with no error.

Best, --Yarden
Post by Gabriel Otte
Hi. I have the same error when running my test. Please advise.
Best,
Gabe
Post by Huajing Teng
Dear Dr,
I have installed MISO. When module_availability.py was used, all modules are available. However when i run test_miso.py, i got error:cannot import name defaultdict
[tenghuajing at master misopy]$ python2.6 test_miso.py
Testing conversion of SAM to BAM...
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/sam_to_bam.py --convert /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output
Converting SAM to BAM...
- Executing: samtools view -Sbh /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-data/sam-data/c2c12.Atp2b1.sam > /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam
[samopen] SAM header is present: 35 sequences.
Sorting BAM file...
- Executing: samtools sort /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.bam /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted
Indexing BAM...
- Executing: samtools index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam
Conversion took 0.02 minutes.
.Testing gene-level Psi...
Testing GFF indexing of: /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py --index /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1.mm9.gff /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/index_gff.py", line 11, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
Executing: python /home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py --compute-genes-psi /home/share1/huajingteng/soft/misopy-0.4.3/misopy/gff-events/mm9/genes/Atp2b1/indexed /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/sam-output/c2c12.Atp2b1.sorted.bam --output-dir /home/share1/huajingteng/soft/misopy-0.4.3/misopy/test-output/gene-psi-output --read-len 35
File "/home/share1/huajingteng/soft/misopy-0.4.3/misopy/run_events_analysis.py", line 9, in ?
from collections import defaultdict
ImportError: cannot import name defaultdict
.
----------------------------------------------------------------------
Ran 2 tests in 3.596s
OK
I wonder whether you can give me some suggestion. Thank you very much.
--------------
Huajing Teng
_______________________________________________
miso-users mailing list
miso-users at mit.edu
http://mailman.mit.edu/mailman/listinfo/miso-users
_______________________________________________
miso-users mailing list
miso-users at mit.edu
http://mailman.mit.edu/mailman/listinfo/miso-users
Loading...