[Biopython] using a function on a batch of files

Iddo Friedberg idoerg at gmail.com
Mon Jun 27 23:09:17 UTC 2011


Hi Dilara,

Read up on the glob module. http://docs.python.org/library/glob.html

That being said, this kind of question is probably better directed to one of
the Python community resources: http://python.org/community/

This list is primarily for Biopython inquiries.

Cheers,

Iddo

On Mon, Jun 27, 2011 at 6:33 PM, Dilara Ally <dilara.ally at gmail.com> wrote:

> 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
> ______________________________**_________________
> Biopython mailing list  -  Biopython at lists.open-bio.org
> http://lists.open-bio.org/**mailman/listinfo/biopython<http://lists.open-bio.org/mailman/listinfo/biopython>
>



-- 
Iddo Friedberg
http://iddo-friedberg.net/contact.html



More information about the Biopython mailing list