<commit_before>%% =============================================================================
%% Task definitions
%% =============================================================================

% gunzip
deftask gunzip( out( File ) : gz( File ) )in bash *{
  gzip -c -d $gz > $out
}*

% FastQC
deftask fastqc( zip( File ) : fq( File ) )in bash *{
    fastqc -f fastq --noextract -o ./ $fq
    zip=`ls *.zip`
}*

% SAMtools
deftask samtools-faidx( fai( File ) : fa( File ) )in bash *{
  samtools faidx $fa
  fai=$fa.fai
}*

deftask tabix( tbi( File ) : vcf( File ) )in bash *{
  tabix $vcf
  tbi=$vcf.tbi
}*

% BWA
deftask bwa-build( idx( File ) : fa( File ) )in bash *{
  idx=bwaidx.tar
  bwa index -p bwaidx $fa
  tar cf $idx --remove-files bwaidx.*
}*

deftask bwa-align( bam( File ) : idx( File ) [fq1( File ) fq2( File ) group] )in bash *{
  tar xf $idx
  bwa mem -R "@RG\tID:group${group}\tSM:sample1\tPL:illumina\tLB:lib1\tPU:unit1" bwaidx $fq1 $fq2 -t 4 | samtools view -b - > $bam
}*

% Picard tools
deftask picard-sort( sortedbam( File ) : bam( File ) )in bash *{
  picard SortSam I=$bam O=$sortedbam SO=coordinate
}*

deftask picard-merge( mergedbam( File ) : <bam( File )> )in bash *{
  picard MergeSamFiles I=$bam SO=coordinate AS=true O=$mergedbam
}*

deftask picard-dedup( dedupbam( File ) dedupmetrics( File ) : bam( File ) ) in bash *{
  dedupbam=dedup.bam
  picard MarkDuplicates I=$bam O=$dedupbam METRICS_FILE=$dedupmetrics
}*

deftask picard-dict( dict( File ) : fa( File ) )in bash *{
  ln -s $fa ref.fa
  picard CreateSequenceDictionary REFERENCE=ref.fa OUTPUT=$dict
}*

deftask picard-bai( bai( File ) : bam( File ) )in bash *{
  picard BuildBamIndex I=$bam O=$bai
}*

% GATK
deftask gatk-createtarget(
    interval( File )
  : [fa( File ) fai( File ) dict( File )] [bam( File ) bai( File )]
    <known( File )> <tbi( File )> )in bash *{<commit_msg>Workflow updated.<commit_after>%% =============================================================================
%% Task definitions
%% =============================================================================

% gunzip
deftask gunzip( out( File ) : gz( File ) )in bash *{
  out=unzipped_${gz%.gz}
  gzip -c -d $gz > $out
}*

% FastQC
deftask fastqc( zip( File ) : fq( File ) )in bash *{
    fastqc -f fastq --noextract -o ./ $fq
    zip=`ls *.zip`
}*

% SAMtools
deftask samtools-faidx( fai( File ) : fa( File ) )in bash *{
  samtools faidx $fa
  fai=$fa.fai
}*

deftask tabix( tbi( File ) : vcf( File ) )in bash *{
  tabix $vcf
  tbi=$vcf.tbi
}*

% BWA
deftask bwa-build( idx( File ) : fa( File ) )in bash *{
  idx=bwaidx.tar
  bwa index -p bwaidx $fa
  tar cf $idx --remove-files bwaidx.*
}*

deftask bwa-align( bam( File ) : idx( File ) [fq1( File ) fq2( File ) group] )in bash *{
  tar xf $idx
  bam=aligned_reads.bam
  bwa mem -R "@RG\tID:group${group}\tSM:sample1\tPL:illumina\tLB:lib1\tPU:unit1" bwaidx $fq1 $fq2 -t 4 | samtools view -b - > $bam
}*

% Picard tools
deftask picard-sort( sortedbam( File ) : bam( File ) )in bash *{
  sortedbam=sorted.bam
  picard SortSam I=$bam O=$sortedbam SO=coordinate
}*

deftask picard-merge( mergedbam( File ) : <bam( File )> )in bash *{
  mergedbam=merged.bam
  picard MergeSamFiles I=$bam SO=coordinate AS=true O=$mergedbam
}*

deftask picard-dedup( dedupbam( File ) dedupmetrics( File ) : bam( File ) ) in bash *{
  dedupbam=dedup.bam
  picard MarkDuplicates I=$bam O=$dedupbam METRICS_FILE=$dedupmetrics
}*

deftask picard-dict( dict( File ) : fa( File ) )in bash *{
  ln -s $fa ref.fa
  dict=$fa.dict
  picard CreateSequenceDictionary REFERENCE=ref.fa OUTPUT=$dict
}*

deftask picard-bai( bai( File ) : bam( File ) )in bash *{
  bai=$bam.bai
  picard BuildBamIndex I=$bam O=$bai
}*

% GATK
deftask gatk-createtarget(
    interval( File )
  : [fa( File ) fai( File ) dict( File )] [bam( File ) bai( File )]
    <known( File )> <tbi( File )> )in bash *{
{'fraction_non_alphanumeric': 0.22603092783505155, 'fraction_numerical': 0.004123711340206186, 'mean_word_length': 3.8451935081148565, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, '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': '6975805', 'n_tokens_mistral': 1651, 'n_tokens_neox': 1573, 'n_words': 409}