# automate rnastar index generation
# from existing fasta genomes using limited ram - cut genomeChrbinNbits down to 13, genomeSAindexNbases 12 genomeSAsparseD 1

INDEXROOT=/mnt/galaxyIndices/genomes
# fix that, the list of genomes below and SOURCE below to suit your needs. This is for GVL august 2013
for genome in Arabidopsis_thaliana_TAIR9  ce10  danRer7  dm3  hg19  hg_g1k_v37  mm9  phiX  rn5  sacCer2  sacCer3  xenTro2
do
  SOURCE=${INDEXROOT}/${genome}/seq/
  TARGET=${INDEXROOT}/${genome}/rnastar
  mkdir -p $TARGET
  cd $TARGET
/mnt/galaxy/tools/rnastar/2.3.0e/fubar/rgrnastar_203e/9425706f4e97/bin/STAR --runMode genomeGenerate --genomeDir $TARGET --genomeFastaFiles ${SOURCE}/${genome}.fa --runThreadN 2 genomeLoad=NoSharedMemory --genomeChrBinNbits 13 genomeSAindexNbases 12 genomeSAsparseD 1
done

echo "#add these lines TABS not spaces please to rnastar_indexes.loc in tool-data" > rnastar_indexes.loc
for genome in Arabidopsis_thaliana_TAIR9  ce10  danRer7  dm3  hg19  hg_g1k_v37  mm9  phiX  rn5  sacCer2  sacCer3  xenTro2
do
  SOURCE=${INDEXROOT}/${genome}/seq/
  TARGET=${INDEXROOT}/${genome}/rnastar
  echo ${genome}'\t'${genome}'\t'${genome}'\t'/mnt/galaxyIndices/genomes/${genome}/rnastar >> rnastar_indexes.loc
done
