Coder Social home page Coder Social logo

Include or import etc. about sos HOT 4 CLOSED

vatlab avatar vatlab commented on July 26, 2024
Include or import etc.

from sos.

Comments (4)

gaow avatar gaow commented on July 26, 2024

snakemake doesn't restrict the use of libraries ... I suppose the current support for import modules are perhaps sufficient:

  1. in python(''' ... ''') it is fully supported
  2. class and def are also supported and one can always add an import statement inside a class or function if the class or function requires. There is then no need to have global support for this.

from sos.

BoPeng avatar BoPeng commented on July 26, 2024

This depends on what we want to include. snakemake uses a special include
directive to include rules. This is useful but something I dislike about
snakemake because for example tophat/STAR accept tones of parameters for
different applications and I do not want them to be hidden in another file.

SoS cannot include steps because of the index mechanism but

  1. We can include a bunch of auxiliary steps. That pushes SoS to a
    dangerous application that I do not want to encourage.
  2. We can define a bunch of unnamed steps and do something like
[my_step_100 = pre-defines-1]
  1. We can import a bunch of action functions, but there is nothing special
    and we can do this through regular import. Users can either import sos and
    decorate their functions in their own module, or do something like
from mymodule import func1, func2, func3

func1 = SoS_Action(func1)
func2 = SoS_Action(func2)

@SoS_Action
def func3_wrapper(parameter):
   return func3(parameter) is None

The advantage is that mymodule can be defined independent of SoS and used
in other places.

from sos.

gaow avatar gaow commented on July 26, 2024

Oh I see here modules refer to pre-defined SoS text ... yes snakemake would call these "wrappers". I think it will make our life easier if we restrict it to actions only. One way out, as you proposed, is to encourage users to write python functions. But perhaps a lot useful actions are just run() calls with hard-to-remember arguments that is best imported one way or another rather than copy-paste. Perhaps we can define a special SoS action that exclusively imports a desired action from another SoS file (e.g. from given action at given step)?

from sos.

BoPeng avatar BoPeng commented on July 26, 2024

I tend to think the currently SoS is open enough.because it can run any
external script and import any python function. The SoS level import, e.g.
import SoS action function, import SoS step, and import SoS workflows are
possible but we should keep things simple for now until we find a good
justification for such features.

Bo

On Sun, Mar 13, 2016 at 10:53 AM, gaow [email protected] wrote:

Oh I see here modules refer to pre-defined SoS text ... yes snakemake
would call these "wrappers". I think it will make our life easier if we
restrict it to actions only. One way out, as you proposed, is to encourage
users to write python functions. But perhaps a lot useful actions are just
run() calls with hard-to-remember arguments that is best imported one way
or another rather than copy-paste. Perhaps we can define a special SoS
action that exclusively imports a desired action from another SoS file
(e.g. from given action at given step)?


Reply to this email directly or view it on GitHub
#20 (comment).

from sos.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.