[Biopython] using a function on a batch of files

Dilara Ally dilara.ally at gmail.com
Mon Jun 27 22:33:42 UTC 2011


Hi All

I'm a newbie to python and I'm interested in using a function on a batch 
of files.

I know that in R, you can set the working directory to the directory of 
interest.  Is there a way to do this in Python?  This would allow me to 
access files that were in a different location than where the script 
file is.  The reason I would be interested to do this is that I have a 
function that I want to apply to 400 different files.  If I were 
scripting in R (which I am familiar with) I could use the fn list.files 
that would list the files in the directory.  Then I could read them in 
one by one with a loop.  Apply the function and then write the files to 
a different directory.

What is the best way to do this in python?

Thanks for the help.

Cheers, Dilara



More information about the Biopython mailing list