예제 #1
0
    def ena_id_to_gi_number(self, identifiers):

        # Now, let us convert the ENA accession to NCBI GI number once for all.
        # We can fetch only at max 200 identifiers:
        logger.info("Fetching %s identifiers from NCBI" % len(identifiers))
        Nbaskets = int(math.ceil(len(identifiers) / 200.))
        results = {}
        from easydev import split_into_chunks
        for chunk in split_into_chunks(identifiers, Nbaskets):
            result = self.eutils.accession_to_info(",".join(chunk))
            results.update(result)
        return results
예제 #2
0
def test_chunks():

    assert list(split_into_chunks([0, 1, 2, 3, 4, 5, 6], 2)) == [[0, 2, 4, 6],
                                                                 [1, 3, 5]]
    assert list(split_into_chunks([0, 1, 2, 3, 4, 5], 2)) == [[0, 2, 4],
                                                              [1, 3, 5]]
예제 #3
0
def test_chunks():

    assert list(split_into_chunks([0,1,2,3,4,5,6], 2)) == [[0, 2, 4, 6], [1, 3, 5]]
    assert list(split_into_chunks([0,1,2,3,4,5], 2)) == [[0, 2, 4], [1, 3, 5]]