This is a test version of Biostars. For the public version, visit https://www.biostars.org.
MToolBox mapExome.py error

I am using MToolBox to analysis mtDNA NGS data. When it runs mapExome.py for alignment, always showing error:

EXECUTING READ MAPPING WITH MAPEXOME...

mapExome for sample F-00-02-44707, files found: F-00-02-44707.fastq F-00-02-44707.R1.fastq F-00-02-44707.R2.fastq
F-00-02-44707.fastq is an empty unpaired fastq. File has been removed.
Traceback (most recent call last):
File "/home/MToolBox-master/MToolBox/mapExome.py", line 66, in 
if not os.path.exists(folder): os.mkdir(folder)
OSError: [Errno 71] Protocol error: 'OUT_F-00-02-44707'

Compression of fastq files from bam/sam input files...
mkdir: cannot create directory ‘processed_fastq’: Protocol error
Done.

SAM files post-processing...

SORTING OUT.sam FILES WITH PICARDTOOLS...

[Fri Jun 02 13:05:54 CDT 2017] net.sf.picard.sam.SortSam INPUT=OUT.sam OUTPUT=OUT.sam.bam SORT_ORDER=coordinate TMP_DIR=[/Sequence/test_MTB/OUT_F-00-02-44707/tmp] VERBOSITY=INFO QUIET=false VALIDATION_STRINGENCY=STRICT COMPRESSION_LEVEL=5 MAX_RECORDS_IN_RAM=500000 CREATE_INDEX=false CREATE_MD5_FILE=false
[Fri Jun 02 13:05:54 CDT 2017] Executing as jing@jing-VirtualBox on Linux 4.8.0-53-generic amd64; OpenJDK 64-Bit Server VM 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11; Picard version: 1.98(1547)
[Fri Jun 02 13:05:54 CDT 2017] net.sf.picard.sam.SortSam done. Elapsed time: 0.00 minutes.
Runtime.totalMemory()=62390272
To get help, see http://picard.sourceforge.net/index.shtml#GettingHelp
Exception in thread "main" net.sf.picard.PicardException: Cannot read non-existent file: /Sequence/test_MTB/OUT_F-00-02-44707/OUT.sam
at net.sf.picard.io.IoUtil.assertFileIsReadable(IoUtil.java:59)
at net.sf.picard.sam.SortSam.doWork(SortSam.java:61)
at net.sf.picard.cmdline.CommandLineProgram.instanceMain(CommandLineProgram.java:177)
at net.sf.picard.cmdline.CommandLineProgram.instanceMainWithExit(CommandLineProgram.java:119)
at net.sf.picard.sam.SortSam.main(SortSam.java:57)
Success.

[E::hts_open_format] fail to open file 'OUT.sam.bam'
samtools index: failed to open "OUT.sam.bam": No such file or directory

Anyone knows how to fix it? Appreciate ahead.

sequencing alignment
  • It appears that you are trying to use three files out of which one is empty/absent: F-00-02-44707.fastq.
  • Program seems to be unable to create a required direcotry: mkdir: cannot create directory ‘processed_fastq’: Protocol error
  • Another file does not appear to exist (perhaps because of errors above): Exception in thread "main" net.sf.picard.PicardException: Cannot read non-existent file: /Sequence/test_MTB/OUT_F-00-02-44707/OUT.sam
  • Then we get to: [E::hts_open_format] fail to open file 'OUT.sam.bam'

Start tackling errors in that order and try to eliminate them.

I tried to disable "if not os.path.exists(folder): os.mkdir(folder)" in mapExome.py, line 66. Then the script can go through, but no reads assembled.My guess is the issue is in mapExome.py. But I don't know how to fix it.

#!/usr/bin/python

"""
    Written by Ernesto Picardi - e.picardi@biologia.uniba.it
    """

import getopt, sys, os

def usage():
    print """Map FASTQ onto mtDNA
        Options:
        -a      Input Fastq
        -b      Input Fastq for pair-end (optional)
        -c      Input Fastq for single-end
        -g      GSNAP executable [/usr/local/bin/gsnap]
        -D      GSNAP database location [/usr/local/share]
        -M      GSNAP database for mtDNA [chrRSRS]
        -H      GSNAP database for complete human genome [hg19RSRS]
        -t      GSNAP threads [8]
        -o      Out folder
        """

try:
    opts, args = getopt.getopt(sys.argv[1:], "ha:b:c:g:D:M:H:t:o:")
except getopt.GetoptError, err:
    print str(err)
    usage()
    sys.exit()

if len(opts)==0:
    usage()
    sys.exit()
fastq1=None
fastq2=None
fastq3=None
gsnapexe='/usr/local/bin/gsnap'
gsnapdb='/usr/local/share/gmapdb'
mtdb='chrRSRS'
humandb='hg19RSRS'
mqual=30
thread=8
folder=os.path.join(os.getcwd(),'OUTfolder2')

for o,a in opts:
    if o == "-h":
        usage()
        sys.exit()
    elif o == "-a": fastq1 = a
    elif o == "-b": fastq2 = a
    elif o == "-c": fastq3 = a
    elif o == "-g": gsnapexe = a
    elif o == "-D": gsnapdb = a
    elif o == "-M": mtdb = a
    elif o == "-H": humandb = a
    #elif o == "-q": mqual = int(a)
    elif o == "-t": thread = int(a)
    elif o == "-o": folder = a
    else:
        assert False, "unhandled option"
def rev(seq):
    d={'A':'T','T':'A','C':'G','G':'C','N':'N'}
    s=''.join([d[x] for x in seq])
    return s[::-1]


if not os.path.exists(folder): os.mkdir(folder)

0 answers

No answers yet.

Log in to answer this question.