2017年6月15日 星期四

Centos tar file

tar xvzf file-1.0.tar.gz - tgfo uncompress a gzip tar file (.tgz or .tar.gz)
tar xvjf file-1.0.tar.bz2 - to uncompress a bzip2 tar file (.tbz or .tar.bz2) to extract the contents.
tar xvf file-1.0.tar - to uncompressed tar file (.tar)
tar xvC /var/tmp -f file-1.0.tar - to uncompress tar file (.tar) to another directory



x = eXtract, this indicated an extraction c = create to create )
v = verbose (optional) the files with relative locations will be displayed.
z = gzip-ped; j = bzip2-zipped
f = from/to file ... (what is next after the f is the archive file)
C = directory. In c and r mode, this changes the directory before adding the following files. In x mode, changes directoriy after opening the archive but before extracting entries from the archive.

How to install blat on centos7


How to install blat


First :  (https://www.mail-archive.com/genome@soe.ucsc.edu/msg04337.html)


You need the libpng headers.  On Fedora/Centos etc. systems, you'll need:

libpng-devel

or

libpng-dev



Installing BLAT  (ref: http://nix-bio.blogspot.tw/2013/10/installing-blat-and-blast.html)

It's been a while since I last installed BLAT and when I went to the download directory at UCSC: http://users.soe.ucsc.edu/~kent/src/ I found that the latest blast is now version 35 and that the code to download was: blatSrc35.zip. However, you can also get pre-compiled binaries at: http://hgdownload.cse.ucsc.edu/admin/exe/ and that there was a linux x86_64 executable for my architecture available at: http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/blat/. Though YYMV, BLAT can be a little bit of a tricky beast to get going, so I decided to download the source code and compile that.

I will be compiling this code as 'root' as a system tool in /usr/local/src, so do not scream at me for that.

First I created an /usr/local/src/blat directory and I copied the blatSrc35.zip file into that.

Next I used

unzip blatSrc35.zip


to unpack the archive. This gives a directory blatSrc now move into that directory.

#cd blatSrc


before you begin read the README file that comes with the source code.

One thing about building blat is that you need to set the MACHTYPE variable so that the BLAT sources know what type of machine you are compiling the software on.

on most *nix machines, typing

echo $MACHTYPE

will return the machine architecture type.

On my CentOS 6 based system this gave:

x86_64-redhat-linux-gnu

However, what BLAT requires is the 'short value' (ie the first part of the MACHTYPE). To correct this, in the bash shell type (change this to the correct MACHTYPE for your system)

MACHTYPE=x86_64
export MACHTYPE


now running the command:

echo $MACHTYPE


should give the correct short form of the MACHTYPE:

x86_64

now create the directory lib/$MACHTYPE in the source tree. ie:

mkdir lib/$MACHTYPE

For my machine, lib/x86_64 already existed, so I did not have to do this, but this is not the case for all architectures.

The BLAT code assumes that you are compiling BLAT as a non-privileged (ie non-root) user. As a result, you must create the directory for the executables to go into:

mkdir ~/bin/$MACHTYPE

If you are installing as a normal user, edit your .bashrc to add the following (change the x86_64 to be your MACHTYPE):

export PATH=~/bin/x86_64::$PATH

For me, though, this was not good enough. I wanted the executables in /usr/local/bin where all my other code goes. As a result I did some hackery...

There is a master make template in the inc directory called common.mk and I edited this file with the command:

vi inc/common.mk

I replaced the line
    BINDIR=${HOME}/bin/${MACHTYPE}

with
    BINDIR=/usr/local/bin


saved and quit (as this is in my path, I do not need to do anything else)

All the preparation is now done and you can create the blat executables by going into the toplevel of the blat source tree (for me it was /usr/local/src/blat/blatSrc, but change to wherever you unpacked blat into).

Now simply run the command:

make


to compile the code.

Blat installed cleanly and the executables were all neatly placed in /usr/local/bin/x86_64, just like I wanted.

now simply running the command:

blat


on the command line gives me information on blat and sample usage.

Blat is installed and it's installed properly in my system code tree!!!

2017年6月14日 星期三

virtualbox CentOS7 networking setting


please reference the following article:
http://jimc1682000.blogspot.tw/2015/09/centos-7-virtualbox.html

2016年10月7日 星期五

Python install package

*Open package management PIP install

You should install the pip :
 #download get-pip.py and exeic
py get-pip.py
Requirement already up-to-date: pip in c:\users\andychung\appdata\local\programs\python\python35-32\lib\site-packages

# check the pip tools
pip list
hexdump (3.3)
pip (8.1.2)
python-evtx (0.5.0)
setuptools (20.10.1)
simplejson (3.8.2)
six (1.10.0)
wheel (0.29.0)


Ref: https://packaging.python.org/installing/#use-pip-for-installing


*Self PACKAGE  install

 python setup.py install

example:
git clone https://github.com/williballenthin/python-evtx

Reference: https://packaging.python.org/distributing/#setup-py

2016年8月26日 星期五

python sqlite interface

1.  Connection to DB and import many records



import sqlite3
conn = sqlite3.connect('C:\\sqlite\\IE11.sqlite')
c = conn.cursor()
c.executemany('INSERT INTO PCInfo(log,ip,pcname,IE,home) VALUES (?,?,?,?,?)', records)
conn.commit()



REF
official sqlite3

sqlite install in windows 64bits

1. Download from sqlite  https://sqlite.org/download.html

sqlite-dll-win64-x64-3140100.zip
sqlite-tools-win32-x86-3140100.zip


2. Create Folder and unzip 

.mkdir  in C:\sqlite
.unzip above  two zip











3. launch the sqlite 

cd c:\sqlite
sqlite3.exe

SQLite version 3.14.1 2016-08-11 18:53:32
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.


4. How to use 

.open test.sqlite
CREATE TABLE users (id integer primary key autoincrement, name text not null);
insert into users (name) values('jon');
insert into users (name) values('paul');
sqlite> select * from users;
1|john
2|paul

the .open is the command for create/connection database
other .tables or .drop



Reference :
First_Installing-and-Using-SQLite-on-Windows
Appropriate Uses For SQLite
SQLite vs MySQL


Python 3.5 windows install

1. Download site  https://www.python.org/downloads/

2.  Install it and will in the
C:\Users\andychung\AppData\Local\Programs\Python\Python35-32

3. default python will launch by py
cmd
py some_script

InstallREference GOOD
https://docs.python.org/3/using/windows.html
https://docs.python.org/3.3/using/windows.html