Add plot subcommand.
[lightning.git] / example-1kg-pca.py
1 #!/usr/bin/env python
2
3 """
4 lightning gvcf2numpy -tag-library ~/keep/by_id/su92l-4zz18-92bx4zjg5hgs3yc/tagset.fa.gz -ref ./hg38.fa.gz ~/keep/by_id/su92l-4zz18-s3e6as6uzsoocsb > example.npy
5 example-1k-pca.py example.npy
6 example-1k-plot.py example.npy.pca.npy sample_info.csv ~/keep/by_id/su92l-4zz18-s3e6as6uzsoocsb
7 ls -l example.npy.pca.npy.png
8 """
9
10 import sys
11 infile = sys.argv[1]
12
13 import scipy
14 X = scipy.load(infile)
15
16 from sklearn.decomposition import PCA
17 pca = PCA(n_components=4)
18 X = pca.fit_transform(X)
19 scipy.save(infile+".pca.npy", X)