Commits

Doug Burke  committed 4e44830

Added SIF output version for BioFabric view

  • Participants
  • Parent commits ca46253

Comments (0)

Files changed (1)

File GetUserConnections.hs

   ./getuserconnections <infile1> .. <infileN>
   ./getuserconnections csv <infile1> .. <infileN>
   ./getuserconnections json <infile1> .. <infileN>
+  ./getuserconnections sif <infile1> .. <infileN>
 
 Aim:
 
 
 and the sindex/tindex values index into nodes.
 
+The sif argument creates
+   <node1>\tab<count>\tab<node2>
+
+since that is the format required by http://www.BioFabric.org/ (I am
+assukming the count value is one of a small number of values so it can be
+considered to be a small set of labels for v 1.0.0 of biofabric).
+
 When no argument is given an "unspecified" screen output is used
 (for debugging).
 
   let asCSV (c, r, nt, _) = T.unpack (getCSVLabel c) ++ "," ++ T.unpack (getCSVLabel r) ++ ";" ++ show nt
   in mapM_ (putStrLn . asCSV) . fst
   
+displaySIF :: ([UserConn], a) -> IO ()
+displaySIF = 
+  let asSIF (c, r, nt, _) = T.unpack (getCSVLabel c) ++ "\t" ++ show nt ++ "\t" ++ T.unpack (getCSVLabel r)
+  in mapM_ (putStrLn . asSIF) . fst
+  
 {-
 Just dump the output.
 -}
 usage :: IO ()
 usage = do
   pName <- getProgName
-  hPutStrLn stderr $ "Usage: " ++ pName ++ " [csv|json] <endpoint>"
+  hPutStrLn stderr $ "Usage: " ++ pName ++ " [csv|json|sif] <endpoint>"
   exitFailure
   
 main :: IO ()
       
     (a:endpoint:[]) | a == "json" -> queries endpoint >>= displayJSON
                     | a == "csv"  -> queries endpoint >>= displayCSV
+                    | a == "sif"  -> queries endpoint >>= displaySIF
     _ -> usage