mitoNGS / MToolBox

A bioinformatics pipeline to analyze mtDNA from NGS data
http://sourceforge.net/projects/mtoolbox/?source=navbar
GNU General Public License v3.0
90 stars 38 forks source link

assembleMTgenome.py breaks when sample_name doesn't have an underscore #18

Closed ghost closed 8 years ago

ghost commented 8 years ago

Hi,

I was wondering if you are aware that assembleMTgenome.py in the master branch breaks if sample_name doesn't have an underscore. I noticed that there has been a change in the code to accommodate a case when sample_name does contain an underscore, but the change now ironically breaks when sample_name doesn't have an underscore. Below is an error I get:

Path to mitochondrial reference genome: bio/mtoolbox/genome_fasta/chrM.
fa

Path to nuclear and mitochondrial reference genome: bio/mtoolbox/genome_fasta/hg19RCRS.fa

Samtools version is 1.3

assembleMTgenome for sample ['SAMPLE102']
Converting SAM to BAM...
Sorting and indexing BAM...
Creating pileup...
[mpileup] 1 samples in 1 input files
<mpileup> Set max per-file depth to 8000
Reading mtDNA sequence...
Reading pileup file...
Assembling...
Basic statistics:
Assembled bases: 84.94%
Mean coverage depth: 17.97
Number of Contigs: 33
Base composition [A,C,G,T]: 0.26,0.27,0.11,0.21

searching for indels in ['SAMPLE102'].. please wait...

Traceback (most recent call last):
  File "bio/mtoolbox/MToolBox/assembleMTgenome.py", line 441, in <modul
e>
    mut_events = mtvcf_main_analysis(mt_table, sam_file, sample_name, tail=tail)
  File "bio/mtoolbox/MToolBox/mtVariantCaller.py", line 911, in mtvcf_m
ain_analysis
    Indels[name2]=[]
TypeError: unhashable type: 'list'

I just added a line in assembleMTgenome.py as below to accommodate my case:

# Line 129
try:
    sample_name = os.getcwd().split('/')[-1].split('_')[1:]
    if len(sample_name)!=1:
        sample_name="_".join(sample_name)
    else:
        sample_name=sample_name[-1]
    print "assembleMTgenome for sample", sample_name

Best, Jessica

domenico-simone commented 8 years ago

@leejae8 @robertopreste can we close this issue?

robertopreste commented 8 years ago

Yes, this issue should be fixed now.