Monday 10 February 2014

Downloading scientific papers from UL



 Recently the policy of the UL library has changed and right now it is not possible to directly download the scientific papers just by clicking on "Full text". 

So, if you want to download, let's say, this paper (http://www.sciencemag.org/content/343/6171/624.full.pdf) you should connect to the web site of the UL library (http://www.bibl.ulaval.ca/services/acces-aux-ressources-electroniques), generate a link, copy it on a new tab, click enter. After that you can finally read your paper. 

I was tired of all these tabs and links! So, today I spent 30 minutes of my life to write a small php page where you provide the URL of your article and you are directly redirected to the paper you want to read (you do not need to generate links, open tabs, etc.). I am aware it is not a big improvement, but I find it cool and can be useful for some people! Here is the address: http://www.bio.ulaval.ca/landrylab/shir/

If you know other (and faster ways) to download the papers, please keep me posted! :)

Here is a screenshot of Shir:


Wednesday 5 February 2014

Perl and object oriented programming

When you program and you want to write some code you can reuse, it is always a good practice to use an object oriented approach for your code. Today I realized that I never follow this rule when I program in Perl, because I am not so familiar with the oo synthax for this programming language. So I decided to fill this gap and I wrote a small program to convert a some files containing sequence alignements arranged in a pretty strange format to classic (and readable) fasta files. Here is the result of my experiment (I simplified a lot my script!). I hope someone will find it useful!

 The main script:
 
#!/usr/bin/perl 
 
#Perl will search for packages in the current directory
push(@INC,'.'); 

#I load the package Covertcsv
use Convertcsv; 
 
#I create a new object Convertcsv 
$obj=Convertcsv->new(); 
 
#I call the method csv2fasta 
$obj->csv2fasta("a.txt","b.fasta");



And the package Convertcsv.pm:

#!/usr/bin/perl 
 
#this is the package Convertcsv 
package Convertcsv;
use strict; 
 
#constructor 
sub new{
 my $this={};
 bless $this;
 return $this;
} 
 
#method 
sub csv2fasta{
 my $this = shift;

 my($file_input,$file_output)=@_;

 #code to convert the files

}

 

After all it is easy to work with objects in Perl too! :)