#We need to get the genome files set up before we can do anything else:
#
cd ScGENOME
source 0README
cd ..

#Get the data:
#
#The file samples.tsv assumes implicitly that the read data are accessible
#in the download/stripeseq directory under the listed file name prefixes.
#If you have NCBI SRA Toolkit installed, the following will download the
#relevant STRIPE-seq read data:
cd downloads/stripeseq
./xgetdata
#If you done have the toolkit installed, follow the instructions below to
#define the singularity shortcut command as $rws, then run xgetdata from
#the toolkit installed in the container:
$rws ./xgetdata
cd ../..

#Let's set up a template Makefile to run the workflow:
#
sed -e "s#{RAWREAD1}.fq#{RAWREAD1}.fastq#; s#{RAWREAD2}.fq#{RAWREAD2}.fastq#;" ../GoSTRIPES/templates/Makefile_Sc >  Makefile_Sc

#And now we set up the sample directories to get the work done:
#
sed -e "s#EXPERIMENT=demo#EXPERIMENT=GSF2268#; s#{READFILESTEM\[i\]}_R1#{READFILESTEM[i]}_1#; s#{READFILESTEM\[i\]}_R2#{READFILESTEM[i]}_2#; " ../GoSTRIPES/templates/xsetup_samples >  xsetup_samples
chmod a+x xsetup_samples
#NOTE: You should adjust the Makefile parameters to choices that are appropriate
#      for your system. As provided, the workflow will run with 8 cores.
./xsetup_samples

#Ok, one more absolutely necessary preparatory step:
#
echo "We must set the rws variable again, as we have moved the gostripes.simg images."
echo "Execute the following (or equivalent) in your working shell:"
echo ""
echo "source ../GoSTRIPES/bin/xworkStripes -b `pwd` -i `pwd`/../gostripes.simg" 
echo ""
