Friday, October 14, 2016

Find and copy

A quick way to find and list all the presentations and copy them to another directory.

find /home/user/ -type f -name "*.pptx" -exec cp -s --parents \{\} /home/user2/Presentations/ ';'

Thursday, May 19, 2016

Splitting PDB by delimiter

csplit  --prefix=chain --suffix="%1d".pdb 3FDL_Repair.pdb "/^TER/+1" "{*}"

Monday, March 7, 2016

Renaming Files

#!/bin/bash
for file in foo[0-9]*.png; do
  # strip the prefix ("foo") off the file name
  postfile=${file#foo}
  # strip the postfix (".png") off the file name
  number=${postfile%.png}
  # subtract 1 from the resulting number
  i=$((number-1))
  # copy to a new name in a new folder
  cp ${file} ../newframes/$(printf foo%08d.png $i)
done
http://stackoverflow.com/questions/55754/how-to-zero-pad-numbers-in-file-names-wit-a-bash-script

Wednesday, December 30, 2015

Thursday, December 17, 2015

String manipulation with bash

String manipulation with bash

for each in *.txt; do echo ${each/.txt/.pdb};done






${string:position}


paste -d '\n' file1 file2

Thursday, March 13, 2014

Using Rpy2 with Anaconda and Ipython notebook

Typically in ipython notebook, the only command required to print a plot inline is the following:

=====================
%load_ext rmagic
=====================

=====================
%%R 
x<-c(1,2,3)
y<-c(2,3,4)
plot(x,y)
=====================

While working on AWS, my plots would not show up inline. I found out that this is because rpy2 only works for python 2.7.5. 

The easy fix is 

conda install python=2.7.5=2