示例#1
0
  def test_blast_evalue_threshold(self):
    self.feature_db.build()

    query = 'G'*100+self.dna+'A'*40
    feature_list = blast(query, self.feature_db)
    self.assertEquals(len(feature_list), 1)
    feature_list = blast(query, self.feature_db, evalue_threshold=1E-50)
    self.assertEquals(len(feature_list), 0)
示例#2
0
  def test_blast_feature_threshold(self):
    self.feature_db.build()
    p = 0.8
    n = int(len(self.dna)*p)

    query = 'G'*100+self.dna[0:n]+'A'*40
    feature_list = blast(query, self.feature_db, feature_threshold=None)
    self.assertEquals(len(feature_list), 1)
    self.assertEquals(feature_list[0].query_start, 101)
    self.assertEquals(feature_list[0].query_end, 100+n)
    self.assertEquals(feature_list[0].subject_start, 1)
    self.assertEquals(feature_list[0].subject_end, n)

    feature_list = blast(query, self.feature_db, feature_threshold=p)
    self.assertEquals(len(feature_list), 0)
示例#3
0
  def test_get_feature_from_blast_result(self):
    self.feature_db.build()

    query = 'G'*100+self.dna+'A'*40
    feature_list = blast(query, self.feature_db)
    self.assertEquals(len(feature_list), 1)
    self.assertEquals(feature_list[0].feature_id, self.feature1.id)
示例#4
0
 def test_returns_one_result_from_across_circular_boundary(self):
   self.feature_db.build()
   q = 'G'*100+self.dna+'A'*40
   query = q[110:]+q[0:110]
   feature_list = blast(query, self.feature_db)
   # if we don't remove truncated features across circular boundary, we'd see
   # 2 results, one for truncated feature, one for full feature
   self.assertEquals(len(feature_list), 1)
示例#5
0
  def test_blast_identity_threshold(self):
    self.feature_db.build()

    q = self.dna
    # make two changes
    q = q[0:3]+'C'+q[4:6]+'C'+q[7:]
    self.assertEquals(len(q), len(self.dna))
    query = 'G'*100+q+'A'*40

    feature_list = blast(query, self.feature_db, identity_threshold=None)
    self.assertEquals(len(feature_list), 1)
    self.assertEquals(feature_list[0].query_start, 101)
    self.assertEquals(feature_list[0].query_end, 100+len(self.dna))
    self.assertEquals(feature_list[0].subject_start, 1)
    self.assertEquals(feature_list[0].subject_end, len(self.dna))

    feature_list = blast(query, self.feature_db, identity_threshold=0.99)
    self.assertEquals(len(feature_list), 0)
示例#6
0
  def test_returns_correct_coordinates_across_circular_boundary(self):
    self.feature_db.build()

    q = 'G'*100+self.dna+'A'*40
    query = q[110:]+q[0:110]

    feature_list = blast(query, self.feature_db)
    self.assertEquals(feature_list[0].query_start, len(q)-10+1)
    self.assertEquals(feature_list[0].query_end, len(self.dna)-10)
    self.assertEquals(feature_list[0].subject_start, 1)
    self.assertEquals(feature_list[0].subject_end, len(self.dna))
示例#7
0
  def test_blast(self):
    self.feature_db.build()

    query = 'G'*100+self.dna+'A'*40
    feature_list = blast(query, self.feature_db)

    self.assertEquals(len(feature_list), 1)
    self.assertEquals(feature_list[0].name, self.feature1.name)
    self.assertEquals(feature_list[0].query_start, 101)
    self.assertEquals(feature_list[0].query_end, 100+len(self.dna))
    self.assertEquals(feature_list[0].subject_start, 1)
    self.assertEquals(feature_list[0].subject_end, len(self.dna))