Skip to content

Instantly share code, notes, and snippets.

@allaway
Last active November 4, 2022 14:37
Show Gist options
  • Select an option

  • Save allaway/c06d53e85b830f72576f76d5df910210 to your computer and use it in GitHub Desktop.

Select an option

Save allaway/c06d53e85b830f72576f76d5df910210 to your computer and use it in GitHub Desktop.
Index files that have been copied from EC2 to an S3 bucket on Synapse
#!/bin/bash
# This script assumes you have a copy of files on an EC2 instance, which you have transferred to an S3 bucket, and copies still exist in both locations (local needed for md5sum)
# synindex.py is from https://github.com/Sage-Bionetworks-Workflows/nf-synindex/blob/main/bin/synindex.py
bucket_path=s3://nf-syn28545963-s3-bucket-18czl49o70rsc/rnaseq/
FILES=$(aws s3 ls $bucket_path | awk '{$1=$2=$3=""; print $0}' | sed 's/^[ \t]*//')
LOCAL_FILES_PATH=$HOME/nerves/
pat=".+bam"
for i in $FILES
do
if [[ $i =~ $pat ]]; then
echo $i
$HOME/synindex.py --config $HOME/.synapseConfig --storage_id 41621 --file $LOCAL_FILES_PATH$i --uri $bucket_path$i --parent_id syn43460855
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment