@@ -694,7 +694,7 @@ sub get_profile_breakpoints_command {
694
694
return ($bkpt_command );
695
695
}
696
696
697
- # format command to run dinucleotide profiling
697
+ # format command to run dinucleotide profiling on 'normal' size fragments
698
698
sub get_dinucleotide_profiling_command {
699
699
my %args = (
700
700
id => undef ,
@@ -747,6 +747,59 @@ sub get_dinucleotide_profiling_command {
747
747
return ($din_command );
748
748
}
749
749
750
+ # format command to run dinucleotide profiling on 'short' fragments
751
+ sub get_dinucleotide_profiling_short_command {
752
+ my %args = (
753
+ id => undef ,
754
+ bedpe => undef ,
755
+ outdir => undef ,
756
+ @_
757
+ );
758
+
759
+ my $output_stem = join (' /' , $args {outdir }, $args {id });
760
+
761
+ # format bedpe to bed
762
+ my $din_command = " # convert bedpe to bed" ;
763
+ $din_command .= " \n echo '>>> Running dinucleotide_format_bedpe.R <<<'" ;
764
+ $din_command .= " \n\n " . join (' ' ,
765
+ " Rscript $fragmentomics_code_dir /dinucleotide/scripts/dinucleotide_format_bedpe.R" ,
766
+ ' --id' , $args {id },
767
+ ' --bedpe' , $args {bedpe },
768
+ ' --outdir' , $args {outdir }
769
+ );
770
+
771
+ # get fasta sequences
772
+ $din_command .= " \n\n # extract fasta sequences" ;
773
+ $din_command .= " \n echo '>>> Running bedtools getfasta <<<'" ;
774
+ $din_command .= " \n\n " . join (' ' ,
775
+ ' bedtools getfasta' ,
776
+ ' -bedOut -fi' , $reference ,
777
+ ' -bed' , $output_stem . ' .bed' ,
778
+ ' >' , $output_stem . ' _fasta.bed'
779
+ );
780
+
781
+ # convert fasta to end motif context frequencies
782
+ $din_command .= " \n\n # run dinucleotide context profiling" ;
783
+ $din_command .= " \n echo '>>> Running dinucleotide_get_contexts.R <<<'" ;
784
+ $din_command .= " \n\n " . join (' ' ,
785
+ " Rscript $fragmentomics_code_dir /dinucleotide/scripts/dinucleotide_get_contexts_short.R" ,
786
+ " --id" , $args {id },
787
+ " --fasta" , $output_stem . ' _fasta.bed' ,
788
+ " --outdir" , $args {outdir }
789
+ );
790
+
791
+ # remove intermediate files
792
+ $din_command .= " \n\n # check for completeness and remove intermediates" ;
793
+ $din_command .= " \n " . join (" \n " ,
794
+ ' if [[ -f ' . $output_stem . ' _contexts.txt ]]; then' ,
795
+ " echo '>>> Dinucleotide Profiling completed successfully! <<<'" ,
796
+ ' rm ' . $output_stem . ' *.bed*' ,
797
+ ' fi'
798
+ );
799
+
800
+ return ($din_command );
801
+ }
802
+
750
803
# ## MAIN ###########################################################################################
751
804
sub main {
752
805
my %args = (
@@ -1628,7 +1681,7 @@ sub main {
1628
1681
outdir => $di_directory
1629
1682
);
1630
1683
1631
- my $dinucleotide_cmd_part2 = get_dinucleotide_profiling_command (
1684
+ my $dinucleotide_cmd_part2 = get_dinucleotide_profiling_short_command (
1632
1685
id => $tumour_stem . ' _len150' ,
1633
1686
bedpe => $short_bedpe ,
1634
1687
outdir => $di_directory
0 commit comments