<commit_before>// Bpipe pipeline to simulate paired end reads from a fasta file, with no stutter
// Simulates reads from STR alleles at a provided set of loci

// Set up to run on the redwood cluster

INSTALLDIR="~/storage/git/STR-pipelines"
ART="~/tools/art_bin_MountRainier"
REF="/uufs/chpc.utah.edu/common/HIPAA/u6026198/storage/ref-data/GATK_Bundle/human_g1k_v37_decoy.fasta"
TOOLS="$INSTALLDIR/simulate_reads" //custom R/python scripts
STUTTER="$INSTALLDIR/simulate_reads/no_stutter_model.csv"
GATK="~/tools/gatk-4.1.2.0/gatk"

DECOY_REF="$INSTALLDIR/simulate_reads/reference-data/hg19.STRdecoys.sorted.fasta"
EXOME_TARGET="/group/bioi1/harrietd/ref-data/hg19_RefSeq_coding.sorted.bed"

// Adjust simulation parameters
PLATFORM="illumina"
total_coverage = 30

def get_fname(path) {
    def x = path.split("/")[-1]
    return(x)
}

@preserve("*.bed")
mutate_locus = {
    doc """Generate a random heterozygous coding STR loci in the potentially
        pathogenic range."""

    output.dir = "sim_bed"
    branch.simID = branch.name

    produce(branch.simID + ".bed") {
        exec """
            $INSTALLDIR/simulate_reads/STR_simulation_script.R
                -L $LOCUS
                $INSTALLDIR/simulate_reads/reference-data/hg19.simpleRepeat.txt.gz
                $INSTALLDIR/simulate_reads/reference-data/str-stats
                -O $output.bed
                -m 500
        """

    }
}

@filter("sorted")
sort_bed = {
    doc "sort bed file"
    output.dir = "sim_bed"
    branch.source_bed = input.bed

    preserve("*.bed") {
        exec """
            bedtools sort -i $input.bed > $output.bed
        """
    }
}



/////////////////////////////
// Produce mutated fasta file

generate_vcf = {
    doc "Generate a VCF of STR mutations and stutter, along with their probabilities"
    output.dir = "vcf_bed"

    def bedname = get_fname(input.bed)

    preserve("*.truth.vcf") {
        produce(bedname.prefix + ".truth.vcf", "*.stutter.vcf", bedname.prefix + ".txt", "*.stutter.bed") {

            exec """
                python $TOOLS/generate_stutter_vcfs.py $REF $input.bed --output $output.prefix.prefix --stutter $STUTTER --flank 100 > $output.txt
        """<commit_msg>increase region simulated around STR<commit_after>// Bpipe pipeline to simulate paired end reads from a fasta file, with no stutter
// Simulates reads from STR alleles at a provided set of loci

// Set up to run on the redwood cluster

INSTALLDIR="~/storage/git/STR-pipelines"
ART="~/tools/art_bin_MountRainier"
REF="/uufs/chpc.utah.edu/common/HIPAA/u6026198/storage/ref-data/GATK_Bundle/human_g1k_v37_decoy.fasta"
TOOLS="$INSTALLDIR/simulate_reads" //custom R/python scripts
STUTTER="$INSTALLDIR/simulate_reads/no_stutter_model.csv"
GATK="~/tools/gatk-4.1.2.0/gatk"

DECOY_REF="$INSTALLDIR/simulate_reads/reference-data/hg19.STRdecoys.sorted.fasta"
EXOME_TARGET="/group/bioi1/harrietd/ref-data/hg19_RefSeq_coding.sorted.bed"

// Adjust simulation parameters
PLATFORM="illumina"
total_coverage = 30

def get_fname(path) {
    def x = path.split("/")[-1]
    return(x)
}

@preserve("*.bed")
mutate_locus = {
    doc """Generate a random heterozygous coding STR loci in the potentially
        pathogenic range."""

    output.dir = "sim_bed"
    branch.simID = branch.name

    produce(branch.simID + ".bed") {
        exec """
            $INSTALLDIR/simulate_reads/STR_simulation_script.R
                -L $LOCUS
                $INSTALLDIR/simulate_reads/reference-data/hg19.simpleRepeat.txt.gz
                $INSTALLDIR/simulate_reads/reference-data/str-stats
                -O $output.bed
                -m 500
        """

    }
}

@filter("sorted")
sort_bed = {
    doc "sort bed file"
    output.dir = "sim_bed"
    branch.source_bed = input.bed

    preserve("*.bed") {
        exec """
            bedtools sort -i $input.bed > $output.bed
        """
    }
}



/////////////////////////////
// Produce mutated fasta file

generate_vcf = {
    doc "Generate a VCF of STR mutations and stutter, along with their probabilities"
    output.dir = "vcf_bed"

    def bedname = get_fname(input.bed)

    preserve("*.truth.vcf") {
        produce(bedname.prefix + ".truth.vcf", "*.stutter.vcf", bedname.prefix + ".txt", "*.stutter.bed") {

            exec """
                python $TOOLS/generate_stutter_vcfs.py $REF $input.bed --output $output.prefix.prefix --stutter $STUTTER --flank 10000 > $output.txt
        """
{'fraction_non_alphanumeric': 0.1416009019165727, 'fraction_numerical': 0.013979706877113867, 'mean_word_length': 2.657048639736191, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5888315', 'n_tokens_mistral': 1622, 'n_tokens_neox': 1469, 'n_words': 298}