pierrepo / PBxplore

A suite of tools to explore protein structures with Protein Blocks :snake:
https://pbxplore.readthedocs.org/en/latest/
MIT License
28 stars 17 forks source link

Regroup demo files ? #97

Closed HubLot closed 8 years ago

HubLot commented 8 years ago

In order to clean up the repository, would you agree to move all demo files (run_demo*, demo_*) into one and only demo (or example) folder ?

jbarnoud commented 8 years ago

Demo file are used for the demo themselves but also for the doc. I would not mind having the demo files as part of the package and somehow available through the API. Maybe just with a pbxplore.DATA_PATH constant. The demo scripts should remain rather simple, though.

jbarnoud commented 8 years ago

Here is a suggestion about what to do with the demo files.

Demo files could be moved in pbxplore/data. All together, without the split by demo (no demo1 or demo2 sub-directory). A file pbxplore/data/__init__.py would expose a DATA_PATH constant that could be imported in the pbxplore main module. A pbxplore.data.list_data function could list the data files available. Finally, a PBdata entry point (program) just print the path in pbxplore.data.DATA_PATH; possibly, a --list argument could print the output of pbxplore.data.list_data.

This implies a change in the demo scripts. A call to PBdata at the beginning of the scripts allows the scripts to get the path to the data path. Because there is no subdirectories anymore, each demo script should list the files it needs to copy. The beginning of a script would look something like this (non tested):

# create and move into the demo directory
DATA_PATH=$(PBdata)
INPUT_FILES=(3ICH.pdb  # one structure, one chain
             1AY7.pdb  # one structure, multiple chains
             2FLU.pdb) # 10 models, one chain each
mkdir demo1_assignation_tmp
for input_file in ${INPUT_FILES[@]}
do
    cp ${DATA_PATH}/input_file demo1_assignation_tmp
done

This approach, in addition to work with the grouped demo files, allows to:

All of this is also useful for the documentation. Indeed, it would allow to run the documentation from any directory. Files would be available with something like:

path = os.path.join(pbxplore.DATA_PATH, '2FLU.pdb')

Most of the demo demo files are redundant with the test file. This makes the package heavier. Yet, I am still reluctant to have the test files not isolated from the rest.

All of this is, of course, open to discussion. I think it would give better access to the demo files so users can play with them while getting familiar with the program.

pierrepo commented 8 years ago

OK with that. But I would prefer that DATA_PATH becomes DEMO_DATA_PATH to make clean that these data are for demo purpose only (and also tests). In contrast, we have other data that belongs to the core of PBxplore (i.e. PBs_substitution_matrix.dat)

jbarnoud commented 8 years ago

Fixed by #99