zktuong/dandelion

Add outfile_dir to define_clones

Ngort opened this issue · 3 comments

Ngort commented

Is your feature request related to a problem?

Right now, if one runs define_clones on a Dandelion object, the wrapper does the following:

    if os.path.isfile(str(vdj_data)):
        tmpFolder = "{}/tmp".format(os.path.dirname(vdj_data))
        outFolder = "{}".format(os.path.dirname(vdj_data))
    else:
        import tempfile

        tmpFolder = "{}/tmp".format(tempfile.TemporaryDirectory().name)
        outFolder = "{}".format(tempfile.TemporaryDirectory().name)

It should allow for saving the output as a file even if the input wasn't one.

Describe the solution you'd like

Add an argument outfile_dir that fits into that if-statement.

Describe alternatives you've considered

No response

Additional context

No response

hi @Ngort, as this function returns a Dandelion object, you could also just do:

ddl.tl.define_clones(vdj, ...)
vdj.write_airr("after_define_clones.tsv")

this would probably be simpler than trying to rejig the code inside

i'm added in #288 the option out_dir to ddl.tl.define_clones

Ngort commented

Thank you!