示例#1
0
class AstretchScan_Test(unittest.TestCase):
    def setUp(self):
        self.esc = AstretchScan('data/hgex')
    
    def test_itermatch(self):
        assert [m for m in self.esc.itermatch('AAAAAAAA', '+')] == [] #>=10
        assert [m for m in self.esc.itermatch('AAAAAAAAAA', '+')] == [(0, 10)]
        assert [m for m in self.esc.itermatch('AAAACAAAAA', '+')] == [(0, 10)]
        assert [m for m in self.esc.itermatch('AAAACACAAA', '+')] == []
        assert [m for m in self.esc.itermatch('CCAAAAAAAA', '+')] == [(2, 10)]
        assert [m for m in self.esc.itermatch('AAAAAAAACC', '+')] == [(0, 8)]
        assert [m for m in self.esc.itermatch('CCCCCAAAAAAAAAACCCCC', '+')] == [(5, 15)]
        assert [m for m in self.esc.itermatch('AAAAAAAACCAAAAAAAACC', '+')] == [(0, 18)]
        assert [m for m in self.esc.itermatch('AAAAAAAACCCAAAAAAAACC', '+')] == [(0, 8), (11, 19)]
      
        assert [m for m in self.esc.itermatch('TTTTTTTT', '-')] == [] #>=10
        assert [m for m in self.esc.itermatch('TTTTTTTTTT', '-')] == [(0, 10)]
        assert [m for m in self.esc.itermatch('TTTTCTTTTT', '-')] == [(0, 10)]
        assert [m for m in self.esc.itermatch('TTTTCTCTTT', '-')] == []
        assert [m for m in self.esc.itermatch('CCTTTTTTTT', '-')] == [(2, 10)]
        assert [m for m in self.esc.itermatch('TTTTTTTTCC', '-')] == [(0, 8)]
        assert [m for m in self.esc.itermatch('CCCCCTTTTTTTTTTCCCCC', '-')] == [(5, 15)]
        assert [m for m in self.esc.itermatch('TTTTTTTTCCTTTTTTTTCC', '-')] == [(0, 18)]
        assert [m for m in self.esc.itermatch('TTTTTTTTCCCTTTTTTTTCC', '-')] == [(0, 8), (11, 19)]
示例#2
0
 def setUp(self):
     self.esc = AstretchScan('data/hgex')
示例#3
0
        help='Show this help message and exit.')

    (options, args) = parser.parse_args(argv)
    if len(args) < 2:
        parser.error("genome_dir is required")
        
    return options, args

################################################################################

if __name__ == '__main__':
    options, args = process_command_line(sys.argv)    
    genome_dir = args[1]
    assert os.path.exists(genome_dir)
    
    outhandle = sys.stdout
    if options.outfile:
        outhandle = open(options.outfile, "w")
    
    scanner = AstretchScan(genome_dir, options.f_ival)
    i = 0
    for chrom, start, end, strand in scanner.scan():
        i += 1
        outhandle.write("\t".join(map(str, [
            chrom, start, end, i, 0, strand]))+"\n")
    
    if options.outfile:
        outhandle.close()