Advertisement
Creadth

ce sharp

Sep 25th, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. using System.IO;
  4.  
  5. namespace Creadth.OhWhatever
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             var watcher = new Stopwatch();
  12.             watcher.Start();
  13.             var molId = 0;
  14.             using (var inFile = new StreamReader("E:/out"))
  15.             using (var outFile = new StreamWriter("E:/in"))
  16.             {
  17.                 outFile.WriteLine("MolID;Target;Ligand;Run;Pose;Rank;dG;VS;Atom;X;Y;Z");
  18.                 while (!inFile.EndOfStream)
  19.                 {
  20.                     var cnt = int.Parse(inFile.ReadLine());
  21.                     var comment = inFile.ReadLine();
  22.                     var isp = comment.Split(",");
  23.                     var fst = isp[0].Split("-");
  24.                     var l = $"{molId};{fst[0]};{fst[1]};{fst[4]};{fst[6]};{isp[1]};{isp[2]};{isp[3]};";
  25.                     for (int i = 0; i < cnt; i++)
  26.                     {
  27.                         outFile.WriteLine(l+inFile.ReadLine().Replace("    ", ";"));                        
  28.                     }
  29.                     molId++;
  30.                 }
  31.             }
  32.             watcher.Stop();
  33.             Console.WriteLine("Elapsed: " + watcher.Elapsed);
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement