genialis / resolwe-bio

Bioinformatics pipelines for Resolwe
Apache License 2.0
17 stars 34 forks source link

Expose variant objects in python processes #1360

Closed gregorjerse closed 3 months ago

gregorjerse commented 3 months ago

Checklist

Additional guidelines

Processes

Commit and PR messages

Tests

marcellevstek commented 3 months ago

@gregorjerse I have a problem accessing the position field of Variant model. You can test it yourself with the following code. As the migrations are made before every test, I suppose this is not the problem with the database being out of sync with Django models?

class SimpleGetVariant(ProcessBio):
    slug = "test-variants-simple-get"
    name = "Test variants"
    process_type = "data:varianttest"
    version = "1.0.0"

    class Output:
        """Output fields."""

        variant_positions = ListField(
            IntegerField(), label="Variant positions", required=True
        )

    def run(self, inputs, outputs):
        """Start the process."""
        variant_positions = [variant.position for variant in self.variant.iterate()]
        outputs.variant_positions = variant_positions