Skip to content

Commit

Permalink
modify file_formats/bam2gff.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Jun 24, 2015
1 parent 1b313be commit 4a9acea
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions file_formats/bam2gff.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
from collections import defaultdict
import pysam

parser = argparse.ArgumentParser(description="bam2gff")
parser = argparse.ArgumentParser(description="bam2gff",
epilog="https://github.com/shenwei356/bio_scripts")

parser.add_argument('bamfile', type=str, help='bam file')
parser.add_argument('-c', '--cache-size', type=int, default=1000, help='cache size [1000]')
parser.add_argument('-m', '--match-proportion', type=float, default=0.75,
help='minimum match proportion to define properly paired ends [0.75]')

parser.add_argument("-v", "--verbose", help='verbosely print information',
action="count", default=0)
Expand Down Expand Up @@ -48,7 +52,7 @@ def pairs2gff(pairs):
'end': read.reference_end,
'ref': samfile.getrname(read.reference_id),
'reverse': read.is_reverse}
if len(pairs) > 1000:
if len(pairs) > args.cache_size:
pairs2gff(pairs)

samfile.close()
Expand Down

0 comments on commit 4a9acea

Please sign in to comment.