Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to export gistic markers? #622

Closed
BioComSoftware opened this issue May 29, 2021 · 7 comments · Fixed by #623
Closed

How to export gistic markers? #622

BioComSoftware opened this issue May 29, 2021 · 7 comments · Fixed by #623
Labels

Comments

@BioComSoftware
Copy link

Within export.py there's a export_gistic_markers(cnr_fnames).
Also within export.py, there's a dictionary...

EXPORT_FORMATS = {
    'cdt': fmt_cdt,
    # 'gct': fmt_gct,
    'gistic': export_gistic_markers,
    'jtv': fmt_jtv,
    'nexus-basic': export_nexus_basic,
    'nexus-ogt': export_nexus_ogt,
    'seg': export_seg,
    'theta': export_theta,
    'vcf': export_vcf,
}

I've tried exporting a gistic marker file using cnvkit.py export gistic but I get an error...

# cnvkit.py export gistic
usage: cnvkit.py export [-h] {bed,seg,vcf,theta,nexus-basic,nexus-ogt,cdt,jtv} ...
cnvkit.py export: error: invalid choice: 'gistic' (choose from 'bed', 'seg', 'vcf', 'theta', 'nexus-basic', 'nexus-ogt', 'cdt', 'jtv')

What is the usage to get a gistic marker output file from cnvkit?

@tetedange13
Copy link
Contributor

Hi @BioComSoftware ,

Not an author of CNVkit, but reading the code I see "gistic" export is only partially implemented
=> The "core" part is implemented in cnvlib/export.py as you noticed
=> But it lacks a few lines of code within cnvlib/commands.py to allow command-line usage (this explains error you got)

Adding the following chunk of code right after L1882 of your own cnvlib/commands.py file should allow you to use "gistic" export:
(as long as the "core" implementation is correct, which I could not assert)

def _cmd_export_gistic(args):
    formatter = export.EXPORT_FORMATS['gistic']
    outdf = formatter(args.filenames)
    write_dataframe(args.output, outdf)
P_export_gistic = P_export_subparsers.add_parser('gistic',
                                              help=_cmd_export_gistic.__doc__)
P_export_gistic.add_argument('filenames', nargs='+',
        help="""Log2 copy ratio data file(s) (*.cnr), the output of the
                'fix' sub-command.""")
P_export_gistic.add_argument('-o', '--output', metavar="FILENAME",
        help="Output file name.")
P_export_gistic.set_defaults(func=_cmd_export_gistic)

Hope this helps.
Have a nice day.
Felix.

@BioComSoftware
Copy link
Author

Thanks for the fast help!

@BioComSoftware BioComSoftware reopened this Jun 2, 2021
@BioComSoftware
Copy link
Author

BioComSoftware commented Jun 2, 2021

I added the above code to my copy of cnvkit, and it appears to be creating a properly formatted markers file. I will continue testing.

tetedange13 added a commit to tetedange13/cnvkit that referenced this issue Jun 3, 2021
tetedange13 added a commit to tetedange13/cnvkit that referenced this issue Jun 3, 2021
@etal
Copy link
Owner

etal commented Jun 4, 2021

Did the file generated by this function work properly with Gistic?

@tskir
Copy link
Collaborator

tskir commented Jun 23, 2021

Hi @BioComSoftware, did you have a chance to test if the file is correct, so that we could merge the associated PR #623?

@tskir tskir added the question label Jun 23, 2021
@BioComSoftware
Copy link
Author

BioComSoftware commented Jun 24, 2021 via email

@tetedange13
Copy link
Contributor

tetedange13 commented Jun 24, 2021

Hi @BioComSoftware ,

Thanks for your feedback! As discussed here, for now there could be a small inconsistency between cnvkit.py export seg (used for GISTIC's -seg param) and cnvkit.py export gistic (used to feed GISTIC's -mk param)
=> Can you please try to remove sex-chromosomes from your SEG file, then run GISTIC again with both SEG and marker files produced by CNVkit? (your error should be gone)
=> Also could you instruct us about "rightfulness" of the results produced by GISTIC when fed with SEG and markers files exported with CNVkit? Do they make sense according to you?

Thanks in advance Mike.
Have a nice day.
Felix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants