#!/usr/bin/perl -w 

@list = qw(
2AB_1_BC1.fastq.sam
2AB_2_BC2.fastq.sam
2AB_T_BC3.fastq.sam
45_2_BC5.fastq.sam
45a_1_BC4.fastq.sam
45b_1_BC6.fastq.sam
91a_1_BC7.fastq.sam
91a_2_BC8.fastq.sam
91b_1_BC9.fastq.sam
91b_2_BC10.fastq.sam
);


# maxintorn.pl
# co200.sr_2AB_1_BC1_sorted.bed


foreach $a (@list){
system("samtools view -Sb demultiplexed_trimmed_minimap/sr_$a > tmp.bam");
$a =~ s/\.fastq\.sam//;
system("samtools sort tmp.bam > sr_$a\_sorted.bam");
system("samtools index sr_$a\_sorted.bam");
system("bedtools bamtobed -bed12 -i sr_$a\_sorted.bam > sr_$a\_sorted.bed ");
print "track type=bam name='$a' description='$a' genome=sacCer3 priority=0.25 visibility=squish maxItems=2500 bigDataUrl=http://intron.ucsc.edu/jen/may2021/sr_$a\_sorted.bam \n";


}

