Posts

Showing posts with the label perl

What are the best ways to start learning bioinformatics for a wet lab biologist?

Image
I came across this question several times. In my real life, I also encountered this question many times. Many time, my friend asked me: “Hey, can I learn Bioinformatics with your? Can you give me some materials? ” At the beginning, I would say: “Sure. Let me know if you need any help.” Then mostly nothing happened after I sent them the web links or e-books. Now if someone ask me the same question, I usually will say: “Are you sure? If you take it seriously, I’ll teach you.” My point here is take it seriously. What is Bioinformatics? Bioinformatics is the science of collection and analyzing complex biological data such as genetics codes. This is the definition given by the first result in Google search. Maybe it’s too abstract to understand. Based on my understanding, I want to talk about Bioinformatics in the following aspects: Software development Maybe the most popular tool is blast . When I was in college, I selected a course called “生物信息学”. The english name is “Bioinformati...

perl2python: Reading files

Table of Contents File Read files HERE documents File Read files •               perl #!/usr/bin/perl -w use   strict ; open  FILE,  " data/test.fa "   or   die   " $! " ; while ( my   $line  =  <FILE>  ){      print   " $line " ; } ## >gene1 ## ATGGCTAGCATCGTACGTCG ## >gene2 ## ATGGCTAGCTACGTACGTAG •               python infile  =   open ( "data/test.fa" ,  'r' ) for  line  in  infile.readlines():   line  =  line.rstrip( ' \n ' )    print  line ## >gene1 ## ATGGCTAGCATCGTACGTCG ## >gene2 ## ATGGCTAGCTACGTACGTAG Here  readline()  reads one line character at a time,  readlines()  reads in the whole file at once and splits it by line. The xreadlines...

Perl2Python: Get the current working path

Perl Cwd can be used to get pathname of current working directory. use Cwd; my $dir = getcwd; Python To get the current working directory use os.getcwd() The question asked for the directory of a given file, so the proper answer is: import os os.path.dirname(os.path.realpath(__file__))

Perl2Python: Get the current working path

Perl Cwd can be used to get pathname of current working directory. use Cwd; my $dir = getcwd; Python To get the current working directory use os.getcwd() The question asked for the directory of a given file, so the proper answer is: import os os.path.dirname(os.path.realpath(__file__))