PowerShell Remoting Project Home

Tuesday, January 03, 2006

Working with SQL server in monad using pre-compiled .NET Class Library (3)

Now the usual routine operation:

Add a plasmid
Edit a plasmid

Why there is no “Delete plasmid” operation?

Because Biologists Never, Never, Ever lose their plasmids!


1. Add following code to our PlasmidView.DLL:


namespace PlasmidView

public class SQLProvider
{
public static PlasmidFull PlasmidFull_ByPlasmidID (int plasmidid)
{… }

public static void Plasmid_Add (PlasmidFull PlasmidToAdd)
{… }
public static void Plasmid_Edit (PlasmidFull PlasmidToEdit)
{…}

public static string Enzyme_ByEnzymeID (int enzymeID)
{…}
public static string BacResistanceType_ByTypeID (int TypeID)
{…}
public static string MamResistanceType_ByTypeID (int TypeID)
{…}
public static string InsertType_ByInsertTypeID (int insertTypeID)
{…}
}
public class PlasmidFull : PlasmidCore
{…}
}


2. Get a Plasmid by PlasmidID

[void][System.Reflection.Assembly]::LoadFile("D:\MSH\PlasmidView.dll")
$Plasmid= [PlasmidView.SQLProvider]::PlasmidFull_ByPlasmidID (10)
$Plasmid


BacResistance : 1
MamResistance : 2
HasGlycerolStock : False
InsertDescription : IL-17R full length receptor
InsertLength : 2451
InsertTypeID : 1
InsertType : Human
LeftEnzymeID : 14
LeftEnzyme : BamHI
RightEnzymeID : 62
RigthEnzyme : NcoI
IsBluntLigation : False
IsSequenced : True
Comments :
FullSeq :
InsertSeq :
PlasmidID : 10
BoxID : B
BoxPosition : 1
PlasmidName : IL-17R-FL-HA
DateCreated : 10/30/2005 9:18:18 PM
UserID : 1
UserCreated : me
PlasmidType : Cytokine Receptor
PlasmidTypeID : 3
ParentPlasmidID : 9
ParentPlasmid : pCMV4 HA Neo

3. Edit this plasmid entry

$Plasmid.PlasmidName = “mouse IL-17R-FL-HA”
$Plasmid.InsertTypeID = 2
[PlasmidView.SQLProvider]::Plasmid_Edit($Plasmid)
$Plasmid= [PlasmidView.SQLProvider]::PlasmidFull_ByPlasmidID (10)
$Plasmid


BacResistance : 1
MamResistance : 2
HasGlycerolStock : False
InsertDescription : IL-17R full length receptor
InsertLength : 2451
InsertTypeID : 2
InsertType : Mouse
LeftEnzymeID : 14
LeftEnzyme : BamHI
RightEnzymeID : 62
RigthEnzyme : NcoI
IsBluntLigation : False
IsSequenced : True
Comments :
FullSeq :
InsertSeq :
PlasmidID : 10
BoxID : B
BoxPosition : 1
PlasmidName : mouse IL-17R-FL-HA
DateCreated : 10/30/2005 9:18:18 PM
UserID : 1
UserCreated : me
PlasmidType : Cytokine Receptor
PlasmidTypeID : 3
ParentPlasmidID : 9
ParentPlasmid : pCMV4 HA Neo
4. Add a plasmid entry

$Plasmid= new-object PlasmidView.PlasmidFull
$Plasmid.BacResistance = 1
$Plasmid.MamResistance = 2
$Plasmid.HasGlycerolStock = $False
$Plasmid.InsertDescription = "truncated IL-17R receptor"
$Plasmid.InsertLength = 1851
$Plasmid.InsertTypeID = 2
$Plasmid.LeftEnzymeID = 14
$Plasmid.RightEnzymeID = 62
$Plasmid.IsBluntLigation = $False
$Plasmid.IsSequenced = $True
$Plasmid.BoxID = "B"
$Plasmid.BoxPosition = 90
$Plasmid.PlasmidName = "truncated mouse IL-17R-FL-HA"
$Plasmid.DateCreated = get-date
$Plasmid.UserID = 1
$Plasmid.PlasmidTypeID = 3
$Plasmid.ParentPlasmidID = 9

$Plasmid
$Plasmid= [PlasmidView.SQLProvider]::Plasmid_Add($Plasmid)
[PlasmidView.SQLProvider]::Plasmid_All() where-object {$_.PlasmidName
-like "*truncated mouse IL-17R-FL-HA*"}


PlasmidID : 22
BoxID : B
BoxPosition : 90
PlasmidName : truncated mouse IL-17R-FL-HA
DateCreated : 1/3/2006 12:09:52 AM
UserID : 1
UserCreated : me
PlasmidType : Cytokine Receptor
PlasmidTypeID : 3
ParentPlasmidID : 9
ParentPlasmid : pCMV4 HA Neo

Conclusion:
1. One of the advantages of using monad is that it is fully integrated with .Net frameworks. Although MSH does not have class definition machinery right now, we can easily construct a customized class in C# and use it in monad.

2. Pre-compiled class library will greatly simplify monad script. Even a new user can be trained to work with fairly complex administration jobs.

3. Security should always be in mind! Expose crucial objects or methods to unauthorized user may cause disastrous effect to system.

Tags:    


Comments:

Post a Comment



Links to this post:

Create a Link



<< Home