生信|通过manifest文件批量构建软链接

从GDC下载的数据都被放在UUID目录下,该目录名非常乱,为了有效的读取文件,可以采用软链接的形式。

命令:

tail -n +2 /public/home/liuxs/biodata/gdc/wes/gdc_manifest.2018-10-17.txt |\
head -n 5| \
awk 'BEGIN{OFS="\t";}{info=$2; gsub(/\.bam/,"",info); system("ln -s /public/home/liuxs/biodata/gdc/wes/"$1"/"info".bam /public/home/liuxs/biodata/gdc/test-link/"info".bam &&  ln -s /public/home/liuxs/biodata/gdc/wes/"$1"/"info".bai /public/home/liuxs/biodata/gdc/test-link/"info".bai")}'

这里只测试了5行

$ ls -l biodata/gdc/test-link/
total 0
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-7077-01A-11D-1961-08.2_gdc_realn.bai -> /public/home/liuxs/biodata/gdc/wes/f5581aed-da3f-436d-bfe5-cb0132a34b37/C529.TCGA-HC-7077-01A-11D-1961-08.2_gdc_realn.bai
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-7077-01A-11D-1961-08.2_gdc_realn.bam -> /public/home/liuxs/biodata/gdc/wes/f5581aed-da3f-436d-bfe5-cb0132a34b37/C529.TCGA-HC-7077-01A-11D-1961-08.2_gdc_realn.bam
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A632-10A-01D-A29Q-08.2_gdc_realn.bai -> /public/home/liuxs/biodata/gdc/wes/e0e07c0a-7be4-4da2-b46b-31620c2dc220/C529.TCGA-HC-A632-10A-01D-A29Q-08.2_gdc_realn.bai
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A632-10A-01D-A29Q-08.2_gdc_realn.bam -> /public/home/liuxs/biodata/gdc/wes/e0e07c0a-7be4-4da2-b46b-31620c2dc220/C529.TCGA-HC-A632-10A-01D-A29Q-08.2_gdc_realn.bam
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A6AL-01A-11D-A30E-08.1_gdc_realn.bai -> /public/home/liuxs/biodata/gdc/wes/599ad0f7-1762-401f-ab97-c176c48445d8/C529.TCGA-HC-A6AL-01A-11D-A30E-08.1_gdc_realn.bai
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A6AL-01A-11D-A30E-08.1_gdc_realn.bam -> /public/home/liuxs/biodata/gdc/wes/599ad0f7-1762-401f-ab97-c176c48445d8/C529.TCGA-HC-A6AL-01A-11D-A30E-08.1_gdc_realn.bam
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A6AQ-10A-01D-A30H-08.1_gdc_realn.bai -> /public/home/liuxs/biodata/gdc/wes/3ed6f960-efe6-4ad6-8357-de3d9671f04b/C529.TCGA-HC-A6AQ-10A-01D-A30H-08.1_gdc_realn.bai
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-HC-A6AQ-10A-01D-A30H-08.1_gdc_realn.bam -> /public/home/liuxs/biodata/gdc/wes/3ed6f960-efe6-4ad6-8357-de3d9671f04b/C529.TCGA-HC-A6AQ-10A-01D-A30H-08.1_gdc_realn.bam
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-VN-A88O-01A-11D-A34U-08.1_gdc_realn.bai -> /public/home/liuxs/biodata/gdc/wes/70b3df83-7fe3-4c62-8967-f9163c53f6e9/C529.TCGA-VN-A88O-01A-11D-A34U-08.1_gdc_realn.bai
lrwxrwxr-x 1 liuxs liuxs 121 Nov 17 07:02 C529.TCGA-VN-A88O-01A-11D-A34U-08.1_gdc_realn.bam -> /public/home/liuxs/biodata/gdc/wes/70b3df83-7fe3-4c62-8967-f9163c53f6e9/C529.TCGA-VN-A88O-01A-11D-A34U-08.1_gdc_realn.bam

你可能感兴趣的:(生信|通过manifest文件批量构建软链接)