#!/usr/bin/perl

print STDERR"
##################################################
# atomconverter.pl -f<from_fromat> -t<to_format> #
#                  < in_noe_list > out_noe_list  #
#                                                #
# Coverts atom names from one format to another. #
# Known formats: BMRB, UCSF, XPLOR, MSI, PDB,    #
# SYBYL, MIDAS, DIANA, GROMACS                   #
# Conversion is based on the file:               #
# http://www.bmrb.wisc.edu/ref_info/atom_nom.tbl #
#                                                #
##################################################

";

&Init;
use Getopt::Std;
getopts('f:t:hv') || die "Valid options are: -f<format>, -t<format>, -h[elp], -v[erbose]\n";
if ($opt_h){
    print "Conversion table used:\n$conversion_table\n";
    exit;
}

if (($opt_f !~ /[a-z]/i) || ($opt_t !~ /[a-z]/i)){
    die "Please specify valid 'from' and 'to' formats\n";
}
if ($opt_f !~/^BMRB|UCSF|XPLOR|MSI|PDB|SYBYL|MIDAS|DIANA|GROMACS$/i){
    die "Invalid 'from' format, please choose from known formats only\n";
}
if ($opt_t !~/^BMRB|UCSF|XPLOR|MSI|PDB|SYBYL|MIDAS|DIANA|GROMACS$/i){
    die "Invalid 'to' format, please choose from known formats only\n";
}
if ($opt_f eq $opt_t){
    die "'from' and 'to' formats are the same, nothing to do.\n";
}

# reading conversion table
foreach $cl (split(/\n/,$conversion_table)){
    # skip comment or blank lines
    next if (($cl =~ /^\#/) || ($cl !~/[a-z]/i));
    # header line
    if ($cl =~ /^A\tAAA/){
	$n=0;
	foreach $colname (split(/\t/,$cl)){
	    $colname=~s/ //g;
	    if ($colname eq uc($opt_f)){$FROM=$n}
	    if ($colname eq uc($opt_t)){$TO=$n}
	    $n++;
	}
        #print "FROM $FROM TO $TO\n";
    }
    # atom name line
    else{
	@ac=split(/\t/,$cl);
	$from_id=$ac[1]." ".$ac[$FROM];
	$to_id=$ac[1]." ".$ac[$TO];
	#if (length($to_id) < length($from_id)){$to_id.=" "x(length($from_id)-length($to_id))}
	#if (length($from_id) < length($to_id)){$from_id.=" "x(length($to_id)-length($from_id))}
        if (($from_id =~ /[A-Z]+ [A-Z0-9]+/) && ($to_id =~ /[A-Z]+ [A-Z0-9]+/)){
	 $CONVERT{$from_id}=$to_id;
        }

    }
}

# reading NMR-STAR format NOE restraint file
while(<>){
    chomp;
    # simplest...
    #$_=~s/ ([A-Z]{3}) +([0-9A-Z]+) / $1 $2 /g;
    foreach $from_id (keys %CONVERT){
        ($rsf,$atf)=split(/ +/,$from_id);
        #print "$from_id -> $rsf $atf\n" if ($from_id =~/TYR/);
        ($rst,$att)=split(/ +/,$CONVERT{$from_id});
        #if ($_=~/ $rsf +$atf/){print "HELLO: $_ | $from_id ($rsf $atf)\n"}
        # Replacing spaces between resnum and atom ensures
        # that the already changed atom will not be changed again
        # within the loop
	if ($_=~/ $rsf( +)$atf /){
	    $ptc=$_;
	    $ptc=~s/^.* $rsf( +)$atf .*$/$1/;
	    $ptc=~s/ /\=/g;
	    #print "PTC $ptc\n";
	    $_=~s/ $rsf( +)$atf / $rst$ptc$att /g;
	}
    }
    $_=~s/\=/ /g;
    print "$_\n";
}


sub Init{
# Conversion table put here to avoid dependence on external files.
# This table is a slightly modified version of 
# http://www.bmrb.wisc.edu/ref_info/atom_nom.tbl
$conversion_table="
# Correlation of hydrogen atom naming systems, including diastereotopic
# protons. The original version of this table was created by Charles 
# Hoogstraten.
#
# BMRB  = System in use at BioMagResBank (IUPAC/IUB Biochemistry 9, 3471-3479
#	  [1970]).
#
# SC    = Stereochemical designations 
#
# UCSF  = Mardigras-type software (peptide protonated with newhyd utility).
#
# XPLOR = Peptide protonated with XPLOR 3.1.  Atom nomenclature is derived
#	  from the X-PLOR topology file topallhdg.pro.  
#
# MSI   = Artificial peptide created with InsightII.  For the side chain
#	  protons attached to nitrogen in ASN, GLN, and ARG, the atom
#	  nomenclature does not reflect the potential stereoisomerism of the
#	  planar amide and guanidinium groups.  The correlation with Z and E
#	  nomenclature listed here simply reflects the state of the artificial
#	  peptide generated as an example.  The CG1 and CG2 atoms for VAL in a
#	  peptide generated by InsightII are not labeled according to IUPAC
#	  rules, while the CD1 and CD2 atoms for LEU are.
#
# PDB   = PDB nomenclature (Taken from PDB entry 6I1B REVDAT 15-OCT-92.)
#
# SYBYL = The atom nomenclature was taken from the xxx.res files supplied with
#	  the software package Sybyl version 6.2 from Tripos, Inc.  
#
# MIDAS = MidasPlus from the Computer Graphics Laboratory at UCSF.  The atom 
#	  nomenclature has been taken from the XXX.ins files supplied with the
#	  software.  The prochiral atoms have not been correlated with the
#	  BMRB assignments at this time.  Hydrogens are not included in the
#	  XXX.ins template files.
#
# Note-1: The prochiral methyl group names may reflect convention of code
#	  generating heavy atom names if protons are added later.
#
# Note-2: '*' The stereochemical assignments for the named atoms have not been
#	  determined for these software systems.
#
# Note-3: The Z and E nomenclature is defined in the paper by Blackwood, J.E.,
#	  Gladys, C.L., Loening, K.L., Petrarca, A.E., and Rush, J.E., 
#	  'Unambiguous Specification of Stereoisomerism about a Double Bond,'
#	  J. Amer. Chem. Soc. 90, 509-510 (1968).
#
# Note-3: For the terminal amine and carboxyl atoms, 'X' has been used as a
#	  dummy value for the amino acid type.
#
# Note-4: The terminal secondary amine protons for PRO have been included
#	  with the other PRO atoms.
#
# Note-5: Fields in the table are separated by tabs.
#
# Note-6: Please report errors, updates, or extensions to Eldon Ulrich
#	  (elu@nmrfam.wisc.edu)

# A.A.		BMRB	SC	PDB	UCSF	MSI	XPLOR	SYBYL*	MIDAS*	DIANA
# ----		----	----	----	----	----	-----	-----	-----	-----

# Header line for determining column for each format

A	AAA	BMRB	SC	PDB	UCSF	MSI	XPLOR	SYBYL	MIDAS	DIANA	GROMACS

# Terminal amine protons

X	XXX	H1		1H	HN1	HN1	HT1	HNCAP			H1
X	XXX	H2		2H	HN2	HN2	HT2				H2
X	XXX	H3		3H	HN3	HN3	HT3				H3

# Terminal carboxyl atoms

X	XXX	H''						HOCAP		
X	XXX	O'		O		O	OT1	O	O		OC1
X	XXX	O''		OXT		OXT	OT2	OXT	OXT		OC2

# Residue atoms

A	ALA	H		H	HN	HN	HN	H		HN	H
A	ALA	HA		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S	ND1		ND1		ND1	ND1	ND1	ND1	ND1	ND1
H	HIS	NE2		NE2		NE2	NE2	NE2	NE2	NE2	NE2
H	HIS	O		O		O	O	O	O	O	O

I	ILE	H		H	HN	HN	HN	H		HN	H
I	ILE	HA		HA	HA	HA	HA	HA		HA	HA
I	ILE	HB		HB	HB	HB	HB	HB		HB	HB
I	ILE	HG12	pro-R	1HG1	HG11	HG11	HG12	HG12		HG12	2HG1
I	ILE	HG13	pro-S	2HG1	HG12	HG12	HG11	HG11		HG13	1HG1
I	ILE	HG21		1HG2	HG21	HG21	HG21	HG21		HG21	1HG2
I	ILE	HG22		2HG2	HG22	HG22	HG22	HG22		HG22	2HG2
I	ILE	HG23		3HG2	HG23	HG23	HG23	HG23		HG23	3HG2
I	ILE	HD11		1HD1	HD11	HD11	HD11	HD11		HD11	HD1
I	ILE	HD12		2HD1	HD12	HD12	HD12	HD12		HD12	HD2
I	ILE	HD13		3HD1	HD13	HD13	HD13	HD13		HD13	HD3
I	ILE	C		C		C	C	C	C	C	C
I	ILE	CA		CA		CA	CA	CA	CA	CA	CA
I	ILE	CB		CB		CB	CB	CB	CB	CB	CB
I	ILE	CG1		CG1		CG1	CG1	CG1	CG1	CG1	CG1
I	ILE	CG2		CG2		CG2	CG2	CG2	CG2	CG2	CG2
I	ILE	CD1		CD1		CD1	CD1	CD1	CD1	CD1	CD1
I	ILE	N		N		N	N	N	N	N	N
I	ILE	O		O		O	O	O	O	O	O

L	LEU	H		H	HN	HN	HN	H		HN	H
L	LEU	HA		HA	HA	HA	HA	HA		HA	HA
L	LEU	HB2	pro-R	1HB	HB1	HB1	HB2	HB2		HB2	HB2
L	LEU	HB3	pro-S	2HB	HB2	HB2	HB1	HB1		HB3	HB1
L	LEU	HG		HG	HG	HG	HG	HG		HG	HG
L	LEU	HD11		1HD1	HD11	HD11	HD11	HD11		HD11	1HD1
L	LEU	HD12		2HD1	HD12	HD12	HD12	HD12		HD12	2HD1
L	LEU	HD13		3HD1	HD13	HD13	HD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