)
 parser.add_argument('--bed', type=str, required=True,
     help='Path to Flux bed'
 )
 parser.add_argument('--fastq', type=str, required=True,
     help='Path to Flux FASTQ'
 )
 parser.add_argument('--ignore-b-tails', action='store_const', const=True,
     default=False,
     help='Don\'t count reads for which the last 10 bases have Q <= 15'
 )
 parser.add_argument('-x', '--bowtie-idx', required=True,
     help='Path to Bowtie 1 index. Specify its basename.'
 )
 args = parser.parse_args()
 reference_index = BowtieIndexReference(args.bowtie_idx)
 truths = [0 for i in xrange(args.length)]
 recalls = [0 for i in xrange(args.length)]
 k = 0
 b_tail_count, read_count = 0, 0
 with open(args.bed) as bed_stream:
     with open(args.fastq) as fastq_stream:
         while True:
             bed_line = bed_stream.readline().strip()
             if not bed_line: break
             read_name = fastq_stream.readline().strip()[1:]
             seq = fastq_stream.readline().strip().upper()
             fastq_stream.readline()
             qual = fastq_stream.readline().strip()
             read_count += 1
             if args.ignore_b_tails and all(
示例#2
0
    import argparse
    # Print file's docstring if -h is invoked
    parser = argparse.ArgumentParser(description=__doc__, 
                formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--bowtie2-idx', type=str, required=False,
            default=None,
            help=('Path to Bowtie 2 genome index used to determine '
                  'whether junctions are canonical. Canonical/'
                  'noncanonical status and intron length '
                  'distribution are output only if this '
                  'is specified.')
        )
    args = parser.parse_args()
    if args.bowtie2_idx is not None:
        from count_introns import BowtieIndexReference
        reference_index = BowtieIndexReference(args.bowtie2_idx)
        intron_lengths = defaultdict(int)
        motif_counts = defaultdict(int)
    exons = defaultdict(set)
    for line in sys.stdin:
        if line[0] == '#': continue
        tokens = line.strip().split('\t')
        if tokens[2].lower() != 'exon': continue
        '''key: transcript_id
           value: (rname, exon start (1-based), exon end (1-based))

        transcript_id in token 12 is decked with " on the left and "; on the
        right; kill them in key below.
        '''
        attribute = tokens[-1].split(';')
        id_index = [i for i, name in enumerate(attribute)
示例#3
0
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument(
        '--bowtie2-idx',
        type=str,
        required=False,
        default=None,
        help=('Path to Bowtie 2 genome index used to determine '
              'whether junctions are canonical. Canonical/'
              'noncanonical status and intron length '
              'distribution are output only if this '
              'is specified.'))
    args = parser.parse_args()
    if args.bowtie2_idx is not None:
        from count_introns import BowtieIndexReference
        reference_index = BowtieIndexReference(args.bowtie2_idx)
        intron_lengths = defaultdict(int)
        motif_counts = defaultdict(int)
    exons = defaultdict(set)
    for line in sys.stdin:
        if line[0] == '#': continue
        tokens = line.strip().split('\t')
        if tokens[2].lower() != 'exon': continue
        '''key: transcript_id
           value: (rname, exon start (1-based), exon end (1-based))

        transcript_id in token 12 is decked with " on the left and "; on the
        right; kill them in key below.
        '''
        attribute = tokens[-1].split(';')
        id_index = [
示例#4
0
 parser.add_argument('--fastq',
                     type=str,
                     required=True,
                     help='Path to Flux FASTQ')
 parser.add_argument(
     '--ignore-b-tails',
     action='store_const',
     const=True,
     default=False,
     help='Don\'t count reads for which the last 10 bases have Q <= 15')
 parser.add_argument('-x',
                     '--bowtie-idx',
                     required=True,
                     help='Path to Bowtie 1 index. Specify its basename.')
 args = parser.parse_args()
 reference_index = BowtieIndexReference(args.bowtie_idx)
 truths = [0 for i in xrange(args.length)]
 recalls = [0 for i in xrange(args.length)]
 k = 0
 b_tail_count, read_count = 0, 0
 with open(args.bed) as bed_stream:
     with open(args.fastq) as fastq_stream:
         while True:
             bed_line = bed_stream.readline().strip()
             if not bed_line: break
             read_name = fastq_stream.readline().strip()[1:]
             seq = fastq_stream.readline().strip().upper()
             fastq_stream.readline()
             qual = fastq_stream.readline().strip()
             read_count += 1
             if args.ignore_b_tails and all(