[Biopython-dev] Memory problems with eutils.efetch_using_dbids ...

BONIS SANZ, JULIO JBonis at imim.es
Mon Dec 13 09:36:45 EST 2004

I have tried the following code (see at the end).

It is a function that retrieves information about a given SNP from pubmed.
I use:

	snpInfoFile = eutils.efetch_using_dbids(...) 

and then:


and store this in a list (local memory).

My problem is that I do it for several SNPs and each time some <urllib2.OpenerDirector instance at 0x01435F30> is stored in the RAM. At the end the system hungs up.

Do you know how to free this memory?

I have tried to snpInfoFile.close() and del snpInfoFile but seems not to work!!!!

Help please!!!!!


Julio Bonis Sanz

    def getSNPInfo(self,rs): #
        given a rs return the contig and the position in it
        eutils = self.GenBank.EUtils.ThinClient.ThinClient()
        snpdbi = self.GenBank.DBIds("snp",[str(rs)])
        #print "getSNPInfo(" + str(rs) + ")" + ": " + str(len(gc.garbage))
        snpInfoFile = eutils.efetch_using_dbids(snpdbi,rettype = 'flt',retmode = 'html')

        del eutils
        del snpdbi
        snpInfoLines = []
        while 1:
            cLine = snpInfoFile.readline()
            if (cLine == ''):
        del snpInfoFile
        print "getSNPInfo(" + str(rs) + ")" + ": " + str(len(gc.garbage))
	  return snpInfoLines

More information about the Biopython-dev mailing list