Skip to content

Commit

Permalink
Fixing tests to use 1/-1 strand numbering
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnovak committed Feb 26, 2015
1 parent 0d7bd47 commit 39cf674
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Bio/AlignIO/FastaIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def build_hsp():
alignment = MultipleSeqAlignment([], alphabet)

#TODO - Introduce an annotated alignment class?
#See also Bio/AlignIO/MafIO.py for same requirement.
#See also Bio/AlignIO/MafIO.py for same requirement.
#For now, store the annotation a new private property:
alignment._annotations = {}

Expand Down
2 changes: 1 addition & 1 deletion Bio/AlignIO/MafIO.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def search(self, starts, ends):

yield fetched

def get_spliced(self, starts, ends, strand = "+1"):
def get_spliced(self, starts, ends, strand = 1):
"""Returns a multiple alignment of the exact sequence range provided.
Accepts two lists of start and end positions on target_seqname, representing
Expand Down
2 changes: 2 additions & 0 deletions Tests/output/test_SeqIO
Original file line number Diff line number Diff line change
Expand Up @@ -1741,6 +1741,7 @@ Testing reading uniprot-xml format file SwissProt/H2CNN8.xml
Checking can write/read as 'sff' format
Failed: Missing SFF flow information
Checking can write/read as 'tab' format
Checking can write/read as 'maf' format
Checking can write/read as 'nexus' format
Checking can write/read as 'phylip-sequential' format
Testing reading swiss format file SwissProt/H2CNN8.txt
Expand Down Expand Up @@ -1768,6 +1769,7 @@ Testing reading swiss format file SwissProt/H2CNN8.txt
Checking can write/read as 'sff' format
Failed: Missing SFF flow information
Checking can write/read as 'tab' format
Checking can write/read as 'maf' format
Checking can write/read as 'nexus' format
Checking can write/read as 'phylip-sequential' format
Testing reading genbank format file GenBank/noref.gb
Expand Down
24 changes: 12 additions & 12 deletions Tests/test_MafIO_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_records_begin(self):
description="",
annotations={"start": 3009319,
"srcSize": 129993255,
"strand": "+1",
"strand": 1,
"size": 162})

recs[1] = SeqRecord(Seq("TCACAGATATTTACTATTAAATATGGTTTGTTATATGGTTACGG"
Expand All @@ -183,7 +183,7 @@ def test_records_begin(self):
description="",
annotations={"start": 11087,
"srcSize": 13221,
"strand": "+1",
"strand": 1,
"size": 164})

fetched_recs = self.idx._get_record(34)
Expand All @@ -200,7 +200,7 @@ def test_records_end(self):
description="",
annotations={"start": 3021494,
"srcSize": 129993255,
"strand": "+1",
"strand": 1,
"size": 42})

recs[1] = SeqRecord(Seq("TGTTGCATGTCCTTTATTCTTTGGCGTGATAGGCTCACCCAATCTT"),
Expand All @@ -209,7 +209,7 @@ def test_records_end(self):
description="",
annotations={"start": 16173516,
"srcSize": 174210431,
"strand": "-1",
"strand": -1,
"size": 46})

recs[2] = SeqRecord(Seq("TGTTGCATATCCTTTATTCTTTGGCGTGATAGGCTCACCCAATCTT"),
Expand All @@ -218,7 +218,7 @@ def test_records_end(self):
description="",
annotations={"start": 16393864,
"srcSize": 173908612,
"strand": "-1",
"strand": -1,
"size": 46})

recs[3] = SeqRecord(Seq("TGTTGCATGTCGTTTATTCTTTGGCGTGATAGGCTCACCCAATCTT"),
Expand All @@ -227,7 +227,7 @@ def test_records_end(self):
description="",
annotations={"start": 15875298,
"srcSize": 170899992,
"strand": "-1",
"strand": -1,
"size": 46})

recs[4] = SeqRecord(Seq("TGTTAAGTCTCACTTGCTGTTCAAAGTGATAGCTTCACTCCATCAT"),
Expand All @@ -236,7 +236,7 @@ def test_records_end(self):
description="",
annotations={"start": 78072287,
"srcSize": 125616256,
"strand": "-1",
"strand": -1,
"size": 46})

recs[5] = SeqRecord(Seq("TGTTTAAAATG----ATTGCTAGAACTTCTA--CTCACTGGA----"),
Expand All @@ -245,7 +245,7 @@ def test_records_end(self):
description="",
annotations={"start": 14757144,
"srcSize": 54797317,
"strand": "-1",
"strand": -1,
"size": 36})

fetched_recs = self.idx._get_record(99228)
Expand Down Expand Up @@ -347,7 +347,7 @@ def test_invalid_strand(self):
(0, 1000), (500, 1500), ".")

def test_no_alignment(self):
result = self.idx.get_spliced((0, 1000), (500, 1500), "+1")
result = self.idx.get_spliced((0, 1000), (500, 1500), 1)

self.assertEqual(len(result), 1)
self.assertEqual(len(result[0].seq), 1000)
Expand All @@ -367,7 +367,7 @@ def test_correct_retrieval_1(self):
(3134909, 3185897, 3192258, 3193677,
3203580, 3206222, 3208186, 3211493,
3212019, 3217518, 3219906, 3220446,
3227479), "+1")
3227479), 1)

cnksr3 = str(SeqIO.read("MAF/cnksr3.fa", "fasta").seq).upper()
mm9_seq = "".join([str(x.seq) for x in result if x.id.startswith("mm9")]).replace("-", "")
Expand All @@ -384,12 +384,12 @@ def setUp(self):
def test_inconsistent_strand(self):
self.assertRaises(ValueError,
self.idx.get_spliced,
(0, 3021421), (1000, 3022000), "+1")
(0, 3021421), (1000, 3022000), 1)

def test_bundle_without_target(self):
self.assertRaises(ValueError,
self.idx.get_spliced,
(3009319,), (3009900,), "+1")
(3009319,), (3009900,), 1)

if __name__ == "__main__":
runner = unittest.TextTestRunner(verbosity=2)
Expand Down

0 comments on commit 39cf674

Please sign in to comment.