Showing posts with label bioperl. Show all posts
Showing posts with label bioperl. Show all posts

Monday, July 27, 2015


It's that time of year again!! Just when you've finished ripping your hair out instailling BioPerl on Mavericks, Mac decides that it is not pissing off its users enough and decides to upgrade its operating system. And just when you can't take the notifications any longer, you are faced with that critical decision: jeapardize the security of your system for the sake of never having to reinstall bioperl, or update the OSX and know that the impending doom of reinstalling bioperl lingers--waiting to ruin your afternoon.

Well, it did just that! After hundreds of attempts to try to find the missing YAML library, I had to resort to installing perlbrew, which I did once, and it didn't work for me, but then I tried a different aspect of implementing the implementation in perlbrew several hours later, and it happened to work. If you are having serious trouble from the suggested cpan installation, give this a try:

curl -L http://install.perlbrew.pl | bash
source ~/perl5/perlbrew/etc/bashrc #and put this in your .bash_profile

#now we are going to pretend like we are in cpan, but we have to give ourselves permission first
#change your user name from mine (in pink)
sudo chown loloyohe /Users/loloyohe/.cpanm

#install cpanm
perlbrew install-cpanm

#install the builder from CPAN--oh, NOW it knows where YAML is!!!! >:|
sudo cpanm install Module::Build

#nothing really prints to screen, but it works!
#visit https://www.cpan.org/authors/id/C/CJ/CJFIELDS/ to get the latest version
sudo cpanm install CJFIELDS/BioPerl-1.6.923.tar.gz

#test to see if it works!
perl -MBio::Seq -e 0

Naturally, you will likely not have any of the same issues as me but a completely unique set of horrific issues specific to you! 

Wednesday, December 3, 2014


Gave in and installed the new blast+ using homebrew.

The sequence can have no newlines and needs to have a FASTA specific header:
head /Volumes/Ruficollis/ORA_annotations/C_sowelli_ORs_nonewline.fasta
>gb|deg7180000002010|OR7
CTGCACTCACCTATG....
>gb|deg7180000002011|OR51_PSEUDOGENE

sudo makeblastdb -in /Volumes/Ruficollis/ORA_annotations/C_sowelli_ORs_nonewline.fasta -out C_sowelli_ORS_blastdb -dbtype nucl -parse_seqids


awk '{if (substr($0,1,1)==">"){print "\n"$0} else printf("%s",$0);p++;}END{print "\n"}' DR_091_Mobl_MOE_assembled.fasta > joined.fasta

renamed_DR_013_Mored_MOE fasta:
>gnl|some_ID|gene129

Still didn't work.
OKAY GRUMBLE!!!! BLAST AND ITS ARCHAIC WAY OF LIFE >_<

perl ~/ora-1.9.1/scripts/or.pl -sequence DR_004_Arjam_MOE_assembled.part-01.fasta -a -d 

------------- EXCEPTION: Bio::Root::Exception -------------
MSG: die in _initialize, hmm profile not found at /Volumes/Ruficollis/ORA_annotations/to_analyze/or.hmm

It doesn't like not being in its home directory when running the perl script.
perl or.pl -sequence /Volumes/Ruficollis/ORA_annotations/to_analyze/DR_004_Arjam_MOE_assembled.part-01.fasta -a -d >/Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs_pt1.fasta

Okay so this finally worked. Now time to get hacky. With all of my sequence data I get this annoying perl file open error:


Too many open files at /Library/Perl/5.16/Bio/ORA.pm line 524.

ulimit -a
The OS limits the number of files that perl can open at one time.
ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited

We see that the max is 256. From what I've read on a Mac OSX the max is 1024--but PLEASE someone correct me if I'm wrong.

ulimit -n 1024

Just to be safe, I am going to split my sequence data into 100 fasta files each:
perl ~/Scripts/fasta-splitter.pl DR_004_Arjam_MOE_assembled.fasta -n-parts 100
perl ~/Scripts/fasta-splitter.pl DR_011_Arjam_VNO_assembled.fasta -n-parts 100
perl ~/Scripts/fasta-splitter.pl DR_013_Mored_MOE_assembled.fasta -n-parts 100
perl ~/Scripts/fasta-splitter.pl DR_013_Mored_VNO_assembled.fasta -n-parts 100
perl ~/Scripts/fasta-splitter.pl DR_091_Mobl_MOE_assembled.fasta -n-parts 100

Then run the ORA pipeline in a shell script for each file. AND THEN cat them all together. Yes, I know..very hacky.

#this must be run from within the ORA scripts folder so it can access all of the HMM folders at once

sh run_ORA_DR_004MOE.sh

#What does this shell script look like?
#!/bin/bash
perl or.pl -sequence /Volumes/Ruficollis/ORA_annotations/to_analyze/DR_004_Arjam_MOE_assembled.part-001.fasta -a -d >/Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs_pt1.fasta
perl or.pl -sequence /Volumes/Ruficollis/ORA_annotations/to_analyze/DR_004_Arjam_MOE_assembled.part-002.fasta -a -d >/Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs_pt2.fasta
perl or.pl -sequence /Volumes/Ruficollis/ORA_annotations/to_analyze/DR_004_Arjam_MOE_assembled.part-003.fasta -a -d >/Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs_pt3.fasta
....
perl or.pl -sequence /Volumes/Ruficollis/ORA_annotations/to_analyze/DR_004_Arjam_MOE_assembled.part-100.fasta -a -d >/Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs_pt100.fasta

cat /Volumes/Ruficollis/ORA_annotations/to_analyze/to_cat/DR_004_ORs* >> /Volumes/Ruficollis/ORA_annotations/DR_004_Arjam_MOE_ORs.fasta

Okay if that doesn't do the trick then I will be letting out another very loud grumble!

Wednesday, July 2, 2014

Plans for today:

[1] Find missing data for high school student
[2] Figure out how to teach RaxML to a high school student (JW slides) COMPLETE
[3] Get Gazey-Staley algorithm set up in R and running. COMPLETE
      -Okay, so we don't actually have to do this step, as its just a measure of cloning success (and since we didn't clone. We don't really need to measure this. What we do need to measure (but not right away, is the # of sequences (reads) v. # genes (unique contigs). This will tell us if we have sampled enough of the genome for the OR genes given our degenerate primers.

Anyways, to download the R code for the Gazey-Staley algorithm along with a heterogeneity test (with very good documentation), visit:
http://batlab.ucd.ie/~spuechmaille/

[4] Figure out most recent problem with babbler paper.
[5] Set up ORA pipeline COMPLETE
____________________________________________
To install ORA (after having install BioPerl, HMMER, and FASTA), download the .zip file from:
http://search.cpan.org/~ceratites/ora-1.9.1/lib/Bio/ORA.pm#DRIVER_SCRIPT

Unzip and navigate to the ORA folder.

#run the perl script to make the "makefile"

perl Makefile.PL
sudo make install
perl Build.PL

WOOOOHOOOO got it working.
There are two main issues (assuming you have everything installed).
1) You must run the perl script in the /ora-*/scripts folder because it must access the .hmm files
2) When you install ORA, it includes the older version of HMMER. The error message you get when you run "or.pl", is: 
...
binary auxfiles are in an outdated HMMER format (3/b); please hmmpress your HMM file again

To fix this, do the following (assuming you have HMMER installed).
-In the /ora-*/scripts folder, there should be several files related to HMMER
Delete the following: or.hmm.h3f     or.hmm.h3i     or.hmm.h3m     or.hmm.h3p
On the command line, type:
hmmpress or.hmm

That should fix things.

To run the ORA:
perl or.pl --sequence ~/Documents/Analyses/Carrollia_OR/GPC-trim.deg.fasta
#still playing with all of the fun parameters

Now I need to trim the data of a certain length.
By the end of the weekend, it would be great to make a tree from the sequences.

Thursday, June 12, 2014

Going to install the Olfactory Receptor family Assigner (http://search.cpan.org/~ceratites/ora-1.9.1/lib/Bio/ORA.pm#SEE_ALSO)

Downloaded the .gz.tar

Install Bioperl.

#need to find out version of perl
perl -v
# it is v.5.16.2

#woops of course you have to install fink
http://www.finkproject.org/download/index.php?phpLang=en

#of course there is no fink installation for macs OS > 10.8
# http://www.bioperl.org/wiki/Installing_BioPerl_on_Mac_OSX
#following general installation on unix
# http://www.bioperl.org/wiki/Installing_BioPerl_on_Unix

#first install CPAN
perl -MCPAN -e shell #answer a bunch of questions--try to select automate
#CPAN interface will install
cpan>install Bundle::CPAN #a bunch of installing lines happen
#takes several minutes and you have to answer questions in between

cpan>q #quits the CPAN interface

To get the most updated version of BioPerl (which I'm sure I'll regret down the line), install it via cpan (assuming you got cpan working as well).
>perl -MCPAN -e shell
cpan>d /bioperl/
Reading '/home/francisco/.cpan/Metadata'
  Database was generated on Wed, 19 Mar 2014 13:17:02 GMT
Distribution    BOZO/Fry-Lib-BioPerl-0.15.tar.gz
Distribution    CJFIELDS/BioPerl-1.6.923.tar.gz
Distribution    CJFIELDS/BioPerl-DB-1.006900.tar.gz
Distribution    CJFIELDS/BioPerl-Network-1.006902.tar.gz
Distribution    CJFIELDS/BioPerl-Run-1.006900.tar.gz
cpan>install CJFIELDS/BioPerl-1.6.923.tar.gz 
#now a million things will happen and you should run the tests to make
#sure that it worked

Now you have to set up a local module. For some reason this cpan thing seems to work better and they are begging you to use it. What I have highlighted in pink is what you should change for your home directory.

>perl -e shell -MCPAN
cpan>o conf makepl_arg PREFIX=/Users/loloyohe/My_Local_Perl_Modules
cpan>o conf mbuildpl_arg "--prefix /Users/loloyohe/My_Local_Perl_Modules"
cpan>o conf commit

Should be done now!
Test to see if it worked:

Quit cpan and type in your terminal:
>perl -MBio::Seq -e 0

If there are no errors, you have installed it correctly :)