#include #include #include #include #include #include "nabcode.h" extern char NAB_rsbuf[]; INT_T put_tmp ( REAL_T *x, REAL_T *y, REAL_T *z, INT_T *count, INT_T *rescount, STRING_T * *atomname, STRING_T * *resname, FILE_T * *outfile, INT_T *nres ){ if( *rescount == 1 || *rescount == ( *nres / 2 ) + 1 ) if( NAB_rematch( *atomname, "P" ) ) return( 1 ); if( EQ( *atomname, "O1'" ) ) NAB_strcpy( & *atomname, "O4'" ); fprintf( *outfile, "ATOM %5d %-4s %-3s%6d %8.3lf%8.3lf%8.3lf\n", *count, *atomname, *resname, *rescount, *x, *y, *z ); return( 1 ); } MOLECULE_T *fd_helix( STRING_T * *helix_type, STRING_T * *seq, STRING_T * *acid_type ) { MOLECULE_T *m; HASH_T *ade_r = NULL; HASH_T *ade_phi = NULL; HASH_T *ade_zz = NULL; HASH_T *gua_r = NULL; HASH_T *gua_phi = NULL; HASH_T *gua_zz = NULL; HASH_T *thy_r = NULL; HASH_T *thy_phi = NULL; HASH_T *thy_zz = NULL; HASH_T *ura_r = NULL; HASH_T *ura_phi = NULL; HASH_T *ura_zz = NULL; HASH_T *cyt_r = NULL; HASH_T *cyt_phi = NULL; HASH_T *cyt_zz = NULL; REAL_T temp_r, temp_phi, temp_zz; REAL_T x, y, z, yyr, xrad; REAL_T current_height, current_rotation; REAL_T height_increment, rotation_increment; HASH_T *hxht = NULL; HASH_T *hxrep = NULL; STRING_T *tempname = NULL, *cseq = NULL, *fullseq = NULL, *buffer = NULL, *restype = NULL; STRING_T *temp = NULL; STRING_T *resout = NULL; STRING_T *nabhome = NULL; INT_T nres, nresh, i, hxmul, count, chain, begin, end; FILE_T *infile, *outfile; INT_T __it0001__; STRING_T *__st0001__ = NULL; STRING_T *__st0002__ = NULL; STRING_T *__st0003__ = NULL; CURHASH_T __cht0001__; CURHASH_T __cht0002__; CURHASH_T __cht0003__; CURHASH_T __cht0004__; CURHASH_T __cht0005__; HRF( &hxht, "arna", 3 ) = 2.810000E+00;HRF( &hxht, "aprna", 3 ) = 3.000000E+00;HRF( &hxht, "lbdna", 3 ) = 3.380000E+00; HRF( &hxht, "abdna", 3 ) = 3.380000E+00;HRF( &hxht, "sbdna", 3 ) = - 3.380000E+00;HRF( &hxht, "adna", 3 ) = 2.560000E+00; HRF( &hxrep, "arna", 3 ) = 3.270000E+01;HRF( &hxrep, "aprna", 3 ) = 3.000000E+01;HRF( &hxrep, "lbdna", 3 ) = 3.600000E+01; HRF( &hxrep, "abdna", 3 ) = 3.600000E+01;HRF( &hxrep, "sbdna", 3 ) = 3.600000E+01;HRF( &hxrep, "adna", 3 ) = 3.270000E+01; if( !( NAB_strcpy( &nabhome, getenv( "NABHOME" ) ) ) ){ fprintf( stderr, "Error: NABHOME not defined.\n" ); exit( 0 ); } NAB_strcpy( &temp, wc_complement( seq, STEMP( __st0001__, NAB_strcat( *acid_type, "amber94.rlb" ) ), acid_type ) ); NAB_strcpy( &cseq, "" ); for( i = length( temp );i >= 1;i -- ){ NAB_strcpy( &cseq, NAB_strcat( cseq, substr( temp, i, 1 ) ) ); } NAB_strcpy( &fullseq, NAB_strcat( *seq, cseq ) ); nresh = length( *seq ); nres = length( fullseq ); NAB_strcpy( &temp, NAB_strcat( nabhome, NAB_strcat( "/fd_data/", NAB_strcat( *helix_type, ".dat" ) ) ) ); printf( "Data file: %s\n", temp ); infile = fopen( temp, "r" ); if( infile == NULL ){ fprintf( stderr, "Unable to open data file %s; exiting\n", temp ); exit( 1 ); } outfile = fopen( "nab_tmp.pdb", "w" ); while( NAB_strcpy( &buffer, NAB_getline( infile ) ) ){ sscanf( buffer, "%s %lf %lf %lf %s", NAB_readstring( &tempname ), &temp_r, &temp_phi, &temp_zz, NAB_readstring( &restype ) ); if( ( EQ( restype, "A" ) ) || ( EQ( restype, "a" ) ) ){ HRF( &ade_r, tempname, 3 ) = temp_r; HRF( &ade_phi, tempname, 3 ) = temp_phi; HRF( &ade_zz, tempname, 3 ) = temp_zz; } else if( ( EQ( restype, "G" ) ) || ( EQ( restype, "g" ) ) ){ HRF( &gua_r, tempname, 3 ) = temp_r; HRF( &gua_phi, tempname, 3 ) = temp_phi; HRF( &gua_zz, tempname, 3 ) = temp_zz; } else if( ( EQ( restype, "T" ) ) || ( EQ( restype, "t" ) ) ){ HRF( &thy_r, tempname, 3 ) = temp_r; HRF( &thy_phi, tempname, 3 ) = temp_phi; HRF( &thy_zz, tempname, 3 ) = temp_zz; } else if( ( EQ( restype, "U" ) ) || ( EQ( restype, "u" ) ) ){ HRF( &ura_r, tempname, 3 ) = temp_r; HRF( &ura_phi, tempname, 3 ) = temp_phi; HRF( &ura_zz, tempname, 3 ) = temp_zz; } else if( ( EQ( restype, "C" ) ) || ( EQ( restype, "c" ) ) ){ HRF( &cyt_r, tempname, 3 ) = temp_r; HRF( &cyt_phi, tempname, 3 ) = temp_phi; HRF( &cyt_zz, tempname, 3 ) = temp_zz; } } height_increment = HRF( &hxht, *helix_type, 3 ); rotation_increment = HRF( &hxrep, *helix_type, 3 ); current_height = 0; current_rotation = 0; count = 0; for( chain = 1;chain <= 2;chain ++ ){ if( chain == 1 ){ begin = 1; end = nresh; hxmul = - 1; } else if( chain == 2 ){ begin = nresh + 1; end = nres; hxmul = 1; } for( i = begin;i <= end;i ++ ){ NAB_strcpy( &restype, substr( fullseq, i, 1 ) ); if( ( EQ( restype, "A" ) ) || ( EQ( restype, "a" ) ) ){ NAB_strcpy( &resout, "A" );if( EQ( *acid_type, "rna" ) )NAB_strcpy( &resout, "RA" ); if( i == begin )NAB_strcpy( &resout, NAB_strcat( resout, "5" ) ); if( i == end )NAB_strcpy( &resout, NAB_strcat( resout, "3" ) ); for( NAB_hfirst( ade_r, &__cht0001__ );NAB_strcpy( &tempname, NAB_hnext( ade_r, &__cht0001__ ) ); ){ count ++ ; yyr = ( hxmul * ( HRF( &ade_phi, tempname, 3 ) ) + current_rotation ); xrad = HRF( &ade_r, tempname, 3 ); x = xrad * ( COS( yyr ) ); y = xrad * ( SIN( yyr ) ); z = hxmul * ( HRF( &ade_zz, tempname, 3 ) ) + current_height; put_tmp( &x, &y, &z, &count, &i, &tempname, &resout, &outfile, &nres ); } } else if( ( EQ( restype, "G" ) ) || ( EQ( restype, "g" ) ) ){ NAB_strcpy( &resout, "G" );if( EQ( *acid_type, "rna" ) )NAB_strcpy( &resout, "RG" ); if( i == begin )NAB_strcpy( &resout, NAB_strcat( resout, "5" ) ); if( i == end )NAB_strcpy( &resout, NAB_strcat( resout, "3" ) ); for( NAB_hfirst( gua_r, &__cht0002__ );NAB_strcpy( &tempname, NAB_hnext( gua_r, &__cht0002__ ) ); ){ count ++ ; yyr = ( hxmul * ( HRF( &gua_phi, tempname, 3 ) ) + current_rotation ); xrad = HRF( &gua_r, tempname, 3 ); x = xrad * ( COS( yyr ) ); y = xrad * ( SIN( yyr ) ); z = hxmul * ( HRF( &gua_zz, tempname, 3 ) ) + current_height; put_tmp( &x, &y, &z, &count, &i, &tempname, &resout, &outfile, &nres ); } } else if( ( EQ( restype, "T" ) ) || ( EQ( restype, "t" ) ) ){ NAB_strcpy( &resout, "T" ); if( i == begin )NAB_strcpy( &resout, NAB_strcat( resout, "5" ) ); if( i == end )NAB_strcpy( &resout, NAB_strcat( resout, "3" ) ); for( NAB_hfirst( thy_r, &__cht0003__ );NAB_strcpy( &tempname, NAB_hnext( thy_r, &__cht0003__ ) ); ){ count ++ ; yyr = ( hxmul * ( HRF( &thy_phi, tempname, 3 ) ) + current_rotation ); xrad = HRF( &thy_r, tempname, 3 ); x = xrad * ( COS( yyr ) ); y = xrad * ( SIN( yyr ) ); z = hxmul * ( HRF( &thy_zz, tempname, 3 ) ) + current_height; put_tmp( &x, &y, &z, &count, &i, &tempname, &resout, &outfile, &nres ); } } else if( ( EQ( restype, "U" ) ) || ( EQ( restype, "u" ) ) ){ NAB_strcpy( &resout, "RU" ); if( i == begin )NAB_strcpy( &resout, NAB_strcat( resout, "5" ) ); if( i == end )NAB_strcpy( &resout, NAB_strcat( resout, "3" ) ); for( NAB_hfirst( ura_r, &__cht0004__ );NAB_strcpy( &tempname, NAB_hnext( ura_r, &__cht0004__ ) ); ){ count ++ ; yyr = ( hxmul * ( HRF( &ura_phi, tempname, 3 ) ) + current_rotation ); xrad = HRF( &ura_r, tempname, 3 ); x = xrad * ( COS( yyr ) ); y = xrad * ( SIN( yyr ) ); z = hxmul * ( HRF( &ura_zz, tempname, 3 ) ) + current_height; put_tmp( &x, &y, &z, &count, &i, &tempname, &resout, &outfile, &nres ); } } else if( ( EQ( restype, "C" ) ) || ( EQ( restype, "c" ) ) ){ NAB_strcpy( &resout, "C" );if( EQ( *acid_type, "rna" ) )NAB_strcpy( &resout, "RC" ); if( i == begin )NAB_strcpy( &resout, NAB_strcat( resout, "5" ) ); if( i == end )NAB_strcpy( &resout, NAB_strcat( resout, "3" ) ); for( NAB_hfirst( cyt_r, &__cht0005__ );NAB_strcpy( &tempname, NAB_hnext( cyt_r, &__cht0005__ ) ); ){ count ++ ; yyr = ( hxmul * ( HRF( &cyt_phi, tempname, 3 ) ) + current_rotation ); xrad = HRF( &cyt_r, tempname, 3 ); x = xrad * ( COS( yyr ) ); y = xrad * ( SIN( yyr ) ); z = hxmul * ( HRF( &cyt_zz, tempname, 3 ) ) + current_height; put_tmp( &x, &y, &z, &count, &i, &tempname, &resout, &outfile, &nres ); } } current_height += height_increment; current_rotation += rotation_increment; } height_increment = - height_increment; rotation_increment = - rotation_increment; current_rotation += rotation_increment; current_height += height_increment; if( chain == 1 ) fprintf( outfile, "TER\n" ); } fclose( infile ); fclose( outfile ); m = getpdb_prm( STEMP( __st0001__, "nab_tmp.pdb" ), STEMP( __st0002__, "leaprc.ff94" ), STEMP( __st0003__, "" ), ITEMP( __it0001__, 0 ) ); unlink( "nab_tmp.pdb" ); return( m ); }