import os
os.system( 'ls -al' )

a = os.popen( 'ls -al' ).read()
print a

------------------------------------------------

Here's a summary of the ways to call external programs and the advantages and disadvantages of each:

os.system("some_command with args") passes the command and arguments to your system's shell. This is nice because you can actually run multiple commands at once in this manner and set up pipes and input/output redirection. For example,

os.system("some_command < input_file another_command > output_file")

However, while this is convenient, you have to manually handle the escaping of shell characters such as spaces, etc. On the other hand, this also lets you run commands which are simply shell commands and not actually external programs.

http://docs.python.org/lib/os-process.html

stream = os.popen("some_command with args") will do the same thing as os.system except that it gives you a file-like object that you can use to access standard input/output for that process. There are 3 other variants of popen that all handle the i/o slightly differently. If you pass everything as a string, then your command is passed to the shell; if you pass them as a list then you don't need to worry about escaping anything.
http://docs.python.org/lib/os-newstreams.html

The Popen class of the subprocess module. This is intended as a replacement for os.popen but has the downside of being slightly more complicated by virtue of being so comprehensive. For example, you'd say

print Popen("echo Hello World", stdout=PIPE, shell=True).stdout.read()
instead of
print os.popen("echo Hello World").read()

but it is nice to have all of the options there in one unified class instead of 4 different popen functions.
http://docs.python.org/lib/node528.html

The call function from the subprocess module. This is basically just like the Popen class and takes all of the same arguments, but it simply wait until the command completes and gives you the return code. For example:
return_code = call("echo Hello World", shell=True)
http://docs.python.org/lib/node529.html

The os module also has all of the fork/exec/spawn functions that you'd have in a C program, but I don't recommend using them directly.

The subprocess module should probably be what you use.

 

Posted by 옥탑방람보
,
* 1000 genome proejct
http://www.1000genomes.org/wiki/Analysis/variant-call-format
  • AA    ancestral allele
  • AC    allele count in genotypes, for each ALT allele, in the same order as listed
  • AF    allele frequency for each ALT allele in the same order as listed: use this when estimated from primary data, not called genotypes
  • AN    total number of alleles in called genotypes
  • BQ    RMS base quality at this position
  • CIGAR    cigar string describing how to align an alternate allele to the reference allele
  • DB    dbSNP membership
  • DP    combined depth across samples, e.g. DP=154
  • END    end position of the variant described in this record (esp. for CNVs)
  • H2    membership in hapmap2
  • MQ    RMS mapping quality, e.g. MQ=52
  • MQ0    Number of MAPQ == 0 reads covering this record
  • NS    Number of samples with data
  • SB    strand bias at this position
  • SOMATIC    indicates that the record is a somatic mutation, for cancer genomics
  • VALIDATED    validated by follow-up experiment

* samtools mpileup
http://samtools.sourceforge.net/mpileup.shtml

Tag Description
  • I16
    • 1 #reference Q13 bases on the forward strand 2 #reference Q13 bases on the reverse strand
    • 3 #non-ref Q13 bases on the forward strand 4 #non-ref Q13 bases on the reverse strand
    • 5 sum of reference base qualities 6 sum of squares of reference base qualities
    • 7 sum of non-ref base qualities 8 sum of squares of non-ref base qualities
    • 9 sum of ref mapping qualities 10 sum of squares of ref mapping qualities
    • 11 sum of non-ref mapping qualities 12 sum of squares of non-ref mapping qualities
    • 13 sum of tail distance for ref bases 14 sum of squares of tail distance for ref bases
    • 15 sum of tail distance for non-ref bases 16 sum of squares of tail distance for non-ref
  • INDEL    Indicating the variant is an INDEL.
  • DP    The number of reads covering or bridging POS.
  • DP4    Number of 1) forward ref alleles; 2) reverse ref; 3) forward non-ref; 4) reverse non-ref alleles, used in variant calling. Sum can be smaller than DP because low-quality bases are not counted.
  • PV4    P-values for 1) strand bias (exact test); 2) baseQ bias (t-test); 3) mapQ bias (t); 4) tail distance bias (t)
  • FQ    Consensus quality. If positive, FQ equals the phred-scaled probability of there being two or more different alleles. If negative, FQ equals the minus phred-scaled probability of all chromosomes being identical. Notably, given one sample, FQ is positive at hets and negative at homs.
  • AF1    EM estimate of the site allele frequency of the strongest non-reference allele.
  • CI95    Equal-tail (Bayesian) credible interval of the site allele frequency at the 95% level.
  • PC2    Phred-scaled probability of the alternate allele frequency of group1 samples being larger (,smaller) than of group2 samples.
  • PCHI2    Posterior weighted chi^2 P-value between group1 and group2 samples. This P-value is conservative.
  • QCHI2    Phred-scaled PCHI2
  • RP    Number of permutations yeilding a smaller PCHI2
 
Specifications for VCF format are different in Info field.

 

Posted by 옥탑방람보
,
sudo apt-get install ssh
sudo apt-get install openssh-server
sudo update-rc ssh defaults

 

'TA > Common' 카테고리의 다른 글

[linux] working multiple files on vi editor  (0) 2012.12.24
[linux] vi regular expression  (0) 2012.12.24
[ssh] Keeping SSH session from Firewall  (0) 2012.12.24
[linux] Adding a samba user on Ubuntu  (0) 2012.12.24
[linux] umout: device is busy  (0) 2012.12.24
Posted by 옥탑방람보
,
> vi /etc/ssh/ssh_config    (or  ~/.ssh/config)

Host *
    ServerAliveInterval 60

On Client machine,
The 'ServerAliveInterval 60' indicates that it should send a little bit of data over the connection every 60 seconds. You can avoid disconnection by many firewalls. Available on SSH protocol 2 version only.



Possible on server machine as an another solution,

> vi /etc/ssh/ssh_config

ClientAliveInterval 600
ClientAliveCountMax 3

 

'TA > Common' 카테고리의 다른 글

[linux] vi regular expression  (0) 2012.12.24
[ssh] start SSH server on Ubuntu  (0) 2012.12.24
[linux] Adding a samba user on Ubuntu  (0) 2012.12.24
[linux] umout: device is busy  (0) 2012.12.24
[ssh] Very slow login of SSH on Ubuntu  (0) 2012.12.24
Posted by 옥탑방람보
,

> sudo adduser user01  (if need)
> sudo passwd user01  (if need)
> sudo smbpasswd -a user01
> sudo vi /etc/samba/smb.conf

[user01]
command = user01's smb
path = /home/user01
read -nly = no
writable = yes
printable = yes
public = yes
browsable = yes
guest ok = no

> sudo /etc/init.d/smbd restart  (or   service smbd restart)

Posted by 옥탑방람보
,

> umount /mnt/imsi
umount: /mnt/imsi: device is busy


==>
> fuser -cu /mnt/imsi/     #check users holding this directory
> fuser -ck /mnt/imsi      #remove users holding this directory forcely

(주의, fuser 하면 로그인되어 있는 유저들이 로그아웃됨)

Posted by 옥탑방람보
,
> vi /etc/nsswith.conf
hosts:          files mdns4_minimal [NOTFOUND=return] dns mdns4 
==>
hosts:          files mdns4_minimal [NOTFOUND=return] dns #mdns4 

 

Posted by 옥탑방람보
,
Type the following command to install plugin, enter:

# yum install yum-downloadonly


# yum update httpd -y --downloadonly --downloaddir=/opt
==> update or install or reinstall

 

'TA > Common' 카테고리의 다른 글

[linux] umout: device is busy  (0) 2012.12.24
[ssh] Very slow login of SSH on Ubuntu  (0) 2012.12.24
[linux] write error in swap file  (0) 2012.12.24
[ssh] sync ssh key between two different machines or accounts  (0) 2012.12.24
[ssh] slow SSH login  (0) 2012.12.24
Posted by 옥탑방람보
,
consider embedding the octal value of the tab character, 011, inside the sed command
sed 's/,/'"$(printf '\011')"'/g' data.file

 

Posted by 옥탑방람보
,
Posted by 옥탑방람보
,