-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathInfomap.sh
67 lines (39 loc) · 1.89 KB
/
Infomap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Usage: bash ~/Script/Infomap.sh 2-cols-edgelist
# Input: full edge infomation blocks
# Process: prepare edgelist, infomap, ID conversion, Profiling, binary and Transpose, prepare phylip matrix.
# Output:
# load module
module load R
module load python2/x86_64/2.7.14
# Define Input
InputNet=$1
export PATH=/home/tazha/Programs/Infomap:$PATH
# Use R to prepare input
Rscript /home/tazha/Scripts/PrepareInput.r $InputNet
# Change name, make folder
mv $InputNet.pajek $InputNet.net
# mkdir -p standalone_infomap_clustering_unweighted
mkdir -p $InputNet'_infomapClustering'
# Run stand-alone infomap
# Infomap $InputNet.net standalone_infomap_clustering_unweighted --clu -N 10 --map -2
# Infomap $InputNet.net standalone_infomap_clustering_unweighted --clu -N 5 --map -2
Infomap $InputNet.net $InputNet'_infomapClustering' --clu -N 10 --map -2
# can print out all the levels
# Infomap $InputNet.net standalone_infomap_clustering_unweighted --clu -N 1 --tree
# Post-process the output
python /home/tazha/Scripts/ReplaceNames.py $InputNet.nodelist $InputNet'_infomapClustering'/$InputNet.clu $InputNet'_infomapClustering'/Fixed-$InputNet.clu
# Let's continue
# make 2-column clustering result
sed "/#/d" $InputNet'_infomapClustering'/Fixed-$InputNet.clu|cut -f1,2 > $InputNet'_infomapClustering'/Fixed-$InputNet.clu_2cols
# run PhyProfiling
bash /home/tazha/Scripts/PhylogeneticProfiling_v125_justprofiling.sh $InputNet'_infomapClustering'/Fixed-$InputNet.clu_2cols
# binary and transpose matrix, size can be changed, now is 1
Rscript /home/tazha/Scripts/BinaryDataandTranspose.r $InputNet'_infomapClustering'/Fixed-$InputNet.clu_2cols-3-cols-input-profiled 1
# check columns and rows
matrix=$InputNet'_infomapClustering'/*binary_transposed
col=($(awk -F' ' '{print NF; exit}' $matrix))
row=($(wc -l $matrix))
col2=$(expr $col - 1)
#echo $col2
#echo $row
sed -i "1i$row $col2" $matrix