Question: How to call BBMap, SAMTools and GATK from Python or Ruby?
0
gravatar for vassialk
3.6 years ago by
vassialk190
Belarus
vassialk190 wrote:

How to call BBMap, SAMTools and GATK from Python or Ruby? Need some example scripts, please.

sequencing wgs software • 1.9k views
ADD COMMENTlink modified 12 days ago by Roman Luštrik70 • written 3.6 years ago by vassialk190
1

Google would help you a lot. StackOverflow as well, there are tons of similar questions there. E.g. for Python here and here, and for Ruby here and here.

ADD REPLYlink written 3.6 years ago by h.mon25k
2
gravatar for Devon Ryan
3.6 years ago by
Devon Ryan90k
Freiburg, Germany
Devon Ryan90k wrote:

In python use the subprocess library. No clue about Ruby, though it has an equivalent of making system calls.

ADD COMMENTlink written 3.6 years ago by Devon Ryan90k

thank you, are there any actual sample scripts available somewhere?

ADD REPLYlink written 3.6 years ago by vassialk190
1
gravatar for Tky
3.6 years ago by
Tky990
Japan
Tky990 wrote:

You can search the GitHub with keyword "GATK", on the left panel 

Select "Code" and in Language section, check "Python".

Here is one actual script from this link ,  there are 2000+ such scripts, you should be able to find some useful ones for your project. And you can do same for Ruby as well. 

from package import *

class gatk(Package):
    dependencies = ['jre_oracle']
    def fetch(self):
        f = self.fillVars('%(srcpath)s/GenomeAnalysisTK-3.3-0.tar.bz2')
        if not os.path.isfile(f):
            error('Please supply source file: %s' %f)
        return f
    
    workdir="gatk-3.3-0"
    create_workdir=True

    build="""
        mkdir -p %(prefix)s/opt/gatk
        cp -R * %(prefix)s/opt/gatk
        cd %(prefix)s/opt/gatk
        """

    install="""
        cd %(prefix)s/opt/gatk
        echo "#!/bin/bash" > gatk
        echo "java -jar %(prefix)s/opt/gatk/GenomeAnalysisTK.jar \$@" >> gatk
        chmod +x gatk
        cp ./gatk %(prefix)s/bin/
    """ 
ADD COMMENTlink modified 3.6 years ago • written 3.6 years ago by Tky990

Thank you --------------------------

ADD REPLYlink written 3.5 years ago by vassialk190
0
gravatar for Roman Luštrik
12 days ago by
Ljubljana, Slovenia
Roman Luštrik70 wrote:

You can run it using package plumbum.

from plumbum import local

samtools = local['samtools']  # or relative/absolute path to samtools
print(samtools['--help']())

Output:

Program: samtools (Tools for alignments in the SAM format)
Version: 1.8 (using htslib 1.8)
Usage:   samtools <command> [options]
Commands:
  -- Indexing
     dict           create a sequence dictionary file
     faidx          index/extract FASTA
     index          index alignment
ADD COMMENTlink written 12 days ago by Roman Luštrik70
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 801 users visited in the last hour