First attempt at script-run-workflow
This commit is contained in:
69
workflow/templates/qhtcp/Code/RenameFiles2.sh
Normal file
69
workflow/templates/qhtcp/Code/RenameFiles2.sh
Normal file
@@ -0,0 +1,69 @@
|
||||
#ReNameFiles2.sh renames files in the /ZScores and /QC folders of each EXP_ to reflect the user labeling of the Exp_'s
|
||||
#The ZScores_Interaction.csv file is required by many processes and therefore its name must be preserved
|
||||
pwd
|
||||
#Preserve ZScores_Interaction.csv in ZScores_Interaction.csvx temporary file
|
||||
cp ZScores_Interaction.csv ZScores_Interaction.csvx
|
||||
#Determine which /Exp_ this script is called from
|
||||
cd ../
|
||||
ExpDir="${PWD##*/}"
|
||||
cd ZScores
|
||||
|
||||
if [ "$ExpDir" = "Exp1" ];then j=1;fi #Cannot have spaces in declaratives. Must have spaces in compare statements
|
||||
if [ "$ExpDir" = "Exp2" ];then j=2;fi #Must use j to make value an integer
|
||||
if [ "$ExpDir" = "Exp3" ];then j=3;fi
|
||||
if [ "$ExpDir" = "Exp4" ];then j=4;fi
|
||||
echo $j #j makes value an integer for use in the following extraction of data from StudyInfo.csv spreadsheet
|
||||
#-------------
|
||||
#Extract the user's experiment Name stored in StudyInfo.csv found in../Code folder
|
||||
eCollection=( $(cut -d ',' -f2 ../../Code/StudyInfo.csv) )
|
||||
expName="${eCollection[$j]}"
|
||||
echo $expName
|
||||
|
||||
#Remove double quotes that are an artifact of the .csv spreadsheet cells
|
||||
temp=`echo $expName | sed 's/.\(.*\)/\1/' | sed 's/\(.*\)./\1/'`
|
||||
expName=$temp
|
||||
echo $expName #display the extracted user experiment label without the double quotes
|
||||
|
||||
#Rename csv files
|
||||
#The Sumary...csv files have a leading "white space" that the basename removes. Therefore must directly rename the #Summary files without the whitespace.
|
||||
mv " "SummaryStats_BackgroundStrains.csv SummaryStats_BackgroundStrains.csv
|
||||
mv " "SummaryStats_ALLSTRAINS.csv SummaryStats_ALLSTRAINS.csv
|
||||
for i in $(ls *.csv); do
|
||||
mv $i $(basename $i .csv)___$expName.csv
|
||||
done
|
||||
|
||||
#restore ZScores_Interaction.csv
|
||||
mv ZScores_Interaction.csvx ZScores_Interaction.csv
|
||||
|
||||
#Rename pdf files
|
||||
for i in $(ls *.pdf); do
|
||||
mv $i $(basename $i .pdf)___$expName.pdf
|
||||
done
|
||||
|
||||
#Rename .html files
|
||||
for i in $(ls *.html); do
|
||||
mv $i $(basename $i .html)___$expName.html
|
||||
done
|
||||
|
||||
pwd
|
||||
echo $expName
|
||||
|
||||
#Rename csv files
|
||||
cd QC #Step into the ../QC directory
|
||||
#Rename csv files#Rename csv files
|
||||
for i in $(ls *.csv); do
|
||||
mv $i $(basename $i .csv)___$expName.csv
|
||||
done
|
||||
#Rename pdf files
|
||||
for i in $(ls *.pdf); do
|
||||
mv $i $(basename $i .pdf)___$expName.pdf
|
||||
done
|
||||
#Rename .html files
|
||||
for i in $(ls *.html); do
|
||||
mv $i $(basename $i .html)___$expName.html
|
||||
done
|
||||
|
||||
cd .. #Return to ../ZScores folder
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user