쉽게 사용할 수있는 값을 검색하기 위해 처리해야하는 .pdb 파일이 여러 개 있습니다. 나는 bash 스크립트를 만들어서 모든 명령을 하나로 묶어 보았다. 이 스크립트에 대한bash 스크립트가 작동하지 않습니다.
내 구체적인 질문은 두 가지이다 : 나는/입력 ./myscript.bash를 입력하여 우분투에서 명령 줄에서 bash는 그것을 실행하려고하고 후
내 스크립트가 동결 원하는 파일을 폴더로 출력하지 않습니다. 이 스크립트가 멈추는 원인이 될 수있는 실수는 무엇입니까? 마지막 명령에서
- ,
grep 'model*' $file >> $file"-confscore".txt #command to keep only the 1-5 lines from each dir I want to keep that contain this full format " model1 -5.00 0.21+-0.05 19.9+-1.8 404 0.003 " then >> combinedcscore.txt #Then reformat it to just "$dir model1 -5.00" >> newcombcscore.txt
나는 bash는이 명령을 작성하는 방법을 모르겠어요. 처음에 볼 수있는 grep은 모든 모델 * 텍스트를 포함하는 행을 $ file ___. txt라는 파일에 인쇄합니다. grep 밑의 # 라인에 포함 된 특정 형식으로이 파일이 필요합니다. 다음을 사용하려고합니다 :
for files in $dirs; do awk -F':' ' { print $dir model* firstvalueidk? }' >> newcombcscore.txt
awk를 올바르게 사용하고 있습니까?
여기 참조를 위해 전체 스크립트입니다 :
#! /usr/bin/env bash
#Step 0 - Set up variables & navigate to app. directory
set GETLOCATION = "~/Desktop/DCompartment/RolandoHT_Scripts/Perl_Scripts"
set GETNAME = "get_right_pdb_format.pl"
set SSLOCATION = "~/Desktop/DCompartment/RolandoHT_Scripts/Perl_Scripts"
set SSNAME = "get_ss_dssp_itasser.pl"
set PROTALOCATION = "~/Desktop/protAlign-master/"
set dirs = ~/Videos/Proteins/*
#Step 1 - Process PDB for readily available values
for dir in $dirs; do
rm `cscore|model*.pdb|seq.fasta`
done
for dir in $dirs; do
for file in *.pdb; do
perl $GETLOCATION/$GETNAME $file
dssp -i $file"-fix" -o $file.dssp
perl $SSLOCATION/$SSNAME $file.dssp $file"-out"
done
for file in $dirs/*.dssp; do
grep 'ACCESSIBLE SURFACE OF PROTEIN' $file >> $file"-SASA".txt
done
for file in $dirs/*.txt; do
echo "$file `cat $file`" >> $dir-combinedSASAs.txt
done
done
#Step 2 - Set up tool
for dir in $dirs; do
./$PROTALOCATION/initialize.sh
source $PROTALOCATION/bin/activate
done
#Step 3 - Start analyzing files
for dir in $dirs; do
for file in *.pdb; do
./$PROTALOCATION/program_name.py $dir $dir/native.pdb $dir-SPAR
done
done
for file in $dirs/data; do
set filerep = native-*.txt
grep 'TM-score' $filerep >> combinedreports.txt
awk 'FNR%2' combinedreports.txt > newcombinedrep.txt
done
for dir in $dirs; do
for file in cscore; do
grep 'model*' $file >> $file"-confscore".txt
#command to keep only the 1-5 lines from each dir I want to keep that contain this full format " model1 -5.00 0.21+-0.05 19.9+-1.8 404 0.003 " then >> combinedcscore.txt
#Then reformat it to just "$dir model1 -5.00" >> newcombcscore.txt
done
done
살펴 보시기 바랍니다 : http://www.shellcheck.net/를 – Cyrus
'bash는 set'은 (t) CSH의 set''대로 작동하지 않습니다. – choroba
[\ [shellcheck \]] (http://shellcheck.net)을 사용하여 스크립트를 검사할만한 가치가 있습니다. 또한'for cscore'는 당신이하고 싶지 않은 것일 수도 있습니다. – sjsam