Skip to content

Instantly share code, notes, and snippets.

@nievergeltlab
Created September 5, 2018 16:33
Show Gist options
  • Select an option

  • Save nievergeltlab/b9c2202484202b9f93c1d0f02fe5af3d to your computer and use it in GitHub Desktop.

Select an option

Save nievergeltlab/b9c2202484202b9f93c1d0f02fe5af3d to your computer and use it in GitHub Desktop.
CNV files don't have the name as the actual ID, this extracts the id from the file and lists the filename and id next to eachother. A couple of other functions are in here as well.
#list all files, make folder for each
ls * | grep .idat | awk 'BEGIN{FS="_"}{print $1}' | sort -u > folderlist.txt
for folders in $(cat folderlist.txt)
do
mkdir $folders
done
for files in $(ls * | grep .idat )
do
fmove=$(echo $files | awk 'BEGIN{FS="_"}{print $1}' )
echo "moving $files to $fmove"
mv $files "$fmove"/$files
done
for files in $(ls /oasis/scratch/comet/amaihofer/temp_project/psy2/intensities/ | grep psy2_4)
do
fname=$(cat /oasis/scratch/comet/amaihofer/temp_project/psy2/intensities//$files | awk 'NR==15 {print $2}')
echo $files $fname >> psy2_files.txt
fname=""
done
for files in $(ls /cygdrive/g/broad_download/CVB_PTSD_Roberts_GUTS_PsychChip/idats)
do
f2=$(echo $files | awk 'BEGIN{FS="_"}{print $1}')
#echo "Looking for $files plate in missing plate list "
if grep -q $f2 /cygdrive/g/psy2_3/platelist.txt.txt;
then
echo $f2 found will move
mv /cygdrive/g/broad_download/CVB_PTSD_Roberts_GUTS_PsychChip/idats/$files /cygdrive/g/broad_download/psy2/CVB_PTSD_GUTS_NHS_Idat/idat/g4/.
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment