Path Name Convention

Issue #31 resolved
Xinqiu Yao created an issue

In some function, such as fit.xyz and pdbfit, the value for the option "outpath" mush be ended with "/". Is it really necessary?

Comments (5)

  1. Barry Grant

    We should probably fix this if there is an easy way that copes with cwd "./" maybe paste0(pth,"/") or similar?

  2. Xinqiu Yao reporter

    I have done it with the function file.path(). The idea is

    1. the path name can be ended either with or without "/"
    2. empty string ("") is equal to "/" and "." represents current working directory
    3. there are two exceptions:
    • exepath="" means default searching path of executable files
    • pdb.path="" does not locate the file to root "/". For example, in read.fasta.pdb(aln, pdb.path=""), the file path is extracted directly from aln$id instead of "/aln$id".

    Point 3 breaks the consistence of path name convention. Suggestion is to rename the options. For example, pdb.path is called prefix.pdb.path. Exepath can be called exefile, and the default value is just the executable file name (e.g. "dssp").

    It may be overkilled but I was constantly confused with the path name ended with or without "/" (they are different in previous version of bio3d). Any comment?

  3. Barry Grant

    Great, file.path() should take care of this nicely.

    For your listed exceptions in #3 I like the suggested exefile replacment of exepath. However, for pdb.path replacement by prefix.pdb.path I am not so sure. Generally I am not that fond of making variable names (especially user exposed ones that I have to type) longer without significantly enhancing understandability. Does "prefix" help here?

  4. Log in to comment