Skip to content

Commit

Permalink
Merge branch 'development_3.0' into arch_frontend_invitro
Browse files Browse the repository at this point in the history
  • Loading branch information
Newatia authored and Newatia committed Apr 17, 2024
2 parents dbe3fec + 7278c99 commit f683bae
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/core/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ export class AdminService extends BaseHttpService {
if (scrubber) {
toput.processingActions[0].parameters['scrubberSettings'] = scrubber;
toput.processingActions[0]["processingActionName"] = "Scrub";
toput.processingActions[1] = {"parameters": {

}, "processingActionName": action}
}

return this.http.put< any >(url, toput);
Expand Down
3 changes: 3 additions & 0 deletions src/app/core/substance-form/substance-form.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
<mat-option value="regenRefs" >
Regenerate reference UUIDs
</mat-option>
<mat-option value="regenUUID" >
Regenerate substance UUID
</mat-option>
</ng-container>
</mat-select>
</mat-form-field>
Expand Down
8 changes: 8 additions & 0 deletions src/app/core/substance-form/substance-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -592,8 +592,16 @@ getDrafts() {
if (this.feature === 'regenRefs') {
this.regenRefs();
}
if (this.feature === 'regenUUID') {
if(confirm('Warning: This will regenerate the substance UUID which will cause issues with already registered substances. Are you sure you want to continue?')){
this.substanceFormService.regenUUID();
alert('Substance UUID has been regenerated');
}
}





}

Expand Down
105 changes: 105 additions & 0 deletions src/app/core/substance-form/substance-form.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1527,6 +1527,11 @@ export class SubstanceFormService implements OnDestroy {

}

regenUUID(): void {
this.privateSubstance.uuid = this.utilsService.newUUID();
this.substanceEmitter.next(this.privateSubstance);
}

approveSubstance(): Observable<any> {
return new Observable(observer => {
const results: SubstanceFormResults = {
Expand Down Expand Up @@ -2077,10 +2082,110 @@ export class SubstanceFormService implements OnDestroy {
this.substanceEmitter.next(this.privateSubstance);
}


//by Tyler, convert smiles, single, and 3 letter amino acids. convert 3 to 1, 1 to 3, and 1 to SMILES
aminoSmilesConversion(value: string, direction: string): string {
const aminoLookups = {
"A": "ALA",
"C": "CYS",
"D": "ASP",
"E": "GLU",
"F": "PHE",
"G": "GLY",
"H": "HIS",
"I": "ILE",
"K": "LYS",
"L": "LEU",
"M": "MET",
"N": "ASN",
"P": "PRO",
"Q": "GLN",
"R": "ARG",
"S": "SER",
"T": "THR",
"V": "VAL",
"W": "TRP",
"Y": "TYR"
};


const aaSmilesLookup={
"A": "N[C@@H](C)C(=O)",
"a": "N[C@H](C)C(=O)",
"C": "N[C@@H](CS)C(=O)",
"c": "N[C@H](CS)C(=O)",
"D": "N[C@@H](CC(=O)O)C(=O)",
"d": "N[C@H](CC(=O)O)C(=O)",
"E": "N[C@@H](CCC(=O)O)C(=O)",
"e": "N[C@H](CCC(=O)O)C(=O)",
"F": "N[C@@H](CC$1C=CC=CC=$1)C(=O)",
"f": "N[C@H](CC$1C=CC=CC=$1)C(=O)",
"G": "NCC(=O)",
"g": "NCC(=O)",
"H": "N[C@@H](CC$1=CNC=N$1)C(=O)",
"h": "N[C@H](CC$1=CNC=N$1)C(=O)",
"I": "N[C@@H]([C@@H](C)CC)C(=O)",
"i": "N[C@H]([C@@H](C)CC)C(=O)",
"K": "N[C@@H](CCCCN)C(=O)",
"k": "N[C@H](CCCCN)C(=O)",
"L": "N[C@@H](CC(C)C)C(=O)",
"l": "N[C@H](CC(C)C)C(=O)",
"M": "N[C@@H](CCSC)C(=O)",
"m": "N[C@H](CCSC)C(=O)",
"N": "N[C@@H](CC(=O)N)C(=O)",
"n": "N[C@H](CC(=O)N)C(=O)",
"P": "N$1[C@@H](CCC$1)C(=O)",
"p": "N$1[C@H](CCC$1)C(=O)",
"Q": "N[C@@H](CCC(=O)N)C(=O)",
"q": "N[C@H](CCC(=O)N)C(=O)",
"R": "N[C@@H](CCCNC(=N)N)C(=O)",
"r": "N[C@H](CCCNC(=N)N)C(=O)",
"S": "N[C@@H](CO)C(=O)",
"s": "N[C@H](CO)C(=O)",
"T": "N[C@@H]([C@H](O)C)C(=O)",
"t": "N[C@H]([C@H](O)C)C(=O)",
"V": "N[C@@H](C(C)C)C(=O)",
"v": "N[C@H](C(C)C)C(=O)",
"W": "N[C@@H](CC$1=CNC$2=C$1C=CC=C$2)C(=O)",
"w": "N[C@H](CC$1=CNC$2=C$1C=CC=C$2)C(=O)",
"Y": "N[C@@H](CC$1C=CC(O)=CC=$1)C(=O)",
"y": "N[C@H](CC$1C=CC(O)=CC=$1)C(=O)",
".": "O.",
";": "O."
};

Object.keys(aminoLookups)
.map(k => {
aminoLookups[aminoLookups[k]] = k;
});

if (direction === 'toSmiles') {
let smi = value.split("")
.map(am=>aaSmilesLookup[am].replace(/[$]/g,""))
.join("") + "O";

return smi;
} else if (direction === 'toThree') {
return value.split("")
.map(aa => aminoLookups[aa.toUpperCase()])
.map(aa => (aa) ? aa : "UNK")
.map(aa => aa[0] + (aa[1] + aa[2]).toLowerCase())
.join("-");
} else {
return value.split("-")
.map(aa => aminoLookups[aa.toUpperCase()])
.map(aa => (aa) ? aa : "X")
.join("");
}
}


}





interface DisplaySite {
type: string;
subunit: number;
Expand Down

0 comments on commit f683bae

Please sign in to comment.