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}

Advertisements

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();
}
}

}
}

How to use APT(Advanced Packaging Tool) Ubuntu/Debian


To know more about what can we do with the applications/packages i.e. apt-get help.Visit following link & browse through the pages.

http://www.debian.org/doc/manuals/apt-howto/index.en.html#contents

Import tab or space delimited data into MySQL database


If you have data that you need to bring into your MySQL database, there are a few ways to do it. Exporting data out of mysql is another topic, described here.

1. Using the LOAD DATA INFILE SQL statement

For security reasons, no one has the mysql FILE priv, which means you cannot “LOAD DATA INFILE”. You can, however, use a “LOAD DATA LOCAL INFILE” statement as long as you have a mysql prompt on our system and have uploaded the data file to your account here first.

The “LOAD DATA LOCAL INFILE” statement will only work from a MySQL prompt on our local system. It will not work from any web-based tool such as phpMyAdmin, and will never pull a file in directly off your own computer.

To import a file this way, first upload your data file to your home directory on our system with FTP or SCP. Then get a shell prompt on our system, and then a MySQL Monitor prompt so that you can issue the SQL that will import your file.

For example, suppose you have a data file named importfile.csv that contains 3 comma separated columns of data on each line. You want to import this textfile into your MySQL table named test_table, which has 3 columns that are named field1, field2 and field3.

To import the datafile, first upload it to your home directory, so that the file is now located at /importfile.csv on our local system. Then you type the following SQL at the mysql prompt:

LOAD DATA LOCAL INFILE ‘/importfile.csv
INTO TABLE test_table
FIELDS TERMINATED BY ‘,’
LINES TERMINATED BY ‘\n’
(field1, filed2, field3);

The above SQL statement tells the MySQL server to find your INFILE on the LOCAL filesystem, to read each line of the file as a separate row, to treat any comma character as a column delimiter, and to put it into your MySQL test_table as columns field1, field2, and field3 respectively. Many of the above SQL clauses are optional and you should read the MySQL documentation on the proper use of this statement.

2. Using a script to parse and import the file

You can also write a script in any programming language that can connect to MySQL (such as PHP) to open your data file, break it up into an array of lines that each represent a row of data, split each line up by the delimiter character (such as a comma ‘,’, tab ‘\t’, semicolon ‘;’, space ‘ ‘, etc.), and then perform invididual MySQL INSERT queries (one INSERT for each line) to insert all your data from the file into the appropriate table fields.

Such scripts are not difficult to write in less than 15 lines and can import data from text files just as effectively as a LOAD DATA LOCAL INFILE command. A working example script written in PHP appears below in the Annotations.

3. Importing a mysqldump

If your data file actually comes from another MySQL database, and not from Excel or any other source, then the most direct way to export and import your data would be to dump out your table or entire MySQL database on the original database server using the mysqldump command, FTP the resulting dump file to your account here, and then import the dump file at a shell prompt.

How to Back Up and Restore a MySQL Database


Back up From the Command Line (using mysqldump)

If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. This command connects to the MySQL server and creates an SQL dump file. The dump file contains the SQL statements necessary to re-create the database. Here is the proper syntax:

$ mysqldump –opt -u [uname] -p[pass] [dbname] > [backupfile.sql]
  • [uname] Your database username
  • [pass] The password for your database (note there is no space between -p and the password)
  • [dbname] The name of your database
  • [backupfile.sql] The filename for your database backup
  • [–opt] The mysqldump option

For example, to backup a database named ‘Tutorials’ with the username ‘root’ and with no password to a file tut_backup.sql, you should accomplish this command:

$ mysqldump -u root -p Tutorials > tut_backup.sql

This command will backup the ‘Tutorials’ database into a file called tut_backup.sql which will contain all the SQL statements needed to re-create the database.

With mysqldump command you can specify certain tables of your database you want to backup. For example, to back up only php_tutorials and asp_tutorials tables from the ‘Tutorials’ database accomplish the command below. Each table name has to be separated by space.

$ mysqldump -u root -p Tutorials php_tutorials asp_tutorials > tut_backup.sql

Sometimes it is necessary to back up more that one database at once. In this case you can use the –database option followed by the list of databases you would like to backup. Each database name has to be separated by space.

$ mysqldump -u root -p –databases Tutorials Articles Comments > content_backup.sql

If you want to back up all the databases in the server at one time you should use the –all-databases option. It tells MySQL to dump all the databases it has in storage.

$ mysqldump -u root -p –all-databases > alldb_backup.sql

The mysqldump command has also some other useful options:

–add-drop-table: Tells MySQL to add a DROP TABLE statement before each CREATE TABLE in the dump.

–no-data: Dumps only the database structure, not the contents.

–add-locks: Adds the LOCK TABLES and UNLOCK TABLES statements you can see in the dump file.

The mysqldump command has advantages and disadvantages. The advantages of using mysqldump are that it is simple to use and it takes care of table locking issues for you. The disadvantage is that the command locks tables. If the size of your tables is very big mysqldump can lock out users for a long period of time.

Back up your MySQL Database with Compress

If your mysql database is very big, you might want to compress the output of mysqldump. Just use the mysql backup command below and pipe the output to gzip, then you will get the output as gzip file.

$ mysqldump -u [uname] -p[pass] [dbname] | gzip -9 > [backupfile.sql.gz]

If you want to extract the .gz file, use the command below:

$ gunzip [backupfile.sql.gz]

Restoring your MySQL Database

Above we backup the Tutorials database into tut_backup.sql file. To re-create the Tutorials database you should follow two steps:

  • Create an appropriately named database on the target machine
  • Load the file using the mysql command:
$ mysql -u [uname] -p[pass] [db_to_restore] < [backupfile.sql]

Have a look how you can restore your tut_backup.sql file to the Tutorials database.

$ mysql -u root -p Tutorials < tut_backup.sql

To restore compressed backup files you can do the following:

gunzip < [backupfile.sql.gz] | mysql -u [uname] -p[pass] [dbname]

If you need to restore a database that already exists, you’ll need to use mysqlimport command. The syntax for mysqlimport is as follows:

mysqlimport -u [uname] -p[pass] [dbname] [backupfile.sql]

Bioconductor : Open source software for Bioinformatics


Bioconductor provides tools for the analysis and comprehension of high-throughput genomic data. Bioconductor uses the R statistical programming language, and is open source and open development. It has two releases each year, more than 460 packages, and an active user community.
URL: http://bioconductor.org/

Enable Remote MySql Ubuntu


Set mysql bind address

Before you can access the database from other computers in your network, you have to change its bind address. Note that this can be a security problem, because your database can be accessed by other computers than your own. Skip this step if the applications which require mysql are running on the same machine.

type:

sudo vi /etc/mysql/my.conf

and change the line:

bind-address=localhost 

to your own internal ip address e.g. 192.168.3.209

bind-address=192.168.3.209  

If your ip address is dynamic you can also comment out the bind-address line and it will default to your current ip.

If you try to connect without changing the bind-address you will recieve a “Can not connect to mysql error 10061”.

Then restart mysql service :

sudo service mysql restart

 

%d bloggers like this: