Linuxでパイプラインを実行する[閉じる]

Linuxでパイプラインを実行する[閉じる]

このスクリプトがあります

#!/bin/bash
module load bedtools/2.21.0
bamfiles=(
/temp/hgig/fi1d18/1672_WTSI-COLO_023_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_023_1pre.dupmarked.bam
/temp/hgig/fi1d18/1672_WTSI-OESO_005_w3/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_005_w3.dupmarked.bam
/temp/hgig/fi1d18/1672_WTSI-OESO_036_2post/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_036_2post.dupmarked.bam
/temp/hgig/fi1d18/1672_WTSI-COLO_021_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_021_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_027_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_027_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_011_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_011_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_176_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_176_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_170_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_170_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_141_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_141_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLIVM_005_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLIVM_005_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_099_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_099_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_085_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_085_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_075_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_075_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_027_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_027_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_021_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_021_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-OESO_036_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_036_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_005_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_005_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_023_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_023_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-OESO_121_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_121_1pre.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-OESO_013_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_013_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-OESO_005_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-OESO_005_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_011_a_RNA/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_011_a_RNA.dupmarked.bam 
/temp/hgig/fi1d18/1672_WTSI-COLO_019_1pre/mapped_sample/HUMAN_1000Genomes_hs37d5_RNA_seq_WTSI-COLO_019_1pre.dupmarked.bam
)

for file in "${bamfiles[@]}"; do
    fname=$(basename "$file")
    fdir=$(dirname "$file")
    bamtofastq -i "$file" -fq "${fdir}/${fname%.bam}.fq"
done

私はこれを実行します

[fi1d18@cyan01 ~]$ chmod +x run.sh

[fi1d18@cyan01 ~]$ run.sh
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
basename: invalid option -- 's'
Try `basename --help' for more information.
./run.sh: line 30: bamtofastq: command not found
[fi1d18@cyan01 ~]$


[fi1d18@cyan01 ~]$ run.sh
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
./run.sh: line 32: bamtofastq: command not found
[fi1d18@cyan01 ~]$

ベストアンサー1

あなたの質問に限られた情報が与えられ、あなたのbamtofastqコマンドは次のようになります。これbedtoolsパッケージで次のことを思い出しました。

#!/bin/bash

bamfiles=(
    /path/to/file1.bam
    /path/to/file2.bam
    /path/to/file3.bam
)

for file in "${bamfiles[@]}"; do
    fname=$(basename "$file")
    fdir=$(dirname "$file")
    bedtools bamtofastq -i "$file" -fq "${fdir}/${fname%.bam}.fq"
done

これは、すべてのbamファイルをスクリプトに手動で入力し、.fqファイルがそのbamファイルと同じディレクトリにあることを前提としています。そうでない場合は、あなたの質問にもっと効果的に答えるための追加情報を提供してください。

おすすめ記事