UnityMol  0.9.6-875
UnityMol viewer / In developement
VARNA.cs
Go to the documentation of this file.
1 using UnityEngine;
2 using System.Collections;
3 using System.Diagnostics;
4 using System.Collections.Generic;
5 using System.Text;
6 
7 public class VARNA : MonoBehaviour {
8  public static string generateStructureString(int sequenceLength, List<int[]> pairs)
9  {
10  StringBuilder structure = new StringBuilder(new string('.', sequenceLength), sequenceLength);
11  int pair_count = pairs.Count;
12  for (int i = 0; i < pair_count; i++)
13  {
14  int n1 = pairs[i][0];
15  int n2 = pairs[i][1];
16  if(n1 > n2) {
17  int temp = n1;
18  n1 = n2;
19  n2 = temp;
20  }
21  if (n1 <= pair_count && n2 <= pair_count && n1 != n2) {
22  structure[n1 - 1] = '(';
23  structure[n2 - 1] = ')';
24  }
25  }
26  return structure.ToString();
27  }
28 
29  public static Process generateImage(string sequence, string structure, string outputDirectory, string filename)
30  {
31  string cmd = "java";
32  ProcessStartInfo startInfo = new ProcessStartInfo(cmd);
33  startInfo.WorkingDirectory = outputDirectory;
34  startInfo.UseShellExecute = false;
35  startInfo.RedirectStandardInput = false;
36  startInfo.RedirectStandardOutput = false;
37  startInfo.Arguments = "-cp /Users/sebastien/Downloads/VARNAv3-9-src.jar fr.orsay.lri.varna.applications.VARNAcmd -sequenceDBN " + sequence + " -structureDBN " + structure + " -o " + filename;
38 
39  Process process = new Process();
40  process.StartInfo = startInfo;
41 
42  process.EnableRaisingEvents = true;
43 
44  return process;
45  }
46 }
static string generateStructureString(int sequenceLength, List< int[]> pairs)
Definition: VARNA.cs:8
Definition: VARNA.cs:7
static Process generateImage(string sequence, string structure, string outputDirectory, string filename)
Definition: VARNA.cs:29