예제 #1
0
 def test_twoheaders(self):
     fmt = FastqFormat()
     with open_output(self.path, "w") as fw:
         fw.write(fmt.format(Sequence("name", "CCATA", "!#!#!", name2="name")))
         fw.write(fmt.format(Sequence("name2", "HELLO", "&&&!&", name2="name2")))
     with open(self.path) as t:
         assert t.read() == '@name\nCCATA\n+name\n!#!#!\n@name2\nHELLO\n+name2\n&&&!&\n'
예제 #2
0
	def test_twoheaders(self):
		fmt = FastqFormat()
		with open_output(self.path, "w") as fw:
			fw.write(fmt.format(Sequence("name", "CCATA", "!#!#!", name2="name")))
			fw.write(fmt.format(Sequence("name2", "HELLO", "&&&!&", name2="name2")))
		with open(self.path) as t:
			assert t.read() == '@name\nCCATA\n+name\n!#!#!\n@name2\nHELLO\n+name2\n&&&!&\n'
예제 #3
0
 def test(self):
     fmt = FastqFormat()
     with open_output(self.path, "w") as fw:
         fw.write(fmt.format_entry("name", "CCATA", "!#!#!"))
         fw.write(fmt.format_entry("name2", "HELLO", "&&&!&&"))
     with open(self.path) as t:
         assert t.read() == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n'
예제 #4
0
	def test(self):
		fmt = FastqFormat()
		with open_output(self.path, "w") as fw:
			fw.write(fmt.format_entry("name", "CCATA", "!#!#!"))
			fw.write(fmt.format_entry("name2", "HELLO", "&&&!&&"))
		with open(self.path) as t:
			assert t.read() == '@name\nCCATA\n+\n!#!#!\n@name2\nHELLO\n+\n&&&!&&\n'
예제 #5
0
 def test(self):
     reads = [
         (Sequence('A/1 comment', 'TTA', '##H'),
         Sequence('A/2 comment', 'GCT', 'HH#')),
         (Sequence('B/1', 'CC', 'HH'),
         Sequence('B/2', 'TG', '#H'))
     ]
     fmt = InterleavedFormatter(FastqFormat(), "foo")
     result = defaultdict(lambda: [])
     for read1, read2 in reads:
         fmt.format(result, read1, read2)
     assert fmt.written == 2
     assert fmt.read1_bp == 5
     assert fmt.read2_bp == 5
     assert "foo" in result
     assert "".join(result["foo"]) == '@A/1 comment\nTTA\n+\n##H\n@A/2 comment\nGCT\n+\nHH#\n@B/1\nCC\n+\nHH\n@B/2\nTG\n+\n#H\n'