<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Related items]]></title>
	<link>https://bioinformaticsonline.com/related/40768?</link>
	<atom:link href="https://bioinformaticsonline.com/related/40768?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/9242/check-the-size-of-a-directory-free-disk-space</guid>
	<pubDate>Mon, 17 Mar 2014 02:35:32 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/9242/check-the-size-of-a-directory-free-disk-space</link>
	<title><![CDATA[Check the Size of a directory &amp; Free disk space.]]></title>
	<description><![CDATA[<p>The amount of databases we bioinformatician deal are just HUGE &hellip; In such cases, we always need to check our server for free spaces etc. I planned this article to explains 2 simple commands that most bioinformatician want to know when they start using Linux / BioLinux. First: Size of a directory (du) and and second: free disk space that exists on your machine (df).</p><p><br /><strong>'du' &ndash; Check the size of a directory</strong></p><p><br />$ du<br />This command ( du) gives you a list of directories that exist in the current working directory along with their sizes in kilobytes (default). The last line of the output gives you the total size of the current directory including its subdirectories. <br /><br />$ du /home/jin1<br />The above command would give you the directory size of the directory /home/david<br /><br />$ du -h<br />The same &ldquo;du&rdquo;command with some flag gives you a better output than the default one. The option '-h' stands for human readable format. Therefore, in order to print the sizes of the files / directories in your desire notation use this time suffixed with a 'k' if its kilobytes and 'M' if its Megabytes and 'G' if its Gigabytes.<br /><br />$ du -ah<br />If you are interested in checking everything present in a folder use above mentioned command. It gives us not only the directories but also all the files that are present in the current directory. The &ldquo;-a&rdquo; flag displays the filenames along with the directory names in the output. <br /><br />$ du -c<br />This gives you a grand total as the last line of the output. So if your directory occupies 30MB the last 2 lines of the output would be 30M.<br /><br />$ du -s<br />Use this command to displays a summary of the directory size. It is the simplest way to know the total size of the current directory.<br /><br />$ du -S<br />This would display the size of the current directory excluding the size of the subdirectories that exist within that directory. So it basically shows you the total size of all the files that exist in the current directory.<br /><br />$ du --exculde=mp3<br />Several times it required to exclude some directory in our size calculation. In such cases the above command would display the size of the current directory along with all its subdirectories, but it would exclude all the files having the given pattern present in their filenames.</p><p><br /><strong>'df' - finding the disk free space / disk usage</strong><br /><br />$ df<br />Hmmm &hellip; now &ldquo;df&rdquo; command is really useful, and I guess you are going to use it over time. Typing the above command, outputs a table consisting of 6 columns. All the columns are very easy to understand. Remember that the 'Size', 'Used' and 'Avail' columns use kilobytes as the unit. The 'Use%' column shows the usage as a percentage which is also very useful.<br /><br />$ df -h<br />Displays the same output as the previous command but the '-h' indicates human readable format. Hence instead of kilobytes as the unit the output would have 'M' for Megabytes and 'G' for Gigabytes.<br /><br />Example: Linux installed on /dev/hda1<br />$ df -h | grep /dev/hda1</p><p><br />All right, this is not the only option to check the sizes and free spaces but there are a few more options that can be used with 'du' and 'df' . I will discuss it later.<br /><br /></p>]]></description>
	<dc:creator>Jitendra Narayan</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/file/view/87/linux-cheat-sheet</guid>
	<pubDate>Tue, 09 Jul 2013 17:30:04 -0500</pubDate>
	<link>https://bioinformaticsonline.com/file/view/87/linux-cheat-sheet</link>
	<title><![CDATA[Linux Cheat Sheet]]></title>
	<description><![CDATA[<p><span>In an attempt to find a good Linux reference for bioinformatician and BOL readers, I was unsuccessful at finding a decent one on the Internet. So, we decided to make a cheat sheet for biological programmers.</span></p>]]></description>
	<dc:creator>Jitendra Narayan</dc:creator>
	<enclosure url="https://bioinformaticsonline.com/file/download/87" length="81260" type="application/pdf" />
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/9030/linux-ssh-client-commands-for-bioinformatics</guid>
	<pubDate>Thu, 13 Mar 2014 17:16:32 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/9030/linux-ssh-client-commands-for-bioinformatics</link>
	<title><![CDATA[Linux SSH Client Commands for Bioinformatics]]></title>
	<description><![CDATA[<p>Here come on let play with the following basic command line usage of the ssh client.<br /><br /><strong>1. Check your SSH Client Version:</strong><br /><br />Checking for your SSH client is very sare, but sometimes it may be necessary to identify the SSH client that you are currently running and it&rsquo;s corresponding version number. The SSh client can be identified as follows<br /><br />$ ssh -V<br />OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2013<br /><br />$ ssh -V<br />ssh: SSH Secure Shell 3.2.9.1 (non-commercial version) on i686-pc-linux-gnu<br /><br /><strong>2. Connect and login to remote host:</strong></p><p>The First time when you login to the remotehost from a localhost, it will display the host key not found message and you can give &ldquo;yes&rdquo; to continue. The host key of the remote host will be added under .ssh2/hostkeys directory of your home directory, as shown below.<br /><br />localhost$ ssh -l jit remotehost.example.com<br /><br />jit@remotehost.example.com password:</p><p>remotehost.example.com$</p><p>The Second time when you login to the remote host from the localhost, it will prompt only for the password as the remote host key is already added to the known hosts list of the ssh client.<br /><br />localhost$ ssh -l jit remotehost.example.com<br />jit@remotehost.example.com password: <br />remotehost.example.com$<br /><br />For some reason, if the host key of the remote host is changed after you logged in for the first time, you may get a warning message as shown below. This could be because of various reasons such as 1) Sysadmin upgraded/reinstalled the SSH server on the remote host 2) someone is doing malicious activity etc., The best possible action to take before saying &ldquo;yes&rdquo; to the message below, is to call your sysadmin and identify why you got the host key changed message and verify whether it is the correct host key or not.<br /><br />localhost$ ssh -l jit remotehost.example.com<br /><br />jit @remotehost.example.com's password: <br />remotehost$<br /><br /><strong>4. Debug SSH Client:</strong><br /><br />Sometimes it is necessary to view debug messages to troubleshoot any SSH connection issues. For this purpose, pass -v (lowercase v) option to the ssh as shown below.<br /><br />Example without debug message:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localhost$ ssh -l jit remotehost.example.com<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; warning: Connecting to remotehost.example.com failed: No address associated to the name<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; localhost$</p><p>Example with debug message:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; locaclhost$ ssh -v -l jit remotehost.example.com<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug: SshConfig/sshconfig.c:2838/ssh2_parse_config_ext: Metaconfig parsing stopped at line 3.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug: SshConfig/sshconfig.c:637/ssh_config_set_param_verbose: Setting variable 'VerboseMode' to 'FALSE'.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug: SshConfig/sshconfig.c:3130/ssh_config_read_file_ext: Read 17 params from config file.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug: Ssh2/ssh2.c:1707/main: User config file not found, using defaults. (Looked for '/home/jit/.ssh2/ssh2_config')<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; debug: Connecting to remotehost.example.com, port 22... (SOCKS not used)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; warning: Connecting to remotehost.example.com failed: No address associated to</p><p><strong>5. Escape Character: (Toggle SSH session, SSH session statistics etc.)</strong><br /><br />Escape character ~ get&rsquo;s SSH clients attention and the character following the ~ determines the escape command.<br />Toggle SSH Session: When you&rsquo;ve logged on to the remotehost using ssh from the localhost, you may want to come back to the localhost to perform some activity and go back to remote host again. In this case, you don&rsquo;t need to disconnect the ssh session to the remote host. Instead follow the steps below.</p><p>i. Login to remotehost from localhost: localhost$ssh -l jit remotehost<br />ii. Now you are connected to the remotehost: remotehost$<br />iii. To come back to the localhost temporarily, type the escape character ~ and Control-Z. When you type ~ you will not see that immediately on the screen until you press and press enter. So, on the remotehost in a new line enter the following key strokes for the below to work: ~<br /><br />&nbsp;&nbsp;&nbsp; remotehost$ ~^Z<br />&nbsp;&nbsp;&nbsp; [1]+&nbsp; Stopped&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssh -l jit remotehost<br />&nbsp;&nbsp;&nbsp; localhost$</p><p>iv. Now you are back to the localhost and the ssh remotehost client session runs as a typical unix background job, which you can check as shown below:<br /><br />&nbsp;&nbsp;&nbsp; localhost$ jobs<br />&nbsp;&nbsp;&nbsp; [1]+&nbsp; Stopped&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ssh -l jit remotehost<br /><br />v. You can go back to the remote host ssh without entering the password again by bringing the background ssh remotehost session job to foreground on the localhost<br /><br />&nbsp;&nbsp;&nbsp; localhost$ fg %1<br />&nbsp;&nbsp;&nbsp; ssh -l jit remotehost<br />&nbsp;&nbsp;&nbsp; remotehost$</p>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/9639/find-certain-filesdocuments-in-linux-os</guid>
	<pubDate>Sun, 06 Apr 2014 23:56:18 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/9639/find-certain-filesdocuments-in-linux-os</link>
	<title><![CDATA[Find certain files/documents in Linux OS]]></title>
	<description><![CDATA[<p>As bioinformatician I know the fact that we usually handle the large dataset and lost in the huge numbers of files and folders. In order to search the missing file a strong search command is required. The Linux Find Command is one of the most important and much used command in Linux sytems. Find command used to search and locate list of files and directories based on conditions you specify for files that match the arguments. Find can be used in variety of conditions like you can find files by permissions, users, groups, file type, date, size and other possible criteria.<br /><br />Through this article we are sharing our day-to-day Linux find command experience and its usage in the form of examples. In this article we will show you the most used 35 Find Commands examples in Linux. We have divided the section into Five parts from basic to advance usage of find command.</p><p><strong>Part I &ndash; Basic Find Commands for Finding Files with Names</strong><br />1. Find Files Using Name in Current Directory<br /><br />Find all the files whose name is gene.txt in a current working directory.<br /><br /># find . -name gene.txt<br /><br />./gene.txt<br /><br />2. Find Files Under Home Directory<br /><br />Find all the files under /home directory with name gene.txt.<br /><br /># find /home -name gene.txt<br /><br />/home/gene.txt<br /><br />3. Find Files Using Name and Ignoring Case<br /><br />Find all the files whose name is gene.txt and contains both capital and small letters in /home directory.<br /><br /># find /home -iname gene.txt<br /><br />./gene.txt<br />./Gene.txt<br /><br />4. Find Directories Using Name<br /><br />Find all directories whose name is Gene in / directory.<br /><br /># find / -type d -name Gene<br /><br />/Gene<br /><br />5. Find fasta Files Using Name<br /><br />Find all php files whose name is gene.fasta in a current working directory.<br /><br /># find . -type f -name gene.fasta<br /><br />./gene.fasta<br /><br />6. Find all PHP Files in Directory<br /><br />Find all fasta files in a directory.<br /><br /># find . -type f -name "*.fasta"<br /><br />./gene.fasta<br />./cancer.fasta<br />./allgene.fasta<br /><br /><strong>Part II &ndash; Find Files Based on their Permissions</strong><br />7. Find Files With 777 Permissions<br /><br />Find all the files whose permissions are 777.<br /><br /># find . -type f -perm 0777 -print<br /><br />8. Find Files Without 777 Permissions<br /><br />Find all the files without permission 777.<br /><br /># find / -type f ! -perm 777<br /><br />9. Find SGID Files with 644 Permissions<br /><br />Find all the SGID bit files whose permissions set to 644.<br /><br /># find / -perm 2644<br /><br />10. Find Sticky Bit Files with 551 Permissions<br /><br />Find all the Sticky Bit set files whose permission are 551.<br /><br /># find / -perm 1551<br /><br />11. Find SUID Files<br /><br />Find all SUID set files.<br /><br /># find / -perm /u=s<br /><br />12. Find SGID Files<br /><br />Find all SGID set files.<br /><br /># find / -perm /g+s<br /><br />13. Find Read Only Files<br /><br />Find all Read Only files.<br /><br /># find / -perm /u=r<br /><br />14. Find Executable Files<br /><br />Find all Executable files.<br /><br /># find / -perm /a=x<br /><br />15. Find Files with 777 Permissions and Chmod to 644<br /><br />Find all 777 permission files and use chmod command to set permissions to 644.<br /><br /># find / -type f -perm 0777 -print -exec chmod 644 {} \;<br /><br />16. Find Directories with 777 Permissions and Chmod to 755<br /><br />Find all 777 permission directories and use chmod command to set permissions to 755.<br /><br /># find / -type d -perm 777 -print -exec chmod 755 {} \;<br /><br />17. Find and remove single File<br /><br />To find a single file called gene.txt and remove it.<br /><br /># find . -type f -name "gene.txt" -exec rm -f {} \;<br /><br />18. Find and remove Multiple File<br /><br />To find and remove multiple files such as .fa or .gb, then use.<br /><br /># find . -type f -name "*.fa" -exec rm -f {} \;<br /><br />OR<br /><br /># find . -type f -name "*.gb" -exec rm -f {} \;<br /><br />19. Find all Empty Files<br /><br />To file all empty files under certain path.<br /><br /># find /tmp -type f -empty<br /><br />20. Find all Empty Directories<br /><br />To file all empty directories under certain path.<br /><br /># find /tmp -type d -empty<br /><br />21. File all Hidden Files<br /><br />To find all hidden files, use below command.<br /><br /># find /tmp -type f -name ".*"<br /><br /><strong>Part III &ndash; Search Files Based On Owners and Groups</strong><br />22. Find Single File Based on User<br /><br />To find all or single file called gene.txt under / root directory of owner root.<br /><br /># find / -user root -name gene.txt<br /><br />23. Find all Files Based on User<br /><br />To find all files that belongs to user Rahul under /home directory.<br /><br /># find /home -user rahul<br /><br />24. Find all Files Based on Group<br /><br />To find all files that belongs to group Developer under /home directory.<br /><br /># find /home -group developer<br /><br />25. Find Particular Files of User<br /><br />To find all .txt files of user Rahul under /home directory.<br /><br /># find /home -user rahul -iname "*.txt"<br /><br /><strong>Part IV &ndash; Find Files and Directories Based on Date and Time</strong><br />26. Find Last 50 Days Modified Files<br /><br />To find all the files which are modified 50 days back.<br /><br /># find / -mtime 50<br /><br />27. Find Last 50 Days Accessed Files<br /><br />To find all the files which are accessed 50 days back.<br /><br /># find / -atime 50<br /><br />28. Find Last 50-100 Days Modified Files<br /><br />To find all the files which are modified more than 50 days back and less than 100 days.<br /><br /># find / -mtime +50 &ndash;mtime -100<br /><br />29. Find Changed Files in Last 1 Hour<br /><br />To find all the files which are changed in last 1 hour.<br /><br /># find / -cmin -60<br /><br />30. Find Modified Files in Last 1 Hour<br /><br />To find all the files which are modified in last 1 hour.<br /><br /># find / -mmin -60<br /><br />31. Find Accessed Files in Last 1 Hour<br /><br />To find all the files which are accessed in last 1 hour.<br /><br /># find / -amin -60<br /><br /><strong>Part V &ndash; Find Files and Directories Based on Size</strong><br />32. Find 50MB Files<br /><br />To find all 50MB files, use.<br /><br /># find / -size 50M<br /><br />33. Find Size between 50MB &ndash; 100MB<br /><br />To find all the files which are greater than 50MB and less than 100MB.<br /><br /># find / -size +50M -size -100M<br /><br />34. Find and Delete 100MB Files<br /><br />To find all 100MB files and delete them using one single command.<br /><br /># find / -size +100M -exec rm -rf {} \;<br /><br />35. Find Specific Files and Delete<br /><br />Find all .gb files with more than 10MB and delete them using one single command.<br /><br /># find / -type f -name *.gb -size +10M -exec rm {} \;</p>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/11735/search-shell-command-history</guid>
	<pubDate>Thu, 12 Jun 2014 17:43:34 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/11735/search-shell-command-history</link>
	<title><![CDATA[Search Shell Command History]]></title>
	<description><![CDATA[<p>We use couple of hundreads of command in daily basis. Most of them are actually repeated several time. The question remain open how do I search old command history under bash shell and modify or reuse it? <br /><br />Now a days almost all modern shell allows you to search command history if enabled by user. Use history command to display the history list with line numbers. Lines listed with with a * have been modified by user.</p><p><br /><strong>Shell history search command</strong><br /><br />Type history at a shell prompt:<br />$ history</p><p>It will display the list of all used commandline history with an serial number.<br /><br />To search particular command, enter:<br />$ history | grep command-name<br />$ history | egrep -i 'scp|ssh|ftp'<br />Emacs Line-Edit Mode Command History Searching<br /><br />To get previous command containing string, hit [CTRL]+[r] followed by search string:<br /><br />(reverse-i-search): <br /><br />To get previous command, hit [CTRL]+[p]. You can also use up arrow key.<br /><br />CTRL-p<br /><br />To get next command, hit [CTRL]+[n]. You can also use down arrow key.<br /><br />CTRL-n<br /><br /></p><p><strong>fc command</strong></p><p>Apart from hostory command there are fc command to extract the command from history. The fc stands for either "find command" or "fix command.</p><p>For example list last 10 command, enter:<br />$ fc -l 10<br />To list commands 130 through 150, enter:<br />$ fc -l 130 150<br />To list all commands since the last command beginning with ssh, enter:<br />$ fc -l ssh<br />You can edit commands 1 through 5 using vi text editor, enter:<br />$ fc -e vi 1 5</p><p><strong>Delete command history</strong><br /><br />The -c option causes the history list to be cleared by deleting all of the entries:<br />$ history -c</p>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/34864/installing-perl-environment-on-linux</guid>
	<pubDate>Tue, 26 Dec 2017 21:21:50 -0600</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/34864/installing-perl-environment-on-linux</link>
	<title><![CDATA[Installing Perl environment on Linux]]></title>
	<description><![CDATA[<p>By using&nbsp;<code>plenv</code>, you can easily install and switch among different version of Perl. This will be installed under your home directory in<code>~/.plenv</code>.</p><h4>Install latest Perl (with supporting multithreading) and CPANMinus.</h4><pre><code> $ cd
 $ git clone git://github.com/tokuhirom/plenv.git ~/.plenv
 $ git clone git://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
 $ echo 'export PATH="$HOME/.plenv/bin:$PATH"' &gt;&gt; ~/.bashrc
 $ echo 'eval "$(plenv init -)"' &gt;&gt; ~/.bashrc
 $ source ~/.bashrc
 $ plenv install 5.18.1 -Dusethreads
 $ plenv rehash
 $ plenv global 5.18.1
 $ plenv install-cpanm
</code></pre><ul>
<li><code>git</code>&nbsp;is a distributed revision control and source code management software which can help you to download files from GitHub server.</li>
<li><code>echo</code>&nbsp;means "print".</li>
<li><code>&gt;&gt;</code>&nbsp;means adding the output into the end of the file, while&nbsp;<code>&gt;</code>&nbsp;means adding the output by overwriting the whole file. Please use<code>&gt;</code>&nbsp;with additional cares.</li>
<li>In Linux system, there are two types of outputs when you execute a command. One is called standard output (or sometimes STDOUT for short), and the other is a standard error (STDERR).&nbsp;<code>1&gt;</code>&nbsp;is for STDOUT only,&nbsp;<code>2&gt;</code>&nbsp;is for STDERR only, and&nbsp;<code>&amp;&gt;</code>means for both. In default&nbsp;<code>&gt;</code>&nbsp;is the same to&nbsp;<code>1&gt;</code>.</li>
<li><code>exec</code>&nbsp;is execution.</li>
<li>Remember to install Perl in supporting multithreading (with option&nbsp;<code>-Dusethreads</code>), which is important for many NGS analysis packages (e.g. Trinity). In this setting, you can use multiple CPU for Perl software.</li>
<li>Install the CPAN (Comprehensive Perl Archive Network) manager software, CPANMinus, by&nbsp;<code>install-cpanm</code>.</li>
</ul><p>You can use&nbsp;<code>plenv global</code>&nbsp;and&nbsp;<code>plenv local</code>&nbsp;to change the different version of Perl to fulfil different needs of your Perl software.</p><p>For example, if the&nbsp;specific version of Perl is not compatible with your script, you can switch to the different version by:</p><pre><code> $ plenv local 
</code></pre><ul>
<li>It is similar to set the local version of your script language when you use&nbsp;<code>pyenv</code>&nbsp;and&nbsp;<code>rbenv</code>&nbsp;as the following.</li>
</ul><p>Put the following path into&nbsp;<code>~/.bashrc file</code>.</p><pre><code>export PERL5LIB="$HOME/.plenv/build/perl-5.18.1/lib"
</code></pre><h4>Install BioPerl and PerlIO::gzip</h4><p>CPANMinus is a very good Perl module manager, use&nbsp;<code>cpanm</code>&nbsp;to install BioPerl can save you a lot of time. Here are some useful modules:</p><pre><code>$ cpanm Bio::Perl
$ cpanm Bio::SearchIO
$ cpanm PerlIO::gzip<br /></code></pre><p><span>For more information, please visit:&nbsp;</span><a href="https://github.com/tokuhirom/plenv">https://github.com/tokuhirom/plenv</a></p><pre><code>&nbsp;</code></pre>]]></description>
	<dc:creator>biogeek</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/37627/setting-python-version-as-default-on-linux</guid>
	<pubDate>Tue, 04 Sep 2018 10:15:47 -0500</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/37627/setting-python-version-as-default-on-linux</link>
	<title><![CDATA[Setting python version as default on Linux]]></title>
	<description><![CDATA[<p>If you have a later version than 2.6 you'll need to set 2.6 as the default Python. Later versions would be 2.7 and 3.1; see what you have by typing</p><pre>python -V
</pre><p><span>at the terminal. For purposes of this example we'll assume you have 3.1 installed. You'll next need to execute the following commands:</span></p><p>&nbsp;</p><pre>sudo apt-get install python2.6 idle-python2.6
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.1 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 10
sudo update-alternatives --config python
</pre><p>This last command will allow you to choose which version of python to use by default. If you have done everything above correctly, python2.6 should already be set as the default. If it is not, choose it to be the default. From now on, running python should start version 2.6.</p><div><p>Undoing These Changes</p><p>In some cases (e.g., installing or updating certain packages), you'll get an error message if you've run the commands above. To update these packages, you'll have to temporarily undo these changes. Here's how to do that:</p><pre>sudo update-alternatives --remove-all python
sudo ln -s python3.1 /usr/bin/python
</pre><p>Once you're done updating these packages, execute the commands at the top to set python2.6 as the default again.</p></div>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/42003/perl-one-liner-for-beginners</guid>
	<pubDate>Fri, 24 Jul 2020 05:58:28 -0500</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/42003/perl-one-liner-for-beginners</link>
	<title><![CDATA[Perl one-liner for beginners !]]></title>
	<description><![CDATA[<p>I often use the following arguments to perl:</p><ul>
<li>-e Makes the line of code be executed instead of a script</li>
<li>-n Forces your line to be called in a loop. Allows you to take lines from the diamond operator (or stdin)</li>
<li>-p Forces your line to be called in a loop. Prints $_ at the end</li>
</ul><p>&nbsp;</p><ul>
<li>This counts the number of quotation marks in each line and prints it
<div>
<blockquote>
<div>perl -ne&nbsp;'$cnt = tr/"//;print "$cnt\n"'&nbsp;inputFileName.txt</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>Adds string to each line, followed by tab
<div>
<blockquote>
<div>perl -pe&nbsp;'s/(.*)/string\t$1/'&nbsp;inFile &gt; outFile</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>Append a new line to each line
<div>
<blockquote>
<div>perl -pe&nbsp;'s//\n/'&nbsp;all.sent.classOnly &gt; all.sent.classOnly.sep</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>Replace all occurrences of pattern1 (e.g. [0-9]) with pattern2
<div>
<blockquote>
<div>perl -p -i.bak -w -e&nbsp;'s/pattern1/pattern2/g'&nbsp;inputFile</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>Go through file and only print words that do not have any uppercase letters.
<div>
<blockquote>
<div>perl -ne&nbsp;'print unless m/[A-Z]/'&nbsp;allWords.txt &gt; allWordsOnlyLowercase.txt</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>Go through file, split line at each space and print words one per line.
<div>
<blockquote>
<div>perl -ne&nbsp;'print join("\n", split(/ /,$_));print("\n")'&nbsp;someText.txt &gt; wordsPerLine.txt</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>or in other words, delete every character that is not a letter, white space or line end (replace with nothing)
<div>
<blockquote>
<div>perl -pne&nbsp;'s/[^a-zA-Z\s]*//g'&nbsp;text_withSpecial.txt &gt; text_lettersOnly.txt</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>
<div>
<div>perl -pne&nbsp;'tr/[A-Z]/[a-z]/'&nbsp;textWithUpperCase.txt &gt; textwithoutuppercase.txt;</div>
</div>
</li>
</ul><ul>
<li>Print only the second column of the data when using tabular as a separator
<div>
<blockquote>
<div>perl -ne&nbsp;'@F = split("\t", $_); print "$F[1]";'&nbsp;columnFileWithTabs.txt &gt; justSecondColumn.txt</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>
<div>One-Liner: Sort lines by their length
<blockquote>
<div>perl -e&nbsp;'print sort {length $a &lt;=&gt; length $b} &lt;&gt;'&nbsp;textFile</div>
</blockquote>
</div>
</li>
</ul><ul>
<li>One-Liner: Print second column, unless it contains a number
<blockquote>
<div>perl"&gt;perl -lane&nbsp;'print $F[1] unless $F[1] =~ m/[0-9]/'&nbsp;wordCounts.txt</div>
</blockquote>
</li>
</ul>]]></description>
	<dc:creator>BioStar</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/blog/view/1182/installing-perl-gd-module</guid>
	<pubDate>Mon, 22 Jul 2013 14:02:01 -0500</pubDate>
	<link>https://bioinformaticsonline.com/blog/view/1182/installing-perl-gd-module</link>
	<title><![CDATA[Installing Perl GD Module]]></title>
	<description><![CDATA[<div><p>In comparative genome analysis work, we usually compare more than two genomes and looks for syntenic regions amongst them. In my research I used Evolution Highway (RH) <a href="http://eh-demo.ncsa.uiuc.edu/">http://eh-demo.ncsa.uiuc.edu/</a>, which is a collaborative project designed to provide a visual means for simultaneously comparing genomes of multiple amniote species. The tool removes the burden of manually aligning these maps and allows cognitive skills to be used toward something more valuable than preparation and transformation of data. In addition to EH, attractive Circos (<a href="http://circos.ca/">http://circos.ca/</a>) is also very popular for this kind of analysis.</p><p>The EH is available online, and can be easily access and use, whereas Circos installation is not entirely straightforward. One of the most difficult parts of the installation involves installing the GD library. Since there weren't good instructions for installing this library on the internet I decided to post instructions here in case they are useful to anyone else.</p><p><strong>Following are the steps to install GD modules in Mac OS</strong><br /><br />1. Setup<br /><br />Create a folder for the files:<br /><br />$ mkdir -p /SourceCache<br />$ cd /SourceCache<br /><br />Get and unpack the required Jpeg-6b and GD libraries:<br />Download Jpeg-6b (<a href="http://code.google.com/p/google-desktop-for-linux-mirror/downloads/detail?name=jpeg-6b.tar.gz&amp;can=2&amp;q">http://code.google.com/p/google-desktop-for-linux-mirror/downloads/detail?name=jpeg-6b.tar.gz&amp;can=2&amp;q</a>)<br />Download GD (<a href="http://search.cpan.org/%7Elds/GD-2.46/">http://search.cpan.org/~lds/GD-2.46/</a>)<br /><br />Place the "tar.gz" files in "/SourceCache" and double click to unpack.<br /><br />2. Install libjpeg<br /><br />Copy the "config.sub" and "config.guess" files to "/SourceCache". Note that your "config.sub" and ""config.guess" files may be in a slightly different location. The commands below show where they were on my machine:<br /><br />$ cd /SourceCache/jpeg-6b/src<br />$ cp /usr/share/libtool/config/config.sub .<br />$ cp /usr/share/libtool/config/config.guess .<br /><br />Configure libjpeg as follows. Note that this was installed on a 64 bit machine. However, this method may configure it in a 32 bit format. This may not be the best way to configure the installation but it works.<br /><br />$ .configure --enable-shared<br />$ make<br /><br />Check to see if the following directories exist on your machine. Create the missing directories in the following manner:<br /><br />$ mkdir -p /usr/local/include<br />$ mkdir -p /usr/local/bin<br />$ mkdir -p /usr/local/lib<br />$ mkdir -p /usr/local/man/man1<br /><br />Finish making and installing libjpeg:<br /><br />$ make install<br /><br />3. Install GD<br /><br />$ cd /SourceCache/GD-2.46/GD/<br />$ perl Makefile.PL<br />$ make<br />$ make test (optional)<br />$ make html (optional)<br />$ make install</p><p><strong>Other way for Mac OS</strong><br />The easiest way to get a lot of these is with a program called Fink, which is similar in nature to the CPAN installer, but installs common GNU utilities. Fink is available from &lt;<a href="http://sourceforge.net/projects/fink/%3E">http://sourceforge.net/projects/fink/&gt;</a>.<br /><br />Follow the instructions for setting up Fink. Once it's installed, you'll want to run the following as root: fink install gd<br /><br />It will prompt you for a number of dependencies, type 'y' and hit enter to install all of the dependencies. Then watch it work.<br /><br />To prevent creating conflicts with the software that Apple installs by default, Fink creates its own directory tree at /sw where it installs most of the software that it installs. This means your libraries and headers for libgd will be at /sw/lib and /sw/include instead of /usr/lib and /usr/local/include. Because of these changed locations for the libraries, the Perl GD module will not install directly via CPAN, because it looks for the specific paths instead of getting them from your environment. But there's a way around that :-)<br /><br />Instead of typing "install GD" at the cpan&gt; prompt, type look GD. This should go through the motions of downloading the latest version of the GD module, then it will open a shell and drop you into the build directory. Apply below patch to the Makefile.PL file (save the patch into a file and use the command patch &lt; patchfile.)<br /><br />Then, run these commands to finish the installation of the GD module:<br /><br />perl Makefile.PL<br />make<br />make test<br />make install<br />And don't forget to run exit to get back to CPAN.</p><p>&nbsp;</p><p><strong>Install on MS Window, using PPM</strong></p><p>C:\Documents and Settings\Owner&gt;ppm<br />PPM interactive shell (2.2.0) - type 'help' for available commands.<br />PPM&gt; install GD<br />Install package 'GD?' (y/N): y<br />Installing package 'GD'...<br />Downloading <a href="http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW">http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW</a>. ...<br />Installing C:\Perl\site\lib\auto\GD\GD.bs<br />Installing C:\Perl\site\lib\auto\GD\GD.dll<br />Installing C:\Perl\site\lib\auto\GD\GD.exp<br />Installing C:\Perl\site\lib\auto\GD\GD.lib<br />Installing C:\Perl\html\site\lib\GD.html<br />Installing C:\Perl\site\lib\GD.pm<br />Installing C:\Perl\site\lib\qd.pl<br />Installing C:\Perl\site\lib\auto\GD\autosplit.ix<br />PPM&gt;<br /><br /><br />If you can't install it from ppm. You can download it:<br /><a href="http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW">http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW</a>.<br /><br /><br />BTW,All Perl 5.6.1 Modules are located at:<br /><br /><a href="http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW">http://ppm.ActiveState.com/PPMPackages/5.6plus/MSW</a>.</p><p>&nbsp;</p><p><strong>Install the Perl GD Module on Linux</strong><br /><br />$ sudo perl -MCPAN -e shell<br /><br />Since it was the first time I had run this command on this particular machine I had to answer a lot of questions but simply selected the defaults for everything as this usually works for me. Once in the CPAN shell I entered<br /><br />$ install Bundle::CPAN<br /><br />and selected all of the defaults again. Once the CPAN bundle had finished installing I tried to install GD::Graph by typing<br /><br />$ install GD::Graph<br /><br />but it failed with hundreds of errors &ndash; the first of which was<br /><br />GD.xs:7:16: error: gd.h: No such file or directory<br /><br />This was fixed with the following apt-get command (in the bash shell)<br /><br />$ sudo apt-get install libgd2-xpm-dev<br /><br />back in the CPAN shell I still couldn&rsquo;t get GD::Graph to build and I guessed this was because of some left over files from the failed build. I don&rsquo;t know the command to clean things up inside the CPAN shell and am too lazy to read the docs so I simply went into the .cpan/build directory in my home directory and deleted anything that started with GD &ndash; eg<br /><br />$ rm -rf GD-2.35-HC_vkB<br /><br />$ rm -rf GDGraph-1.44-Evfibe<br /><br />and so on. Those strings at the end (VkB and so on) look random so they might be different on your machine. Then I went back into the CPAN shell and ran<br /><br />$ install GD::Graph<br /><br />There were a few dependencies which the script fetched and installed for me but everything worked smoothly.</p><p>Manual and other Perl Module instalation are mentioned in my previous blog @ <a href="http://bioinformaticsonline.com/blog/view/710/how-to-install-perl-modules-manually-using-cpan-command-and-other-quick-ways">http://bioinformaticsonline.com/blog/view/710/how-to-install-perl-modules-manually-using-cpan-command-and-other-quick-ways</a></p></div>]]></description>
	<dc:creator>Jit</dc:creator>
</item>
<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/pages/view/9029/syntax-for-secure-copy-scp</guid>
	<pubDate>Thu, 13 Mar 2014 17:01:32 -0500</pubDate>
	<link>https://bioinformaticsonline.com/pages/view/9029/syntax-for-secure-copy-scp</link>
	<title><![CDATA[Syntax for Secure Copy (scp)]]></title>
	<description><![CDATA[<div><p>In our day to day research activity, we need to securely copy our data from several to local computer and visa-versa. I am jotting down some of the commonly used SCP command for your future help. Hope you all will like it</p><p>What is Secure Copy?<br /><br />scp allows files to be copied to, from, or between different hosts. It uses ssh for data transfer and provides the same authentication and same level of security as ssh.</p><p><br />Examples</p><p><br /><strong>Copy the file "gene.txt" from a remote host to the local host</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp your_username@remotehost.edu:gene.txt /some/local/directory<br /><br /><strong>Copy the file "foobar.txt" from the local host to a remote host</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp gene.txt your_username@remotehost.edu:/some/remote/directory<br /><br /><strong>Copy the directory "chromosome" from the local host to a remote host's directory "bar"</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp -r chromosome your_username@remotehost.edu:/some/remote/directory/bar<br /><br /><strong>Copy the file "gene.txt" from remote host "rh1.edu" to remote host "rh2.edu"</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp your_username@rh1.edu:/some/remote/directory/gene.txt \<br />&nbsp;&nbsp;&nbsp; your_username@rh2.edu:/some/remote/directory/<br /><br /><strong>Copying the files "gene.txt" and "cancer.txt" from the local host to your home directory on the remote host</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp gene.txt cancer.txt your_username@remotehost.edu:~<br /><br /><strong>Copy the file "gene.txt" from the local host to a remote host using port 2264</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp -P 2264 gene.txt your_username@remotehost.edu:/some/remote/directory<br /><br /><strong>Copy multiple files from the remote host to your current directory on the local host</strong><br /><br />&nbsp;&nbsp;&nbsp; $ scp your_username@remotehost.edu:/some/remote/directory/\{a,b,c\} .<br /><br />&nbsp;&nbsp;&nbsp; $ scp your_username@remotehost.edu:~/\{gene.txt,cancer.txt\} .<br /><br /><strong>scp Performance</strong><br /><br />By default scp uses the Triple-DES cipher to encrypt the data being sent. Using the Blowfish cipher has been shown to increase speed. This can be done by using option -c blowfish in the command line.<br /><br />&nbsp;&nbsp;&nbsp; $ scp -c blowfish some_file your_username@remotehost.edu:~<br /><br />It is often suggested that the -C option for compression should also be used to increase speed. The effect of compression, however, will only significantly increase speed if your connection is very slow. Otherwise it may just be adding extra burden to the CPU. An example of using blowfish and compression:<br /><br />&nbsp;&nbsp;&nbsp; $ scp -c blowfish -C local_file your_username@remotehost.edu:~</p></div>]]></description>
	<dc:creator>Rahul Nayak</dc:creator>
</item>

</channel>
</rss>