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

Use pandas in the post treatment #59

Closed
wants to merge 17 commits into from
Closed

Conversation

FlorianTesson
Copy link
Collaborator

No description provided.

@FlorianTesson
Copy link
Collaborator Author

Still need to change the tests files (and to check if everything is the same)

@FlorianTesson
Copy link
Collaborator Author

Add pandas requirements


def export_defense_finder_systems(defense_finder_genes, outdir, filename):
systems = build_defense_finder_systems(defense_finder_genes)
systems_list = systems_to_list(systems)
write_defense_finder_systems(systems_list, outdir, filename)
systems.to_csv(outdir+'/'+filename+'_defense_finder_systems.tsv',sep='\t',index=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use os.path.join

return [ 'sys_id', 'type', 'subtype', 'sys_beg', 'sys_end', 'protein_in_syst', 'genes_count', 'name_of_profiles_in_sys' ]
sys_beg=defense_finder_genes.sort_values('hit_pos').drop_duplicates('sys_id').rename({'hit_id' : 'sys_beg'},axis=1)[['sys_id','sys_beg']]
sys_end=defense_finder_genes.sort_values('hit_pos' , ascending=False).drop_duplicates('sys_id').rename({'hit_id' : 'sys_end'},axis=1)[['sys_id','sys_end']]
protein_in_syst=defense_finder_genes.groupby('sys_id').hit_id.apply(lambda x: ",".join(x.sort_values())).reset_index().rename({'hit_id':'protein_in_syst'},axis=1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

simplify to get sys_beg and sys_end from protein in syst

from defense_finder_posttreat import best_solution

def export_defense_finder_genes(defense_finder_genes, outdir, filename):
defense_finder_genes_list = defense_finder_genes_to_list(defense_finder_genes)
write_defense_finder_genes(defense_finder_genes_list, outdir, filename)
defense_finder_genes.to_csv(outdir+'/'+filename+'_defense_finder_genes.tsv',sep='\t',index=False)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem os.path.join

Copy link

This PR has been inactive for 60 days and is now marked as stale. It will be closed in 7 days without further activity. We might have missed your issue, if you still have it, don't hesitate to comment again.

@jeanrjc
Copy link
Collaborator

jeanrjc commented Jun 24, 2024

This could be merged @FlorianTesson ?

@FlorianTesson
Copy link
Collaborator Author

Close in favor to PR #64

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

Successfully merging this pull request may close these issues.

2 participants