Exemple #1
0
def assemble(options):
    # check output directory
    out_dir = check_dir(options['<circ_dir>'])
    # check tophat results
    if options['--tophat-dir']:
        tophat_dir = check_dir(options['--tophat-dir'])
    else:
        tophat_dir = check_dir(out_dir + '/tophat')
    # check cufflinks
    if which('cufflinks') is None:
        sys.exit('Cufflinks is required for CIRCexplorer2 assemble!')
    # check genePredToGtf
    if which('genePredToGtf') is None:
        sys.exit('genePredToGtf is required for CIRCexplorer2 assemble!')
    # check gtfToGenePred
    if which('gtfToGenePred') is None:
        sys.exit('gtfToGenePred is required for CIRCexplorer2 assemble!')
    # prepare cufflinks directory
    cufflinks_dir = out_dir + '/cufflinks'
    create_dir(cufflinks_dir)
    # filter ref file
    ref_filter(options['--ref'], tophat_dir, out_dir)
    # assemble with cufflinks
    cufflinks_assemble(out_dir, tophat_dir, cufflinks_dir, options['--thread'],
                       options['--remove-rRNA'], options['--max-bundle-frags'])
    # convert assembly results
    convert_assembly_gtf(out_dir, cufflinks_dir, options['--ref'],
                         options['--bb'], options['--chrom-size'])
Exemple #2
0
def denovo(options):
    # check output directory
    out_dir = check_dir(options['<circ_dir>'])
    # check tophat results
    if options['--tophat-dir']:
        tophat_dir = check_dir(options['--tophat-dir'])
    else:
        tophat_dir = check_dir(out_dir + '/tophat')
    # prepare denovo directory
    denovo_dir = '%s/denovo' % out_dir
    create_dir(denovo_dir)
    # combine ref files
    cufflinks_ref_path = '%s/cufflinks/transcripts_ref.txt' % out_dir
    if os.path.isfile(cufflinks_ref_path):
        print('Combine %s with %s to create a new ref file!' %
              (options['--ref'], cufflinks_ref_path))
        ref_path = '%s/combined_ref.txt' % denovo_dir
        new_ref_f = open(ref_path, 'w')
        with open(cufflinks_ref_path, 'r') as cuff_ref:
            for line in cuff_ref:
                if line.startswith('CUFF'):  # only import novel isoforms
                    new_ref_f.write(line)
        new_ref_f.write(open(options['--ref'], 'r').read())
        new_ref_f.close()
    else:
        print('Warning: no cufflinks directory under %s!' % out_dir)
        print('Please run CIRCexplorer2 assembly before this step!')
        ref_path = options['--ref']
    # annotate fusion junctions
    annotate_fusion(ref_path, denovo_dir, denovo_flag=1)
    # fix fusion juncrions
    fix_fusion(ref_path,
               options['--genome'],
               denovo_dir,
               options['--no-fix'],
               denovo_flag=1)
    # extract novel circRNAs
    extract_novel_circ(denovo_dir, options['--ref'])
    if options['--as']:
        if options['--pAplus'] and os.path.isdir(options['--pAplus']):
            pAplus_dir = os.path.abspath(options['--pAplus'])
        else:
            sys.exit('You should offer --pAplus option in --as mode!')
        if not options['--as-type'] or options['--as-type'] == 'CE':
            # extract cassette exons
            extract_cassette_exon(denovo_dir, tophat_dir, pAplus_dir,
                                  options['--rpkm'])
        if not options['--as-type'] or options['--as-type'] == 'RI':
            # extract retained introns
            extract_retained_intron(denovo_dir, tophat_dir, pAplus_dir)
        if not options['--as-type'] or options['--as-type'] == 'ASS':
            # characterize A5SS and A3SS
            parse_splice_site(denovo_dir, tophat_dir, pAplus_dir)
Exemple #3
0
def denovo(options):
    # check output directory
    out_dir = check_dir(options['<circ_dir>'])
    # check tophat results
    if options['--tophat-dir']:
        tophat_dir = check_dir(options['--tophat-dir'])
    else:
        tophat_dir = check_dir(out_dir + '/tophat')
    # prepare denovo directory
    denovo_dir = '%s/denovo' % out_dir
    create_dir(denovo_dir)
    # combine ref files
    cufflinks_ref_path = '%s/cufflinks/transcripts_ref.txt' % out_dir
    if os.path.isfile(cufflinks_ref_path):
        print('Combine %s with %s to create a new ref file!' %
              (options['--ref'], cufflinks_ref_path))
        ref_path = '%s/combined_ref.txt' % denovo_dir
        new_ref_f = open(ref_path, 'w')
        with open(cufflinks_ref_path, 'r') as cuff_ref:
            for line in cuff_ref:
                if line.startswith('CUFF'):  # only import novel isoforms
                    new_ref_f.write(line)
        new_ref_f.write(open(options['--ref'], 'r').read())
        new_ref_f.close()
    else:
        print('Warning: no cufflinks directory under %s!' % out_dir)
        print('Please run CIRCexplorer2 assembly before this step!')
        ref_path = options['--ref']
    # annotate fusion junctions
    annotate_fusion(ref_path, denovo_dir, 1)
    # fix fusion juncrions
    fix_fusion(ref_path, options['--genome'], denovo_dir,
               options['--no-fix'], 1)
    # extract novel circRNAs
    extract_novel_circ(denovo_dir, options['--ref'])
    if options['--as']:
        if options['--pAplus'] and os.path.isdir(options['--pAplus']):
            pAplus_dir = os.path.abspath(options['--pAplus'])
        else:
            sys.exit('You should offer --pAplus option in --as mode!')
        if not options['--as-type'] or options['--as-type'] == 'CE':
            # extract cassette exons
            extract_cassette_exon(denovo_dir, tophat_dir, pAplus_dir,
                                  options['--rpkm'])
        if not options['--as-type'] or options['--as-type'] == 'RI':
            # extract retained introns
            extract_retained_intron(denovo_dir, tophat_dir, pAplus_dir)
        if not options['--as-type'] or options['--as-type'] == 'ASS':
            # characterize A5SS and A3SS
            parse_splice_site(denovo_dir, tophat_dir, pAplus_dir)
def annotate(options):
    # check output directory
    out_dir = check_dir(options['<circ_dir>'])
    # prepare annotate directory
    annotate_dir = '%s/annotate' % out_dir
    create_dir(annotate_dir)
    # annotate fusion junctions
    annotate_fusion(options['--ref'], annotate_dir)
    # fix fusion juncrions
    fix_fusion(options['--ref'], options['--genome'], annotate_dir,
               options['--no-fix'])
Exemple #5
0
def annotate(options):
    # check output directory
    out_dir = check_dir(options['<circ_dir>'])
    # prepare annotate directory
    annotate_dir = '%s/annotate' % out_dir
    create_dir(annotate_dir)
    # annotate fusion junctions
    annotate_fusion(options['--ref'], annotate_dir)
    # fix fusion juncrions
    fix_fusion(options['--ref'], options['--genome'], annotate_dir,
               options['--no-fix'])