One-Liners
A collection of potentially useful one-liners.
Gathering .db2 files from and .sdi list
while read line; do name=$(echo $line | awk -F'/' '{print $NF}'); echo $name; cp $line GZ/$RANDOM-$RANDOM-$name; done <working/enrichment_sdi
Repacking from .db2.gz to .tgz
echo "Gunzipping files..."; files=$(ls *db2.gz); for file in $files; do echo $file; gunzip $file; done; echo "Making tgz archives..."; files1=$(ls *db2); for file1 in $files1; do tar -czvf $file1.tgz $file1; done
Gathering and renaming db2 files
files=$(find . -name "*db2*"); for file in $files; do id=$(echo $file | awk -F"/" '{print $(NF-1)}'); echo $id; filename=$(echo $file | awk -F"/" '{print $NF}'); echo $filename; cp $file $id-$filename; done
while read line; do filename=$(echo $line | awk -F"/" '{print $(NF-1)"_"$NF}'); echo $filename; cp -v $line $filename; done <actives.list
db2.gz to names
files=$(ls *db2.gz); for file in $files; do zcat $file | head -n 1; done | awk '{print $2}' | sort -u > ../ligands.names
gather decoys to decoys.names
ll decoys | awk '{print $9}' | awk 'FS="." {print $1}' > decoys.names
then examine file content and delete not needed lines to get ligands.names use ligands.smi
copy decoy files listed in decoys_sdi
while read -u 9 line; do echo $line; name=$(echo $line | awk -F'\/' '{print $(NF-1) "-" $NF}'); echo $name "\n"; cp -v $line $name; done 9<../decoys/decoys_sdi
Getting names from .mol2
grep Name nsp14-frags-sel.mol2 | grep -v fake | grep -v Long | awk '{print $3}' | awk -F'.' '{print $1}' | sort -u
Make subset mol2 from larger mol2 file:
on gimel5 or dev nodes
python ~ttummino/zzz.scripts/misc/lc_blazing_fast_collect_mol2.py list_of_ids input_mol2 output_mol2
Add data to MOL2 header
python ~stefan/zzz.scripts/add_stuff_to_mol2_header_tc.py
The inputs are: the mol2 file a 2-columns list of ZINC-ID and Variables you want to add to the mol2 (ZINC ID tab variable) output file name Name of variable you add to the mol2
Purchasability: search zinc-22.py
https://wiki.docking.org/index.php/Search_zinc22.py
ssh n-1-17
source /nfs/soft/zinc22/search_zinc/miniconda/bin/activate /nfs/soft/zinc22/search_zinc/miniconda/envs/zinc22_search
python /nfs/soft/zinc22/search_zinc/search_zinc22.py --get-vendors input_zinc_ids.txt output_vendor_ids.txt
Get output as a table
file_name="pkd2-zinc22a-hac13-20-jji.out"; ids=$(awk '{print $2}' $file_name | sort -u); echo $ids; for id in $ids; do grep -m 1 $id $file_name | awk '{print $1}' | tr "\n" "\t"; echo -ne $id "\t"; grep --color $id $file_name | awk '{print $4}' | grep -v ZINC | sort -u | tr "\n" "\t"; echo ; done
with HAC
file_name="pkd2-down-sel-jji.out"; ids=$(awk '{print $2}' $file_name | sort -u); echo $ids; for id in $ids; do grep -m 1 $id $file_name | awk '{print $1}' | tr "\n" "\t"; echo -ne $id "\t"; hac=$(grep -m 1 $id $file_name | awk '{print $3}'); out_line=$(grep --color $id $file_name | awk '{print $4}' | grep -v ZINC | sort -u | tr "\n" "\t"; echo); echo -e $hac $out_line ; done
Rigid ligand docking
On Gimel Prepare a mol2 files corresponding to your ligands, then run
#!/bin/tcsh
# set mols= ( ls *mol2 )
setenv DOCKBASE /nfs/soft/dock/versions/dock37/DOCK-3.7.4rc1/
source $DOCKBASE/env.csh
foreach f ( `ls *mol2` )
set NAME = `basename $f .mol2`
echo "name.txt 1 $NAME CCCCCCCCCCCC | NO_LONG_NAME" > name.txt
python /mnt/nfs/home/ak87/PROGRAM/RIGID/convert.py --i=$f --o=$f-conv.mol2
$DOCKBASE/ligand/amsol/calc_solvation.csh $f-conv.mol2
$DOCKBASE/ligand/mol2db2/mol2db2.py -v --mol2=output.mol2 --solv=output.solv --db=$NAME.db2.gz
end