Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From "Python for Biologist" #24

Open
tralynca opened this issue Apr 25, 2018 · 1 comment
Open

From "Python for Biologist" #24

tralynca opened this issue Apr 25, 2018 · 1 comment

Comments

@tralynca
Copy link

tralynca commented Apr 25, 2018

Binning DNA sequences
Write a program which creates nine new folders – one for sequences between 100 and 199 bases long, one for sequences between 200 and 299 bases long, etc.
Write out each DNA sequence in the input files to a separate file in the appropriate folder.
They gave a few dna files, all file names with the file extension .dna, with each containing sequences of variable length.

I basically followed the example to the 't' and eventually even matched my variable names to theirs. The only part I initially got stuck on was line 37. I don't understand why it has to be repeated (it's a replica of line 13).
I struggled for a long time to figure out why the code was just creating the folders and then printing out what it should to STDIN, but it wasn't moving the files to the created directories.

Anyway, I liked this exercise, because it's useful for sorting files, based on certain criteria and automatically creating the folders and their names, based on their content.

@pvanheus
Copy link

pvanheus commented May 2, 2018

The code for this session is here. We did 3 different versions of the code - one in the session and two afterwards. @tralynca's original code is also in the repository. The data to test on is in the data/dna_files directory of the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants