def dostream(stream):
    reader = SamLocusStream(stream)
    while True:
        locus = reader.read_locus()
        if not locus: break
        print locus[0].chr + "\t" + str(locus[0].start - 1) + "\t" + str(
            locus[0].end)
示例#2
0
def dopart(stream):
    reader = SamLocusStream(stream)
    v = []
    while True:
      locus = reader.read_locus()
      if not locus: break
      v.append(locus[0].chr+"\t"+str(locus[0].start-1)+"\t"+str(locus[0].end))
    return v
def dopart(stream):
    reader = SamLocusStream(stream)
    v = []
    while True:
        locus = reader.read_locus()
        if not locus: break
        v.append(locus[0].chr + "\t" + str(locus[0].start - 1) + "\t" +
                 str(locus[0].end))
    return v
示例#4
0
def main():
  parser = argparse.ArgumentParser()
  parser.add_argument('--min_intron',type=int,default=68)
  parser.add_argument('--min_depth',type=int,default=1)
  parser.add_argument('-v','--verbose',action='store_true')
  parser.add_argument('input',help="BAM file or stream sam input with header with -")
  args = parser.parse_args()
  if args.input == '-':  inf = sys.stdin
  else:
    cmd = "samtools view -h "+args.input
    p = Popen(cmd.split(),stdout=PIPE,bufsize=1)
    inf = p.stdout
  s = SamLocusStream(inf)
  #s.junctions_only = False
  while True:
    locus = s.read_locus()
    if not locus: break
    #print locus[0].get_range_string()+"\t"+str(len(locus[1]))
    process_locus(locus[1],args)
  if args.input != '-': p.communicate()
示例#5
0
def dostream(stream):
    reader = SamLocusStream(stream)
    while True:
      locus = reader.read_locus()
      if not locus: break
      print locus[0].chr+"\t"+str(locus[0].start-1)+"\t"+str(locus[0].end)