Commit 9f332056e88eedaa57bcc71267eb489bd80226c2

Authored by Luis Arturo Medrano-Soto
1 parent b344449ca4
Exists in master

Fixed annoying bug where the origial input file(s) to getDomainTopology.pl was(were) modified

Showing 1 changed file with 11 additions and 3 deletions Side-by-side Diff

getDomainTopology.pl View file @ 9f33205
... ... @@ -234,6 +234,12 @@
234 234 my $tcdbDir = "$rootDir/tcdb";
235 235 system "mkdir -p $tcdbDir" unless (-d $tcdbDir);
236 236  
  237 + #to prevent modifying the original files, here I'll save the input
  238 + #sequences with the artificial TCIDs
  239 + my $origInfilesDir = "$rootDir/inputFiles";
  240 + system "mkdir -p $origInfilesDir" unless (-d $origInfilesDir);
  241 +
  242 +
237 243 #generate an empty "TCDB sequence file" that will contains proteins not in TCDB
238 244 my $new_tcdbSeqsFile = "$tcdbDir/tcdb.faa";
239 245 system "cat /dev/null > $new_tcdbSeqsFile";
... ... @@ -247,6 +253,8 @@
247 253 my $tcid = $pair->[0];
248 254 my $tgtF = $pair->[1];
249 255  
  256 + my @comp = split(/\//, $tgtF);
  257 + my $tgtFileName = $comp[-1];
250 258  
251 259 #Add family to the main array (as if provided by the -f commandline option)
252 260 push (@fams, $tcid);
... ... @@ -270,8 +278,8 @@
270 278  
271 279  
272 280 #Replace the TCID in the file corresponding to the target proteins
273   - my $cmd1 = qq(perl -i.orig -pe 's/\\>([a-zA-Z0-9_-]+).*/\\>${tgtTC}-\$1/;' $tgtF);
274   - system $cmd1 unless (-f "${tgtF}.orig");
  281 + my $cmd1 = qq(perl -pe 's/\\>([a-zA-Z0-9_-]+).*/\\>${tgtTC}-\$1/;' $tgtF > $origInfilesDir/$tgtFileName);
  282 + system $cmd1 unless (-f "$origInfilesDir/$tgtFileName");
275 283  
276 284  
277 285 #Extract sequences for reference family
... ... @@ -282,7 +290,7 @@
282 290  
283 291  
284 292 #Add family and target sequences to the new TCDB family
285   - my $cmd3 = qq(cat $outFile $tgtF >> $new_tcdbSeqsFile);
  293 + my $cmd3 = qq(cat $outFile $origInfilesDir/$tgtFileName >> $new_tcdbSeqsFile);
286 294 system $cmd3;
287 295 }
288 296