Thursday, January 8, 2015

dbSNP statistics Number of RefSNP Clusters

I'm writing this post at 2015-01-08

The statistics of dbSNP data is well explained in dbSNP summary page.

http://www.ncbi.nlm.nih.gov/projects/SNP/snp_summary.cgi?view+summary=view+summary&build_id=142

































When I'm finding the statistics of dbSNP database, the dbSNP build 142 is the newest.

But, I needed not only the number of RefSNP of Homo sapiens(Human), but also other organisms.

I agonized how can I get the whole number of RefSNP including all of Organisms...

I found that previous Build release has other organisms's data.

















The build 138 has 131 Organisms's data.

So I combined each builds, and when there are same organisms in different build such as homo sapiens, I select only up to date data.
















... I combined The number of each RefSNP of organisms.
To remove bracket(~) I made a c++ parsing code with sumation.




#include <stdio.h>
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <vector>

using namespace std;


int main()
{
   FILE * pFile;
   char mystring [100];
   char* tokens;
   vector<int> v;

   int sum = 0;

   pFile = fopen ("count.txt" , "r");

    while ( fgets (mystring , 100 , pFile) != NULL ){
                tokens = strtok(mystring, "(");
                v.push_back( atoi(tokens) );
        }
    fclose (pFile);

        for(int i=0;i < v.size(); i++){
                sum+=v[i];
                cout<<v[i]<<endl;
        }cout<<endl;

        cout<<"Sum of RefSNP without homo sapiens: "<<sum<<endl;
        sum+=112736879; // Homo sapiens

        cout<<"Sum of RefSNP with homo sapiens: "<<sum<<endl;
        return 0;
}


Number of RefSNP Clusters

Homosapiens: 112,736,879
Sum of 151 organisms with Homosapiens: 466,071,153

Wednesday, January 7, 2015

Various genome variation and related measures

Genome variation is divided into Base Variation & Structural variation.


Base variation: variation under 1,000 base pair.
Structural variation: variation over 1,000 base pair.



- The type of base variation
Single Nucleotide Polymorphism (SNP)
Insertion and Deletion (InDel)

- The type of structural variation.
Copy Number Variation (CNV)
Segmental duplication
Translocation
Inversion




Various genome variation and related measures

Single nucleotide
Substitution, point mutation
Insertion-deletions (InDel)
SNPs

2bp ~ 1,000 bp
Microsatellites, minisatellites (indel)
Inversion
Nucleotide repeats
VNTRs

1kb to submicroscopic
Copy number variants(CNVs)
Segmental duplications
Inversions, translocations
CNV regions(CNVRs)
Microdeletions, micro duplications.

Microscopic to subchromosomal
Semgental aneusomy
Chromosomal deletions, losses, inserstions, gains, inversions
Intrachromosomal transloaations
Heteromorphisms
Fragile sites

Whole chromosomal to whole genome
Interchromosomal translocations
Ring chromosomes, isochromosomes
Marker chromosomes
Aneuploidy
Aneusomy


Tuesday, January 6, 2015

WinAPI process kill by name / C++ source

This program source is very easy to use and understand.

There are only 2 functions for killing process.

One is ListProcessInfo(void).
This function just prints all of the process name.

The other is KillProcess(TCHAR* TargetProcess);
Using ListPRocessInfo() function, You can get the process name you want to kill.

I used tchar.h.
so, TCHAR, _tprintf _tscanf .. etc.. is not different with char, printf, scanf.
you can use char, printf, scanf as well, don't worry.





#include<stdio.h>
#include<locale.h>
#include<string.h>
#include<stdlib.h>
#include<tchar.h>
#include<windows.h>
#include<tlhelp32.h>

void ListProcessInfo(void);
void KillProcess(TCHAR* TargetProcess);


int _tmain(int argc, TCHAR* argv[]){
 TCHAR TargetProcess[BUFSIZ];
 //Target Process name. It would be killed.
 while(1){
    ListProcessInfo(); // This function prints Process list
    _tprintf( _T("Input TargetProcess name (End :: EXIT) :: "));
    _tscanf( _T("%s"),TargetProcess);
    _tprintf(_T("input :: %s"), TargetProcess);

  if(_tcscmp(TargetProcess, _T("EXIT")) == 0)
   exit(EXIT_SUCCESS);
  KillProcess(TargetProcess);
  //Process be killed by this function.
 }
 return 0;
}


//Just print the process list.
void ListProcessInfo(void){
 HANDLE hProcessSnap =
  CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
   //The status of current processes. processes are dynamic, it's changing

  if(hProcessSnap == INVALID_HANDLE_VALUE){
    _tprintf( _T("CreateToolhelp32Snapshot error \n"));
    exit(EXIT_FAILURE);
 }
 PROCESSENTRY32 pe32; //This is just struct for saving process status
 pe32.dwSize = sizeof(PROCESSENTRY32);


 if( !Process32First(hProcessSnap, &pe32)){
  _tprintf( _T("Process32First error ! \n"));
  CloseHandle(hProcessSnap);
  return;
 }
//Using Process32First, you can get System process information.
//This is parent of all processes.
 _tprintf(_T("\t[Process name] \t[PID]\t[PPID]\t[ThreadID] \n"));

 do{
  _tprintf(_T("%25s %8d %8d %8d \n"),
   pe32.szExeFile,pe32.th32ProcessID, pe32.th32ParentProcessID,pe32.cntThreads);
 } while(Process32Next(hProcessSnap,&pe32));
//Process32Next give you an next process's information
 return;
}

//This function is for killing process.
//It's similar to ListProcessInfo() until find the process that you are killing.

void 
KillProcess(TCHAR* TargetProcess){
 //Argument TargetProcess is the process name that you want to kill.
 HANDLE hProcessSnap =
  CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0);
 if( hProcessSnap == INVALID_HANDLE_VALUE){
  _tprintf( _T("CreateToolhelp32Snapshot error! \n"));
  return;
 }
 PROCESSENTRY32 pe32;
 pe32.dwSize = sizeof(PROCESSENTRY32);
 if(!Process32First(hProcessSnap, &pe32)){
  _tprintf(_T("Process32First error ! \n"));
  CloseHandle(hProcessSnap);
  return;
 }
 HANDLE hProcess = NULL;
 BOOL isKill = FALSE;

do { //do Process32Next until the next process name is same with TargetProcess
  if(_tcscmp(pe32.szExeFile, TargetProcess) == 0)
   hProcess = OpenProcess(
   PROCESS_ALL_ACCESS, FALSE, pe32.th32ProcessID);
  // When the function finds the process that you want to kill,
  // It gets the process's handle using OpenProcess(~),
 

  if(hProcess != NULL){
   TerminateProcess(hProcess, -1);
  //If handle status is no problem, It kills!

   isKill = TRUE;
   CloseHandle(hProcess);
   break;
  }
 } while( Process32Next(hProcessSnap, &pe32) );
 CloseHandle(hProcessSnap);
 if(isKill == FALSE)
  _tprintf( _T("Kill process fail. Try again! \n"));
}


thanks.

Monday, January 5, 2015

Korea graduate school admission.

This posting is for those who want to enter a graduation school in south Korea.

If you can not understand or read korean, then use translate.google.com.

At first, connect to the hibrain.net





















Click the tab that I draw red block.
That means 'Graduate Recruitment'.

Hibrain.net is site for research job and university job.







This is the list of laboratories that recruit MS, and Ph.D students.





























Every recruiting articles have information.
Check what they research, and funding.

You can get a admission to the graduation school in korea.

If you have a question, comment.
Thanks.

Ensembl to Gene symbol convertion - R programming

There are many way to convert Ensembl ID to Gene symbol,
in this posting, I've set an example of R programming.




R programming -

at first, you need to install biocLite and library biomaRt.

> source("http://bioconductor.org/biocLite.R")
> biocLite()
> biocLite("biomaRt")
> library(biomaRt)

When you install this packages and libraries, you need an authentication.




I've set an example for you.


These are Ensembl examples.

ENSG00000116783
ENSG00000139656
ENSG00000196987
ENSG00000216560
...
..

To use Ensembl examples in R, you need to form those as vector c(" "... ).

like this..

> ensembl_gene = c("ENSG00000116783","ENSG00000139656","ENSG00000196987","ENSG00000216560"........);
> mart<- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
# hsapiens_gene_ensembl database, mart object
>getBM(filters= "ensembl_gene_id", attributes= c("ensembl_gene_id", "entrezgene", "description"),values=ensembl_gene,mart= mart)



This is R programming source.

ensembl_gene  <- c("ENSG00000116783","ENSG00000139656","ENSG00000196987","ENSG00000216560")
mart<- useDataset("hsapiens_gene_ensembl", useMart("ensembl"))
getBM(filters= "ensembl_gene_id", attributes= c("ensembl_gene_id", "entrezgene", "description"),values=ensembl_gene, mart= mart)





using cpu-z, see your computer specifications




It's the download link to the cpu-z official website.



When you download cpu-z and install,
you can see your computer's specifications.



first tab - CPU
you can see cpu information.


My cpu is Intel core i7 3630QM.
There are 4 cores and 8 threads.
it means, my computer can execute 4 process and 8 threads simultaneously,




second tab is Caches.


Chaches help to find the address of process.
Processes's adress that are used frequently was saved in cache,
and when cpu need adress of process, then cache provides the adress.

So, it's important to improve cpu's speed.



third tab-mainboard.
You can check your mainboard specifications.




fourth tab- Memory. (RAM)


My ram specification is DDR3, 16GBytes.



SPD is also related to memory (RAM)




fifth tab- Graphics


I have two graphics devices.
One is Mainboard's, the other is VDD.

NVIDIA GeFore GTX 860M.
It's not that good to play high performance gaming,
but I'm not hard game user, so it's great to me.

thanks.



It's the download link to the cpu-z official website.


Codon(DNA) to Amino acid converter c++ source



Codon is translated into protein.
Because DNA strings are so long, you can not translate all the DNA strings into protein manually.

So I've set an c++ program function source.

Function argument (parameter) is a string which consists of 3 char of base.

If the length of string is more then 4, The first 3 DNA nodes are only translated into one Amino acid.



char translation(string input){
char RET;
switch(input[0]){
case 'A':
switch(input[1]){
case 'A'://AA
switch(input[2]){
case 'A':
case 'G':
RET='K';
break;
case 'C':
case 'T':
RET='N';
break;
}
break;
case 'C'://AC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='T';
break;
}
break;
case 'G'://AG
switch(input[2]){
case 'A':
case 'G':
RET='R';
break;
case 'C':
case 'T':
RET='S';
break;
}
break;
case 'T'://AU
switch(input[2]){
case 'G':
RET='M';
break;
case 'A':
case 'C':
case 'T':
RET='I';
break;
}
}
/////////////////////
break;
case 'C':
switch(input[1]){
case 'A': //CA
;
switch(input[2]){
case 'A':
case 'G':
RET='Q';
break;
case 'C':
case 'T':
RET='H';
break;
}
break;
case 'C': //CC
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='P';
break;
}
break;
case 'G': //CG
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='R';
break;
}
break;
case 'T': //CU
switch(input[2]){
case 'A':
case 'C':
case 'G':
case 'T':
RET='L';
break;
}
}
break;
case 'G':
switch(input[1]){
case 'A': //GA
switch(input[2]){
case 'A':
case 'G':
RET='E';
break;
case 'C':
case 'T':
RET='D';
break;
}
break;
case 'G': //GG
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='G';
break;
}
break;
case 'C': //GC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='A';
break;
}
break;
case 'T': //GU
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='V';
break;
}
break;
}
break;
case 'T':
switch(input[1]){
case 'A': //UA
switch(input[2]){
case 'A':
case 'G':
RET='0';
break;
case 'C':
case 'T':
RET='Y';
break;
}
break;
case 'G': //UG
switch(input[2]){
case 'A':
RET='0';
break;
case 'G':
RET='W';
break;
case 'C':
case 'T':
RET='C';
break;
}
break;
case 'C': //UC
switch(input[2]){
case 'A':
case 'G':
case 'C':
case 'T':
RET='S';
break;
}
break;
case 'T': //UU
switch(input[2]){
case 'A':
case 'G':
RET='L';
break;
case 'C':
case 'T':
RET='F';
break;
}
break;
}
}
return RET;
}