JiscMail Logo
Email discussion lists for the UK Education and Research communities

Help for CCPEM Archives


CCPEM Archives

CCPEM Archives


CCPEM@JISCMAIL.AC.UK


View:

Message:

[

First

|

Previous

|

Next

|

Last

]

By Topic:

[

First

|

Previous

|

Next

|

Last

]

By Author:

[

First

|

Previous

|

Next

|

Last

]

Font:

Monospaced Font

LISTSERV Archives

LISTSERV Archives

CCPEM Home

CCPEM Home

CCPEM  March 2017

CCPEM March 2017

Options

Subscribe or Unsubscribe

Subscribe or Unsubscribe

Log In

Log In

Get Password

Get Password

Subject:

Re: Problem running star_replace_UVA.com script to replace per-particle defocus parameters after Gctf.

From:

Oliver Clarke <[log in to unmask]>

Reply-To:

Oliver Clarke <[log in to unmask]>

Date:

Thu, 2 Mar 2017 18:51:17 -0500

Content-Type:

text/plain

Parts/Attachments:

Parts/Attachments

text/plain (99 lines)

In case it’s useful to anyone else - couldn’t figure out why star_replace_UVA.com wasn’t working, so ended up writing my own scriptlet.

It only works for complete star files though - it assumes that the order of the lines in each _local.star is the same as the order in the particle stack, and the output needs a little massaging, but it works.

Cheers
Oli

#!/bin/bash
#run as ./cat_local.com *local.star
#you’ll need to add the header back after (with an additional field label for the image name
rm all_local.star #remove output if it already exists
touch all_local.star #make a fresh star file
for i in "$@“ #for each local.star
do
tail -n +19 ${i} > local_tmp.star #grab everything but the header from local.star
awk '{print $0, "\t", NR"@Particles_for_local/mics/"$1"s"}' local_tmp.star > local_tmp2.star #print each line to a temp file, and add a field corresponding to the image name
cat local_tmp2.star >> all_local.star #append the modified lines to the resulting star
rm local_tmp.star #get rid of temp files.
rm local_tmp2.star
done

> On Mar 2, 2017, at 5:32 PM, Oliver Clarke <[log in to unmask]> wrote:
>
> Eh, spoke too soon. It still isn’t substituting the local ctf values, just rearranging the lines. But at least it is not deleting the U/V/A columns entirely now, not entirely sure whether that is progress however.
>
> Cheers
> Oli
>> On Mar 2, 2017, at 5:21 PM, Oliver Clarke <[log in to unmask]> wrote:
>>
>> Fixed it! Edited lines 84-99 of star_replace_UVA.com and now it works for both test and my data. Basically altered the way variables were referred to. No idea why that fixed it, but there you go.
>>
>> Cheers
>> Oli
>>
>> Fixed:
>> gawk 'BEGIN{}/mrc/{\
>> if(FILENAME==ARGV[1]){image=$raw_rlnImageNameIndex; split(image, strimage, "@"); ImageId =strimage[1]; data_raw[$raw_rlnMicrographNameIndex, ImageId] = $0; } \
>> if(FILENAME==ARGV[2]){ImageId = $local_keywordNplus; data_rf[$local_rlnMicrographNameIndex, ImageId] = $0; } }\
>> END{\
>> for ( i in data_raw ) {\
>> n_raw=split(data_raw[i], str_raw, " ");\
>> n_rf=split(data_rf[i], str_rf, " ");\
>> for (j=1;j<=n_raw;j++){\
>> if ( j == $raw_rlnDefocusUIndex ) printf("%s ",str_rf[$local_rlnDefocusUIndex]);\
>> else if ( j == $raw_rlnDefocusVIndex ) printf("%s ",str_rf[$local_rlnDefocusVIndex]);\
>> else if ( j == $raw_rlnDefocusAngleIndex ) printf("%s ",str_rf[$local_rlnDefocusAngleIndex]);\
>> else printf("%s ",str_raw[j]);\
>> }\
>> printf("\n");\
>> }\
>> } ' $raw_starf $all_localstarf >> $new_starf
>>
>> Original:
>> gawk 'BEGIN{}/mrc/{\
>> if(FILENAME==ARGV[1]){image=$'$raw_rlnImageNameIndex'; split(image, strimage, "@"); ImageId =strimage[1]; data_raw[$'$raw_rlnMicrographNameIndex', ImageId] = $0; } \
>> if(FILENAME==ARGV[2]){ImageId = $'$local_keywordNplus'; data_rf[$'$local_rlnMicrographNameIndex', ImageId] = $0; } }\
>> END{\
>> for ( i in data_raw ) {\
>> n_raw=split(data_raw[i], str_raw, " ");\
>> n_rf=split(data_rf[i], str_rf, " ");\
>> for (j=1;j<=n_raw;j++){\
>> if ( j == '$raw_rlnDefocusUIndex' ) printf("%s ",str_rf['$local_rlnDefocusUIndex']);\
>> else if ( j == '$raw_rlnDefocusVIndex' ) printf("%s ",str_rf['$local_rlnDefocusVIndex']);\
>> else if ( j == '$raw_rlnDefocusAngleIndex' ) printf("%s ",str_rf['$local_rlnDefocusAngleIndex']);\
>> else printf("%s ",str_raw[j]);\
>> }\
>> printf("\n");\
>> }\
>> } ' $raw_starf $all_localstarf >> $new_starf
>>
>>
>>> On Mar 2, 2017, at 5:02 PM, Oliver Clarke <[log in to unmask]> wrote:
>>>
>>> To add another data point - when I run star_replace_UVA.com using the example Gctf_1.06 dynactin data, it also doesn’t work - gawk gives a syntax error (below). Could there be a version incompatibility? My gawk is 4.1.3, running on Ubuntu 16.04.
>>>
>>> Cheers
>>> Oli
>>>
>>> Error:
>>> user@narwhal:~/gct_local_test/Gctf_v1.06/examples_local_ctf$ ./star_replace_UVA.com micrographs_all_gctf.star Micrographs/*local.star
>>> original star file: micrographs_all_gctf.star
>>> gawk: cmd. line:2: if(FILENAME==ARGV[1]){image=$; split(image, strimage, "@"); ImageId =strimage[1]; data_raw[$1, ImageId] = $0; }
>>> gawk: cmd. line:2: ^ syntax error
>>> new star file micrographs_all_gctf_localUVA.star generated.
>>>
>>>> On Mar 2, 2017, at 10:37 AM, Oliver Clarke <[log in to unmask]> wrote:
>>>>
>>>> Hi all,
>>>>
>>>> I used Gctf 1.06 to run per-particle CTF correction, which seemed to work fine - it generates the appropriate _local.star files, and the output looks sensible. However, when I run star_replace_UVA.com to replace the global defocus values with local ones, it instead just deletes the defocus columns entirely in the output star. Has anyone run int this issue (and solved it)?
>>>>
>>>> I notice that the _local.star files have an additional column for phase shift which is not present in the example _local.star files, which were generated I presume with Gctf 0.50 - could this be the issue?
>>>>
>>>> Cheers
>>>> Oli
>>>
>>
>

Top of Message | Previous Page | Permalink

JiscMail Tools


RSS Feeds and Sharing


Advanced Options


Archives

May 2024
April 2024
March 2024
February 2024
January 2024
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013


JiscMail is a Jisc service.

View our service policies at https://www.jiscmail.ac.uk/policyandsecurity/ and Jisc's privacy policy at https://www.jisc.ac.uk/website/privacy-notice

For help and support help@jisc.ac.uk

Secured by F-Secure Anti-Virus CataList Email List Search Powered by the LISTSERV Email List Manager