-
Notifications
You must be signed in to change notification settings - Fork 0
/
cartoflow.sh
161 lines (160 loc) · 4.45 KB
/
cartoflow.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#! /usr/bin/bash
##Make sure to run:
#chmod u+x cartoflow.sh
##Then run at least:
#bash cartoflow.sh -i <your_chemical_file.tsv>
##Workflow Program which runs all other Programs##
##################################
#Define Input and Output Files
infile="" #-i
outfile3="faceted_inact_node_network.tsv" #-o
outfile1="interactionsCTD" #-c
outjson="" #-j
organism="" #Define Taxonomy ID -g
test="" #Omniscience function toggle for single file output -t
debug="" #Debugging toggle for verbose output -d
removeJSON="" #Toggle for deleting orginal IntAct JSON file -r
noinstall="" #Disables installation of required packages in requirements.txt -z
#This one is for genebridge, not cartogene#
outputHeader="" #Toggle for having headers in the final master list(s) -e
chugReduction="" #Toggle to enable group betweeneness centrality for genebridge, VERY SLOW -f
fileName="edge2comm.txt" #Edge to Community file suffix -a
fileName2="comm2nodes.txt" #Community to Nodes file suffix -b
CARTOGENE_ARGS=""
GENEBRIDGE_ARGS=""
###USER DEFINED FUNCTIONS###
# Iterating through the arguments
while [[ $# -gt 0 ]]; do
case "$1" in
-a)
if [ -n "$2" ]; then
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -a $2"
fileName="$2"
fi
shift 2
;;
-b)
if [ -n "$2" ]; then
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -b $2"
fileName2="$2"
fi
shift 2
;;
-c)
if [ -n "$2" ]; then
CARTOGENE_ARGS="$CARTOGENE_ARGS -c $2"
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -c $2"
outfile1="$2"
fi
shift 2
;;
-d)
CARTOGENE_ARGS="$CARTOGENE_ARGS -d"
shift
;;
-e)
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -e"
shift
;;
-f)
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -f"
shift
;;
-g)
if [ -n "$2" ]; then
CARTOGENE_ARGS="$CARTOGENE_ARGS -g $2"
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -g $2"
organism="$2"
fi
shift 2
;;
-i)
if [ -n "$2" ]; then
CARTOGENE_ARGS="$CARTOGENE_ARGS -i $2"
infile="$2"
fi
shift 2
;;
-j)
if [ -n "$2" ]; then
CARTOGENE_ARGS="$CARTOGENE_ARGS -j $2"
outjson="$2"
fi
shift 2
;;
-o)
if [ -n "$2" ]; then
CARTOGENE_ARGS="$CARTOGENE_ARGS -o $2"
outfile3="$2"
fi
shift 2
;;
-r)
CARTOGENE_ARGS="$CARTOGENE_ARGS -r"
shift
;;
-t)
CARTOGENE_ARGS="$CARTOGENE_ARGS -t"
shift
;;
-z)
CARTOGENE_ARGS="$CARTOGENE_ARGS -z"
GENEBRIDGE_ARGS="$GENEBRIDGE_ARGS -z"
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
#repository download
rm -rf cartogene || true
rm -rf linkcomm-U || true
rm -rf genebridge || true
git clone https://github.com/ZealousGeneticist/cartogene.git
git clone https://github.com/ZealousGeneticist/linkcomm-U.git
git clone https://github.com/ZealousGeneticist/genebridge.git
echo ""
echo "If git wasn't 'found', then you may have to run this:"
echo "sudo apt install git"
echo ""
sleep 5
#
echo "Cartogene Phase..."
sleep 1
cp $infile ./cartogene
cd ./cartogene
python3 cartogene_standalone.py $CARTOGENE_ARGS
#
sleep 1
echo "LinkComm-U Phase..."
cp $outfile3 ../linkcomm-U
cd ../linkcomm-U
sleep 2
python3 python/link_clustering.py $outfile3
#Aquire actual file names
e2c=$fileName
fileName=$(find "." -type f -name "*$fileName")
fileName2=$(find "." -type f -name "*$fileName2")
outfile1+="_chemical-protein.tsv"
#fileName & fileName2 refer to linkcomm-U files
sleep 1
echo "Genebridge Phase..."
sleep 2
cp $fileName ../genebridge
cp $fileName2 ../genebridge
cd ../cartogene
cp $outfile1 ../genebridge
cp $outfile1 ../chemicalProteinInteractions.tsv
cd ../genebridge
sleep 2
python3 genebridge.py $GENEBRIDGE_ARGS
cp -r toppfunANDgraphs ..
cp Pyvis_Graph.html ../fullNetworkGraph.html
cp commMetrics.tsv ../communityMetrics.tsv
cp nodeMetrics.tsv ..
cp $fileName ../communityEdgeList.tsv
cd ..
#conclusion message
echo "Workflow complete!"