示例#1
0
def test_combine_hits_overlap():
  """If the overlap removal is working correctly, the combined length of the coordinates
  should be 3 * the total length of the query (6 bp less than combined length of subjects"""
  
  results = [{'qstart': 1, 'qend': 5, 'sstart': 1, 'send': 15, 'strand': 1},
             {'qstart': 4, 'qend': 8, 'sstart': 21, 'send': 35, 'strand': 1}]
  coords =  combine_hits(results)
  print coords
  assert coords[0][1]-coords[0][0]+1 + coords[1][1]-coords[1][0]+1 == (results[1]['qend'] - results[0]['qstart'] + 1) * 3
示例#2
0
def test_combine_hits():
  """this will ensure that all pairs of coordinates are in the correct order (lowest to
  highest for + strand hits; highest to lowest for - strand hits"""
  
  args = parse_args((os.path.join(test_dir, 'test.tblastn'), os.path.join(test_dir, 'test.fa')))
  results = top_query(args)
  for result in results:
    coords =  combine_hits(result)
    print coords
    if coords[0][0] < coords[0][1]:
      for x in range(len(coords)-1):
        assert coords[x][0] > coords[x+1][0]
    else:
      for x in range(len(coords)-1):
        assert coords[x][0] < coords[x+1][0]