<commit_before><tool id="rna_star" name="RNA STAR" version="2.4.0d">
    <description>Gapped-read mapper for RNA-seq data</description>
    <requirements>
        <requirement type="package" version="2.4.0d">rnastar</requirement>
        <requirement type="package" version="0.1.19">samtools</requirement>
    </requirements>
    <stdio>
        <regex match="EXITING: FATAL INPUT ERROR:" source="both" level="fatal"/>
        <regex match="EXITING: fatal error trying to allocate genome arrays, exception thrown: std::bad_alloc" source="both" level="fatal"/>
        <regex match="\[sam_read1\] missing header\? Abort!" source="both" level="fatal"/>
        <regex match=".*" source="both" level="warning" description="Some stderr/stdout text"/>
    </stdio>

    <command><![CDATA[
    ## Create temporary index for custom reference
    #if str($refGenomeSource.genomeSource) == 'history':
        mkdir -p tempstargenomedir;
        STAR
            --runMode genomeGenerate
            --genomeDir "tempstargenomedir"
            --genomeFastaFiles "$refGenomeSource.ownFile"
            --runThreadN \${GALAXY_SLOTS:-4}
        
        #if str($refGenomeSource.geneModel) != 'None':
            --sjdbOverhang "100"
            --sjdbGTFfile "$refGenomeSource.geneModel"
            
            #if str($refGenomeSource.geneModel.ext) == 'gff3':
                --sjdbGTFtagExonParentTranscript Parent
            #end if
        #end if
        ;
    #end if
    
    
    ## Actual alignment
    STAR
        --genomeLoad NoSharedMemory    
    #if str($refGenomeSource.genomeSource) == 'history':
        --genomeDir "tempstargenomedir"
    #else
        --genomeDir "$refGenomeSource.index.fields.path"
    #end if
    
    --readFilesIn
    #if str($singlePaired.sPaired) == "paired_collection"
        "$singlePaired.input.forward" "$singlePaired.input.reverse"
    #else
        "$singlePaired.input1"
        #if str($singlePaired.sPaired) == "paired"
            "$singlePaired.input2"
        #end if
    #end if
    
        --runThreadN \${GALAXY_SLOTS:-4}
    #if str($params.settingsType) != "default":
        --chimSegmentMin $params.chim_segment_min
        --chimJunctionOverhangMin $params.chim_junction_overhang_min
        --chimScoreMin $params.chim_score_min
        --seedSearchStartLmax $params.seed_search_start_l_max
        --alignSJDBoverhangMin $params.align_sjdb_overhang_min
        --alignMatesGapMax $params.align_mates_gap_max
        --alignIntronMax $params.align_intron_max
        --outFilterScoreMinOverLread $params.out_filter_score_min_over_l_read
    #end if

    ## may or may not need to generate SAM tags and handle non-canonicals for Cufflinks tools.
        $params.outSAMstrandField
        $params.outFilterIntronMotifs
        $outSAMattributes
    ;
    
    ## BAM conversion.
    
    ## Convert aligned reads.
    samtools view -@ \${GALAXY_SLOTS:-4} -Shb Aligned.out.sam | samtools sort -@ \${GALAXY_SLOTS:-4} - AlignedSorted 2>/dev/null ;
    
    ## Convert chimeric reads.
    #if str($params.settingsType) == "full" and $params.chim_segment_min > 0:
        samtools view-@ \${GALAXY_SLOTS:-4} -Shb Chimeric.out.sam | samtools sort -@ \${GALAXY_SLOTS:-4} - ChimericSorted 2>/dev/null
    #end if
    ]]></command>

    <inputs>
        <!-- FASTQ input(s) and options specifically for paired-end data. -->
        <conditional name="singlePaired">
            <param name="sPaired" type="select" label="Single ended or mate-pair ended reads in this library?">
              <option value="single">Single-end</option>
              <option value="paired">Paired-end (as individual datasets)</option>
              <option value="paired_collection">Paired-end (as collection)</option>
            </param>
            <when value="single">
                <param format="fastqsanger,fastq,fasta" name="input1" type="data" label="RNA-Seq FASTQ file"/>
            </when>
            <when value="paired">
                <param format="fastqsanger,fastq,fasta" name="input1" type="data" label="RNA-Seq FASTQ file, forward reads"
                    help="Nucleotide-space: Must have Sanger-scaled quality values with ASCII offset 33" /><commit_msg>RNA-STAR: use ampersands<commit_after><tool id="rna_star" name="RNA STAR" version="2.4.0d-1">
    <description>Gapped-read mapper for RNA-seq data</description>
    <requirements>
        <requirement type="package" version="2.4.0d">rnastar</requirement>
        <requirement type="package" version="0.1.19">samtools</requirement>
    </requirements>
    <stdio>
        <regex match="EXITING: FATAL INPUT ERROR:" source="both" level="fatal"/>
        <regex match="EXITING: fatal error trying to allocate genome arrays, exception thrown: std::bad_alloc" source="both" level="fatal"/>
        <regex match="\[sam_read1\] missing header\? Abort!" source="both" level="fatal"/>
        <regex match=".*" source="both" level="warning" description="Some stderr/stdout text"/>
    </stdio>

    <command><![CDATA[
    ## Create temporary index for custom reference
    #if str($refGenomeSource.genomeSource) == 'history':
        mkdir -p tempstargenomedir &&
        STAR
            --runMode genomeGenerate
            --genomeDir "tempstargenomedir"
            --genomeFastaFiles "$refGenomeSource.ownFile"
            --runThreadN \${GALAXY_SLOTS:-4}
        
        #if str($refGenomeSource.geneModel) != 'None':
            --sjdbOverhang "100"
            --sjdbGTFfile "$refGenomeSource.geneModel"
            
            #if str($refGenomeSource.geneModel.ext) == 'gff3':
                --sjdbGTFtagExonParentTranscript Parent
            #end if
        #end if
        ;
    #end if
    
    
    ## Actual alignment
    STAR
        --genomeLoad NoSharedMemory    
    #if str($refGenomeSource.genomeSource) == 'history':
        --genomeDir "tempstargenomedir"
    #else
        --genomeDir "$refGenomeSource.index.fields.path"
    #end if
    
    --readFilesIn
    #if str($singlePaired.sPaired) == "paired_collection"
        "$singlePaired.input.forward" "$singlePaired.input.reverse"
    #else
        "$singlePaired.input1"
        #if str($singlePaired.sPaired) == "paired"
            "$singlePaired.input2"
        #end if
    #end if
    
        --runThreadN \${GALAXY_SLOTS:-4}
    #if str($params.settingsType) != "default":
        --chimSegmentMin $params.chim_segment_min
        --chimJunctionOverhangMin $params.chim_junction_overhang_min
        --chimScoreMin $params.chim_score_min
        --seedSearchStartLmax $params.seed_search_start_l_max
        --alignSJDBoverhangMin $params.align_sjdb_overhang_min
        --alignMatesGapMax $params.align_mates_gap_max
        --alignIntronMax $params.align_intron_max
        --outFilterScoreMinOverLread $params.out_filter_score_min_over_l_read
    #end if

    ## may or may not need to generate SAM tags and handle non-canonicals for Cufflinks tools.
        $params.outSAMstrandField
        $params.outFilterIntronMotifs
        $outSAMattributes
    &&
    
    ## BAM conversion.
    
    ## Convert aligned reads.
    samtools view -@ \${GALAXY_SLOTS:-4} -Shb Aligned.out.sam | samtools sort -@ \${GALAXY_SLOTS:-4} - AlignedSorted 2>/dev/null ;
    
    ## Convert chimeric reads.
    #if str($params.settingsType) == "full" and $params.chim_segment_min > 0:
        samtools view-@ \${GALAXY_SLOTS:-4} -Shb Chimeric.out.sam | samtools sort -@ \${GALAXY_SLOTS:-4} - ChimericSorted 2>/dev/null
    #end if
    ]]></command>

    <inputs>
        <!-- FASTQ input(s) and options specifically for paired-end data. -->
        <conditional name="singlePaired">
            <param name="sPaired" type="select" label="Single ended or mate-pair ended reads in this library?">
              <option value="single">Single-end</option>
              <option value="paired">Paired-end (as individual datasets)</option>
              <option value="paired_collection">Paired-end (as collection)</option>
            </param>
            <when value="single">
                <param format="fastqsanger,fastq,fasta" name="input1" type="data" label="RNA-Seq FASTQ file"/>
            </when>
            <when value="paired">
                <param format="fastqsanger,fastq,fasta" name="input1" type="data" label="RNA-Seq FASTQ file, forward reads"
                    help="Nucleotide-space: Must have Sanger-scaled quality values with ASCII offset 33" />
{'fraction_non_alphanumeric': 0.12686567164179105, 'fraction_numerical': 0.0072257758824923, 'mean_word_length': 2.5927659574468085, 'pattern_counts': {'":': 2, '<': 71, '<?xml version=': 0, '>': 77, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '1531609', 'n_tokens_mistral': 2734, 'n_tokens_neox': 2594, 'n_words': 542}