Example #1
0
    def setUp(self):
        
        self.buf = open('data/ProtDNA.psl').read()
        self.buf = self.buf.replace("\r\n","\n")

        thisdir = os.path.abspath(os.path.dirname(__file__))
        def thisfile(name):
            return os.path.join(thisdir, name)
        
        
        self.srcDB = seqdb.SequenceFileDB(thisfile('data/test_prot.fa'))
        self.destDB = seqdb.SequenceFileDB(thisfile('data/test_dna.fa'))
        self.db = seqdb.SequenceFileDB(thisfile('data/translatedDB.fa'))
        
        self.aln_type = 1 #protein-dna alignmet = 1, else - 0 
        
        self.matches, genome_names = blat_NLMSA.parse_blat(self.buf, 
                                                           self.aln_type)

        self.db = translationDB.get_translation_db(self.destDB)

        alignment = cnestedlist.NLMSA('test', mode='memory', pairwiseMode=True,
                                      bidirectional=False)

        self.temp_nlmsa = blat_NLMSA.create_NLMSA_blat(self.buf, alignment,
                                                       aln_type = self.aln_type,        
                                                       srcDB = self.srcDB, 
                                                       destDB = self.db)
    def test_translation_db_in_results_of_db_search(self):
        """
        Test that the NLMSA in a BlastxMapping properly picks up the
        translationDB from the query sequence dict.
        """
        if not testutil.blast_enabled():
            raise SkipTest("no BLAST installed")
        blastmap = blast.BlastxMapping(self.prot, verbose=False)
        results = blastmap(queryDB=self.dna)

        tdb = translationDB.get_translation_db(self.dna)
        assert tdb.annodb in results.seqDict.dicts
    def test_translation_db_in_results_of_seq_search(self):
        """
        Test that the NLMSA in a BlastxMapping properly picks up the
        translationDB from a single input sequence.
        """
        if not testutil.blast_enabled():
            raise SkipTest("no BLAST installed")
        blastmap = blast.BlastxMapping(self.prot, verbose=False)

        query_seq = self.dna["gi|171854975|dbj|AB364477.1|"]
        results = blastmap(seq=query_seq)

        tdb = translationDB.get_translation_db(self.dna)
        assert tdb.annodb in results.seqDict.dicts
    def test_translated_seqs_in_results(self):
        """
        Only NLMSASlices for the query sequence should show up in
        BlastxMapping.__getitem__, right?
        """
        if not testutil.blast_enabled():
            raise SkipTest("no BLAST installed")
        blastmap = blast.BlastxMapping(self.prot, verbose=False)

        query_seq = self.dna["gi|171854975|dbj|AB364477.1|"]
        results = blastmap[query_seq]

        tdb = translationDB.get_translation_db(self.dna)
        annodb = tdb.annodb

        for slice in results:
            assert slice.seq.id in annodb, "%s not in annodb!" % slice.seq.id
Example #5
0
 def setUp(self):
     hbb1_mouse = testutil.datafile('hbb1_mouse.fa')
     self.dna = seqdb.SequenceFileDB(hbb1_mouse)
     self.tdb = translationDB.get_translation_db(self.dna)
Example #6
0
 def setUp(self):
     hbb1_mouse = testutil.datafile('hbb1_mouse.fa')
     self.dna = seqdb.SequenceFileDB(hbb1_mouse)
     self.tdb = translationDB.get_translation_db(self.dna)