Wednesday, 27 November 2013

GBrowse Bio::DB::BigFile


wget http://hgdownload.cse.ucsc.edu/admin/jksrc.zip
unzip jksrc.zip
cd kent/src/lib
echo $MACHTYPE
x86_64
export MACHTYPE=x86_64
make CXXFLAGS=-fPIC CFLAGS=-fPIC CPPFLAGS=-fPIC
cd..
export KENT_SRC=`pwd`
sudo perl -MCPAN -e 'install Bio::DB::BigFile'

Thursday, 31 October 2013

Simple awk function to read file line by line and merge columns using unique id

Here is the input:

MA_9270965g0010 PF00010 Helix-loop-helix DNA-binding domain
MA_10437060g0010        PF00082;PF05922 Subtilase family;Peptidase inhibitor I9



Here is the function:
#Start reading file line by line using tab field seperator
awk 'BEGIN{FS="\t"}{
 #split second and third column by ";"
 second_field_array_length=split($2,second_field_array,";");
 third_field_array_length=split($3,third_field_array,";");
 concat_str="";
 #Loop the second column array and merge with 3rd column consecutive element
 for(i=1;i<=second_field_array_length;i++){
  #concat with ";" when count is greater than 0
  if(i>1){
   concat_str=concat_str";"second_field_array[i]"-"third_field_array[i]
  }else{
   concat_str=second_field_array[i]"-"third_field_array[i]
  }
 }
print $1,concat_str
}' Pabies1.0-Pfam-update.txt | head


Here is the output:

MA_9270965g0010 PF00010-Helix-loop-helix DNA-binding domain
MA_10437060g0010 PF00082-Subtilase family;PF05922-Peptidase inhibitor I9


Saturday, 23 February 2013

Galaxy Bowttie/BWA/BLAST tools/dataset restricted access per user

Add following line to bowtie_wrapper.xml/bwa_wrapper.xml 
--email=$__user_email__ 

Add following lines to bowtie_wrapper.py/bwa_wrapper.py 
parser.add_option( '', '--email', dest='email', help='email' ) 

Above line should add before the options, args) = parser.parse_args() line After the stdout = '' add following lines.
if options.ref in "[dataset paths]" :
  if options.email in "[email addresses]":
    sys.stdout.write( 'Permission granted! ' )
  else:
    stop_err( 'You dont have permissions!' ) 
else: 
 sys.stdout.write( 'Permission granted! ' ) 

Retart the Galaxy! Now you can restrcit tool datasets per user without having two Galaxy instances.

/Chanaka

Tuesday, 5 February 2013

Symlink all files from a base directory to a target directory


for f in $(ls -d /base/*); do ln -s $f /target; done && ls -al /target