Archive | November 2011

Using YUM and RPM_ Help Manual :CentOs


http://wiki.centos.org/TipsAndTricks/YumAndRPM

Advertisements

Uninstall / Remove / Delete Softwares in Linux


Remove Software under Red Hat / RHEL / Fedora / CentOS Linux

Use rpm or yum command to delete the software.

To list the installed software type

rpm -qa | less
rpm -qa {software-name}
yum list | less
yum list {software-name}

To get information about httpd package, enter:
rpm -qa httpd
yum list httpd

To remove a software use rpm or yum command as follows

rpm -e {software-name}
yum remove {software-name}

To delete a package called httpd, enter:
rpm -e httpd
yum remove httpd

Delete / Uninstall Software Under Debian / Ubuntu Linux

To list installed software type:
dpkg --list
dpkg --list | less
dpkg --list | grep apache


To delete the software, enter:

sudo apt-get remove {package-name}

FASTX-Toolkit : Short-Reads FASTA/FASTQ files preprocessing


FASTX-Toolkit provides various tools for file conversion from FASTA AND FASTQ files.Since various NGS tools need the specific file format as a part of the assembly and mapping commands.

The toolkit provides the following commands;

These commands have saved the efforts to write a code for converting file formats .So you can try these commands to process your data depending on your purpose.

URL to download http://hannonlab.cshl.edu/fastx_toolkit/download.html  choose your operating system and extract the archive and use terminal to execute the commands with proper command line arguments.

Configure wget with proxy username and password


If you want to download files from terminal using wget through a network having proxy then edit the file wgetrc which is present in etc directory.

  • Edit the file using suitable editor eg. sudo gedit /etc/wgetrc
  • Append the following lines by editing it with your proxy information(i.e.right hand side of = sign)  but keep the last line unchanged. If your proxy doesn’t need username and password then you can skip the lines having user name and password or comment it.

https_proxy = http://10.100.15.3:8080/

http_proxy = http://10.100.15.3:8080/

ftp_proxy = http://10.100.15.3:8080/

proxy_user=kulkarni

proxy_password=kulkarni

use_proxy = on

  • Then save the file and type bash on terminal to refresh the saved settings
  • try to use wget command as wget <http://url&gt;
  • It will show the downloading status and will save it in current working directory.

Defragging Drives in Windows Using Defrag Command and GUI mode.


De-fragment is the task in which the files on the hard disk are arranged sequentially like books in book-shelf so as to have faster access. Due to deletion of files creates many spaces in between two the files which leads to slower disk access and consumes more CPU.So to fix the issue we have defrag utility in windows which organizes the files in a contiguous way.It also properly separates the unused free space for the new files to be appended after the existing files.

A frequent de-fragmentation of the disk  will give faster and disk access & increases overall performance of the system.

Command Mode

You can run the defrag utility from the prompt by the following way.

Start > Run > cmd  then on prompt type the following command  defrag <drive_letter:> <options>

Ex: defrag K: -f -v  for force defragment and verbose(text) output on prompt. You can try by replacing the existing drive letter instead of K  on your disk.  see the output of the process on following screen.

GUI Mode

You can also do the same process in GUI mode by  Start > Programs > Accessories > System Tools > Disk Defragmenter Program.

You can analyze the drive to visualize the extent of fragmenting  and then click on Defragment button.

Resolve Disk Errors in Windows


Many times while using windows some files are unable to delete or read due to some disk errors so there’s necessity to repair and to run the disk check utility.We can run this by using following path My Computer > Any Drive >Right click > Properties >Tools Tab> Error Checking > Check-Now Button.But since it runs in Graphical User Interface(GUI) it takes longer time than that of command based direct run.

we can go to Start > Run > cmd  and type the command as  chkdsk <drive letter> <options>

Ex: chkdsk D: /F /V /R which not only will check drive D with verbose output,repair and forceful unmount of that drive before repair.

You can see the cleaning process as below.

 

Check Used and Free Hard Disk Space from Terminal


 

You can find size of a particular directory using $ du -sh

for details regarding disk usage  $ use df -h  which gives details of disk usage for mounted partitions.

Demo output is given as in screen shot.

How to get Hardware Information Linux.


Sometimes it is necessary to find the hardware details to install new applications which would be compatible with the hardware also it’s useful to know before upgrading your hardware.

lshw lists your hardware. Try it now:
$sudo lshw

You can get specific details by using the -C flag:
$sudo lshw -C disk
will list all you hard disks.

It create an html page with your hardware details if you do a:
$sudo lshw -html > Hardware_Detailed_Specificaton.html

You can get more details of the command using the following command:

$ lshw –help
Hardware Lister (lshw) – B.02.15
usage: lshw [-format] [-options …]
lshw -version

-version        print program version (B.02.15)

format can be
-html           output hardware tree as HTML
-xml            output hardware tree as XML
-short          output hardware paths
-businfo        output bus information

options can be
-class CLASS    only show a certain class of hardware
-C CLASS        same as ‘-class CLASS’
-c CLASS        same as ‘-class CLASS’
-disable TEST   disable a test (like pci, isapnp, cpuid, etc. )
-enable TEST    enable a test (like pci, isapnp, cpuid, etc. )
-quiet          don’t display status
-sanitize       sanitize output (remove sensitive information like serial numbers, etc.)
-numeric        output numeric IDs (for PCI, USB, etc.)

BioJava : Java for Bioinformatics


What is BioJava

BioJava is an open-source project dedicated to providing a Java framework for processing biological data. It provides analytical and statistical routines, parsers for common file formats and allows the manipulation of sequences and 3D structures. The goal of the biojava project is to facilitate rapid application development for bioinformatics.

10 Modules in Biojava 3.0.2 :

  • biojava3-core
  • biojava3-alignment
  • biojava3-genome
  • biojava3-structure
  • biojava3-structure-gui
  • biojava3-phylo
  • biojava3-protmod
  • biojava3-ws
  • biojava3-aa-prop
  • biojava3-protein-disorder

Biojava 3.0.2-Online API (Online JavaDoc): http://www.biojava.org/docs/api/index.html

Download : .tar.gz containing all jars, source and javadocs: biojava-3.0.2-all

Other download/install options

Reading tab/space delimited files & inserting data in MySql Database in Java.


This is an example code to extract tab or space delimited data from a flat file & insert into a MySql database table.
import java.io.BufferedReader;
import java.io.FileReader;
import java.sql.*;
import java.util.regex.*; //for regular expression in java

public class Gene_to_db
{
public static void main(String[] args) throws Exception
{
Connection conn=null;
PreparedStatement gene_info_stmt=null;
PreparedStatement gene_symbol_stmt=null;
PreparedStatement interactions_stmt=null;
BufferedReader gene_info_Reader = null;
BufferedReader interactions_Reader=null;
try
{
String driver=”com.mysql.jdbc.Driver”;
conn = DriverManager.getConnection(“jdbc:mysql://localhost/gene_to_db”, “root”, “root123”);

String gene_info_path = “/home/vaibhav/Dr.Sucha’s Module/Homo_sapiens.gene_info”;
String interactions_path=”/home/vaibhav/Dr.Sucha’s Module/human_only”;

gene_info_Reader = new BufferedReader(new FileReader(gene_info_path));
interactions_Reader=new BufferedReader(new FileReader(interactions_path));

String line;
while ((line = gene_info_Reader.readLine()) != null)
{
String datavalue[] = line.split(“\t”);
String gene_id = datavalue[1];
String taxo_id = datavalue[0];
String gene_symbol = datavalue[2];
String chr_no = datavalue[6];

if(chr_no.matches(“^\\d+$”) || (chr_no.matches(“^[X]$”)) || (chr_no.matches(“^[Y]$”)))
{
gene_info_stmt = conn.prepareStatement(“INSERT INTO gene_info VALUES (?,?,?,?)”);
gene_info_stmt.setString(1,gene_id);
gene_info_stmt.setString(2,taxo_id);
gene_info_stmt.setString(3,gene_symbol);
gene_info_stmt.setString(4,chr_no);
gene_info_stmt.execute();

gene_symbol_stmt=conn.prepareStatement(“INSERT INTO gene_symbol VALUES(?,?)”);
gene_symbol_stmt.setString(1,gene_id);
gene_symbol_stmt.setString(2,gene_symbol);
gene_symbol_stmt.execute();
}
else
{
continue;
}
}

while ((line = interactions_Reader.readLine()) != null)
{
String datavalue[] = line.split(“\t”);
String tax_id1=datavalue[0];
String tax_id2=datavalue[5];
String gene_id=datavalue[1];
String interactant_id=datavalue[6];
interactions_stmt=conn.prepareStatement(“INSERT INTO interactions VALUES(?,?)”);
interactions_stmt.setString(1,gene_id);
interactions_stmt.setString(2,interactant_id);
interactions_stmt.execute();
}

}

catch(Exception ex)
{
ex.printStackTrace();
}
finally
{
try
{
gene_info_stmt.close();
gene_info_Reader.close();
interactions_Reader.close();

} catch (SQLException ex)
{
ex.printStackTrace();
}
}

}
}

%d bloggers like this: