|
[求助]
MS perl code 交联键的建立
各位大神,我最近用MS模拟研究蛋白质上自由巯基形成二硫键交联键。如下是我的perl code。目前的问题
Type mismatch in CreateBond (function/property "CreateBond", parameter 1) at -e line 60
Can't call method "My" on an undefined value at -e line 64.
请问如何解决? 大家有什么想法敬请发言。
#use strict;
use Getopt::Long;
use MaterialsScript qw(:all);
my $doc = $Documents{"peptide.xsd"};
my $sets = $doc->UnitCell->Sets;
foreach my $set (@$sets) {
$set->Delete;
}
$doc->UnitCell->Atoms;
my $atoms = $doc->UnitCell->Atoms;
foreach my $atom (@$atoms){
if($atom->ElementSymbol eq "S"{
$atom->Name = "RS";
foreach my $atom1 (@{$atom->AttachedAtoms}){
if( $atom1->ElementSymbol eq "H"{$atom1->Name = "RH";}
}
}
}
my @reactive_S;
my @reactive_H;
foreach my $atom (@$atoms){
if ($atom -> Name eq "RS"{
push (@reactive_S, $atoms);}
elsif($atom->Name eq "RH"{
push (@reactive_H, $atom);}}
#my $reactive_S_set=$doc->CreateSet("reactive_S",\@reactive_S);
#my $reactive_H_set=$doc->CreateSet("reactive_H",\@reactive_H);
Tools->BondCalculation->ChangeSettings([ExclusionMode => 'Set']);
Tools->BondCalculation->ChangeSettings(Settings( DistanceCriterionMode =>"Absolute",
MinAbsoluteDistance => 0.0, MaxAbsoluteDistance => 3));
$doc->CalculateCloseContacts;
my $CloseContacts = $doc->UnitCell ->CloseContacts;
my @GoodCloseContacts;
foreach my $CloseContact (@$CloseContacts){
my $Name1=$CloseContact->Atom1->Name;
my $Name2=$CloseContact->Atom2->Name;
my $Atom1=$CloseContact->Atom1;
my $Atom2=$CloseContact->Atom2;
if(($Name1 eq "RS" && ($Name2 eq "RS") {
push(@GoodCloseContacts,[1,$Name1,$Name2,$Atom1->X, $Atom1->Y, $Atom1->Z, $Atom2->X, $Atom2->Y, $Atom2->Z, $CloseContact->Length,$CloseContact->Atom1,$CloseContact->Atom2]);}}
if($Name1 eq "RS"{
$S=$Atom1;
foreach my $at1 (@{$Atom1->AttachedAtoms}){
if($at1->Name eq "RS"{$S=$at1;
push(@reactive_S,$S);}
else{
$H=$at1;}}}
$doc->CreateBond($S, $S, "Single"
push(@AtomsToDelete,$H);
$CloseContacts->Delete;
My$AtomsToDelete_Set=$doc->CreateSet("AtomsToDelete",\@AtomsToDelete);
$AtomsToDelete_Set->Items->Delete;
my @atomsToDelete;
my $AtomsToDelete_Set=$doc->CreateSet("AtomsToDelete",\@AtomsToDelete);
$AtomsToDelete_Set->Items->Delete;
my $j=0;
foreach my $b(@reactive_S){
$j=+2;} |
|