<commit_before>import os

import pypeline
import fileutils

from nodes.picard import ValidateBAMNode
from nodes.gatk import IndelRealignerNode
from nodes.bedtools import SlopBedNode
from nodes.samtools import GenotypeNode, TabixIndexNode
from nodes.bam_statistics import PairedStatisticsNode


if __name__ == '__main__':
    class Config:
	jar_root  = "opt/picard-tools"
    	gatk_root = "opt/GATK"
	temp_root = "temp"


    pipeline = pypeline.Pypeline(Config)
    for infile in ('data/small.bam', 'data/medium.bam', 'data/merged.bam'):
        filename = os.path.split(infile)[-1]

        validate   = ValidateBAMNode(Config,
                                     bamfile     = infile, 
                                     ignore      = ["MATE_NOT_FOUND"])

        statistics = PairedStatisticsNode(Config,
                                          infile      = infile)
    
        realigned_bam = fileutils.add_postfix(os.path.basename(infile), ".realigned")
        realigner = IndelRealignerNode(Config,
                                       destination  = "dest",
                                       reference    = "data/reference.fasta",
                                       infile       = infile,
                                       outfile      = realigned_bam,
                                       dependencies = [validate, statistics])

        validate = ValidateBAMNode(Config, 
                                   bamfile      = os.path.join("dest", realigned_bam),
                                   ignore       = ["MATE_NOT_FOUND"],
                                   dependencies = [realigner])


        padding = 10
        vcfraw  = "data/intervals.bed"
        vcfslop = fileutils.swap_ext(realigned_bam, ".vcf.bgz.bed_slop")
        vcffile = fileutils.swap_ext(realigned_bam, ".vcf.bgz")
        
        slop_bed = SlopBedNode(config        = Config,
                               destination   = "dest",
                               genome        = "data/reference.genome",
                               infile        = vcfraw,
                               outfile       = os.path.basename(vcfslop),
                               from_start    = 10,
                               from_end      = 10)

        genotype = GenotypeNode(config       = Config,
                                destination  = "dest",
                                reference    = "data/reference.fasta",
                                regions      = os.path.join("dest", vcfslop),
                                infile       = os.path.join("dest", realigned_bam),
                                outfile      = vcffile,
                                dependencies = [validate, slop_bed])

        tabix = TabixIndexNode(config       = Config,
                               destination  = "dest",
                               infile       = os.path.join("dest", vcffile),
                               dependencies = [genotype])

        pipeline.add_node(tabix)

    pipeline.run()
<commit_msg>Fix space/tab inconsistency in source code.<commit_after>import os

import pypeline
import fileutils

from nodes.picard import ValidateBAMNode
from nodes.gatk import IndelRealignerNode
from nodes.bedtools import SlopBedNode
from nodes.samtools import GenotypeNode, TabixIndexNode
from nodes.bam_statistics import PairedStatisticsNode


if __name__ == '__main__':
    class Config:
        jar_root  = "opt/picard-tools"
        gatk_root = "opt/GATK"
        temp_root = "temp"


    pipeline = pypeline.Pypeline(Config)
    for infile in ('data/small.bam', 'data/medium.bam', 'data/merged.bam'):
        filename = os.path.split(infile)[-1]

        validate   = ValidateBAMNode(Config,
                                     bamfile     = infile, 
                                     ignore      = ["MATE_NOT_FOUND"])

        statistics = PairedStatisticsNode(Config,
                                          infile      = infile)
    
        realigned_bam = fileutils.add_postfix(os.path.basename(infile), ".realigned")
        realigner = IndelRealignerNode(Config,
                                       destination  = "dest",
                                       reference    = "data/reference.fasta",
                                       infile       = infile,
                                       outfile      = realigned_bam,
                                       dependencies = [validate, statistics])

        validate = ValidateBAMNode(Config, 
                                   bamfile      = os.path.join("dest", realigned_bam),
                                   ignore       = ["MATE_NOT_FOUND"],
                                   dependencies = [realigner])


        padding = 10
        vcfraw  = "data/intervals.bed"
        vcfslop = fileutils.swap_ext(realigned_bam, ".vcf.bgz.bed_slop")
        vcffile = fileutils.swap_ext(realigned_bam, ".vcf.bgz")
        
        slop_bed = SlopBedNode(config        = Config,
                               destination   = "dest",
                               genome        = "data/reference.genome",
                               infile        = vcfraw,
                               outfile       = os.path.basename(vcfslop),
                               from_start    = 10,
                               from_end      = 10)

        genotype = GenotypeNode(config       = Config,
                                destination  = "dest",
                                reference    = "data/reference.fasta",
                                regions      = os.path.join("dest", vcfslop),
                                infile       = os.path.join("dest", realigned_bam),
                                outfile      = vcffile,
                                dependencies = [validate, slop_bed])

        tabix = TabixIndexNode(config       = Config,
                               destination  = "dest",
                               infile       = os.path.join("dest", vcffile),
                               dependencies = [genotype])

        pipeline.add_node(tabix)

    pipeline.run()

{'fraction_non_alphanumeric': 0.08064251762006229, 'fraction_numerical': 0.0022947057859367317, 'mean_word_length': 1.1493483620993308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7066480', 'n_tokens_mistral': 1619, 'n_tokens_neox': 1540, 'n_words': 281}