Comments (10)
__author__ = "Johannes Köster"
__copyright__ = "Copyright 2016, Johannes Köster"
__email__ = "[email protected]"
__license__ = "MIT"
import os
from snakemake.shell import shell
prefix = os.path.splitext(snakemake.output[0])[0]
shell(
"samtools sort {snakemake.params} -@ {snakemake.threads} -o {snakemake.output[0]} "
"-T {prefix} {snakemake.input[0]}")
We could provide code inspections for missing parameters
from snakecharm.
E.g we could add reference on a string, see http://www.jetbrains.org/intellij/sdk/docs/tutorials/custom_language_support/reference_contributor.html#define-a-reference-contributor
to provide completion/resolve for wrappers from https://github.com/snakemake/snakemake-wrappers
or any custom source.
Read about wrappers at https://snakemake-wrappers.readthedocs.io/en/stable/
Desired behavior:
- Utility class which could collect wrappers info from user provided directory
- Utility class that works with local github repo - collects wrappers for all repo relizes to some effective data structure
- Gradle task that checkouts wrappers repo locally + collects wrappers info using the step below
- Plugin bundle will include serialized wrappers info from prev step.
- Maybe some optional wrappers crawler from github master, update it by some "button" in settings or "action".
- Plugin uses cached wrappers info for
- resolve/completion for wrappers paths
- documentation popup with useful info (e.g. hyper links on wrapper docs, e.g. https://snakemake-wrappers.readthedocs.io/en/0.62.0/wrappers/bismark/bismark.html + maybe some parameters info extracted from
meta.yaml
content. When using custom wrappers dir - use links to dependencies.yaml, meta.yaml and wrapper.py files instead of https://snakemake-wrappers.readthedocs.io) - Ideally to have useful inspections on input/output/params sections according to
meta.yaml
orwrappers.py
content.
UI:
- Settings page
- Choice for wrappers source: 1) default wrappers repo 2) custom directory (e.g some github branch or just directory with proper structure)
- Refresh button which updates wrappers info from the above source
from snakecharm.
In case of local files - paths starts with file://
prefix, e.g.:
rule foo:
wrapper:
f"file://{PIPELINE_PATH}/wrappers/bio/bismark/bismark"
also could be relative paths
from snakecharm.
Be wary of rate limits for request to repositories: https://confluence.atlassian.com/bitbucket/rate-limits-668173227.html
from snakecharm.
API examples:
- Documentation popup:
SmkShadowSettingsDocumentation
from snakecharm.
Example:
rule virus_reference_genome_chromsizes:
output: "indexes/{virus_genome}/{virus_genome}.chrom.sizes"
log: "indexes/{virus_genome}/{virus_genome}.chrom.sizes.log"
input: "indexes/{virus_genome}/{virus_genome}.2bit"
message: "Indexes: Chrom sizes for {input}"
shadow: "full"
wrapper:
"0.43.1/bio/ucsc/twoBitInfo"
from snakecharm.
@SimonTsirikov
Got an exception when playing with features/#18-resolve-completion-for-wrappers
java.nio.file.NoSuchFileException: /github.com/snakemake/snakemake-wrappers/archive/master.zip
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:149)
at java.base/java.nio.file.Files.readAttributes(Files.java:1763)
at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1225)
at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:727)
at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:844)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:247)
at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)
at com.intellij.platform.templates.github.ZipUtil.unzip(ZipUtil.java:94)
at com.jetbrains.snakecharm.codeInsight.completion.wrapper.SmkWrapperCrawler$runActivity$1$1.run(SmkWrapperCrawler.kt:30)
at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:935)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsync$5(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:235)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:170)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:629)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:581)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:157)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:235)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:668)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:665)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:665)
at java.base/java.lang.Thread.run(Thread.java:834)
from snakecharm.
Missing at the moment:
-
Documentation
- Show doc for wrapper keyword argument in completion/F1. Use info from meta.yaml
- Documentation for section name (e.g input/output/...) that shows expected args for this section, not only documentation for wrapper.
- Documentation for wrapper: show supported sections & params info, not just text from
meta.yaml
-
Wrappers params parsing:
- Parse not only
wrappers.py
but alsometa.yaml
and collect keyword args and their descriptions - In case of using
file://
, collect such wrappers, parse&resolve params and add to module wrappers info 'storage' - Not all wrapper params are obligatory. Maybe understand it from calls like
snakemake.get("key", default_value)
in wrappers.py or use some conventions inmeta.yaml
- Inspection False positive: Wrapper sections detection false positive: 'shell' is missing #311
- Inspection False positive: #312
- Parse not only
-
Wrappers Info bundles:
- Bundle wrappers should contain information about all wrappers releases, e.g. not all tools available in
latest
release or parameters could be changed. Otherwise, our completion/inspection will show false positives for such cases - Load bundled wrappers storage object once for all projects/modules, not
per module
. Here we need several layers, e.g. bundled wrappers could be application level object, facet settings dependent wrappers (e.g. custom folder) - module level - Think of wrappers info auto-update, e.g. from TeamCity
- If custom folder is used as input, need to add file watcher and update case if timestamps changed
- Bundle wrappers should contain information about all wrappers releases, e.g. not all tools available in
from snakecharm.
Initial support implemented, rest will be in wrappers
milestone
from snakecharm.
Seems not all mentioned in Missing at the moment:
is extracted as issues
from snakecharm.
Related Issues (20)
- Current version of SnakeCharm is incompatible with PyCharm 2023.1 HOT 2
- Exception: "Access is allowed from write thread only" creating project in dumb mode HOT 2
- PyCharm 2023.3 Support
- Show notice on deprecated features HOT 1
- Unresolved reference warning when iterating over 'input' key-value pairs using '.items()'
- [7.11] Resources scopes support
- Unresolved reference 'snakemake' HOT 3
- Wildcard not defined in output of Target Rule HOT 3
- PyCharm 2024.1 support HOT 5
- Improve parser error message when rule/module is declared with name but lacks ':'
- Completion for wrapper names rarely works
- Section names cannot be resolved for rules after inheritance using use
- After using import, fuctions from other smk files are not detected HOT 1
- Importing rules using github function does not work
- Gitfile command is not recognized by snakecharm
- Snakecharm does not recognize localrule directive
- Cache and bechmark are not reported as an error
- Multiple functions are not recognized by snakecharm
- Snakecharm marks error on comment in last line HOT 1
- Improve target rules support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from snakecharm.