rhysnewell / aviary

A hybrid assembly and MAG recovery pipeline (and more!)
GNU General Public License v3.0
76 stars 11 forks source link

Running aviary directly from a git checkout #183

Closed wwood closed 6 months ago

wwood commented 7 months ago

Hey,

Maybe I'm reinventing the wheel here, but if I add this to the top of aviary/aviary.py

+import os
+import sys
+
+if __name__ == '__main__':
+    # Should only be here when not pip installed.
+    __version__ = 'dev'
+    # Put aviary first on the path to avoid Python choosing the wrong aviary
+    # import along the lines of
+    # https://stackoverflow.com/questions/54333865/python-no-module-named-error-package-is-not-a-package
+    sys.path = [os.path.dirname(os.path.realpath(__file__))+'/../'] + sys.path
+else:
+    from .__init__ import __version__

Then I can run it directly rather than having to run pip install -e . like so

~/git/aviary$ rm -rf assembly1.aviary_recover3; ~/git/aviary/aviary/aviary.py recover --coassemble -1 data1/SRR9330*_1.fastq.gz -2 data1/SRR9330*_2.fastq.gz -o assembly1.aviary_recover3 -t 64 --skip-binners maxbin2 concoct

Useful for debugging.

Happy to make a PR ofc.

Relatedly, is there a way to specify a target for the snakemake? When debugging or otherwise that would be useful so extraneous rules aren't run.

TIA.

rhysnewell commented 7 months ago

So the point of using pip install -e . is that the -e treats the current directory as the install directory. So you can make changes on the fly and they are automatically installed, which is very helpful for debugging. A normal aviary installation would just run pip install . or the pip package name or the conda install. I see the benefit of this, but I'm not in a rush to add it. So if you want to make a PR and can guarantee that it won't negatively impact the rest of the code base then I'm fine with it being added.

If you want to target a specific rule then there is the -w flag. You just add -w to your aviary command then a list of rules that you want to target and it will spin up an aviary run targeting each one specifically in order

wwood commented 7 months ago

Figured I was missing something simple. The README does actually say what to do already, but I didn't pay enough attention.

Re -w I didn't see it because I was ctrl-f for snakemake and target, but neither picked up -w.