def pre_RNA_Nsplited_bam():
    step7 = FreebayesPipe()
    step7.getreadyfilelist()
    print 'your splited N cigar files list: %s' % step7.namelist
    print 'total %s files.' % len(step7.namelist)
    print 'the next step: index your files used to call snp'
    step7.runbaifile()
    print 'done~'
Example #2
0
samtools.By pointing -c, You can choose any tool you like. You should choose
the data you have, such as fastq? sam? bam?. You also should point the type
of your data,DNA? or RNA?
'''
optparser = OptionParser(usage = msg_usage, description = descr)
optparser.add_option('-C', '--caller', dest = 'snpcaller',
                     help = 'point the caller you want to use. FB, SB, or GATK?')
optparser.add_option('-T', '--type', dest = 'datatype',
                     help = 'your data is DNA or RNA ?')
optparser.add_option('-R', '--ref', dest = 'refpath',
                     help = 'where is your reference seq ?')
optparser.add_option('-O', '--output', dest = 'output',
                     help = 'point your outcome file name.')
options, args = optparser.parse_args()

DNA_step = FreebayesPipe('.')
DNA_step.getrmpfilelist()
print 'files used to call DNA SNP %s'%DNA_step.namelist

RNA_step = FreebayesPipe('.')
RNA_step.getreadyfilelist()
print 'files used to call RNA SNP: %s'%RNA_step.namelist

def get_seqs(ref):
    '''in order to run SNPcallers simultaneously'''
    f0 = open(ref)
    contiglist = []
    for i in f0:
        if i.startswith('>'):
            seq = i.strip().split()[0][1:]
            contiglist.append(seq)
def pre_DNA_sam():
    step2 = FreebayesPipe()
    step2.getsamfilelist()
    print step2.namelist
    step2.runsam2bamfile()

    step3 = FreebayesPipe()
    step3.getbamfilelist()
    print step3.namelist
    step3.runsortfile()

    step4 = FreebayesPipe()
    step4.getsortfilelist()
    print step4.namelist
    step4.runrmdupfile()

    step5 = FreebayesPipe()
    step5.getrmpfilelist()
    print step5.namelist
    step5.runbaifile()
    print 'done~'
def pre_DNA_fq(refseq):
    ref = FreebayesPipe()
    ref.pre_ref(refseq)
    step1 = FreebayesPipe()
    step1.getfqfilelist()
    print step1.namelist
    step1.pre_bwa(refseq)
    step1.runbwafile(refseq)

    step2 = FreebayesPipe()
    step2.getsamfilelist()
    print step2.namelist
    step2.runsam2bamfile()

    step3 = FreebayesPipe()
    step3.getbamfilelist()
    print step3.namelist
    step3.runsortfile()

    step4 = FreebayesPipe()
    step4.getsortfilelist()
    print step4.namelist
    step4.runrmdupfile()

    step5 = FreebayesPipe()
    step5.getrmpfilelist()
    print step5.namelist
    step5.runbaifile()
    print 'done~'
def pre_RNA_rg_bam(refseq):
    '''if your file is bam files which have been added rg info'''
    step5 = FreebayesPipe('.')
    step5.getrgfilelist()
    print 'your bam files with rg info list: %s' % step5.namelist
    print 'total %s files.' % len(step5.namelist)
    print 'next step: keep the order consistent between bam and ref.'
    step5.runorderfile(refseq)

    step6 = FreebayesPipe('.')
    step6.getorderfilelist()
    print 'your order bam files list: %s' % step6.namelist
    print 'total %s files.' % len(step6.namelist)
    step6.runbaifile()
    print 'next step: split N cigar'
    step6.runsplitNfile(refseq)

    step7 = FreebayesPipe()
    step7.getreadyfilelist()
    print 'your splited N cigar files list: %s' % step7.namelist
    print 'total %s files.' % len(step7.namelist)
    print 'the next step: index your files used to call snp'
    step7.runbaifile()
    print 'done~'
def pre_RNA_order_bam(refseq):
    step6 = FreebayesPipe('.')
    step6.getorderfilelist()
    print 'your order bam files list: %s' % step6.namelist
    print 'total %s files.' % len(step6.namelist)
    step6.runbaifile()
    print 'next step: split N cigar'
    step6.runsplitNfile(refseq)

    step7 = FreebayesPipe()
    step7.getreadyfilelist()
    print 'your splited N cigar files list: %s' % step7.namelist
    print 'total %s files.' % len(step7.namelist)
    print 'the next step: index your files used to call snp'
    step7.runbaifile()
    print 'done~'
def pre_RNA_sortedbam(refseq):
    step3 = FreebayesPipe('.')
    step3.getsortfilelist()
    print 'your sorted bam files list: %s' % step3.namelist
    print 'total %s files.' % len(step3.namelist)
    print 'next step: remove duplicate.'
    step3.runrmdupfile()

    step4 = FreebayesPipe('.')
    step4.getrmpfilelist()
    print 'your removed bam files list: %s' % step4.namelist
    print 'total %s files.' % len(step4.namelist)
    print 'next step: add the read group info on each sample'
    step4.runaddrgfile()

    step5 = FreebayesPipe('.')
    step5.getrgfilelist()
    print 'your bam files with rg info list: %s' % step5.namelist
    print 'total %s files.' % len(step5.namelist)
    print 'next step: keep the order consistent between bam and ref.'
    step5.runorderfile(refseq)

    step6 = FreebayesPipe('.')
    step6.getorderfilelist()
    print 'your order bam files list: %s' % step6.namelist
    print 'total %s files.' % len(step6.namelist)
    step6.runbaifile()
    print 'next step: split N cigar'
    step6.runsplitNfile(refseq)

    step7 = FreebayesPipe()
    step7.getreadyfilelist()
    print 'your splited N cigar files list: %s' % step7.namelist
    print 'total %s files.' % len(step7.namelist)
    print 'the next step: index your files used to call snp'
    step7.runbaifile()
    print 'done~'
def pre_RNA_fqgz(refseq, gtf):
    ref = FreebayesPipe('.')
    ref.pre_ref(refseq)
    step1 = FreebayesPipe('.')
    step1.getgzfilelist()
    print 'your fastq.gz file list: %s' % step1.namelist
    print 'total %s files.' % len(step1.namelist)
    print 'next step: align using tophat2.'
    step1.pre_tophat2(refseq)
    step1.runtophat2file(refseq, gtf)

    step2 = FreebayesPipe('.')
    step2.getbamfilelist()
    print 'your bam file list: %s' % step2.namelist
    print 'total %s files.' % len(step2.namelist)
    print 'next step: remove duplicate reads in  your bam files.'
    step2.runrmdupfile()

    step4 = FreebayesPipe('.')
    step4.getrmpfilelist()
    print 'your removed bam files list: %s' % step4.namelist
    print 'total %s files.' % len(step4.namelist)
    print 'next step: add the read group info on each sample'
    step4.runaddrgfile()

    step5 = FreebayesPipe('.')
    step5.getrgfilelist()
    print 'your bam files with rg info list: %s' % step5.namelist
    print 'total %s files.' % len(step5.namelist)
    print 'next step: keep the order consistent between bam and ref.'
    step5.runorderfile(refseq)

    step6 = FreebayesPipe('.')
    step6.getorderfilelist()
    print 'your order bam files list: %s' % step6.namelist
    print 'total %s files.' % len(step6.namelist)
    step6.runbaifile()
    print 'next step: split N cigar'
    step6.runsplitNfile(refseq)

    step7 = FreebayesPipe()
    step7.getreadyfilelist()
    print 'your splited N cigar files list: %s' % step7.namelist
    print 'total %s files.' % len(step7.namelist)
    print 'the next step: index your files used to call snp'
    step7.runbaifile()
    print 'done~'
def pre_DNA_rmpbam():
    step5 = FreebayesPipe()
    step5.getrmpfilelist()
    print step5.namelist
    step5.runbaifile()
    print 'done~'
def pre_DNA_sortedbam():
    step4 = FreebayesPipe()
    step4.getsortfilelist()
    print step4.namelist
    step4.runrmdupfile()

    step5 = FreebayesPipe()
    step5.getrmpfilelist()
    print step5.namelist
    step5.runbaifile()
    print 'done~'
                     help='point the caller you want to use. FB, SB, or GATK?')
optparser.add_option('-T',
                     '--type',
                     dest='datatype',
                     help='your data is DNA or RNA ?')
optparser.add_option('-R',
                     '--ref',
                     dest='refpath',
                     help='where is your reference seq ?')
optparser.add_option('-O',
                     '--output',
                     dest='output',
                     help='point your outcome file name.')
options, args = optparser.parse_args()

DNA_step = FreebayesPipe('.')
DNA_step.getrmpfilelist()
print 'files used to call DNA SNP %s' % DNA_step.namelist

RNA_step = FreebayesPipe('.')
RNA_step.getreadyfilelist()
print 'files used to call RNA SNP: %s' % RNA_step.namelist


def get_seqs(ref):
    '''in order to run SNPcallers simultaneously'''
    f0 = open(ref)
    contiglist = []
    for i in f0:
        if i.startswith('>'):
            seq = i.strip().split()[0][1:]