Bug Bulletin: we have identified a bug that affects indexing when producing gzipped VCFs. This will be fixed in the upcoming 3.2 release; in the meantime you need to reindex gzipped VCFs using Tabix.

Qscript split into multiple files.

LouisBLouisB Broad InstitutePosts: 25Member, Third-party Developer, GSA Collaborator, Broadie

I'm working on a set of related Queue scripts. I would like to have functionality shared between them, ideally in separate scala files which would be imported. Is there a way to specify additional paths for the Queue scala compiler to search or do I have to bake my library into the gatk when I build it?

Tagged:

Best Answer

Answers

  • LouisBLouisB Broad InstitutePosts: 25Member, Third-party Developer, GSA Collaborator, Broadie

    Thanks for pointing out that post, I hadn't noticed it. I'll let you know how it works.

  • LouisBLouisB Broad InstitutePosts: 25Member, Third-party Developer, GSA Collaborator, Broadie

    I got confirmation that there is currently no way to have Queue load multiple script files at runtime. You have to build your libraries into gatk like that post describes.

  • kevyinkevyin Posts: 9Member

    @LouisB Hi apologies for the noob question, I'm not very good with java/scala and Walkers

    Is it still the case that qscripts can't be split up? What I had in mind is simply importing some traits that extend Qscript so I can add some functions to multiple qscript easily without copy and pasting the code to all the qscripts.

    trait MyFunctions extends QScript {
            case class bwa() extends CommandLineFunction {
            }
    }
    And from a qscript at the top I do:
    class MyQscript extends QScript with MyFunctions {
        qscript =>
        ...
    }

    Maybe I should start a new thread with this? thx

  • Johan_DahlbergJohan_Dahlberg Posts: 80Member ✭✭✭

    @kevyin One what to do what you describe is to create a object (or a class depending on you exact use case) to encapsulate the case classes that you want to use and then import them. That would give you something like this:

    object MyAlignmentUtils {
        case class bwa() extends CommandLineFunction { }
    }
    
    class MyQscript extends QScript { qscript => 
    
        import MyAlignmentUtils._
        add(bwa(...))
    }
    
  • kevyinkevyin Posts: 9Member

    @Johan_Dahlberg Thanks for the help. Pardon my ignorance, but do you know of a way to move this object to another file so as to keep my code repo modular?

    Would it involve compiling the MyAlignmentUtils separately and adding it to the classpath? I'm thinking aloud here.......

  • Johan_DahlbergJohan_Dahlberg Posts: 80Member ✭✭✭

    Just put it in a another file named "MyAlignmentUtils.scala" on your build path. Exactly what your build path is depends on the build system you are using, but normally it should be the directory named "src" or something similar. You can have a look at my repository for Piper (a pipelining system for out sequencing facility) here: https://github.com/johandahlberg/piper to get a feeling for how to organize things (note that this uses gatk as a external dependencies which is downloaded of github and build by the setup.sh script)

    So yes, it would involve compiling MyAlignmentUtils separately and adding it to the class path.

  • kevyinkevyin Posts: 9Member
    edited September 2013

    @Johan_Dahlberg said: Just put it in a another file named "MyAlignmentUtils.scala" on your build path. Exactly what your build path is depends on the build system you are using, but normally it should be the directory named "src" or something similar. You can have a look at my repository for Piper (a pipelining system for out sequencing facility) here: https://github.com/johandahlberg/piper to get a feeling for how to organize things (note that this uses gatk as a external dependencies which is downloaded of github and build by the setup.sh script)

    So yes, it would involve compiling MyAlignmentUtils separately and adding it to the class path.

    Thanks a million

    Post edited by kevyin on
Sign In or Register to comment.